CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
Py8toJetInput Class Reference

#include <Py8toJetInput.h>

Inheritance diagram for Py8toJetInput:
Py8toJetInputHEPEVT

Public Types

typedef Pythia8::Event Event
 
typedef Pythia8::Particle Particle
 

Public Member Functions

virtual const std::vector< fastjet::PseudoJet > fillJetAlgoInput (const Event &, const Event &, const lhef::LHEEvent *lhee=nullptr, const std::vector< int > *partonList=nullptr)
 
 Py8toJetInput ()
 
void setJetEtaMax (double max)
 
virtual ~Py8toJetInput ()
 

Protected Types

enum  partonTypes { ID_TOP = 6, ID_GLUON = 21, ID_PHOTON = 22 }
 

Protected Member Functions

int getAncestor (int, const Event &, const Event &)
 

Protected Attributes

double fJetEtaMax
 
std::vector< fastjet::PseudoJet > fJetInput
 

Detailed Description

Definition at line 13 of file Py8toJetInput.h.

Member Typedef Documentation

◆ Event

typedef Pythia8::Event Py8toJetInput::Event

Definition at line 15 of file Py8toJetInput.h.

◆ Particle

typedef Pythia8::Particle Py8toJetInput::Particle

Definition at line 16 of file Py8toJetInput.h.

Member Enumeration Documentation

◆ partonTypes

Enumerator
ID_TOP 
ID_GLUON 
ID_PHOTON 

Definition at line 31 of file Py8toJetInput.h.

31 { ID_TOP = 6, ID_GLUON = 21, ID_PHOTON = 22 };

Constructor & Destructor Documentation

◆ Py8toJetInput()

Py8toJetInput::Py8toJetInput ( )
inline

Definition at line 18 of file Py8toJetInput.h.

18 : fJetEtaMax(10.) {}

◆ ~Py8toJetInput()

virtual Py8toJetInput::~Py8toJetInput ( )
inlinevirtual

Definition at line 19 of file Py8toJetInput.h.

19 {}

Member Function Documentation

◆ fillJetAlgoInput()

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

Reimplemented in Py8toJetInputHEPEVT.

Definition at line 7 of file Py8toJetInput.cc.

