CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PhotonEnrichmentFilter Class Reference

#include <GeneratorInterface/GenFilters/src/PhotonEnrichmentFilter.cc>

Inheritance diagram for PhotonEnrichmentFilter:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 PhotonEnrichmentFilter (const edm::ParameterSet &)
 
 ~PhotonEnrichmentFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Private Attributes

double CaloIsoEtRatio_
 
int ChargedParticleThreshold_
 
double ClusterConeSize_
 
double ClusterEtRatio_
 
double ClusterEtThreshold_
 
int ClusterNonSeedThreshold_
 
int ClusterSeedThreshold_
 
double ClusterTrackEtRatio_
 
bool Debug_
 
double EMSeedThreshold_
 
double GenParticleThreshold_
 
double IsoConeSize_
 
double IsolationCutOff_
 
int MaxClusterCharge_
 
int NumPhotons_
 
double PionSeedThreshold_
 
double SecondarySeedThreshold_
 
double TrackIsoEtRatio_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 44 of file PhotonEnrichmentFilter.cc.

Constructor & Destructor Documentation

PhotonEnrichmentFilter::PhotonEnrichmentFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 89 of file PhotonEnrichmentFilter.cc.

References edm::ParameterSet::getParameter().

90 {
91  //now do what ever initialization is needed
92  Debug_ = (bool) iConfig.getParameter<bool>("Debug");
93  //Report_ = (bool) iConfig.getParameter<bool>("Report");
94  ClusterConeSize_ = (double) iConfig.getParameter<double>("ClusterConeSize");
95  EMSeedThreshold_ = (double) iConfig.getParameter<double>("EMSeedThreshold");
96  PionSeedThreshold_ = (double) iConfig.getParameter<double>("PionSeedThreshold");
97  GenParticleThreshold_ = (double) iConfig.getParameter<double>("GenParticleThreshold");
98  SecondarySeedThreshold_ = (double) iConfig.getParameter<double>("SecondarySeedThreshold");
99  IsoConeSize_ = (double) iConfig.getParameter<double>("IsoConeSize");
100  IsolationCutOff_ = (double) iConfig.getParameter<double>("IsolationCutOff");
101 
102  ClusterEtThreshold_ = (double) iConfig.getParameter<double>("ClusterEtThreshold");
103  ClusterEtRatio_ = (double) iConfig.getParameter<double>("ClusterEtRatio");
104  CaloIsoEtRatio_ = (double) iConfig.getParameter<double>("CaloIsoEtRatio");
105  TrackIsoEtRatio_ = (double) iConfig.getParameter<double>("TrackIsoEtRatio");
106  ClusterTrackEtRatio_ = (double) iConfig.getParameter<double>("ClusterTrackEtRatio");
107 
108  MaxClusterCharge_ = (int) iConfig.getParameter<int>("MaxClusterCharge");
109  ChargedParticleThreshold_ = (int) iConfig.getParameter<int>("ChargedParticleThreshold");
110  ClusterNonSeedThreshold_ = (int) iConfig.getParameter<int>("ClusterNonSeedThreshold");
111  ClusterSeedThreshold_ = (int) iConfig.getParameter<int>("ClusterSeedThreshold");
112  NumPhotons_ = (int) iConfig.getParameter<int>("NumPhotons");
113 }
T getParameter(std::string const &) const
PhotonEnrichmentFilter::~PhotonEnrichmentFilter ( )

Definition at line 116 of file PhotonEnrichmentFilter.cc.

117 {
118 
119  // do anything here that needs to be done at desctruction time
120  // (e.g. close files, deallocate resources etc.)
121 
122 }

Member Function Documentation

void PhotonEnrichmentFilter::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 331 of file PhotonEnrichmentFilter.cc.

332 {
333 }
void PhotonEnrichmentFilter::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 337 of file PhotonEnrichmentFilter.cc.

337  {
338 }
bool PhotonEnrichmentFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 131 of file PhotonEnrichmentFilter.cc.

References abs, gather_cfg::cout, Geom::deltaR2(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), and dt_dqm_sourceclient_common_cff::reco.

