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 &)
 
 ~EGammaCutBasedEleIdAnalyzer () override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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
 
void endJob () 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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 101 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().

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

Definition at line 129 of file EGammaCutBasedEleIdAnalyzer.cc.

129  {
130  // do anything here that needs to be done at desctruction time
131  // (e.g. close files, deallocate resources etc.)
132 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 139 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, 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.

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

◆ beginJob()

void EGammaCutBasedEleIdAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 241 of file EGammaCutBasedEleIdAnalyzer.cc.

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

◆ endJob()

void EGammaCutBasedEleIdAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 257 of file EGammaCutBasedEleIdAnalyzer.cc.

257 {}

◆ fillDescriptions()

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

Definition at line 272 of file EGammaCutBasedEleIdAnalyzer.cc.

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

272  {
273  //The following says we do not know what parameters are allowed so do no validation
274  // Please change this to state exactly what you do use, even if it is no parameters
276  desc.setUnknown();
277  descriptions.addDefault(desc);
278 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ beamSpotToken_

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

Definition at line 75 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ conversionsToken_

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

Definition at line 74 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ EAtarget

ElectronEffectiveArea::ElectronEffectiveAreaTarget EGammaCutBasedEleIdAnalyzer::EAtarget

Definition at line 57 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ EAtargetToken_

std::string EGammaCutBasedEleIdAnalyzer::EAtargetToken_
private

Definition at line 79 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by beginJob(), and EGammaCutBasedEleIdAnalyzer().

◆ electronsToken_

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

Definition at line 73 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_
private

Definition at line 85 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_fbremeopin_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_fbremeopin_
private

Definition at line 91 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_loose_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_loose_
private

Definition at line 87 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_medium_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_medium_
private

Definition at line 88 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_tight_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_tight_
private

Definition at line 89 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_trig_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_trig_
private

Definition at line 90 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ h1_pt_veto_

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_veto_
private

Definition at line 86 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ isoValTokens_

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

Definition at line 78 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ primaryVertexToken_

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

Definition at line 77 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ printDebug_

bool EGammaCutBasedEleIdAnalyzer::printDebug_
private

Definition at line 82 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

◆ rhoIsoToken_

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

Definition at line 76 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().