You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for (unsignedint i = 0; i < particles_deltar.size(); i++)
83
-
{
80
+
for (unsignedint i = 0; i < particles_deltar.size(); i++) {
84
81
total_pt += particles_pt[i];
85
-
if (total_pt > frixione_isolation_coefficient * (1 - cos(particles_deltar[i])))
86
-
{
87
-
good_photon = false; // if for some delta R the isolation condition is not satisfied, the photon is not good
82
+
if (total_pt > frixione_isolation_coefficient * (1 - cos(particles_deltar[i]))) {
83
+
good_photon =
84
+
false;// if for some delta R the isolation condition is not satisfied, the photon is not good
88
85
break;
89
86
}
90
87
}
91
-
if (good_photon){
92
-
if (hasAncestor(*p,[](int x){return x == 11 || x == 13 || x ==15;}) || hasAncestor(*p,[](int x){return x == 24 || x == 5;},true,false)) { // check if photon is from decay and defines the event as acceptable
88
+
if (good_photon) {
89
+
if (hasAncestor(*p, [](int x) { return x == 11 || x == 13 || x == 15; }) ||
90
+
hasAncestor(
91
+
*p,
92
+
[](int x) { return x == 24 || x == 5; },
93
+
true,
94
+
false)) { // check if photon is from decay and defines the event as acceptable
93
95
accepted_event = true;
94
96
}
95
-
if (!hasAncestor(*p,[](int x){return x == 11 || x == 13 || x ==15;}) && hasAncestor(*p,[](int x){return x == 24 || x == 5;},false,true)) { // check if photon comes from the hard process and discards it, in case it is
97
+
if (!hasAncestor(*p, [](int x) { return x == 11 || x == 13 || x == 15; }) &&
98
+
hasAncestor(
99
+
*p,
100
+
[](int x) { return x == 24 || x == 5; },
101
+
false,
102
+
true)) { // check if photon comes from the hard process and discards it, in case it is
bool isWorBPromptCheck) const { // function to check if a particle has a certain ancestor
130
+
if (!particle)
131
+
returnfalse;
118
132
119
-
boolPhotonGenFilter::hasAncestor(HepMC::GenParticle* particle, function<bool(int)> check,bool isWorBFromDecayCheck,bool isWorBPromptCheck) const { // function to check if a particle has a certain ancestor
returnhasAncestor(*parent,[](int x){return x == 6;},false,false); // if the photon has a W or b quark ancestor, check if it comes from a top quark
137
-
}
138
-
elseif (isWorBPromptCheck) {
139
-
return !hasAncestor(*parent,[](int x){return x == 6;},false,false); // if the photon has a W or b quark ancestor, check that it doesn't come from a top quark decay (therefore it comes form the hard process)
140
-
}
141
-
elsereturntrue;
142
-
}
140
+
for (auto parent = prodVertex->particles_begin(HepMC::parents); parent != prodVertex->particles_end(HepMC::parents);
141
+
++parent) {
142
+
int pdgId = abs((*parent)->pdg_id());
143
+
144
+
// Check if the PDG ID respects a check
145
+
if (check(pdgId)) {
146
+
if (isWorBFromDecayCheck) {
147
+
returnhasAncestor(
148
+
*parent,
149
+
[](int x) { return x == 6; },
150
+
false,
151
+
false); // if the photon has a W or b quark ancestor, check if it comes from a top quark
152
+
} elseif (isWorBPromptCheck) {
153
+
return !hasAncestor(
154
+
*parent,
155
+
[](int x) { return x == 6; },
156
+
false,
157
+
false); // if the photon has a W or b quark ancestor, check that it doesn't come from a top quark decay (therefore it comes form the hard process)
158
+
} else
159
+
returntrue;
160
+
}
143
161
144
-
returnhasAncestor(*parent, check,isWorBFromDecayCheck,isWorBPromptCheck); // Recursively check the ancestry of the parent
145
-
}
162
+
returnhasAncestor(
163
+
*parent, check, isWorBFromDecayCheck, isWorBPromptCheck); // Recursively check the ancestry of the parent
0 commit comments