CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PatElectronAnalyzer Class Reference
Inheritance diagram for PatElectronAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PatElectronAnalyzer (const edm::ParameterSet &)
 
 ~PatElectronAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

TH1F * deltaPhi_
 
TH1F * deltaR_
 
std::string electronID_
 
edm::EDGetTokenT< std::vector< pat::Electron > > electronSrcToken_
 
TH1F * eta_
 
TH1F * genEta_
 
edm::ParameterSet genMatchMode_
 
TH1F * genPhi_
 
TH1F * genPt_
 
TH1F * invMass_
 
TH1F * isoTag_
 
double maxDeltaM_
 
double maxDeltaR_
 
double maxEta_
 
double maxTagIso_
 
double minPt_
 
unsigned int mode_
 
TH1I * nr_
 
edm::EDGetTokenT< reco::GenParticleCollectionparticleSrcToken_
 
TH1F * phi_
 
TH1F * pt_
 
edm::ParameterSet tagAndProbeMode_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 15 of file PatElectronAnalyzer.cc.

Constructor & Destructor Documentation

◆ PatElectronAnalyzer()

PatElectronAnalyzer::PatElectronAnalyzer ( const edm::ParameterSet cfg)
explicit

Definition at line 75 of file PatElectronAnalyzer.cc.

76  : minPt_(cfg.getParameter<double>("minPt")),
77  maxEta_(cfg.getParameter<double>("maxEta")),
78  mode_(cfg.getParameter<unsigned int>("mode")),
79  electronID_(cfg.getParameter<std::string>("electronID")),
80  electronSrcToken_(consumes<std::vector<pat::Electron> >(cfg.getParameter<edm::InputTag>("electronSrc"))),
81  particleSrcToken_(consumes<reco::GenParticleCollection>(cfg.getParameter<edm::InputTag>("particleSrc"))),
82  genMatchMode_(cfg.getParameter<edm::ParameterSet>("genMatchMode")),
83  tagAndProbeMode_(cfg.getParameter<edm::ParameterSet>("tagAndProbeMode")) {
84  // complete the configuration of the analyzer
85  maxDeltaR_ = genMatchMode_.getParameter<double>("maxDeltaR");
86  maxDeltaM_ = tagAndProbeMode_.getParameter<double>("maxDeltaM");
87  maxTagIso_ = tagAndProbeMode_.getParameter<double>("maxTagIso");
88 
89  // register histograms to the TFileService
91  nr_ = fs->make<TH1I>("nr", "nr", 10, 0, 10);
92  pt_ = fs->make<TH1F>("pt", "pt", 20, 0., 100.);
93  eta_ = fs->make<TH1F>("eta", "eta", 30, -3., 3.);
94  phi_ = fs->make<TH1F>("phi", "phi", 35, -3.5, 3.5);
95  genPt_ = fs->make<TH1F>("genPt", "pt", 20, 0., 100.);
96  genEta_ = fs->make<TH1F>("genEta", "eta", 30, -3., 3.);
97  genPhi_ = fs->make<TH1F>("genPhi", "phi", 35, -3.5, 3.5);
98  deltaR_ = fs->make<TH1F>("deltaR", "log(dR)", 50, -5., 0.);
99  isoTag_ = fs->make<TH1F>("isoTag", "iso", 50, 0., 10.);
100  invMass_ = fs->make<TH1F>("invMass", "m", 100, 50., 150.);
101  deltaPhi_ = fs->make<TH1F>("deltaPhi", "deltaPhi", 100, -3.5, 3.5);
102 }

References deltaPhi_, deltaR_, eta_, genEta_, genMatchMode_, genPhi_, genPt_, edm::ParameterSet::getParameter(), invMass_, isoTag_, maxDeltaM_, maxDeltaR_, maxTagIso_, nr_, phi_, pt_, and tagAndProbeMode_.

◆ ~PatElectronAnalyzer()

PatElectronAnalyzer::~PatElectronAnalyzer ( )
override

Definition at line 104 of file PatElectronAnalyzer.cc.

104 {}

Member Function Documentation

◆ analyze()

void PatElectronAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 106 of file PatElectronAnalyzer.cc.

