CMS 3D CMS Logo

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

#include <EGamma/EGammaCutBasedEleIdAnalyzer/src/EGammaCutBasedEleIdAnalyzer.cc>

Inheritance diagram for EGammaCutBasedEleIdAnalyzer:
edm::EDAnalyzer

Public Member Functions

 EGammaCutBasedEleIdAnalyzer (const edm::ParameterSet &)
 
 ~EGammaCutBasedEleIdAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Public Attributes

ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

edm::InputTag beamSpotInputTag_
 
edm::InputTag conversionsInputTag_
 
std::string EAtargetToken_
 
edm::InputTag electronsInputTag_
 
TH1F * h1_pt_
 
TH1F * h1_pt_fbremeopin_
 
TH1F * h1_pt_loose_
 
TH1F * h1_pt_medium_
 
TH1F * h1_pt_tight_
 
TH1F * h1_pt_trig_
 
TH1F * h1_pt_veto_
 
std::vector< edm::InputTagisoValInputTags_
 
edm::InputTag primaryVertexInputTag_
 
bool printDebug_
 
edm::InputTag rhoIsoInputTag
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file EGammaCutBasedEleIdAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 107 of file EGammaCutBasedEleIdAnalyzer.cc.

References beamSpotInputTag_, conversionsInputTag_, EAtargetToken_, electronsInputTag_, edm::ParameterSet::getParameter(), h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, isoValInputTags_, primaryVertexInputTag_, printDebug_, and rhoIsoInputTag.

108 {
109 
110  // get input parameters
111  electronsInputTag_ = iConfig.getParameter<edm::InputTag>("electronsInputTag");
112  conversionsInputTag_ = iConfig.getParameter<edm::InputTag>("conversionsInputTag");
113  beamSpotInputTag_ = iConfig.getParameter<edm::InputTag>("beamSpotInputTag");
114  rhoIsoInputTag = iConfig.getParameter<edm::InputTag>("rhoIsoInputTag");
115  primaryVertexInputTag_ = iConfig.getParameter<edm::InputTag>("primaryVertexInputTag");
116  isoValInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("isoValInputTags");
117 
118  EAtargetToken_ = iConfig.getParameter<std::string>("EAtarget");//EleEANoCorr, EleEAData2011, EleEASummer11MC,EleEAFall11MC, EleEAData2012/
119  // debug
120  printDebug_ = iConfig.getParameter<bool>("printDebug");
121 
122  // output histograms
124 
125  h1_pt_ = fs->make<TH1F>("h1_pt", "pt", 100, 0.0, 100.0);
126  h1_pt_veto_ = fs->make<TH1F>("h1_pt_veto", "pt (veto)", 100, 0.0, 100.0);
127  h1_pt_loose_ = fs->make<TH1F>("h1_pt_loose", "pt (loose)", 100, 0.0, 100.0);
128  h1_pt_medium_ = fs->make<TH1F>("h1_pt_medium", "pt (medium)", 100, 0.0, 100.0);
129  h1_pt_tight_ = fs->make<TH1F>("h1_pt_tight", "pt (tight)", 100, 0.0, 100.0);
130  h1_pt_trig_ = fs->make<TH1F>("h1_pt_trig", "pt (trig)", 100, 0.0, 100.0);
131  h1_pt_fbremeopin_ = fs->make<TH1F>("h1_pt_fbremeopin", "pt (fbremeopin)", 100, 0.0, 100.0);
132 
133 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > isoValInputTags_
EGammaCutBasedEleIdAnalyzer::~EGammaCutBasedEleIdAnalyzer ( )

Definition at line 136 of file EGammaCutBasedEleIdAnalyzer.cc.

137 {
138 
139  // do anything here that needs to be done at desctruction time
140  // (e.g. close files, deallocate resources etc.)
141 
142 }

Member Function Documentation

void EGammaCutBasedEleIdAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 151 of file EGammaCutBasedEleIdAnalyzer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotInputTag_, conversionsInputTag_, EAtarget, electronsInputTag_, edm::EventID::event(), edm::Event::getByLabel(), h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, i, edm::EventBase::id(), isoValInputTags_, j, EgammaCutBasedEleId::LOOSE, edm::EventBase::luminosityBlock(), EgammaCutBasedEleId::MEDIUM, n, EgammaCutBasedEleId::PassEoverPCuts(), EgammaCutBasedEleId::PassTriggerCuts(), EgammaCutBasedEleId::PassWP(), primaryVertexInputTag_, printDebug_, edm::Handle< T >::product(), rhoIsoInputTag, edm::EventID::run(), EgammaCutBasedEleId::TIGHT, EgammaCutBasedEleId::TRIGGERTIGHT, EgammaCutBasedEleId::TRIGGERWP70, and EgammaCutBasedEleId::VETO.

152 {
153  // electrons
155  iEvent.getByLabel(electronsInputTag_, els_h);
156 
157  // conversions
159  iEvent.getByLabel(conversionsInputTag_, conversions_h);
160 
161  // iso deposits
162  IsoDepositVals isoVals(isoValInputTags_.size());
163  for (size_t j = 0; j < isoValInputTags_.size(); ++j) {
164  iEvent.getByLabel(isoValInputTags_[j], isoVals[j]);
165  }
166 
167  // beam spot
168  edm::Handle<reco::BeamSpot> beamspot_h;
169  iEvent.getByLabel(beamSpotInputTag_, beamspot_h);
170  const reco::BeamSpot &beamSpot = *(beamspot_h.product());
171 
172  // vertices
174  iEvent.getByLabel(primaryVertexInputTag_, vtx_h);
175 
176  // rho for isolation
177  edm::Handle<double> rhoIso_h;
178  iEvent.getByLabel(rhoIsoInputTag, rhoIso_h);
179  double rhoIso = *(rhoIso_h.product());
180 
181  // loop on electrons
182  unsigned int n = els_h->size();
183  for(unsigned int i = 0; i < n; ++i) {
184 
185  // get reference to electron
186  reco::GsfElectronRef ele(els_h, i);
187 
188  //
189  // get particle flow isolation
190  //
191 
192  double iso_ch = (*(isoVals)[0])[ele];
193  double iso_em = (*(isoVals)[1])[ele];
194  double iso_nh = (*(isoVals)[2])[ele];
195 
196  //
197  // test ID
198  //
199 
200  // working points
201  bool veto = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::VETO, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
202  bool loose = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::LOOSE, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
203  bool medium = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::MEDIUM, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
204  bool tight = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::TIGHT, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
205 
206  // eop/fbrem cuts for extra tight ID
207  bool fbremeopin = EgammaCutBasedEleId::PassEoverPCuts(ele);
208 
209  // cuts to match tight trigger requirements
211 
212  // for 2011 WP70 trigger
214 
215  //
216  // fill histograms
217  //
218 
219  h1_pt_->Fill(ele->pt());
220  if (veto) h1_pt_veto_ ->Fill(ele->pt());
221  if (loose) h1_pt_loose_ ->Fill(ele->pt());
222  if (medium) h1_pt_medium_ ->Fill(ele->pt());
223  if (tight) h1_pt_tight_ ->Fill(ele->pt());
224  if (trigtight) h1_pt_trig_ ->Fill(ele->pt());
225  if (fbremeopin) h1_pt_fbremeopin_ ->Fill(ele->pt());
226 
227  //
228  // print decisions
229  //
230 
231  if (printDebug_) {
232  printf("%u %u %u : ", iEvent.id().run(), iEvent.luminosityBlock(), iEvent.id().event());
233  printf("veto(%i), ", veto);
234  printf("loose(%i), ", loose);
235  printf("medium(%i), ", medium);
236  printf("tight(%i), ", tight);
237  printf("trigtight(%i), ", trigtight);
238  printf("trigwp70(%i), ", trigwp70);
239  printf("fbremeopin(%i)\n", fbremeopin);
240  }
241 
242  }
243 
244 }
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
bool PassWP(const WorkingPoint workingPoint, const reco::GsfElectronRef &ele, const edm::Handle< reco::ConversionCollection > &conversions, const reco::BeamSpot &beamspot, const edm::Handle< reco::VertexCollection > &vtxs, const double &iso_ch, const double &iso_em, const double &iso_nh, const double &rho, ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget)
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
std::vector< edm::InputTag > isoValInputTags_
std::vector< edm::Handle< edm::ValueMap< double > > > IsoDepositVals
bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const reco::GsfElectronRef &ele)
bool PassEoverPCuts(const reco::GsfElectronRef &ele)
int j
Definition: DBlmapReader.cc:9
ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:56
void EGammaCutBasedEleIdAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 249 of file EGammaCutBasedEleIdAnalyzer.cc.

