CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | 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 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 Member Functions

 EGammaCutBasedEleIdAnalyzer (const edm::ParameterSet &)
 
 ~EGammaCutBasedEleIdAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
edm::EDGetTokenT
< reco::ConversionCollection
conversionsToken_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
electronsToken_
 
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::VertexCollection
primaryVertexToken_
 
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 48 of file EGammaCutBasedEleIdAnalyzer.cc.

Member Typedef Documentation

Definition at line 51 of file EGammaCutBasedEleIdAnalyzer.cc.

Definition at line 52 of file EGammaCutBasedEleIdAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 102 of file EGammaCutBasedEleIdAnalyzer.cc.

References beamSpotToken_, edm::EDConsumerBase::consumes(), conversionsToken_, electronsToken_, edm::ParameterSet::getParameter(), isoValTokens_, primaryVertexToken_, rhoIsoToken_, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

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

Definition at line 130 of file EGammaCutBasedEleIdAnalyzer.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 145 of file EGammaCutBasedEleIdAnalyzer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotToken_, conversionsToken_, 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_, i, edm::EventBase::id(), isoValTokens_, j, EgammaCutBasedEleId::LOOSE, edm::EventBase::luminosityBlock(), EgammaCutBasedEleId::MEDIUM, n, EgammaCutBasedEleId::PassEoverPCuts(), EgammaCutBasedEleId::PassTriggerCuts(), EgammaCutBasedEleId::PassWP(), primaryVertexToken_, printDebug_, edm::Handle< T >::product(), rhoIsoToken_, edm::EventID::run(), EgammaCutBasedEleId::TIGHT, EgammaCutBasedEleId::TRIGGERTIGHT, EgammaCutBasedEleId::TRIGGERWP70, and EgammaCutBasedEleId::VETO.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 243 of file EGammaCutBasedEleIdAnalyzer.cc.

244 {
245 }
void EGammaCutBasedEleIdAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 267 of file EGammaCutBasedEleIdAnalyzer.cc.

268 {
269 }
void EGammaCutBasedEleIdAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 255 of file EGammaCutBasedEleIdAnalyzer.cc.

256 {
257 }
void EGammaCutBasedEleIdAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 249 of file EGammaCutBasedEleIdAnalyzer.cc.

250 {
251 }
void EGammaCutBasedEleIdAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 273 of file EGammaCutBasedEleIdAnalyzer.cc.

274 {
275 }
void EGammaCutBasedEleIdAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 261 of file EGammaCutBasedEleIdAnalyzer.cc.

262 {
263 }
void EGammaCutBasedEleIdAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 279 of file EGammaCutBasedEleIdAnalyzer.cc.

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

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

Member Data Documentation

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

Definition at line 76 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

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

Definition at line 75 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

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

Definition at line 74 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_
private

Definition at line 85 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_fbremeopin_
private

Definition at line 91 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_loose_
private

Definition at line 87 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_medium_
private

Definition at line 88 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_tight_
private

Definition at line 89 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_trig_
private

Definition at line 90 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

TH1F* EGammaCutBasedEleIdAnalyzer::h1_pt_veto_
private

Definition at line 86 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

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

Definition at line 79 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

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

Definition at line 78 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

bool EGammaCutBasedEleIdAnalyzer::printDebug_
private

Definition at line 82 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze().

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

Definition at line 77 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().