CMS 3D CMS Logo

TopElecAnalyzer.cc
Go to the documentation of this file.
2 
4  : inputToken_(consumes<std::vector<pat::Electron> >(cfg.getParameter<edm::InputTag>("input"))),
5  verbose_(cfg.getParameter<bool>("verbose")) {
7 
8  mult_ = fs->make<TH1F>("mult", "multiplicity (electrons)", 10, 0, 10);
9  en_ = fs->make<TH1F>("en", "energy (electrons)", 60, 0., 300.);
10  pt_ = fs->make<TH1F>("pt", "pt (electrons)", 60, 0., 300.);
11  eta_ = fs->make<TH1F>("eta", "eta (electrons)", 30, -3., 3.);
12  phi_ = fs->make<TH1F>("phi", "phi (electrons)", 40, -4., 4.);
13 }
14 
16 
20 
21  // fill histograms
22 
23  mult_->Fill(elecs->size());
24  for (std::vector<pat::Electron>::const_iterator elec = elecs->begin(); elec != elecs->end(); ++elec) {
25  en_->Fill(elec->energy());
26  pt_->Fill(elec->pt());
27  eta_->Fill(elec->eta());
28  phi_->Fill(elec->phi());
29  }
30 
31  // produce printout if desired
32 
33  if (elecs->empty() || !verbose_)
34  return;
35 
36  unsigned i = 0;
37 
38  std::cout << "=======================================================" << std::endl;
39  std::cout << std::setw(5) << "ele :" << std::setw(13) << "et :" << std::setw(13) << "eta :" << std::setw(13)
40  << "phi :" << std::setw(11) << "relIso" << std::endl;
41  std::cout << "-------------------------------------------------------" << std::endl;
42  for (std::vector<pat::Electron>::const_iterator elec = elecs->begin(); elec != elecs->end(); ++elec) {
43  std::cout << std::setw(3) << i << " : " << std::setw(10) << elec->pt() << " : " << std::setw(10) << elec->eta()
44  << " : " << std::setw(10) << elec->phi() << " : " << std::setw(10)
45  << (elec->dr03TkSumPt() + elec->dr03EcalRecHitSumEt() + elec->dr03HcalTowerSumEt()) / elec->et()
46  << std::endl;
47  i++;
48  }
49  std::cout << "=======================================================" << std::endl;
50 }
51 
53 
TopElecAnalyzer::verbose_
bool verbose_
Definition: TopElecAnalyzer.h:26
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
Electron
Definition: Electron.py:1
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TopElecAnalyzer::~TopElecAnalyzer
~TopElecAnalyzer() override
Definition: TopElecAnalyzer.cc:15
TopElecAnalyzer::phi_
TH1F * phi_
Definition: TopElecAnalyzer.h:32
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TopElecAnalyzer::beginJob
void beginJob() override
Definition: TopElecAnalyzer.cc:52
TopElecAnalyzer::TopElecAnalyzer
TopElecAnalyzer(const edm::ParameterSet &)
Definition: TopElecAnalyzer.cc:3
TopElecAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: TopElecAnalyzer.cc:17
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
TopElecAnalyzer::mult_
TH1F * mult_
Definition: TopElecAnalyzer.h:28
edm::Service< TFileService >
TopElecAnalyzer::en_
TH1F * en_
Definition: TopElecAnalyzer.h:29
TopElecAnalyzer::inputToken_
edm::EDGetTokenT< std::vector< pat::Electron > > inputToken_
Definition: TopElecAnalyzer.h:25
edm::EventSetup
Definition: EventSetup.h:57
pat
Definition: HeavyIon.h:7
TopElecAnalyzer::eta_
TH1F * eta_
Definition: TopElecAnalyzer.h:31
looper.cfg
cfg
Definition: looper.py:297
TopElecAnalyzer::pt_
TH1F * pt_
Definition: TopElecAnalyzer.h:30
std
Definition: JetResolutionObject.h:76
TopElecAnalyzer.h
TopElecAnalyzer::endJob
void endJob() override
Definition: TopElecAnalyzer.cc:54
edm::Event
Definition: Event.h:73
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64