132 {
133  using namespace reco;
134 
135  Handle<GenParticleCollection> GenParticles;
136  iEvent.getByLabel("genParticles", GenParticles);
137 
138  bool FilterResult = false;
139  double etalimit = 2.4;
140  //EventNumber_t eventNumber = iEvent.id().event();
141  //RunNumber_t runNumber = iEvent.id().run();
142  vector <pair <GenParticle, GenParticle> > ClusterSeeds;
143  int NumPassClusters = 0;
144 
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();
150 
151  GenParticle SecondarySeed = *itGenParticles;
152 
153  if ((CandidatePDGID==22 || CandidatePDGID==11
154  || CandidatePDGID==211 || CandidatePDGID==310 || CandidatePDGID==130
155  || CandidatePDGID==321 || CandidatePDGID==2112 || CandidatePDGID==2212 || CandidatePDGID==3122)
156  && abs(CandidateEta)<etalimit && CandidateEt>EMSeedThreshold_) {
157  bool newseed=true;
158 
159  if ((CandidatePDGID==211 || CandidatePDGID==321
160  || CandidatePDGID==2112 || CandidatePDGID==2212 || CandidatePDGID==3122)
161  && CandidateEt<PionSeedThreshold_) newseed=false;
162 
163  if (newseed) {
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);
170 
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_))
173  && dR<ClusterConeSize_) newseed=false;
174 
175  if ((GenPDGID==211 || GenPDGID==321 || GenPDGID==2112 || GenPDGID==2212 || GenPDGID==3122)
176  && (GenEt>SecondarySeed.et() || SecondarySeed.et()==CandidateEt)
177  && GenEt>SecondarySeedThreshold_ && GenEt<CandidateEt && dR<ClusterConeSize_) SecondarySeed=*checkGenParticles;
178  }
179  }
180 
181  if (newseed) ClusterSeeds.push_back(make_pair(*itGenParticles,SecondarySeed));
182  }
183  }
184 
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;
194 
195  double SecondaryEta = itClusterSeeds->second.eta();
196  double SecondaryPhi = itClusterSeeds->second.phi();
197 
198  int NumChargesInConeCounter = 0;
199  int NumSeedsInConeCounter = 0;
200  int NumNonSeedsInConeCounter = 0;
201 
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);
212 
213  if (ClusterEta==GenEta && ClusterPhi==GenPhi) TheSeedParticle=true;
214  if (SecondaryEta==GenEta && SecondaryPhi==GenPhi && !(SecondaryEta==ClusterEta && SecondaryPhi==ClusterPhi)) TheSecondarySeed=true;
215  if (GenStatus==1 && GenEt>GenParticleThreshold_) {
216 
217  if (dR<ClusterConeSize_) {
218  if (GenCharge!=0 && !TheSeedParticle && !TheSecondarySeed) {
219  NumChargesInConeCounter++;
220  ClusterTotalCharge += GenCharge;
221  ClusterTrackEnergy += GenEt;
222  }
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;
228  }
229  }
230  if (dR<IsoConeSize_ && dR>ClusterConeSize_) {
231  if (GenCharge!=0) TrackIsoEnergy += GenEt;
232  if (GenPDGID>100 || GenPDGID==22 || GenPDGID==11) CaloIsoEnergy += GenEt;
233  }
234 
235  }
236 
237  }
238 
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;
240  if ((ClusterEnergy<IsolationCutOff_
241  && ClusterEnergy>ClusterEtThreshold_
242  && ClusterEnergy/ClusterTotalEnergy>ClusterEtRatio_
243  && CaloIsoEnergy/ClusterEnergy<CaloIsoEtRatio_
244  && TrackIsoEnergy/ClusterEnergy<TrackIsoEtRatio_
245  && ClusterTrackEnergy/ClusterEnergy<ClusterTrackEtRatio_
246  && abs(ClusterTotalCharge)<MaxClusterCharge_
247  && NumChargesInConeCounter<ChargedParticleThreshold_
248  && NumNonSeedsInConeCounter<ClusterNonSeedThreshold_
249  && NumSeedsInConeCounter<ClusterSeedThreshold_) ||
250  (ClusterEnergy>=IsolationCutOff_
251  && ClusterEnergy>ClusterEtThreshold_
252  && ClusterEnergy/ClusterTotalEnergy>ClusterEtRatio_
253  //&& CaloIsoEnergy/ClusterEnergy<CaloIsoEtRatio_
254  //&& TrackIsoEnergy/ClusterEnergy<TrackIsoEtRatio_
255  && ClusterTrackEnergy/ClusterEnergy<ClusterTrackEtRatio_
256  && abs(ClusterTotalCharge)<MaxClusterCharge_
257  && NumChargesInConeCounter<ChargedParticleThreshold_
258  && NumNonSeedsInConeCounter<ClusterNonSeedThreshold_
259  //&& NumSeedsInConeCounter<ClusterSeedThreshold_
260  )
261  ) NumPassClusters++;
262 
263  /* if (Report_) {
264  Handle<PhotonCollection> Photons;
265  iEvent.getByLabel("photons", Photons);
266 
267  for (PhotonCollection::const_iterator itPhotons = Photons->begin(); itPhotons != Photons->end(); ++itPhotons) {
268 
269  if (itPhotons->pt()>15. && abs(itPhotons->eta())<2.5 && itPhotons->ecalRecHitSumEtConeDR04()<4.2+0.003*itPhotons->pt() &&
270  itPhotons->hcalTowerSumEtConeDR04()<2.2+0.001*itPhotons->pt() && itPhotons->trkSumPtHollowConeDR04()<2.0+0.001*itPhotons->pt() &&
271  itPhotons->hadronicOverEm()<0.05 && itPhotons->isEB() && itPhotons->sigmaIetaIeta()<0.010) {
272 
273  double PhotonEta = itPhotons->eta();
274  double PhotonPhi = itPhotons->phi();
275  double PhotonClusterDr = deltaR2(PhotonEta,PhotonPhi,ClusterEta,ClusterPhi);
276 
277  if (PhotonClusterDr<0.1 && (itPhotons->ecalRecHitSumEtConeDR04()>3 && itPhotons->ecalRecHitSumEtConeDR04()<5)) {
278 
279  if (!((ClusterEnergy<IsolationCutOff_
280  && ClusterEnergy>ClusterEtThreshold_
281  && ClusterEnergy/ClusterTotalEnergy>ClusterEtRatio_
282  && CaloIsoEnergy/ClusterEnergy<CaloIsoEtRatio_
283  && TrackIsoEnergy/ClusterEnergy<TrackIsoEtRatio_
284  && ClusterTrackEnergy/ClusterEnergy<ClusterTrackEtRatio_
285  && abs(ClusterTotalCharge)<MaxClusterCharge_
286  && NumChargesInConeCounter<ChargedParticleThreshold_
287  && NumNonSeedsInConeCounter<ClusterNonSeedThreshold_
288  && NumSeedsInConeCounter<ClusterSeedThreshold_) ||
289  (ClusterEnergy>=IsolationCutOff_
290  && ClusterEnergy>ClusterEtThreshold_
291  && ClusterEnergy/ClusterTotalEnergy>ClusterEtRatio_
292  //&& CaloIsoEnergy/ClusterEnergy<CaloIsoEtRatio_
293  //&& TrackIsoEnergy/ClusterEnergy<TrackIsoEtRatio_
294  && ClusterTrackEnergy/ClusterEnergy<ClusterTrackEtRatio_
295  && abs(ClusterTotalCharge)<MaxClusterCharge_
296  //&& NumChargesInConeCounter<ChargedParticleThreshold_
297  //&& NumNonSeedsInConeCounter<ClusterNonSeedThreshold_
298  //&& NumSeedsInConeCounter<ClusterSeedThreshold_
299  ))
300  ) {
301  cout << "Event " << eventNumber << " in run " << runNumber << " has a photon pt of " << itPhotons->pt() << " and failed because:" << endl;
302  //cout << "ClusterEnergy: " << ClusterEnergy << " | CaloIsoEtRatio: " << CaloIsoEnergy/ClusterEnergy << " | TrackIsoEtRatio: " << TrackIsoEnergy/ClusterEnergy << " | ClusterTrackEtRatio: " << ClusterTrackEnergy/ClusterEnergy << " | ClusterEtRatio: " << ClusterEnergy/ClusterTotalEnergy << " | ChargedParticles: " << NumChargesInConeCounter << " | ClusterNonSeeds: " << NumNonSeedsInConeCounter << " | ClusterSeeds: " << NumSeedsInConeCounter << endl;
303  }
304  if (ClusterEnergy<=ClusterEtThreshold_) cout << "ClusterEnergy: " << ClusterEnergy << endl;
305  if (ClusterEnergy/ClusterTotalEnergy<=ClusterEtRatio_) cout << "ClusterEtRatio: " << ClusterEnergy/ClusterTotalEnergy << endl;
306  if (ClusterEnergy<IsolationCutOff_ && CaloIsoEnergy/ClusterEnergy>=CaloIsoEtRatio_) cout << "CaloIsoEtRatio: " << CaloIsoEnergy/ClusterEnergy << endl;
307  if (ClusterEnergy<IsolationCutOff_ && TrackIsoEnergy/ClusterEnergy>=TrackIsoEtRatio_) cout << "TrackIsoEtRatio: " << TrackIsoEnergy/ClusterEnergy << endl;
308  if (ClusterTrackEnergy/ClusterEnergy>=ClusterTrackEtRatio_) cout << "ClusterTrackEtRatio: " << ClusterTrackEnergy/ClusterEnergy << endl;
309  if (abs(ClusterTotalCharge)>=MaxClusterCharge_) cout << "ClusterTotalCharge: " << ClusterTotalCharge << endl;
310  if (ClusterEnergy<IsolationCutOff_ && NumChargesInConeCounter>=ChargedParticleThreshold_) cout << "ChargedParticles: " << NumChargesInConeCounter << endl;
311  if (ClusterEnergy<IsolationCutOff_ && NumNonSeedsInConeCounter>=ClusterNonSeedThreshold_) cout << "ClusterNonSeeds: " << NumNonSeedsInConeCounter << endl;
312  if (ClusterEnergy<IsolationCutOff_ && NumSeedsInConeCounter>=ClusterSeedThreshold_) cout << "ClusterSeeds: " << NumSeedsInConeCounter << endl;
313 
314  }
315 
316  }
317 
318  }
319 
320  } */
321 
322  }
323 
324  if (NumPassClusters>=NumPhotons_) FilterResult=true;
325  return FilterResult;
326 
327 }
virtual double et() const
transverse energy
#define abs(x)
Definition: mlp_lapack.h:159
virtual double eta() const
momentum pseudorapidity
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double deltaR2(const Vector1 &v1, const Vector2 &v2)
Definition: VectorUtil.h:78
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double PhotonEnrichmentFilter::CaloIsoEtRatio_
private