10  {
11  fJetInput.clear();
12 
13  Event workEventJet = workEvent;
14 
15  const lhef::HEPEUP& hepeup = *lhee->getHEPEUP();
16 
17  std::set<int> typeSet[3];
18 
19  // FIXME !!!
20  // This is not safe to assume it's 3 because we're passing in a pointer
21  // and we do NOT know what the actuial size is. I'll have to improve it.
22  //
23  for (size_t i = 0; i < 3; i++) {
24  typeSet[i].clear();
25  for (size_t j = 0; j < typeIdx[i].size(); j++) {
26  // HEPEUP and Py8 event record are shifted by 3
27  // (system particle + 2 beam particles in Py8 event)
28  // ... EXCEPT FOR THE DECAY PRODUCTS IF DONE AT THE ME LEVEL !!!!!
29  // ... in such case, the decay productes get gutted out of the sequence
30  // and get placed in Py8 Event later on...
31  // so we need to figure out the shift
32  int pos = typeIdx[i][j];
33  int shift = 3;
34  // skip the first 2 entrirs in HEPEUP - they're incoming partons
35  for (int ip = 2; ip < pos; ip++) {
36  // alternative can be: moth1 != 1 && moth2 !=2...
37  // but moth1 == moth2 means pointer to the same mother t
38  // that can only be a resonance, unless moth1==moth2==0
39  //
40  if (hepeup.MOTHUP[ip].first == hepeup.MOTHUP[ip].second) {
41  shift--;
42  }
43  }
44  pos += shift;
45  // typeSet[i].insert( event[pos].daughter1() );
46  typeSet[i].insert(pos);
47  }
48  }
49 
50  // int iTypeEnd = (typeIdx[1].empty()) ? 1 : 2;
51 
52  // --> FIXME !!!
53  int iType = 0; // only LIGHT jets for now
54  int jetAllow = 0; // hardcoded for now for the same value as is set in Steve's example
55  // at present, not even in use...
56  // int jetMatch = 0; // hardcoded for now for the same value as is set in Steve's example
57 
58  // Loop over particles and decide what to pass to the jet algorithm
59  for (int i = 0; i < workEventJet.size(); ++i) {
60  if (!workEventJet[i].isFinal())
61  continue;
62 
63  // jetAllow option to disallow certain particle types
64  if (jetAllow == 1) {
65  // Original AG+Py6 algorithm explicitly excludes tops,
66  // leptons and photons.
67  int id = workEventJet[i].idAbs();
68  if ((id >= 11 && id <= 16) || id == ID_TOP || id == ID_PHOTON) {
69  workEventJet[i].statusNeg();
70  continue;
71  }
72  }
73 
74  // Get the index of this particle in original event
75  int idx = workEventJet[i].daughter1();
76 
77  // Start with particle idx, and afterwards track mothers
78  while (true) {
79  // Light jets
80  if (iType == 0) {
81  // Do not include if originates from heavy jet or 'other'
82  if (typeSet[1].find(idx) != typeSet[1].end() || typeSet[2].find(idx) != typeSet[2].end()) {
83  workEventJet[i].statusNeg();
84  break;
85  }
86 
87  // Made it to start of event record so done
88  if (idx == 0) {
89  break;
90  }
91  // Otherwise next mother and continue
92  idx = event[idx].mother1();
93 
94  // Heavy jets
95  } else if (iType == 1) {
96  // Only include if originates from heavy jet
97  if (typeSet[1].find(idx) != typeSet[1].end())
98  break;
99 
100  // Made it to start of event record with no heavy jet mother,
101  // so DO NOT include particle
102  if (idx == 0) {
103  workEventJet[i].statusNeg();
104  break;
105  }
106 
107  // Otherwise next mother and continue
108  idx = event[idx].mother1();
109 
110  } // if (iType)
111  } // while (true)
112  } // for (i)
113 
114  // For jetMatch = 2, insert ghost particles corresponding to
115  // each hard parton in the original process
116  /*
117  if (jetMatch > 0)
118  {
119 
120  for (int i = 0; i < int(typeIdx[iType].size()); i++)
121  {
122  // Get y/phi of the parton
123  Vec4 pIn = eventProcess[typeIdx[iType][i]].p();
124  double y = Vec4y(pIn);
125  double phi = pIn.phi();
126 
127  // Create a ghost particle and add to the workEventJet
128  double e = MG5_GHOSTENERGY;
129  double e2y = exp(2. * y);
130  double pz = e * (e2y - 1.) / (e2y + 1.);
131  double pt = sqrt(e*e - pz*pz);
132  double px = pt * cos(phi);
133  double py = pt * sin(phi);
134  workEventJet.append(Particle(ID_GLUON, 99, 0, 0, 0, 0, 0, 0,
135  px, py, pz, e, 0., 0, 9.));
136 
137  } // for (i)
138  } // if (jetMatch == 2)
139 */
140 
141  for (int i = 0; i < workEventJet.size(); i++) {
142  // fisrt, weed out all entries marked with statusNeg();
143  //
144  if (workEventJet[i].status() < 0)
145  continue;
146 
147  // now weed out all entries above etaMax
148  // in principle, we can use etaJetMaxAlgo because it's set equal to etaJetMax
149  // as for etaJetMax, it gets set to memain_.etaclmax
150  //
151  if (fabs(workEventJet[i].eta()) > fJetEtaMax)
152  continue;
153 
154  // need to double check if native FastJet understands Py8 Event format
155  // in general, PseudoJet gets formed from (px,py,pz,E)
156  //
157  fastjet::PseudoJet partTmp = workEventJet[i];
158  fJetInput.push_back(partTmp);
159  }
160 
161  return fJetInput;
162 }

References end, PVValHelper::eta, spr::find(), fJetEtaMax, fJetInput, lhef::LHEEvent::getHEPEUP(), mps_fire::i, ID_PHOTON, ID_TOP, training_settings::idx, dqmiolumiharvest::j, lhef::HEPEUP::MOTHUP, edm::shift, and mps_update::status.