References EAtarget, EAtargetToken_, ElectronEffectiveArea::kEleEAData2011, ElectronEffectiveArea::kEleEAData2012, ElectronEffectiveArea::kEleEAFall11MC, ElectronEffectiveArea::kEleEANoCorr, and ElectronEffectiveArea::kEleEASummer11MC.

void EGammaCutBasedEleIdAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 285 of file EGammaCutBasedEleIdAnalyzer.cc.

286 {
287 }
void EGammaCutBasedEleIdAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 273 of file EGammaCutBasedEleIdAnalyzer.cc.

274 {
275 }
void EGammaCutBasedEleIdAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 267 of file EGammaCutBasedEleIdAnalyzer.cc.

268 {
269 }
void EGammaCutBasedEleIdAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 291 of file EGammaCutBasedEleIdAnalyzer.cc.

292 {
293 }
void EGammaCutBasedEleIdAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 279 of file EGammaCutBasedEleIdAnalyzer.cc.

280 {
281 }
void EGammaCutBasedEleIdAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 297 of file EGammaCutBasedEleIdAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

297  {
298  //The following says we do not know what parameters are allowed so do no validation
299  // Please change this to state exactly what you do use, even if it is no parameters
301  desc.setUnknown();
302  descriptions.addDefault(desc);
303 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

edm::InputTag EGammaCutBasedEleIdAnalyzer::beamSpotInputTag_
private

Definition at line 73 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::conversionsInputTag_
private

Definition at line 72 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

ElectronEffectiveArea::ElectronEffectiveAreaTarget EGammaCutBasedEleIdAnalyzer::EAtarget

Definition at line 56 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and beginJob().

std::string EGammaCutBasedEleIdAnalyzer::EAtargetToken_
private

Definition at line 78 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by beginJob(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::electronsInputTag_
private

Definition at line 71 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_
private

Definition at line 83 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_fbremeopin_
private

Definition at line 89 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_loose_
private

Definition at line 85 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_medium_
private

Definition at line 86 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_tight_
private

Definition at line 87 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_trig_
private

Definition at line 88 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_veto_
private

Definition at line 84 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

std::vector<edm::InputTag> EGammaCutBasedEleIdAnalyzer::isoValInputTags_
private

Definition at line 76 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::primaryVertexInputTag_
private

Definition at line 75 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

bool EGammaCutBasedEleIdAnalyzer::printDebug_
private

Definition at line 80 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::rhoIsoInputTag
private

Definition at line 74 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().