CMS 3D CMS Logo

MultiplicityInvestigator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MultiplicityInvestigator
4 // Class: MultiplicityInvestigator
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Mon Oct 27 17:37:53 CET 2008
16 // $Id: MultiplicityInvestigator.cc,v 1.5 2012/02/15 11:13:25 venturia Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
24 
25 #include <vector>
26 #include <map>
27 #include <limits>
28 
37 
40 
46 
47 //
48 // class decleration
49 //
50 
51 class MultiplicityInvestigator : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
52 public:
54  ~MultiplicityInvestigator() override;
55 
56 private:
57  void beginJob() override;
58  void analyze(const edm::Event&, const edm::EventSetup&) override;
59  void beginRun(const edm::Run&, const edm::EventSetup&) override;
60  void endRun(const edm::Run&, const edm::EventSetup&) override {}
61  void endJob() override;
62 
63  // ----------member data ---------------------------
64 
65  const bool m_wantInvestHist;
66  const bool m_wantVtxCorrHist;
67  const bool m_wantLumiCorrHist;
75 
78 };
79 
80 //
81 // constants, enums and typedefs
82 //
83 
84 //
85 // static data member definitions
86 //
87 
88 //
89 // constructors and destructor
90 //
92  : // m_digiinvesthmevent(iConfig.getParameter<edm::ParameterSet>("digiInvestConfig")),
93  m_wantInvestHist(iConfig.getParameter<bool>("wantInvestHist")),
94  m_wantVtxCorrHist(iConfig.getParameter<bool>("wantVtxCorrHist")),
95  m_wantLumiCorrHist(iConfig.getParameter<bool>("wantLumiCorrHist")),
96  m_wantPileupCorrHist(iConfig.getParameter<bool>("wantPileupCorrHist")),
97  m_wantVtxPosCorrHist(iConfig.getParameter<bool>("wantVtxPosCorrHist")),
98  m_digiinvesthmevent(m_wantInvestHist ? DigiInvestigatorHistogramMaker(iConfig, consumesCollector())
99  : DigiInvestigatorHistogramMaker(consumesCollector())),
100  m_digivtxcorrhmevent(m_wantVtxCorrHist ? iConfig.getParameter<edm::ParameterSet>("digiVtxCorrConfig")
102  m_digilumicorrhmevent(
103  m_wantLumiCorrHist ? DigiLumiCorrHistogramMaker(iConfig.getParameter<edm::ParameterSet>("digiLumiCorrConfig"),
104  consumesCollector())
105  : DigiLumiCorrHistogramMaker(consumesCollector())),
106  m_digipileupcorrhmevent(
107  m_wantPileupCorrHist
108  ? DigiPileupCorrHistogramMaker(iConfig.getParameter<edm::ParameterSet>("digiPileupCorrConfig"),
109  consumesCollector())
110  : DigiPileupCorrHistogramMaker(consumesCollector())),
111  m_digivtxposcorrhmevent(
112  m_wantVtxPosCorrHist
113  ? DigiVtxPosCorrHistogramMaker(iConfig.getParameter<edm::ParameterSet>("digiVtxPosCorrConfig"),
114  consumesCollector())
115  : DigiVtxPosCorrHistogramMaker(consumesCollector())),
116  m_multiplicityMapToken(
117  consumes<std::map<unsigned int, int> >(iConfig.getParameter<edm::InputTag>("multiplicityMap"))),
118  m_vertexCollectionToken(
119  mayConsume<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"))) {
120  //now do what ever initialization is needed
121 
122  if (m_wantInvestHist) {
123  m_digiinvesthmevent.book("EventProcs");
124  }
125  if (m_wantVtxCorrHist) {
127  }
128  if (m_wantLumiCorrHist) {
130  }
131  if (m_wantPileupCorrHist) {
132  m_digipileupcorrhmevent.book("PileupCorr");
133  }
134  if (m_wantVtxPosCorrHist) {
135  m_digivtxposcorrhmevent.book("VtxPosCorr");
136  }
137 }
138 
140  // do anything here that needs to be done at desctruction time
141  // (e.g. close files, deallocate resources etc.)
142 }
143 
144 //
145 // member functions
146 //
147 
148 // ------------ method called to for each event ------------
150  using namespace edm;
151 
153  iEvent.getByToken(m_multiplicityMapToken, mults);
154 
155  if (m_wantInvestHist)
157  if (m_wantVtxCorrHist) {
160 
161  m_digivtxcorrhmevent.fill(iEvent, vertices->size(), *mults);
162  }
163 
164  if (m_wantLumiCorrHist)
170 }
171 
172 // ------------ method called once each job just before starting event loop ------------
174 
179 }
180 // ------------ method called once each job just after ending the event loop ------------
182 //define this as a plug-in
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
DigiPileupCorrHistogramMaker m_digipileupcorrhmevent
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< reco::VertexCollection > m_vertexCollectionToken
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
DigiVtxPosCorrHistogramMaker m_digivtxposcorrhmevent
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::map< unsigned int, int > > m_multiplicityMapToken
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
void beginRun(const edm::Run &, const edm::EventSetup &) override
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
void endRun(const edm::Run &, const edm::EventSetup &) override
void fill(const edm::Event &iEvent, const unsigned int nvtx, const std::map< unsigned int, int > &ndigi)
DigiLumiCorrHistogramMaker m_digilumicorrhmevent
fixed size matrix
MultiplicityInvestigator(const edm::ParameterSet &)
HLT enums.
DigiVertexCorrHistogramMaker m_digivtxcorrhmevent
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
DigiInvestigatorHistogramMaker m_digiinvesthmevent
Definition: Run.h:45
void beginRun(const edm::Run &iRun)