Referenced by JetMatchingHook::doVetoPartonLevel().

◆ getAncestor()

int Py8toJetInput::getAncestor ( int  pos,
const Event fullEvent,
const Event workEvent 
)
protected

Definition at line 164 of file Py8toJetInput.cc.

164  {
165  int parentId = fullEvent[pos].mother1();
166  int parentPrevId = 0;
167  int counter = pos;
168 
169  while (parentId > 0) {
170  if (parentId == fullEvent[counter].mother2()) // carbon copy, keep walking up
171  {
172  parentPrevId = parentId;
173  counter = parentId;
174  parentId = fullEvent[parentPrevId].mother1();
175  continue;
176  }
177 
178  // we get here if not a carbon copy
179 
180  // let's check if it's a normal process, etc.
181  //
182  if ((parentId < parentPrevId) || parentId < fullEvent[counter].mother2()) // normal process
183  {
184  // first of all, check if hard block
185  if (abs(fullEvent[counter].status()) == 22 || abs(fullEvent[counter].status()) == 23) {
186  // yes, it's the hard block
187  // we got what we want, and can exit now !
188  parentId = counter;
189  break;
190  } else {
191  parentPrevId = parentId;
192  parentId = fullEvent[parentPrevId].mother1();
193  }
194  } else if (parentId > parentPrevId ||
195  parentId > pos) // "circular"/"forward-pointing parent" - intermediate process
196  {
197  parentId = -1;
198  break;
199  }
200 
201  // additional checks... although we shouldn't be geeting here all that much...
202  //
203  if (abs(fullEvent[parentId].status()) == 22 || abs(fullEvent[parentId].status()) == 23) // hard block
204  {
205  break;
206  }
207  if (abs(fullEvent[parentId].status()) < 22) // incoming
208  {
209  parentId = -1;
210  break;
211  }
212  }
213 
214  return parentId;
215 }

References funct::abs(), counter, and mps_update::status.

Referenced by Py8toJetInputHEPEVT::fillJetAlgoInput().

◆ setJetEtaMax()

void Py8toJetInput::setJetEtaMax ( double  max)
inline

Definition at line 25 of file Py8toJetInput.h.

25  {
26  fJetEtaMax = max;
27  return;
28  }

References fJetEtaMax, and SiStripPI::max.

Referenced by JetMatchingHook::init().

Member Data Documentation

◆ fJetEtaMax

double Py8toJetInput::fJetEtaMax
protected

Definition at line 32 of file Py8toJetInput.h.

Referenced by fillJetAlgoInput(), and setJetEtaMax().

◆ fJetInput

std::vector<fastjet::PseudoJet> Py8toJetInput::fJetInput
protected

Definition at line 36 of file Py8toJetInput.h.

Referenced by fillJetAlgoInput(), and Py8toJetInputHEPEVT::fillJetAlgoInput().

lhef::LHEEvent::getHEPEUP
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:38
counter
Definition: counter.py:1
mps_fire.i
i
Definition: mps_fire.py:355
lhef::HEPEUP::MOTHUP
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:234
mps_update.status
status
Definition: mps_update.py:69
pos
Definition: PixelAliasList.h:18
Py8toJetInput::ID_PHOTON
Definition: Py8toJetInput.h:31
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
training_settings.idx
idx
Definition: training_settings.py:16
end
#define end
Definition: vmac.h:39
PVValHelper::eta
Definition: PVValidationHelpers.h:69
Event
Py8toJetInput::fJetEtaMax
double fJetEtaMax
Definition: Py8toJetInput.h:32
Py8toJetInput::ID_TOP
Definition: Py8toJetInput.h:31
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
lhef::HEPEUP
Definition: LesHouches.h:138
Py8toJetInput::fJetInput
std::vector< fastjet::PseudoJet > fJetInput
Definition: Py8toJetInput.h:36
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Py8toJetInput::ID_GLUON
Definition: Py8toJetInput.h:31