133 using namespace reco;
136 iEvent.
getByLabel(
"genParticles", GenParticles);
138 bool FilterResult =
false;
139 double etalimit = 2.4;
142 vector <pair <GenParticle, GenParticle> > ClusterSeeds;
143 int NumPassClusters = 0;
145 for (GenParticleCollection::const_iterator itGenParticles = GenParticles->begin(); itGenParticles != GenParticles->end(); ++itGenParticles) {
146 double CandidateEt = itGenParticles->et();
147 double CandidateEta = itGenParticles->eta();
148 double CandidatePDGID =
abs(itGenParticles->pdgId());
149 double CandidatePhi = itGenParticles->phi();
153 if ((CandidatePDGID==22 || CandidatePDGID==11
154 || CandidatePDGID==211 || CandidatePDGID==310 || CandidatePDGID==130
155 || CandidatePDGID==321 || CandidatePDGID==2112 || CandidatePDGID==2212 || CandidatePDGID==3122)
159 if ((CandidatePDGID==211 || CandidatePDGID==321
160 || CandidatePDGID==2112 || CandidatePDGID==2212 || CandidatePDGID==3122)
164 for (GenParticleCollection::const_iterator checkGenParticles = GenParticles->begin(); checkGenParticles != GenParticles->end(); ++checkGenParticles) {
165 double GenEt = checkGenParticles->
et();
166 double GenEta = checkGenParticles->eta();
167 double GenPDGID =
abs(checkGenParticles->pdgId());
168 double GenPhi = checkGenParticles->phi();
169 double dR =
deltaR2(CandidateEta,CandidatePhi,GenEta,GenPhi);
171 if ((((GenPDGID==22 || GenPDGID==11 || GenPDGID==310 || GenPDGID==130) && GenEt>CandidateEt)
172 || ((GenPDGID==211 || GenPDGID==321 || GenPDGID==2112 || GenPDGID==2212 || GenPDGID==3122) && GenEt>CandidateEt && GenEt>
PionSeedThreshold_))
175 if ((GenPDGID==211 || GenPDGID==321 || GenPDGID==2112 || GenPDGID==2212 || GenPDGID==3122)
176 && (GenEt>SecondarySeed.
et() || SecondarySeed.
et()==CandidateEt)
181 if (newseed) ClusterSeeds.push_back(make_pair(*itGenParticles,SecondarySeed));
185 for (vector<pair <GenParticle, GenParticle> >::const_iterator itClusterSeeds = ClusterSeeds.begin(); itClusterSeeds != ClusterSeeds.end(); ++itClusterSeeds) {
186 double CaloIsoEnergy = 0;
187 double ClusterEnergy = 0;
188 double ClusterTrackEnergy = 0;
189 double ClusterEta = itClusterSeeds->first.
eta();
190 double ClusterPhi = itClusterSeeds->first.phi();
191 double TrackIsoEnergy = 0;
192 double ClusterTotalCharge = 0;
193 double ClusterTotalEnergy = 0;
195 double SecondaryEta = itClusterSeeds->second.eta();
196 double SecondaryPhi = itClusterSeeds->second.phi();
198 int NumChargesInConeCounter = 0;
199 int NumSeedsInConeCounter = 0;
200 int NumNonSeedsInConeCounter = 0;
202 for(GenParticleCollection::const_iterator itGenParticles = GenParticles->begin(); itGenParticles != GenParticles->end(); ++itGenParticles) {
203 bool TheSecondarySeed =
false;
204 bool TheSeedParticle =
false;
205 double GenCharge = itGenParticles->charge();
206 double GenEt = itGenParticles->et();
207 double GenEta = itGenParticles->eta();
208 double GenPDGID =
abs(itGenParticles->pdgId());
209 double GenPhi = itGenParticles->phi();
210 double GenStatus = itGenParticles->status();
211 double dR =
deltaR2(GenEta,GenPhi,ClusterEta,ClusterPhi);
213 if (ClusterEta==GenEta && ClusterPhi==GenPhi) TheSeedParticle=
true;
214 if (SecondaryEta==GenEta && SecondaryPhi==GenPhi && !(SecondaryEta==ClusterEta && SecondaryPhi==ClusterPhi)) TheSecondarySeed=
true;
218 if (GenCharge!=0 && !TheSeedParticle && !TheSecondarySeed) {
219 NumChargesInConeCounter++;
220 ClusterTotalCharge += GenCharge;
221 ClusterTrackEnergy += GenEt;
223 if (GenPDGID!=12 && GenPDGID!=14 && GenPDGID!=16) ClusterTotalEnergy+=GenEt;
224 if (GenPDGID!=12 && GenPDGID!=14 && GenPDGID!=16 && GenPDGID!=22 && GenPDGID!=11 && GenPDGID!=310 && GenPDGID!=130 && !TheSeedParticle && !TheSecondarySeed) NumNonSeedsInConeCounter++;
225 if (GenPDGID==22 || GenPDGID==11 || GenPDGID==310 || GenPDGID==130 || TheSeedParticle || TheSecondarySeed) {
226 NumSeedsInConeCounter++;
227 ClusterEnergy += GenEt;
231 if (GenCharge!=0) TrackIsoEnergy += GenEt;
232 if (GenPDGID>100 || GenPDGID==22 || GenPDGID==11) CaloIsoEnergy += GenEt;
239 if (
Debug_)
cout <<
"ClusterEnergy: " << ClusterEnergy <<
" | CaloIsoEtRatio: " << CaloIsoEnergy/ClusterEnergy <<
" | TrackIsoEtRatio: " << TrackIsoEnergy/ClusterEnergy <<
" | ClusterTrackEtRatio: " << ClusterTrackEnergy/ClusterEnergy <<
" | ClusterEtRatio: " << ClusterEnergy/ClusterTotalEnergy <<
" | ChargedParticles: " << NumChargesInConeCounter <<
" | ClusterNonSeeds: " << NumNonSeedsInConeCounter <<
" | ClusterSeeds: " << NumSeedsInConeCounter << endl;
324 if (NumPassClusters>=
NumPhotons_) FilterResult=
true;
int ChargedParticleThreshold_
virtual double et() const
transverse energy
double ClusterTrackEtRatio_
double GenParticleThreshold_
virtual double eta() const
momentum pseudorapidity
double PionSeedThreshold_
double ClusterEtThreshold_
double SecondarySeedThreshold_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double deltaR2(const Vector1 &v1, const Vector2 &v2)
int ClusterNonSeedThreshold_
int ClusterSeedThreshold_