CMS 3D CMS Logo

ScoutingTestAnalyzer.cc
Go to the documentation of this file.
1 // This class is used to test the functionalities of the package
2 
5 
6 // A simple constructor which takes as inoput only the name of the PF jet
7 // collection
9  m_pfJetsCollectionTag = conf.getUntrackedParameter<edm::InputTag>("pfJetsCollectionName");
10  // set Token(-s)
12  consumes<reco::CaloJetCollection>(conf.getUntrackedParameter<edm::InputTag>("pfJetsCollectionName"));
13 }
14 
16 
17 // Function to book the Monitoring Elements.
20  std::string collection_name = m_pfJetsCollectionTag.label();
21 
22  /* This method allows us to book an Histogram in one line in a completely
23  * transparent way. Take your time to put axis titles!!!!*/
25  iBooker, collection_name + "_pt", collection_name + " Jet P_{T}", 50, 0., 500., "Jet P_{T} [GeV]");
26 
27  m_jetEtaPhi = bookH2withSumw2(iBooker,
28  collection_name + "_etaphi",
29  collection_name + " #eta #phi",
30  50,
31  -5,
32  5,
33  50,
34  -3.1415,
35  +3.1415,
36  "#eta^{Jet}",
37  "#phi^{Jet}");
38 }
39 
40 // Usual analyze method
43  iEvent.getByToken(m_pfJetsCollectionTagToken_, calojets_handle);
44  /* This is an example of how C++11 can simplify or lifes. The auto keyword
45  make the compiler figure out by itself which is the type of the pfjets
46  object. The qualifier const of course still apply. Poor's man explaination:
47  "compiler, make pfjets a const ref and figure out for me the type"*/
48  auto const &calojets = *calojets_handle;
49 
50  // Again, C++11. A loop on a std::vector becomes as simple as this!
51  for (auto const &calojet : calojets) {
52  m_jetPt->Fill(calojet.pt());
53  m_jetEtaPhi->Fill(calojet.eta(), calojet.phi());
54  }
55 }
CaloJet.h
ScoutingTestAnalyzer::m_pfJetsCollectionTag
edm::InputTag m_pfJetsCollectionTag
Definition: ScoutingTestAnalyzer.h:17
edm::Run
Definition: Run.h:45
ScoutingTestAnalyzer::m_pfJetsCollectionTagToken_
edm::EDGetTokenT< reco::CaloJetCollection > m_pfJetsCollectionTagToken_
Definition: ScoutingTestAnalyzer.h:21
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle< reco::CaloJetCollection >
ScoutingAnalyzerBase::prepareBooking
void prepareBooking(DQMStore::IBooker &)
Definition: ScoutingAnalyzerBase.cc:25
ScoutingTestAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ScoutingTestAnalyzer.cc:41
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
ScoutingAnalyzerBase::bookH1withSumw2
MonitorElement * bookH1withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
Definition: ScoutingAnalyzerBase.cc:49
ScoutingTestAnalyzer::~ScoutingTestAnalyzer
~ScoutingTestAnalyzer() override
Definition: ScoutingTestAnalyzer.cc:15
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
ScoutingTestAnalyzer::m_jetPt
MonitorElement * m_jetPt
Definition: ScoutingTestAnalyzer.h:18
ScoutingAnalyzerBase::bookH2withSumw2
MonitorElement * bookH2withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
Definition: ScoutingAnalyzerBase.cc:144
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ScoutingTestAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ScoutingTestAnalyzer.cc:18
edm::ParameterSet
Definition: ParameterSet.h:36
ScoutingTestAnalyzer.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
ScoutingTestAnalyzer::ScoutingTestAnalyzer
ScoutingTestAnalyzer(const edm::ParameterSet &)
Definition: ScoutingTestAnalyzer.cc:8
ScoutingTestAnalyzer::m_jetEtaPhi
MonitorElement * m_jetEtaPhi
Definition: ScoutingTestAnalyzer.h:19
dqm::implementation::IBooker
Definition: DQMStore.h:43
ScoutingAnalyzerBase
Definition: ScoutingAnalyzerBase.h:19
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15