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 | 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 &)
 

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_
 
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 48 of file EGammaCutBasedEleIdAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 104 of file EGammaCutBasedEleIdAnalyzer.cc.

References beamSpotInputTag_, conversionsInputTag_, 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.

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

Definition at line 132 of file EGammaCutBasedEleIdAnalyzer.cc.

133 {
134 
135  // do anything here that needs to be done at desctruction time
136  // (e.g. close files, deallocate resources etc.)
137 
138 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 147 of file EGammaCutBasedEleIdAnalyzer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotInputTag_, conversionsInputTag_, 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.

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

246 {
247 }
void EGammaCutBasedEleIdAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 269 of file EGammaCutBasedEleIdAnalyzer.cc.

270 {
271 }
void EGammaCutBasedEleIdAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 257 of file EGammaCutBasedEleIdAnalyzer.cc.

258 {
259 }
void EGammaCutBasedEleIdAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 251 of file EGammaCutBasedEleIdAnalyzer.cc.

252 {
253 }
void EGammaCutBasedEleIdAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 275 of file EGammaCutBasedEleIdAnalyzer.cc.

276 {
277 }
void EGammaCutBasedEleIdAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 263 of file EGammaCutBasedEleIdAnalyzer.cc.

264 {
265 }
void EGammaCutBasedEleIdAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 281 of file EGammaCutBasedEleIdAnalyzer.cc.

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

281  {
282  //The following says we do not know what parameters are allowed so do no validation
283  // Please change this to state exactly what you do use, even if it is no parameters
285  desc.setUnknown();
286  descriptions.addDefault(desc);
287 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

edm::InputTag EGammaCutBasedEleIdAnalyzer::beamSpotInputTag_
private

Definition at line 71 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::conversionsInputTag_
private

Definition at line 70 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::electronsInputTag_
private

Definition at line 69 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_
private

Definition at line 80 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_fbremeopin_
private

Definition at line 86 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_loose_
private

Definition at line 82 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_medium_
private

Definition at line 83 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_tight_
private

Definition at line 84 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_trig_
private

Definition at line 85 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_veto_
private

Definition at line 81 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

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

Definition at line 74 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::primaryVertexInputTag_
private

Definition at line 73 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

bool EGammaCutBasedEleIdAnalyzer::printDebug_
private

Definition at line 77 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::InputTag EGammaCutBasedEleIdAnalyzer::rhoIsoInputTag
private

Definition at line 72 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().