CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
56 
57 
58 private:
59  virtual void beginJob() override ;
60  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
61  virtual void beginRun(const edm::Run&, const edm::EventSetup&) override;
62  virtual 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")),
100  m_digiinvesthmevent(m_wantInvestHist ? DigiInvestigatorHistogramMaker(iConfig, consumesCollector()) : DigiInvestigatorHistogramMaker(consumesCollector())),
101  m_digivtxcorrhmevent(m_wantVtxCorrHist ? iConfig.getParameter<edm::ParameterSet>("digiVtxCorrConfig") : DigiVertexCorrHistogramMaker()),
102  m_digilumicorrhmevent(m_wantLumiCorrHist ? DigiLumiCorrHistogramMaker(iConfig.getParameter<edm::ParameterSet>("digiLumiCorrConfig"), consumesCollector()) : DigiLumiCorrHistogramMaker(consumesCollector())),
103  m_digipileupcorrhmevent(m_wantPileupCorrHist ? DigiPileupCorrHistogramMaker(iConfig.getParameter<edm::ParameterSet>("digiPileupCorrConfig"), consumesCollector()) : DigiPileupCorrHistogramMaker(consumesCollector())),
104  m_digivtxposcorrhmevent(m_wantVtxPosCorrHist ? DigiVtxPosCorrHistogramMaker(iConfig.getParameter<edm::ParameterSet>("digiVtxPosCorrConfig"), consumesCollector()) : DigiVtxPosCorrHistogramMaker(consumesCollector())),
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 
142 
143  if(m_wantVtxCorrHist) {
145  iEvent.getByToken(m_vertexCollectionToken,vertices);
146 
147  m_digivtxcorrhmevent.fill(iEvent,vertices->size(),*mults);
148  }
149 
150  if(m_wantLumiCorrHist) m_digilumicorrhmevent.fill(iEvent,*mults);
153 
154 }
155 
156 
157 // ------------ method called once each job just before starting event loop ------------
158 void
160 {
161 
162 }
163 
164 void
166 
170 
171 }
172 // ------------ method called once each job just after ending the event loop ------------
173 void
175 }
176 //define this as a plug-in
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
DigiPileupCorrHistogramMaker m_digipileupcorrhmevent
virtual void beginJob() override
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< reco::VertexCollection > m_vertexCollectionToken
RunNumber_t run() const
Definition: RunBase.h:42
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#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
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.
virtual void endJob() override
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
int orbitNumber() const
Definition: EventBase.h:63
void fill(const unsigned int orbit, const std::map< unsigned int, int > &ndigi)
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
virtual void beginRun(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
MultiplicityInvestigator(const edm::ParameterSet &)
DigiVertexCorrHistogramMaker m_digivtxcorrhmevent
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
DigiInvestigatorHistogramMaker m_digiinvesthmevent
Definition: Run.h:41
void beginRun(const edm::Run &iRun)