<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Dear Rivet experts 
<div class=""><br class="">
</div>
<div class="">I have a simple question regarding gen parton matching using HepMC::GenParticle in a foreach loop as shown below: </div>
<div class="">
<div class=""><br class="">
</div>
<div class="">HepMC::GenParticle* truthParton=NULL;</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span> double truthDelR(0);</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span> foreach (const HepMC::GenParticle& p, particles(event.genEvent())) {</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>   if((p->pdg_id() != 21) and (abs(p->pdg_id()) > 6)) continue; </div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"></span>   const double delR = jets.front().delta_R(fastjet::PseudoJet(p->momentum().px(),</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>p->momentum().py(),</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>p->momentum().pz(),</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>p->momentum().e()));</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>   if(truthParton==NULL){</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>     truthDelR = delR;</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>     truthParton = p;</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>   }</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>   else if(delR < 0.6 && truthParton->momentum().perp() < p->momentum().perp()){</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>     //if(null) assign truthParton, updateDelR</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>     truthDelR = delR;</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>     truthParton = p;</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>   }</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span> }</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span> _h_TruthDeltaR->fill(truthDelR,weight);</div>
</div>
<div class=""><br class="">
</div>
<div class=""> <span style="color: rgb(255, 253, 253); font-family: Monaco; font-size: 10px; background-color: rgb(0, 0, 0); font-variant-ligatures: no-common-ligatures;" class="">MC_GENSTUDY_JETCHARGE.cc:256:33:
</span><span style="font-family: Monaco; font-size: 10px; background-color: rgb(0, 0, 0); font-variant-ligatures: no-common-ligatures; color: rgb(195, 55, 32);" class="">error:
</span><span style="color: rgb(255, 253, 253); font-family: Monaco; font-size: 10px; background-color: rgb(0, 0, 0); font-variant-ligatures: no-common-ligatures;" class="">cannot initialize a variable of type 'HepMC::GenParticle *' with an lvalue of type 'const
 HepMC::GenParticle *const'</span></div>
<div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(217, 209, 173); background-color: rgb(0, 0, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">          foreach (HepMC::GenParticle* p, particles(event.genEvent())) {</span></div>
<div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(52, 189, 38); background-color: rgb(0, 0, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">                                       ^</span></div>
<div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(255, 253, 253); background-color: rgb(0, 0, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">/Users/raghav/WORK/RIVET/local/include/boost/foreach.hpp:1107:14:
</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">note:
</span><span style="font-variant-ligatures: no-common-ligatures; color: #d9d1ad" class="">expanded from macro 'BOOST_FOREACH'</span></div>
<div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(217, 209, 173); background-color: rgb(0, 0, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">        for (VAR = BOOST_FOREACH_DEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true)</span></div>
<div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(52, 189, 38); background-color: rgb(0, 0, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">             ^</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Is there a simpler way to do this? it seems like there might be. thanks! </span></div>
<div class=""><br class="">
</div>
<div class="">Cheers</div>
<div class="">Raghav</div>
<div class=""><br class="">
</div>
</body>
</html>