106  {
107  // get electron collection
110  // get generator particle collection
113 
114  nr_->Fill(electrons->size());
115 
116  // ----------------------------------------------------------------------
117  //
118  // First Part Mode 0: genMatch
119  //
120  // ----------------------------------------------------------------------
121  if (mode_ == 0) {
122  // loop generator particles
123  for (reco::GenParticleCollection::const_iterator part = particles->begin(); part != particles->end(); ++part) {
124  // only loop stable electrons
125  if (part->status() == 1 && abs(part->pdgId()) == 11) {
126  if (part->pt() > minPt_ && fabs(part->eta()) < maxEta_) {
127  genPt_->Fill(part->pt());
128  genEta_->Fill(part->eta());
129  genPhi_->Fill(part->phi());
130  }
131  }
132  }
133 
134  // loop electrons
135  for (std::vector<pat::Electron>::const_iterator elec = electrons->begin(); elec != electrons->end(); ++elec) {
136  if (elec->genLepton()) {
137  float deltaR = ROOT::Math::VectorUtil::DeltaR(elec->genLepton()->p4(), elec->p4());
138  deltaR_->Fill(TMath::Log10(deltaR));
139  if (deltaR < maxDeltaR_) {
140  if (electronID_ != "none") {
141  if (elec->electronID(electronID_) < 0.5)
142  continue;
143  }
144  if (elec->pt() > minPt_ && fabs(elec->eta()) < maxEta_) {
145  pt_->Fill(elec->pt());
146  eta_->Fill(elec->eta());
147  phi_->Fill(elec->phi());
148  }
149  }
150  }
151  }
152  }
153 
154  // ----------------------------------------------------------------------
155  //
156  // Second Part Mode 1: tagAndProbe
157  //
158  // ----------------------------------------------------------------------
159  if (mode_ == 1) {
160  // loop tag electron
161  for (std::vector<pat::Electron>::const_iterator elec = electrons->begin(); elec != electrons->end(); ++elec) {
162  isoTag_->Fill(elec->trackIso());
163  if (elec->trackIso() < maxTagIso_ && elec->electronID("eidTight") > 0.5) {
164  // loop probe electron
165  for (std::vector<pat::Electron>::const_iterator probe = electrons->begin(); probe != electrons->end();
166  ++probe) {
167  // skip the tag electron itself
168  if (probe == elec)
169  continue;
170 
171  float zMass = (probe->p4() + elec->p4()).mass();
172  invMass_->Fill(zMass);
173  float deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(elec->p4(), probe->p4());
174  deltaPhi_->Fill(deltaPhi);
175 
176  // check for the Z mass
177  if (fabs(zMass - 90.) < maxDeltaM_) {
178  if (electronID_ != "none") {
179  if (probe->electronID(electronID_) < 0.5)
180  continue;
181  }
182  if (probe->pt() > minPt_ && fabs(probe->eta()) < maxEta_) {
183  pt_->Fill(probe->pt());
184  eta_->Fill(probe->eta());
185  phi_->Fill(probe->phi());
186  }
187  }
188  }
189  }
190  }
191  }
192 }

References funct::abs(), SiPixelRawToDigiRegional_cfi::deltaPhi, HLT_FULL_cff::DeltaPhi, deltaPhi_, electronAnalyzer_cfi::DeltaR, PbPb_ZMuSkimMuonDPG_cff::deltaR, deltaR_, electronID_, pwdgSkimBPark_cfi::electrons, electronSrcToken_, eta_, genEta_, genPhi_, genPt_, edm::Event::getByToken(), invMass_, isoTag_, EgHLTOffHistBins_cfi::mass, maxDeltaM_, maxDeltaR_, maxEta_, maxTagIso_, minPt_, mode_, nr_, ecalTrigSettings_cff::particles, particleSrcToken_, phi_, pt_, and HLTMuonOfflineAnalyzer_cfi::zMass.

◆ beginJob()

void PatElectronAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 194 of file PatElectronAnalyzer.cc.

194 {}

◆ endJob()

void PatElectronAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 196 of file PatElectronAnalyzer.cc.

196 {}

Member Data Documentation

◆ deltaPhi_

TH1F* PatElectronAnalyzer::deltaPhi_
private

Definition at line 70 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ deltaR_

TH1F* PatElectronAnalyzer::deltaR_
private

Definition at line 67 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ electronID_

std::string PatElectronAnalyzer::electronID_
private

Definition at line 43 of file PatElectronAnalyzer.cc.

Referenced by analyze().

◆ electronSrcToken_

edm::EDGetTokenT<std::vector<pat::Electron> > PatElectronAnalyzer::electronSrcToken_
private

Definition at line 46 of file PatElectronAnalyzer.cc.

Referenced by analyze().

◆ eta_

TH1F* PatElectronAnalyzer::eta_
private

Definition at line 62 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ genEta_

TH1F* PatElectronAnalyzer::genEta_
private

Definition at line 65 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ genMatchMode_

edm::ParameterSet PatElectronAnalyzer::genMatchMode_
private

Definition at line 50 of file PatElectronAnalyzer.cc.

Referenced by PatElectronAnalyzer().

◆ genPhi_

TH1F* PatElectronAnalyzer::genPhi_
private

Definition at line 66 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ genPt_

TH1F* PatElectronAnalyzer::genPt_
private

Definition at line 64 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ invMass_

TH1F* PatElectronAnalyzer::invMass_
private

Definition at line 69 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ isoTag_

TH1F* PatElectronAnalyzer::isoTag_
private

Definition at line 68 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ maxDeltaM_

double PatElectronAnalyzer::maxDeltaM_
private

Definition at line 56 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ maxDeltaR_

