@@ -66,11 +66,21 @@ class LHETablesProducer : public edm::global::EDProducer<> {
66
66
std::vector<int > vals_pid;
67
67
std::vector<int > vals_status;
68
68
std::vector<int > vals_spin;
69
+ std::vector<int16_t > vals_firstMotherIdx;
70
+ std::vector<int16_t > vals_lastMotherIdx;
69
71
alphaS = hepeup.AQCDUP ;
72
+
73
+ int nOutPart = 0 ;
74
+ std::vector<int > newIdxs (pup.size ());
75
+
70
76
for (unsigned int i = 0 , n = pup.size (); i < n; ++i) {
71
77
int status = hepeup.ISTUP [i];
72
78
int idabs = std::abs (hepeup.IDUP [i]);
79
+
73
80
if (status == 1 || status == -1 || (status == 2 && (idabs >= 23 && idabs <= 25 ))) {
81
+ newIdxs[i] = nOutPart;
82
+
83
+ nOutPart += 1 ;
74
84
TLorentzVector p4 (pup[i][0 ], pup[i][1 ], pup[i][2 ], pup[i][3 ]); // x,y,z,t
75
85
vals_pid.push_back (hepeup.IDUP [i]);
76
86
vals_spin.push_back (hepeup.SPINUP [i]);
@@ -81,13 +91,19 @@ class LHETablesProducer : public edm::global::EDProducer<> {
81
91
vals_phi.push_back (0 );
82
92
vals_mass.push_back (0 );
83
93
vals_pz.push_back (p4.Pz ());
94
+ vals_firstMotherIdx.push_back (-1 );
95
+ vals_lastMotherIdx.push_back (-1 );
84
96
} else {
85
97
vals_pt.push_back (p4.Pt ());
86
98
vals_eta.push_back (p4.Eta ());
87
99
vals_phi.push_back (p4.Phi ());
88
100
vals_mass.push_back (p4.M ());
89
101
vals_pz.push_back (0 );
102
+ vals_firstMotherIdx.push_back (newIdxs[std::max (hepeup.MOTHUP [i].first - 1 , 0 )]);
103
+ vals_lastMotherIdx.push_back (newIdxs[std::max (hepeup.MOTHUP [i].second - 1 , 0 )]);
90
104
}
105
+ } else {
106
+ newIdxs[i] = -1 ;
91
107
}
92
108
if ((status == 1 ) && ((idabs == 21 ) || (idabs > 0 && idabs < 7 ))) { // # gluons and quarks
93
109
// object counters
@@ -118,6 +134,7 @@ class LHETablesProducer : public edm::global::EDProducer<> {
118
134
(hepeup.IDUP [i] > 0 ? lep : lepBar) = i;
119
135
}
120
136
}
137
+
121
138
std::pair<int , int > v (0 , 0 );
122
139
if (lep != -1 && lepBar != -1 )
123
140
v = std::make_pair (lep, lepBar);
@@ -153,6 +170,10 @@ class LHETablesProducer : public edm::global::EDProducer<> {
153
170
outPart->addColumn <int >(" pdgId" , vals_pid, " PDG ID of LHE particles" );
154
171
outPart->addColumn <int >(" status" , vals_status, " LHE particle status; -1:incoming, 1:outgoing" );
155
172
outPart->addColumn <int >(" spin" , vals_spin, " Spin of LHE particles" );
173
+ outPart->addColumn <int16_t >(
174
+ " firstMotherIdx" , vals_firstMotherIdx, " Index of this particle's first mother in the LHEPart collection" );
175
+ outPart->addColumn <int16_t >(
176
+ " lastMotherIdx" , vals_lastMotherIdx, " Index of this particle's last mother in the LHEPart collection" );
156
177
157
178
return outPart;
158
179
}
0 commit comments