[Rivet] Rivet question

Andy Buckley andy.buckley at cern.ch
Sun Feb 28 16:32:17 GMT 2016


Hi Jim,

Hmm, good question.

It's not something that we designed Rivet to do, since the only 
programmatic output after analysis is meant to be the centrally-managed 
histogram objects.

I suppose we could add some general way of passing arbitrary objects 
about, but it's not obvious how it would help most users. I think it 
would be as easy to do a dynamic_cast to the exact analysis type and use 
a method specific to that analysis to do whatever you need. Something 
like this (code not at all tested) would work, I think... no 
dynamic_cast needed:

AnalysisHandler ah;
MY_SUPER_ANALYSIS myana;
ah.addAnalysis(&myana);
for (int i = 0; i< NEVENTS; ++i) {
   HepMC::GenEvent* evt = get_next_event_from_somewhere();
   ah.analyze(*evt);
   const FourMomentum foo = myana.my_special_feature();
   ...
}

Does that help?

Andy


On 28/02/16 15:53, James John Lacey wrote:
> Hi Andy,
>
> I am developing a Rivet routine for use in standalone code using the C++
> API. The routine is being developed in the context of the simplified
> Higgs cross sections Truth Classifier that has been discussed...
>
> I have everything up and running and can implement a Rivet analysis in
> my C++ code using the AnalysisHandler::analyze(*HepMC::GenEvent) method.
>
> Now given that I am using Rivet projections to compute the objects and
> quantities used in the classification I would like to have Rivet return
> these values so I can use/save them.
>
> My question is: is there a way to retrieve per event information (ex. a
> 4-vector) from Rivet when running in standalone C++ ?,.. ie. for a given
> HepMC event I want to analyze() the event in Rivet and retrieve the
> relevant event information in the form of a double or 4-vector or ... etc.
>
> Thanks in advance for any insight/help you can provide!
>
> Cheers,
> Jim
>


-- 
Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
Particle Physics Expt Group, University of Glasgow


More information about the Rivet mailing list