CMS 3D CMS Logo

List of all members | Public Types | 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 edm::EDConsumerBase

Public Types

typedef std::vector< edm::Handle< edm::ValueMap< reco::IsoDeposit > > > IsoDepositMaps
 
typedef std::vector< edm::Handle< edm::ValueMap< double > > > IsoDepositVals
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 EGammaCutBasedEleIdAnalyzer (const edm::ParameterSet &)
 
 ~EGammaCutBasedEleIdAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Public Attributes

ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
edm::EDGetTokenT< reco::ConversionCollectionconversionsToken_
 
std::string EAtargetToken_
 
edm::EDGetTokenT< reco::GsfElectronCollectionelectronsToken_
 
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::EDGetTokenT< edm::ValueMap< double > > > isoValTokens_
 
edm::EDGetTokenT< reco::VertexCollectionprimaryVertexToken_
 
bool printDebug_
 
edm::EDGetTokenT< double > rhoIsoToken_
 

Additional Inherited Members

- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file EGammaCutBasedEleIdAnalyzer.cc.

Member Typedef Documentation

Definition at line 52 of file EGammaCutBasedEleIdAnalyzer.cc.

Definition at line 53 of file EGammaCutBasedEleIdAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 105 of file EGammaCutBasedEleIdAnalyzer.cc.

References beamSpotToken_, conversionsToken_, EAtargetToken_, electronsToken_, edm::ParameterSet::getParameter(), h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, isoValTokens_, primaryVertexToken_, printDebug_, rhoIsoToken_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

106 {
107 
108  // get input parameters
109  electronsToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronsInputTag"));
110  conversionsToken_ = consumes<reco::ConversionCollection>(iConfig.getParameter<edm::InputTag>("conversionsInputTag"));
111  beamSpotToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotInputTag"));
112  rhoIsoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("rhoIsoInputTag"));
113  primaryVertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertexInputTag"));
114  isoValTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >("isoValInputTags"), [this](edm::InputTag const & tag){return consumes<edm::ValueMap<double> >(tag);});
115  EAtargetToken_ = iConfig.getParameter<std::string>("EAtarget");//EleEANoCorr, EleEAData2011, EleEASummer11MC,EleEAFall11MC, EleEAData2012/
116 
117  // debug
118  printDebug_ = iConfig.getParameter<bool>("printDebug");
119 
120  // output histograms
122 
123  h1_pt_ = fs->make<TH1F>("h1_pt", "pt", 100, 0.0, 100.0);
124  h1_pt_veto_ = fs->make<TH1F>("h1_pt_veto", "pt (veto)", 100, 0.0, 100.0);
125  h1_pt_loose_ = fs->make<TH1F>("h1_pt_loose", "pt (loose)", 100, 0.0, 100.0);
126  h1_pt_medium_ = fs->make<TH1F>("h1_pt_medium", "pt (medium)", 100, 0.0, 100.0);
127  h1_pt_tight_ = fs->make<TH1F>("h1_pt_tight", "pt (tight)", 100, 0.0, 100.0);
128  h1_pt_trig_ = fs->make<TH1F>("h1_pt_trig", "pt (trig)", 100, 0.0, 100.0);
129  h1_pt_fbremeopin_ = fs->make<TH1F>("h1_pt_fbremeopin", "pt (fbremeopin)", 100, 0.0, 100.0);
130 
131 }
T getParameter(std::string const &) const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::EDGetTokenT< reco::ConversionCollection > conversionsToken_
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isoValTokens_
edm::EDGetTokenT< double > rhoIsoToken_
EGammaCutBasedEleIdAnalyzer::~EGammaCutBasedEleIdAnalyzer ( )
override

Definition at line 134 of file EGammaCutBasedEleIdAnalyzer.cc.

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

Member Function Documentation

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

Definition at line 149 of file EGammaCutBasedEleIdAnalyzer.cc.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, beamSpotToken_, conversionsToken_, EAtarget, electronsToken_, edm::EventID::event(), edm::Event::getByToken(), h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, mps_fire::i, edm::EventBase::id(), isoValTokens_, EgammaCutBasedEleId::LOOSE, edm::EventBase::luminosityBlock(), EgammaCutBasedEleId::MEDIUM, gen::n, EgammaCutBasedEleId::PassEoverPCuts(), EgammaCutBasedEleId::PassTriggerCuts(), EgammaCutBasedEleId::PassWP(), primaryVertexToken_, printDebug_, edm::Handle< T >::product(), rhoIsoToken_, edm::EventID::run(), EgammaCutBasedEleId::TIGHT, EgammaCutBasedEleId::TRIGGERTIGHT, EgammaCutBasedEleId::TRIGGERWP70, EgammaCutBasedEleId::VETO, and TriggerAnalyzer::veto.

