132 using namespace reco;
135 iEvent.
getByLabel(
"genParticles", GenParticles);
137 bool FilterResult =
false;
138 double etalimit = 2.4;
141 vector <pair <GenParticle, GenParticle> > ClusterSeeds;
142 int NumPassClusters = 0;
144 for (GenParticleCollection::const_iterator itGenParticles = GenParticles->begin(); itGenParticles != GenParticles->end(); ++itGenParticles) {
145 double CandidateEt = itGenParticles->et();
146 double CandidateEta = itGenParticles->eta();
147 double CandidatePDGID =
abs(itGenParticles->pdgId());
148 double CandidatePhi = itGenParticles->phi();
152 if ((CandidatePDGID==22 || CandidatePDGID==11
153 || CandidatePDGID==211 || CandidatePDGID==310 || CandidatePDGID==130
154 || CandidatePDGID==321 || CandidatePDGID==2112 || CandidatePDGID==2212 || CandidatePDGID==3122)
158 if ((CandidatePDGID==211 || CandidatePDGID==321
159 || CandidatePDGID==2112 || CandidatePDGID==2212 || CandidatePDGID==3122)
163 for (GenParticleCollection::const_iterator checkGenParticles = GenParticles->begin(); checkGenParticles != GenParticles->end(); ++checkGenParticles) {
164 double GenEt = checkGenParticles->et();
165 double GenEta = checkGenParticles->eta();
166 double GenPDGID =
abs(checkGenParticles->pdgId());
167 double GenPhi = checkGenParticles->phi();
168 double dR =
deltaR2(CandidateEta,CandidatePhi,GenEta,GenPhi);
170 if ((((GenPDGID==22 || GenPDGID==11 || GenPDGID==310 || GenPDGID==130) && GenEt>CandidateEt)
171 || ((GenPDGID==211 || GenPDGID==321 || GenPDGID==2112 || GenPDGID==2212 || GenPDGID==3122) && GenEt>CandidateEt && GenEt>
PionSeedThreshold_))
174 if ((GenPDGID==211 || GenPDGID==321 || GenPDGID==2112 || GenPDGID==2212 || GenPDGID==3122)
175 && (GenEt>SecondarySeed.
et() || SecondarySeed.
et()==CandidateEt)
180 if (newseed) ClusterSeeds.push_back(make_pair(*itGenParticles,SecondarySeed));
184 for (vector<pair <GenParticle, GenParticle> >::const_iterator itClusterSeeds = ClusterSeeds.begin(); itClusterSeeds != ClusterSeeds.end(); ++itClusterSeeds) {
185 double CaloIsoEnergy = 0;
186 double ClusterEnergy = 0;
187 double ClusterTrackEnergy = 0;
188 double ClusterEta = itClusterSeeds->first.
eta();
189 double ClusterPhi = itClusterSeeds->first.phi();
190 double TrackIsoEnergy = 0;
191 double ClusterTotalCharge = 0;
192 double ClusterTotalEnergy = 0;
194 double SecondaryEta = itClusterSeeds->second.eta();
195 double SecondaryPhi = itClusterSeeds->second.phi();
197 int NumChargesInConeCounter = 0;
198 int NumSeedsInConeCounter = 0;
199 int NumNonSeedsInConeCounter = 0;
201 for(GenParticleCollection::const_iterator itGenParticles = GenParticles->begin(); itGenParticles != GenParticles->end(); ++itGenParticles) {
202 bool TheSecondarySeed =
false;
203 bool TheSeedParticle =
false;
204 double GenCharge = itGenParticles->charge();
205 double GenEt = itGenParticles->et();
206 double GenEta = itGenParticles->eta();
207 double GenPDGID =
abs(itGenParticles->pdgId());
208 double GenPhi = itGenParticles->phi();
209 double GenStatus = itGenParticles->status();
210 double dR =
deltaR2(GenEta,GenPhi,ClusterEta,ClusterPhi);
212 if (ClusterEta==GenEta && ClusterPhi==GenPhi) TheSeedParticle=
true;
213 if (SecondaryEta==GenEta && SecondaryPhi==GenPhi && !(SecondaryEta==ClusterEta && SecondaryPhi==ClusterPhi)) TheSecondarySeed=
true;
217 if (GenCharge!=0 && !TheSeedParticle && !TheSecondarySeed) {
218 NumChargesInConeCounter++;
219 ClusterTotalCharge += GenCharge;
220 ClusterTrackEnergy += GenEt;
222 if (GenPDGID!=12 && GenPDGID!=14 && GenPDGID!=16) ClusterTotalEnergy+=GenEt;
223 if (GenPDGID!=12 && GenPDGID!=14 && GenPDGID!=16 && GenPDGID!=22 && GenPDGID!=11 && GenPDGID!=310 && GenPDGID!=130 && !TheSeedParticle && !TheSecondarySeed) NumNonSeedsInConeCounter++;
224 if (GenPDGID==22 || GenPDGID==11 || GenPDGID==310 || GenPDGID==130 || TheSeedParticle || TheSecondarySeed) {
225 NumSeedsInConeCounter++;
226 ClusterEnergy += GenEt;
230 if (GenCharge!=0) TrackIsoEnergy += GenEt;
231 if (GenPDGID>100 || GenPDGID==22 || GenPDGID==11) CaloIsoEnergy += GenEt;
238 if (
Debug_)
cout <<
"ClusterEnergy: " << ClusterEnergy <<
" | CaloIsoEtRatio: " << CaloIsoEnergy/ClusterEnergy <<
" | TrackIsoEtRatio: " << TrackIsoEnergy/ClusterEnergy <<
" | ClusterTrackEtRatio: " << ClusterTrackEnergy/ClusterEnergy <<
" | ClusterEtRatio: " << ClusterEnergy/ClusterTotalEnergy <<
" | ChargedParticles: " << NumChargesInConeCounter <<
" | ClusterNonSeeds: " << NumNonSeedsInConeCounter <<
" | ClusterSeeds: " << NumSeedsInConeCounter << endl;
323 if (NumPassClusters>=
NumPhotons_) FilterResult=
true;
double eta() const final
momentum pseudorapidity
int ChargedParticleThreshold_
double ClusterTrackEtRatio_
double GenParticleThreshold_
double PionSeedThreshold_
double et() const final
transverse energy
Abs< T >::type abs(const T &t)
double ClusterEtThreshold_
double SecondarySeedThreshold_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int ClusterNonSeedThreshold_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
int ClusterSeedThreshold_