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::one::EDAnalyzer<> edm::one::EDAnalyzerBase 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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 EGammaCutBasedEleIdAnalyzer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Public Attributes

ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file EGammaCutBasedEleIdAnalyzer.cc.

Member Typedef Documentation

◆ IsoDepositMaps

Definition at line 50 of file EGammaCutBasedEleIdAnalyzer.cc.

◆ IsoDepositVals

Definition at line 51 of file EGammaCutBasedEleIdAnalyzer.cc.

Constructor & Destructor Documentation

◆ EGammaCutBasedEleIdAnalyzer()

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

Definition at line 93 of file EGammaCutBasedEleIdAnalyzer.cc.

References beamSpotToken_, conversionsToken_, EAtargetToken_, electronsToken_, compareTotals::fs, 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, makeGlobalPositionRcd_cfg::tag, and edm::vector_transform().

93  {
94  // get input parameters
95  electronsToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronsInputTag"));
96  conversionsToken_ = consumes<reco::ConversionCollection>(iConfig.getParameter<edm::InputTag>("conversionsInputTag"));
97  beamSpotToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotInputTag"));
98  rhoIsoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("rhoIsoInputTag"));
99  primaryVertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertexInputTag"));
100  isoValTokens_ =
101  edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >("isoValInputTags"),
102  [this](edm::InputTag const &tag) { return consumes<edm::ValueMap<double> >(tag); });
104  "EAtarget"); //EleEANoCorr, EleEAData2011, EleEASummer11MC,EleEAFall11MC, EleEAData2012/
105 
106  // debug
107  printDebug_ = iConfig.getParameter<bool>("printDebug");
108 
109  // output histograms
111 
112  h1_pt_ = fs->make<TH1F>("h1_pt", "pt", 100, 0.0, 100.0);
113  h1_pt_veto_ = fs->make<TH1F>("h1_pt_veto", "pt (veto)", 100, 0.0, 100.0);
114  h1_pt_loose_ = fs->make<TH1F>("h1_pt_loose", "pt (loose)", 100, 0.0, 100.0);
115  h1_pt_medium_ = fs->make<TH1F>("h1_pt_medium", "pt (medium)", 100, 0.0, 100.0);
116  h1_pt_tight_ = fs->make<TH1F>("h1_pt_tight", "pt (tight)", 100, 0.0, 100.0);
117  h1_pt_trig_ = fs->make<TH1F>("h1_pt_trig", "pt (trig)", 100, 0.0, 100.0);
118  h1_pt_fbremeopin_ = fs->make<TH1F>("h1_pt_fbremeopin", "pt (fbremeopin)", 100, 0.0, 100.0);
119 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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_

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 126 of file EGammaCutBasedEleIdAnalyzer.cc.

References pwdgSkimBPark_cfi::beamSpot, beamSpotToken_, conversionsToken_, EAtarget, electronsToken_, h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, mps_fire::i, iEvent, isoValTokens_, dqmiolumiharvest::j, EgammaCutBasedEleId::LOOSE, caHitNtupletGeneratorKernels::loose, EgammaCutBasedEleId::MEDIUM, dqmiodumpmetadata::n, EgammaCutBasedEleId::PassEoverPCuts(), EgammaCutBasedEleId::PassTriggerCuts(), EgammaCutBasedEleId::PassWP(), primaryVertexToken_, printDebug_, edm::Handle< T >::product(), electronIsolatorFromEffectiveArea_cfi::rhoIso, rhoIsoToken_, EgammaCutBasedEleId::TIGHT, EgammaCutBasedEleId::TRIGGERTIGHT, EgammaCutBasedEleId::TRIGGERWP70, EgammaCutBasedEleId::VETO, and PbPb_ZMuSkimMuonDPG_cff::veto.

