[Rivet] gen parton matching for jets

Andy Buckley andy.buckley at cern.ch
Mon May 9 18:48:06 BST 2016


Hi Raghav,

There is nothing very much easier, because Rivet very specifically 
focuses on *not* using partons in order to make analyses more robust and 
physical.

(I am debating whether to provide a *slightly* more "Rivety" way to 
access the partons, just to make life nicer than working direct with 
HepMC (which would also make our life easier for analysis maintenance). 
But it's not obvious, because we really want to discourage this way of 
doing things.)

Andy


On 09/05/16 11:36, Raghav Kunnawalkam Elayavalli wrote:
> 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
>
>
>
> _______________________________________________
> Rivet mailing list
> Rivet at projects.hepforge.org
> https://www.hepforge.org/lists/listinfo/rivet
>


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


More information about the Rivet mailing list