CMS 3D CMS Logo

PatZjetsJetAnalyzer.cc
Go to the documentation of this file.
1 #include <map>
2 #include <string>
3 
4 #include "TH1.h"
5 
12 
14 
16 public:
17  explicit PatZjetsJetAnalyzer(const edm::ParameterSet&);
18  ~PatZjetsJetAnalyzer() override;
19 
20 private:
21  void beginJob() override;
22  void analyze(const edm::Event&, const edm::EventSetup&) override;
23  void endJob() override;
24 
25  // simple map to contain all histograms;
26  // histograms are booked in the beginJob()
27  // method
28  std::map<std::string, TH1F*> histContainer_;
29 
30  // input tags
32 };
33 
35  : histContainer_(),
36  srcToken_(consumes<edm::View<pat::Jet> >(iConfig.getUntrackedParameter<edm::InputTag>("src"))) {}
37 
39 
41  // get electron collection
43  iEvent.getByToken(srcToken_, jets);
44 
45  // loop jets
46  for (edm::View<pat::Jet>::const_iterator ijet = jets->begin(); ijet != jets->end(); ++ijet) {
47  // fill simple histograms
48  pat::Jet jet = ijet->correctedJet("had", "uds");
49  histContainer_["pt"]->Fill(jet.pt());
50  histContainer_["eta"]->Fill(jet.eta());
51  histContainer_["phi"]->Fill(jet.phi());
52  histContainer_["emf"]->Fill(jet.emEnergyFraction());
53  for (unsigned int i = 0; i < jet.getCaloConstituents().size(); ++i) {
54  histContainer_["dEta"]->Fill(jet.getCaloConstituent(i)->eta() - jet.eta());
55  }
56  }
57 }
58 
60  // register to the TFileService
62 
63  // book histograms:
64  histContainer_["pt"] = fs->make<TH1F>("pt", "pt", 150, 0., 150.);
65  histContainer_["eta"] = fs->make<TH1F>("eta", "eta", 50, 0., 5.);
66  histContainer_["phi"] = fs->make<TH1F>("phi", "phi", 60, 3.14, 3.14);
67  histContainer_["emf"] = fs->make<TH1F>("emf", "emf", 40, 0., 1.);
68  histContainer_["dEta"] = fs->make<TH1F>("dEta", "dEta", 40, 0., 1.);
69 }
70 
72 
mps_fire.i
i
Definition: mps_fire.py:428
PatZjetsJetAnalyzer::~PatZjetsJetAnalyzer
~PatZjetsJetAnalyzer() override
Definition: PatZjetsJetAnalyzer.cc:38
PatZjetsJetAnalyzer
Definition: PatZjetsJetAnalyzer.cc:15
sistrip::View
View
Definition: ConstantsForView.h:26
PatZjetsJetAnalyzer::histContainer_
std::map< std::string, TH1F * > histContainer_
Definition: PatZjetsJetAnalyzer.cc:28
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
EDAnalyzer.h
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
PatZjetsJetAnalyzer::beginJob
void beginJob() override
Definition: PatZjetsJetAnalyzer.cc:59
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
MakerMacros.h
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Jet
Definition: Jet.py:1
PatZjetsJetAnalyzer::PatZjetsJetAnalyzer
PatZjetsJetAnalyzer(const edm::ParameterSet &)
Definition: PatZjetsJetAnalyzer.cc:34
Service.h
TFileService.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
PatZjetsJetAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PatZjetsJetAnalyzer.cc:40
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
pat
Definition: HeavyIon.h:7
Jet.h
InputTag.h
PatZjetsJetAnalyzer::endJob
void endJob() override
Definition: PatZjetsJetAnalyzer.cc:71
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
ParameterSet.h
edm::Event
Definition: Event.h:73
PatZjetsJetAnalyzer::srcToken_
edm::EDGetTokenT< edm::View< pat::Jet > > srcToken_
Definition: PatZjetsJetAnalyzer.cc:31
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64