126  {
127  // electrons
129  iEvent.getByToken(electronsToken_, els_h);
130 
131  // conversions
133  iEvent.getByToken(conversionsToken_, conversions_h);
134 
135  // iso deposits
136  IsoDepositVals isoVals(isoValTokens_.size());
137  for (size_t j = 0; j < isoValTokens_.size(); ++j) {
138  iEvent.getByToken(isoValTokens_[j], isoVals[j]);
139  }
140 
141  // beam spot
142  edm::Handle<reco::BeamSpot> beamspot_h;
143  iEvent.getByToken(beamSpotToken_, beamspot_h);
144  const reco::BeamSpot &beamSpot = *(beamspot_h.product());
145 
146  // vertices
148  iEvent.getByToken(primaryVertexToken_, vtx_h);
149 
150  // rho for isolation
151  edm::Handle<double> rhoIso_h;
152  iEvent.getByToken(rhoIsoToken_, rhoIso_h);
153  double rhoIso = *(rhoIso_h.product());
154 
155  // loop on electrons
156  unsigned int n = els_h->size();
157  for (unsigned int i = 0; i < n; ++i) {
158  // get reference to electron
159  reco::GsfElectronRef ele(els_h, i);
160 
161  //
162  // get particle flow isolation
163  //
164 
165  double iso_ch = (*(isoVals)[0])[ele];
166  double iso_em = (*(isoVals)[1])[ele];
167  double iso_nh = (*(isoVals)[2])[ele];
168 
169  //
170  // test ID
171  //
172 
173  // working points
175  EgammaCutBasedEleId::VETO, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
177  EgammaCutBasedEleId::LOOSE, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
178  bool medium = EgammaCutBasedEleId::PassWP(
179  EgammaCutBasedEleId::MEDIUM, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
181  EgammaCutBasedEleId::TIGHT, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso, EAtarget);
182 
183  // eop/fbrem cuts for extra tight ID
184  bool fbremeopin = EgammaCutBasedEleId::PassEoverPCuts(ele);
185 
186  // cuts to match tight trigger requirements
188 
189  // for 2011 WP70 trigger
191 
192  //
193  // fill histograms
194  //
195 
196  h1_pt_->Fill(ele->pt());
197  if (veto)
198  h1_pt_veto_->Fill(ele->pt());
199  if (loose)
200  h1_pt_loose_->Fill(ele->pt());
201  if (medium)
202  h1_pt_medium_->Fill(ele->pt());
203  if (tight)
204  h1_pt_tight_->Fill(ele->pt());
205  if (trigtight)
206  h1_pt_trig_->Fill(ele->pt());
207  if (fbremeopin)
208  h1_pt_fbremeopin_->Fill(ele->pt());
209 
210  //
211  // print decisions
212  //
213 
214  if (printDebug_) {
215  printf("%u %u %llu : ", iEvent.id().run(), iEvent.luminosityBlock(), iEvent.id().event());
216  printf("veto(%i), ", veto);
217  printf("loose(%i), ", loose);
218  printf("medium(%i), ", medium);
219  printf("tight(%i), ", tight);
220  printf("trigtight(%i), ", trigtight);
221  printf("trigwp70(%i), ", trigwp70);
222  printf("fbremeopin(%i)\n", fbremeopin);
223  }
224  }
225 }
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)
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
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_
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isoValTokens_
edm::EDGetTokenT< double > rhoIsoToken_

◆ beginJob()

void EGammaCutBasedEleIdAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 228 of file EGammaCutBasedEleIdAnalyzer.cc.

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

◆ fillDescriptions()

void EGammaCutBasedEleIdAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 244 of file EGammaCutBasedEleIdAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

244  {
245  //The following says we do not know what parameters are allowed so do no validation
246  // Please change this to state exactly what you do use, even if it is no parameters
248  desc.setUnknown();
249  descriptions.addDefault(desc);
250 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ beamSpotToken_

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

Definition at line 67 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ conversionsToken_

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

Definition at line 66 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ EAtarget

ElectronEffectiveArea::ElectronEffectiveAreaTarget EGammaCutBasedEleIdAnalyzer::EAtarget

Definition at line 56 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ EAtargetToken_

std::string EGammaCutBasedEleIdAnalyzer::EAtargetToken_
private

Definition at line 71 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by beginJob(), and EGammaCutBasedEleIdAnalyzer().

◆ electronsToken_

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

Definition at line 65 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_
private

Definition at line 77 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_fbremeopin_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_fbremeopin_
private

Definition at line 83 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_loose_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_loose_
private

Definition at line 79 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_medium_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_medium_
private

Definition at line 80 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_tight_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_tight_
private

Definition at line 81 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_trig_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_trig_
private

Definition at line 82 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_veto_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_veto_
private

Definition at line 78 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ isoValTokens_

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

Definition at line 70 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ primaryVertexToken_

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

Definition at line 69 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ printDebug_

bool EGammaCutBasedEleIdAnalyzer::printDebug_
private

Definition at line 74 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ rhoIsoToken_

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

Definition at line 68 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().