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 
21 // system include files
22 #include <memory>
23 
24 // user include files
25 
26 #include <vector>
27 #include <map>
28 #include <limits>
29 
38 
41 
47 
48 //
49 // class decleration
50 //
51 
53  public:
55  ~MultiplicityInvestigator() override;
56 
57 
58 private:
59  void beginJob() override ;
60  void analyze(const edm::Event&, const edm::EventSetup&) override;
61  void beginRun(const edm::Run&, const edm::EventSetup&) override;
62  void endJob() override ;
63 
64  // ----------member data ---------------------------
65 
66  const bool m_wantInvestHist;
67  const bool m_wantVtxCorrHist;
68  const bool m_wantLumiCorrHist;
76 
79 
80 };
81 
82 //
83 // constants, enums and typedefs
84 //
85 
86 //
87 // static data member definitions
88 //
89 
90 //
91 // constructors and destructor
92 //
94  // m_digiinvesthmevent(iConfig.getParameter<edm::ParameterSet>("digiInvestConfig")),
95  m_wantInvestHist(iConfig.getParameter<bool>("wantInvestHist")),
96  m_wantVtxCorrHist(iConfig.getParameter<bool>("wantVtxCorrHist")),
97  m_wantLumiCorrHist(iConfig.getParameter<bool>("wantLumiCorrHist")),
98  m_wantPileupCorrHist(iConfig.getParameter<bool>("wantPileupCorrHist")),
99  m_wantVtxPosCorrHist(iConfig.getParameter<bool>("wantVtxPosCorrHist")),
101  m_digivtxcorrhmevent(m_wantVtxCorrHist ? iConfig.getParameter<edm::ParameterSet>("digiVtxCorrConfig") : DigiVertexCorrHistogramMaker()),
105  m_multiplicityMapToken(consumes<std::map<unsigned int, int> >(iConfig.getParameter<edm::InputTag>("multiplicityMap"))),
106  m_vertexCollectionToken(mayConsume<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection")))
107 {
108  //now do what ever initialization is needed
109 
110 
111  if(m_wantInvestHist) { m_digiinvesthmevent.book("EventProcs");}
116 }
117 
118 
120 {
121 
122  // do anything here that needs to be done at desctruction time
123  // (e.g. close files, deallocate resources etc.)
124 
125 }
126 
127 
128 //
129 // member functions
130 //
131 
132 // ------------ method called to for each event ------------
133 void
135 {
136  using namespace edm;
137 
139  iEvent.getByToken(m_multiplicityMapToken,mults);
140 
141  if(m_wantInvestHist) m_digiinvesthmevent.fill(iEvent,*mults);
142  if(m_wantVtxCorrHist) {
144  iEvent.getByToken(m_vertexCollectionToken,vertices);
145 
146  m_digivtxcorrhmevent.fill(iEvent,vertices->size(),*mults);
147  }
148 
149  if(m_wantLumiCorrHist) m_digilumicorrhmevent.fill(iEvent,*mults);
152 
153 }
154 
155 
156 // ------------ method called once each job just before starting event loop ------------
157 void
159 {
160 
161 }
162 
163 void
165 
169 
170 }
171 // ------------ method called once each job just after ending the event loop ------------
172 void
174 }
175 //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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
DigiVtxPosCorrHistogramMaker m_digivtxposcorrhmevent
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
int iEvent
Definition: GenABIO.cc:230
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
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 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
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
Definition: Run.h:44
void beginRun(const edm::Run &iRun)