double PatElectronAnalyzer::maxDeltaR_
private

Definition at line 55 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ maxEta_

double PatElectronAnalyzer::maxEta_
private

Definition at line 28 of file PatElectronAnalyzer.cc.

Referenced by analyze().

◆ maxTagIso_

double PatElectronAnalyzer::maxTagIso_
private

Definition at line 57 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ minPt_

double PatElectronAnalyzer::minPt_
private

Definition at line 27 of file PatElectronAnalyzer.cc.

Referenced by analyze().

◆ mode_

unsigned int PatElectronAnalyzer::mode_
private

Definition at line 33 of file PatElectronAnalyzer.cc.

Referenced by analyze().

◆ nr_

TH1I* PatElectronAnalyzer::nr_
private

Definition at line 60 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ particleSrcToken_

edm::EDGetTokenT<reco::GenParticleCollection> PatElectronAnalyzer::particleSrcToken_
private

Definition at line 48 of file PatElectronAnalyzer.cc.

Referenced by analyze().

◆ phi_

TH1F* PatElectronAnalyzer::phi_
private

Definition at line 63 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ pt_

TH1F* PatElectronAnalyzer::pt_
private

Definition at line 61 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

◆ tagAndProbeMode_

edm::ParameterSet PatElectronAnalyzer::tagAndProbeMode_
private

Definition at line 51 of file PatElectronAnalyzer.cc.

Referenced by PatElectronAnalyzer().

PatElectronAnalyzer::maxDeltaR_
double maxDeltaR_
Definition: PatElectronAnalyzer.cc:55
PatElectronAnalyzer::isoTag_
TH1F * isoTag_
Definition: PatElectronAnalyzer.cc:68
PatElectronAnalyzer::invMass_
TH1F * invMass_
Definition: PatElectronAnalyzer.cc:69
PatElectronAnalyzer::maxTagIso_
double maxTagIso_
Definition: PatElectronAnalyzer.cc:57
PatElectronAnalyzer::maxEta_
double maxEta_
Definition: PatElectronAnalyzer.cc:28
PatElectronAnalyzer::genEta_
TH1F * genEta_
Definition: PatElectronAnalyzer.cc:65
edm::Handle
Definition: AssociativeIterator.h:50
PatElectronAnalyzer::particleSrcToken_
edm::EDGetTokenT< reco::GenParticleCollection > particleSrcToken_
Definition: PatElectronAnalyzer.cc:48
ecalTrigSettings_cff.particles
particles
Definition: ecalTrigSettings_cff.py:11
HLT_FULL_cff.DeltaPhi
DeltaPhi
Definition: HLT_FULL_cff.py:465
PatElectronAnalyzer::maxDeltaM_
double maxDeltaM_
Definition: PatElectronAnalyzer.cc:56
PatElectronAnalyzer::tagAndProbeMode_
edm::ParameterSet tagAndProbeMode_
Definition: PatElectronAnalyzer.cc:51
part
part
Definition: HCALResponse.h:20
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
PatElectronAnalyzer::genPhi_
TH1F * genPhi_
Definition: PatElectronAnalyzer.cc:66
PatElectronAnalyzer::genPt_
TH1F * genPt_
Definition: PatElectronAnalyzer.cc:64
PatElectronAnalyzer::eta_
TH1F * eta_
Definition: PatElectronAnalyzer.cc:62
PatElectronAnalyzer::electronSrcToken_
edm::EDGetTokenT< std::vector< pat::Electron > > electronSrcToken_
Definition: PatElectronAnalyzer.cc:46
PatElectronAnalyzer::deltaPhi_
TH1F * deltaPhi_
Definition: PatElectronAnalyzer.cc:70
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
PatElectronAnalyzer::nr_
TH1I * nr_
Definition: PatElectronAnalyzer.cc:60
edm::Service< TFileService >
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
PatElectronAnalyzer::deltaR_
TH1F * deltaR_
Definition: PatElectronAnalyzer.cc:67
looper.cfg
cfg
Definition: looper.py:297
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
PatElectronAnalyzer::pt_
TH1F * pt_
Definition: PatElectronAnalyzer.cc:61
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PatElectronAnalyzer::electronID_
std::string electronID_
Definition: PatElectronAnalyzer.cc:43
PatElectronAnalyzer::phi_
TH1F * phi_
Definition: PatElectronAnalyzer.cc:63
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:155
PatElectronAnalyzer::mode_
unsigned int mode_
Definition: PatElectronAnalyzer.cc:33
PatElectronAnalyzer::genMatchMode_
edm::ParameterSet genMatchMode_
Definition: PatElectronAnalyzer.cc:50
edm::InputTag
Definition: InputTag.h:15
HLTMuonOfflineAnalyzer_cfi.zMass
zMass
Definition: HLTMuonOfflineAnalyzer_cfi.py:101
PatElectronAnalyzer::minPt_
double minPt_
Definition: PatElectronAnalyzer.cc:27