CMS 3D CMS Logo

List of all members | Public Member Functions
Py8toJetInputHEPEVT Class Reference

#include <Py8toJetInput.h>

Inheritance diagram for Py8toJetInputHEPEVT:
Py8toJetInput

Public Member Functions

const std::vector< fastjet::PseudoJet > fillJetAlgoInput (const Event &, const Event &, const lhef::LHEEvent *, const std::vector< int > *partonList=nullptr) override
 
 Py8toJetInputHEPEVT ()
 
 ~Py8toJetInputHEPEVT () override
 
- Public Member Functions inherited from Py8toJetInput
 Py8toJetInput ()
 
void setJetEtaMax (double max)
 
virtual ~Py8toJetInput ()
 

Additional Inherited Members

- Public Types inherited from Py8toJetInput
typedef Pythia8::Event Event
 
typedef Pythia8::Particle Particle
 
- Protected Types inherited from Py8toJetInput
enum  partonTypes { ID_TOP = 6, ID_GLUON = 21, ID_PHOTON = 22 }
 
- Protected Member Functions inherited from Py8toJetInput
int getAncestor (int, const Event &, const Event &)
 
- Protected Attributes inherited from Py8toJetInput
double fJetEtaMax
 
std::vector< fastjet::PseudoJet > fJetInput
 

Detailed Description

Definition at line 39 of file Py8toJetInput.h.

Constructor & Destructor Documentation

◆ Py8toJetInputHEPEVT()

Py8toJetInputHEPEVT::Py8toJetInputHEPEVT ( )
inline

Definition at line 41 of file Py8toJetInput.h.

41 {}

◆ ~Py8toJetInputHEPEVT()

Py8toJetInputHEPEVT::~Py8toJetInputHEPEVT ( )
inlineoverride

Definition at line 42 of file Py8toJetInput.h.

42 {}

Member Function Documentation

◆ fillJetAlgoInput()

const std::vector< fastjet::PseudoJet > Py8toJetInputHEPEVT::fillJetAlgoInput ( const Event event,
const Event workEvent,
const lhef::LHEEvent lhee,
const std::vector< int > *  partonList = nullptr 
)
overridevirtual

Reimplemented from Py8toJetInput.

Definition at line 220 of file Py8toJetInput.cc.

References funct::abs(), edmPickEvents::event, Py8toJetInput::fJetInput, Py8toJetInput::getAncestor(), lhef::LHEEvent::getHEPEUP(), lhef::HEPEUP::IDUP, heavyIonCSV_trainingSettings::idx, createfilelist::int, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, and lhef::HEPEUP::PUP.

