|
[Rivet] gen parton matching for jetsRaghav Kunnawalkam Elayavalli raghav.k.e at cern.chMon May 9 11:36:48 BST 2016
Dear Rivet experts I have a simple question regarding gen parton matching using HepMC::GenParticle in a foreach loop as shown below: HepMC::GenParticle* truthParton=NULL; double truthDelR(0); foreach (const HepMC::GenParticle& p, particles(event.genEvent())) { if((p->pdg_id() != 21) and (abs(p->pdg_id()) > 6)) continue; const double delR = jets.front().delta_R(fastjet::PseudoJet(p->momentum().px(), p->momentum().py(), p->momentum().pz(), p->momentum().e())); if(truthParton==NULL){ truthDelR = delR; truthParton = p; } else if(delR < 0.6 && truthParton->momentum().perp() < p->momentum().perp()){ //if(null) assign truthParton, updateDelR truthDelR = delR; truthParton = p; } } _h_TruthDeltaR->fill(truthDelR,weight); MC_GENSTUDY_JETCHARGE.cc:256:33: error: cannot initialize a variable of type 'HepMC::GenParticle *' with an lvalue of type 'const HepMC::GenParticle *const' foreach (HepMC::GenParticle* p, particles(event.genEvent())) { ^ /Users/raghav/WORK/RIVET/local/include/boost/foreach.hpp:1107:14: note: expanded from macro 'BOOST_FOREACH' for (VAR = BOOST_FOREACH_DEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true) ^ Is there a simpler way to do this? it seems like there might be. thanks! Cheers Raghav -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20160509/e9422380/attachment.html>
More information about the Rivet mailing list |