150 {
151  // electrons
153  iEvent.getByToken(electronsToken_, els_h);
154 
155  // conversions
157  iEvent.getByToken(conversionsToken_, conversions_h);
158 
159  // iso deposits
160  IsoDepositVals isoVals(isoValTokens_.size());
161  for (size_t j = 0; j < isoValTokens_.size(); ++j) {
162  iEvent.getByToken(isoValTokens_[j], isoVals[j]);
163  }
164 
165  // beam spot
166  edm::Handle<reco::BeamSpot> beamspot_h;
167  iEvent.getByToken(beamSpotToken_, beamspot_h);
168  const reco::BeamSpot &beamSpot = *(beamspot_h.product());
169 
170  // vertices
172  iEvent.getByToken(primaryVertexToken_, vtx_h);
173 
174  // rho for isolation
175  edm::Handle<double> rhoIso_h;
176  iEvent.getByToken(rhoIsoToken_, rhoIso_h);
177  double rhoIso = *(rhoIso_h.product());
178 
179  // loop on electrons
180  unsigned int n = els_h->size();
181  for(unsigned int i = 0; i < n; ++i) {
182 
183  // get reference to electron
184  reco::GsfElectronRef ele(els_h, i);
185 
186  //
187  // get particle flow isolation
188  //
189 
190  double iso_ch = (*(isoVals)[0])[ele];
191  double iso_em = (*(isoVals)[1])[ele];
192  double iso_nh = (*(isoVals)[2])[ele];
193 
194  //
195  // test ID
196  //
197 
198  // working points
199  bool veto = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::VETO, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
200  bool loose = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::LOOSE, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
201  bool medium = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::MEDIUM, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
202  bool tight = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::TIGHT, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
203 
204  // eop/fbrem cuts for extra tight ID
205  bool fbremeopin = EgammaCutBasedEleId::PassEoverPCuts(ele);
206 
207  // cuts to match tight trigger requirements
209 
210  // for 2011 WP70 trigger
212 
213  //
214  // fill histograms
215  //
216 
217  h1_pt_->Fill(ele->pt());
218  if (veto) h1_pt_veto_ ->Fill(ele->pt());
219  if (loose) h1_pt_loose_ ->Fill(ele->pt());
220  if (medium) h1_pt_medium_ ->Fill(ele->pt());
221  if (tight) h1_pt_tight_ ->Fill(ele->pt());
222  if (trigtight) h1_pt_trig_ ->Fill(ele->pt());
223  if (fbremeopin) h1_pt_fbremeopin_ ->Fill(ele->pt());
224 
225  //
226  // print decisions
227  //
228 
229  if (printDebug_) {
230  printf("%u %u %llu : ", iEvent.id().run(), iEvent.luminosityBlock(), iEvent.id().event());
231  printf("veto(%i), ", veto);
232  printf("loose(%i), ", loose);
233  printf("medium(%i), ", medium);
234  printf("tight(%i), ", tight);
235  printf("trigtight(%i), ", trigtight);
236  printf("trigwp70(%i), ", trigwp70);
237  printf("fbremeopin(%i)\n", fbremeopin);
238  }
239 
240  }
241 
242 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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:63
edm::EDGetTokenT< reco::ConversionCollection > conversionsToken_
bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const reco::GsfElectronRef &ele)
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken_
bool PassEoverPCuts(const reco::GsfElectronRef &ele)
ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget
std::vector< edm::Handle< edm::ValueMap< double > > > IsoDepositVals
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
T const * product() const
Definition: Handle.h:81
edm::EventID id() const
Definition: EventBase.h:60
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isoValTokens_
edm::EDGetTokenT< double > rhoIsoToken_
void EGammaCutBasedEleIdAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 247 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 &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 284 of file EGammaCutBasedEleIdAnalyzer.cc.

285 {
286 }
void EGammaCutBasedEleIdAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 272 of file EGammaCutBasedEleIdAnalyzer.cc.

273 {
274 }
void EGammaCutBasedEleIdAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 266 of file EGammaCutBasedEleIdAnalyzer.cc.

267 {
268 }
void EGammaCutBasedEleIdAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 290 of file EGammaCutBasedEleIdAnalyzer.cc.

291 {
292 }
void EGammaCutBasedEleIdAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 278 of file EGammaCutBasedEleIdAnalyzer.cc.

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

Definition at line 296 of file EGammaCutBasedEleIdAnalyzer.cc.

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

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

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> EGammaCutBasedEleIdAnalyzer::beamSpotToken_
private

Definition at line 78 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::EDGetTokenT<reco::ConversionCollection> EGammaCutBasedEleIdAnalyzer::conversionsToken_
private

Definition at line 77 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

ElectronEffectiveArea::ElectronEffectiveAreaTarget EGammaCutBasedEleIdAnalyzer::EAtarget

Definition at line 60 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and beginJob().

std::string EGammaCutBasedEleIdAnalyzer::EAtargetToken_
private

Definition at line 82 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by beginJob(), and EGammaCutBasedEleIdAnalyzer().

edm::EDGetTokenT<reco::GsfElectronCollection> EGammaCutBasedEleIdAnalyzer::electronsToken_
private

Definition at line 76 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_
private

Definition at line 88 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_fbremeopin_
private

Definition at line 94 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_loose_
private

Definition at line 90 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_medium_
private

Definition at line 91 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_tight_
private

Definition at line 92 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_trig_
private

Definition at line 93 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_veto_
private

Definition at line 89 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > EGammaCutBasedEleIdAnalyzer::isoValTokens_
private

Definition at line 81 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::EDGetTokenT<reco::VertexCollection> EGammaCutBasedEleIdAnalyzer::primaryVertexToken_
private

Definition at line 80 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

bool EGammaCutBasedEleIdAnalyzer::printDebug_
private

Definition at line 85 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

edm::EDGetTokenT<double> EGammaCutBasedEleIdAnalyzer::rhoIsoToken_
private

Definition at line 79 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().