Definition at line 66 of file PhotonEnrichmentFilter.cc.

int PhotonEnrichmentFilter::ChargedParticleThreshold_
private

Definition at line 71 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::ClusterConeSize_
private

Definition at line 56 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::ClusterEtRatio_
private

Definition at line 65 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::ClusterEtThreshold_
private

Definition at line 64 of file PhotonEnrichmentFilter.cc.

int PhotonEnrichmentFilter::ClusterNonSeedThreshold_
private

Definition at line 72 of file PhotonEnrichmentFilter.cc.

int PhotonEnrichmentFilter::ClusterSeedThreshold_
private

Definition at line 73 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::ClusterTrackEtRatio_
private

Definition at line 68 of file PhotonEnrichmentFilter.cc.

bool PhotonEnrichmentFilter::Debug_
private

Definition at line 54 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::EMSeedThreshold_
private

Definition at line 57 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::GenParticleThreshold_
private

Definition at line 59 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::IsoConeSize_
private

Definition at line 61 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::IsolationCutOff_
private

Definition at line 62 of file PhotonEnrichmentFilter.cc.

int PhotonEnrichmentFilter::MaxClusterCharge_
private

Definition at line 70 of file PhotonEnrichmentFilter.cc.

int PhotonEnrichmentFilter::NumPhotons_
private

Definition at line 74 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::PionSeedThreshold_
private

Definition at line 58 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::SecondarySeedThreshold_
private

Definition at line 60 of file PhotonEnrichmentFilter.cc.

double PhotonEnrichmentFilter::TrackIsoEtRatio_
private

Definition at line 67 of file PhotonEnrichmentFilter.cc.