223  {
224  fJetInput.clear();
225 
226  HepMC::HEPEVT_Wrapper::zero_everything();
227 
228  // service container for further mother-daughters links
229  //
230  std::vector<int> Py8PartonIdx; // position of original (LHE) partons in Py8::Event
231  Py8PartonIdx.clear();
232  std::vector<int> HEPEVTPartonIdx; // position of LHE partons in HEPEVT (incl. ME-generated decays)
233  HEPEVTPartonIdx.clear();
234 
235  // general counter
236  //
237  int index = 0;
238 
239  int Py8PartonCounter = 0;
240  int HEPEVTPartonCounter = 0;
241 
242  // find the fisrt parton that comes from LHE (ME-generated)
243  // skip the incoming particles/partons
244  for (int iprt = 1; iprt < event.size(); iprt++) {
245  const Particle& part = event[iprt];
246  if (abs(part.status()) < 22)
247  continue; // below 10 is "service"
248  // 11-19 are beam particles; below 10 is "service"
249  // 21 is incoming partons
250  Py8PartonCounter = iprt;
251  break;
252  }
253 
254  const lhef::HEPEUP& hepeup = *lhee->getHEPEUP();
255  // start the counter from 2, because we don't want the incoming particles/oartons !
256  for (int iprt = 2; iprt < hepeup.NUP; iprt++) {
257  index++;
258  HepMC::HEPEVT_Wrapper::set_id(index, hepeup.IDUP[iprt]);
259  HepMC::HEPEVT_Wrapper::set_status(index, 2);
260  HepMC::HEPEVT_Wrapper::set_momentum(
261  index, hepeup.PUP[iprt][0], hepeup.PUP[iprt][1], hepeup.PUP[iprt][2], hepeup.PUP[iprt][4]);
262  HepMC::HEPEVT_Wrapper::set_mass(index, hepeup.PUP[iprt][4]);
263  // --> FIXME HepMC::HEPEVT_Wrapper::set_position( index, part.xProd(), part.yProd(), part.zProd(), part.tProd() );
264  HepMC::HEPEVT_Wrapper::set_parents(index, 0, 0); // NO, not anymore to the "system particle"
265  HepMC::HEPEVT_Wrapper::set_children(index, 0, 0);
266  if (hepeup.MOTHUP[iprt].first > 2 &&
267  hepeup.MOTHUP[iprt].second > 2) // decay from LHE, will NOT show at the start of Py8 event !!!
268  {
269  HEPEVTPartonCounter++;
270  continue;
271  }
272  Py8PartonIdx.push_back(Py8PartonCounter);
273  Py8PartonCounter++;
274  HEPEVTPartonIdx.push_back(HEPEVTPartonCounter);
275  HEPEVTPartonCounter++;
276  }
277 
278  HepMC::HEPEVT_Wrapper::set_number_entries(index);
279 
280  // now that the initial partons are in, attach parton-level from Pythia8
281  // do NOT reset index as we need to *add* more particles sequentially
282  //
283  for (int iprt = 1; iprt < workEvent.size(); iprt++) // from 0-entry (system) or from 1st entry ???
284  {
285  const Particle& part = workEvent[iprt];
286 
287  // if ( part.status() != 62 ) continue;
288  if (part.status() < 51)
289  continue;
290  index++;
291  HepMC::HEPEVT_Wrapper::set_id(index, part.id());
292 
293  // HepMC::HEPEVT_Wrapper::set_status( index, event.statusHepMC(iprt) );
294  HepMC::HEPEVT_Wrapper::set_status(index, 1);
295  HepMC::HEPEVT_Wrapper::set_momentum(index, part.px(), part.py(), part.pz(), part.e());
296  HepMC::HEPEVT_Wrapper::set_mass(index, part.m());
297  HepMC::HEPEVT_Wrapper::set_position(index, part.xProd(), part.yProd(), part.zProd(), part.tProd());
298  HepMC::HEPEVT_Wrapper::set_parents(index, 0, 0); // just set to 0 like in Py6...
299  // although for some, mother will need to be re-set properly !
300  HepMC::HEPEVT_Wrapper::set_children(index, 0, 0);
301 
302  // now refine mother-daughters links, where applicable
303 
304  int parentId = getAncestor(part.daughter1(), event, workEvent);
305 
306  if (parentId <= 0)
307  continue;
308 
309  for (int idx = 0; idx < (int)Py8PartonIdx.size(); idx++) {
310  if (parentId == Py8PartonIdx[idx]) {
311  int idx1 = HEPEVTPartonIdx[idx];
312  HepMC::HEPEVT_Wrapper::set_parents(index, idx1 + 1, idx1 + 1);
313  break;
314  }
315  }
316  }
317 
318  HepMC::HEPEVT_Wrapper::set_number_entries(index);
319 
320  // --> FIXME HepMC::HEPEVT_Wrapper::set_event_number( fEventNumber ); // well, if you know it... well, it's one of the counters...
321 
322  // HepMC::HEPEVT_Wrapper::print_hepevt();
323 
324  return fJetInput;
325 }
int getAncestor(int, const Event &, const Event &)
std::vector< FiveVector > PUP
Definition: LesHouches.h:246
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:234
std::vector< int > IDUP
Definition: LesHouches.h:223
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:38
part
Definition: HCALResponse.h:20
std::vector< fastjet::PseudoJet > fJetInput
Definition: Py8toJetInput.h:36