|
[Rivet] Rivet questionAndy Buckley andy.buckley at cern.chMon Feb 29 11:56:05 GMT 2016
Good! Phew, we don't need to re-engineer everything ;-) Agreed that this is a bit of a special case, and to be honest I can't imagine an easier way, since adding a mechanism for all analyses to return arbitrary objects would *definitely* force some type-casting work on the user. Let us know if you need any more suggestions, or if bits of the Rivet machinery are causing you a lot of trouble. Feedback is always good! Cheers, Andy On 28/02/16 23:50, James John Lacey wrote: > Hi Andy, > > I implemented a procedure similar to your suggestion and everything is working perfectly! > > This is probably the best solution for this special use case, as I don't imagine this type of functionality is required by the large majority of users. > > Thanks again! > > Cheers, > Jim > ________________________________________ > From: James John Lacey > Sent: 28 February 2016 17:41 > To: Andy Buckley > Cc: Rivet > Subject: RE: Rivet question > > Hi Andy, > > Thanks for the quick response! > > I'm just on my way out for the afternoon,.. I'll try this approach out later today and let you know. > > Thanks and cheers, > Jim > > ________________________________________ > From: Andy Buckley > Sent: 28 February 2016 17:32 > To: James John Lacey > Cc: Rivet > Subject: Re: Rivet question > > 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 > -- Dr Andy Buckley, Lecturer / Royal Society University Research Fellow Particle Physics Expt Group, University of Glasgow
More information about the Rivet mailing list |