CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTAlCaMonEcalPhiSym.cc
Go to the documentation of this file.
1 /*
2  * \file HLTAlCaMonEcalPhiSym.cc
3  *
4  * \author Andrea Gozzelino - Universita%G�%@ e INFN Torino
5  * \author Stefano Argiro
6  *
7  *
8  *
9  * Description: Monitoring of Phi Symmetry Calibration Stream
10 */
11 
12 
17 
18 // DQM include files
19 
21 
22 // work on collections
26 
28 
31 
32 
33 using namespace std;
34 using namespace edm;
35 
36 
37 // ******************************************
38 // constructors
39 // *****************************************
40 
42 eventCounter_(0)
43 {
45  folderName_ = ps.getUntrackedParameter<std::string>("FolderName","ALCAStreamEcalPhiSym");
46  prescaleFactor_ = ps.getUntrackedParameter<int>("prescaleFactor",1);
49 
50  saveToFile_=ps.getUntrackedParameter<bool>("SaveToFile",false);
51  fileName_= ps.getUntrackedParameter<std::string>("FileName","MonitorAlCaEcalPhiSym.root");
52 
53  // histogram parameters
54 
55  // Distribution of rechits in iPhi
56  hiPhiDistrEB_nbin_= ps.getUntrackedParameter<int>("hiPhiDistrEB_nbin",361);
57  hiPhiDistrEB_min_= ps.getUntrackedParameter<double>("hiPhiDistrEB_min",1.);
58  hiPhiDistrEB_max_= ps.getUntrackedParameter<double>("hiPhiDistrEB_max",361.);
59 
60  // Distribution of rechits in iEta
61  hiEtaDistrEB_nbin_= ps.getUntrackedParameter<int>("hiEtaDistrEB_nbin",171);
62  hiEtaDistrEB_min_ = ps.getUntrackedParameter<double>("hiEtaDistrEB_min",-85);
63  hiEtaDistrEB_max_ = ps.getUntrackedParameter<double>("hiEtaDistrEB_max",85);
64 
65  // Energy Distribution of rechits
66  hRechitEnergyEB_nbin_=ps.getUntrackedParameter<int>("hRechitEnergyEB_nbin",160);
67  hRechitEnergyEB_min_=ps.getUntrackedParameter<double>("hRechitEnergyEB_min",0.);
68  hRechitEnergyEB_max_= ps.getUntrackedParameter<double>("hRechitEnergyEB_max",2.);
69 
70  // Distribution of total event energy
71  hEventEnergyEB_nbin_= ps.getUntrackedParameter<int>("hEventEnergyEB_nbin",100);
72  hEventEnergyEB_min_ = ps.getUntrackedParameter<double>("hEventEnergyEB_min",0.);
73  hEventEnergyEB_max_ = ps.getUntrackedParameter<double>("hEventEnergyEB_max",20.);
74 
75  // Distribution of number of RecHits
76  hNRecHitsEB_nbin_= ps.getUntrackedParameter<int>("hNRecHitsEB_nbin",100);
77  hNRecHitsEB_min_ = ps.getUntrackedParameter<double>("hNRecHitsEB_min",0);
78  hNRecHitsEB_max_ = ps.getUntrackedParameter<double>("hNRecHitsEB_max",250);
79 
80  // Distribution of Mean energy per rechit
81  hMeanRecHitEnergyEB_nbin_= ps.getUntrackedParameter<int>("hMeanRecHitEnergyEB_nbin",50);
82  hMeanRecHitEnergyEB_min_ = ps.getUntrackedParameter<int>("hMeanRecHitEnergyEB_min",0);
83  hMeanRecHitEnergyEB_max_ = ps.getUntrackedParameter<int>("hMeanRecHitEnergyEB_max",2);
84 
85  // Energy Distribution of rechits
86  hRechitEnergyEE_nbin_=ps.getUntrackedParameter<int>("hRechitEnergyEE_nbin",160);
87  hRechitEnergyEE_min_ =ps.getUntrackedParameter<double>("hRechitEnergyEE_min",0.);
88  hRechitEnergyEE_max_ =ps.getUntrackedParameter<double>("hRechitEnergyEE_max",3.);
89 
90  // Distribution of total event energy
91  hEventEnergyEE_nbin_= ps.getUntrackedParameter<int>("hEventEnergyEE_nbin",100);
92  hEventEnergyEE_min_ = ps.getUntrackedParameter<double>("hEventEnergyEE_min",0.);
93  hEventEnergyEE_max_ = ps.getUntrackedParameter<double>("hEventEnergyEE_max",20.);
94 
95  // Distribution of number of RecHits
96  hNRecHitsEE_nbin_= ps.getUntrackedParameter<int>("hNRecHitsEE_nbin",100);
97  hNRecHitsEE_min_ = ps.getUntrackedParameter<double>("hNRecHitsEE_min",0);
98  hNRecHitsEE_max_ = ps.getUntrackedParameter<double>("hNRecHitsEE_max",250);
99 
100  // Distribution of Mean energy per rechit
101  hMeanRecHitEnergyEE_nbin_= ps.getUntrackedParameter<int>("hMeanRecHitEnergyEE_nbin",50);
102  hMeanRecHitEnergyEE_min_ = ps.getUntrackedParameter<double>("hMeanRecHitEnergyEE_min",0);
103  hMeanRecHitEnergyEE_max_ = ps.getUntrackedParameter<double>("hMeanRecHitEnergyEE_max",5);
104 
105  //set Token(-s)
106  productMonitoredEBToken_ = consumes<EcalRecHitCollection>(ps.getUntrackedParameter<edm::InputTag>("AlCaStreamEBTag"));
107  productMonitoredEEToken_ = consumes<EcalRecHitCollection>(ps.getUntrackedParameter<edm::InputTag>("AlCaStreamEETag"));
108 
109 }
110 
111 
113 {}
114 
115 
116 //--------------------------------------------------------
118 
119 
120  // create and cd into new folder
122 
123  // book some histograms 1D
124  hiPhiDistrEB_ =
125  dbe_->book1D("iphiDistributionEB", "RechitEB iphi",
129 
130  hiPhiDistrEB_->setAxisTitle("i#phi ", 1);
131  hiPhiDistrEB_->setAxisTitle("# rechits", 2);
132 
133 
134  hiEtaDistrEB_ = dbe_->book1D("iEtaDistributionEB", "RechitEB ieta",
138 
139  hiEtaDistrEB_->setAxisTitle("eta", 1);
140  hiEtaDistrEB_->setAxisTitle("#rechits", 2);
141 
142 
143  hRechitEnergyEB_ = dbe_->book1D("rhEnergyEB","rechits energy EB",
147 
148  hRechitEnergyEB_->setAxisTitle("energy (GeV) ",1);
149  hRechitEnergyEB_->setAxisTitle("#rechits",2);
150 
151  hEventEnergyEB_ = dbe_->book1D("eventEnergyEB","event energy EB",
155 
156  hEventEnergyEB_->setAxisTitle("energy (GeV) ",1);
157 
158  hNRecHitsEB_ = dbe_->book1D("nRechitsEB","#rechits in event EB",
162 
163  hNRecHitsEB_->setAxisTitle("rechits ",1);
164 
165  hMeanRecHitEnergyEB_ = dbe_->book1D("meanEnergyEB","Mean rechit energy EB",
169 
170  hMeanRecHitEnergyEB_-> setAxisTitle("Mean Energy [GeV] ",1);
171 
172 
173  hRechitEnergyEE_ = dbe_->book1D("rhEnergyEE","rechits energy EE",
177 
178  hRechitEnergyEE_->setAxisTitle("energy (GeV) ",1);
179  hRechitEnergyEE_->setAxisTitle("#rechits",2);
180 
181  hEventEnergyEE_ = dbe_->book1D("eventEnergyEE","event energy EE",
185 
186  hEventEnergyEE_->setAxisTitle("energy (GeV) ",1);
187 
188  hNRecHitsEE_ = dbe_->book1D("nRechitsEE","#rechits in event EE" ,
192 
193  hNRecHitsEE_->setAxisTitle("rechits ",1);
194 
195  hMeanRecHitEnergyEE_ = dbe_->book1D("meanEnergyEE","Mean rechit energy EE",
199 
200  hMeanRecHitEnergyEE_-> setAxisTitle("Mean Energy [GeV] ",1);
201 
202 }
203 
204 //--------------------------------------------------------
205 void HLTAlCaMonEcalPhiSym::beginRun(const edm::Run& r, const EventSetup& context) {
206 
207 }
208 
209 //--------------------------------------------------------
211  const EventSetup& context) {
212 
213 }
214 
215 //-------------------------------------------------------------
216 
218  const EventSetup& iSetup ){
219 
220  if (eventCounter_% prescaleFactor_ ) return;
221  eventCounter_++;
222 
225 
226  iEvent.getByToken(productMonitoredEBToken_, rhEB);
227  iEvent.getByToken(productMonitoredEEToken_, rhEE);
228 
230 
231  // fill EB histos
232  if (rhEB.isValid()){
233  float etot =0;
234  for(itb=rhEB->begin(); itb!=rhEB->end(); ++itb){
235 
236  EBDetId id(itb->id());
237 
238  hiPhiDistrEB_->Fill(id.iphi());
239  hiEtaDistrEB_->Fill(id.ieta());
240  hRechitEnergyEB_->Fill(itb->energy());
241 
242  etot+= itb->energy();
243  } // Eb rechits
244 
245  hNRecHitsEB_->Fill(rhEB->size());
246  hMeanRecHitEnergyEB_->Fill(etot/rhEB->size());
247  hEventEnergyEB_->Fill(etot);
248 
249  } // if valid
250 
251  // fill EE histos
252 
254 
255  if (rhEE.isValid()){
256 
257  float etot =0;
258  for(ite=rhEE->begin(); ite!=rhEE->end(); ++ite){
259 
260  EEDetId id(ite->id());
261  hRechitEnergyEE_->Fill(ite->energy());
262  etot+= ite->energy();
263  } // EE rechits
264 
265  hNRecHitsEE_->Fill(rhEE->size());
266  hMeanRecHitEnergyEE_->Fill(etot/rhEE->size());
267  hEventEnergyEE_->Fill(etot);
268  }
269 
270 
271 } //analyze
272 
273 
274 
275 
276 //--------------------------------------------------------
278  const EventSetup& context) {
279 }
280 //--------------------------------------------------------
281 void HLTAlCaMonEcalPhiSym::endRun(const Run& r, const EventSetup& context){
282 
283 }
284 //--------------------------------------------------------
286 
287  if (saveToFile_) {
288  dbe_->save(fileName_);
289  }
290 
291 }
292 
293 
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hEventEnergyEB_
Distribution of total event energy.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
edm::InputTag productMonitoredEE_
object to monitor
bool saveToFile_
Write to file.
MonitorElement * hRechitEnergyEE_
Energy Distribution of rechits.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
MonitorElement * hEventEnergyEE_
Distribution of total event energy.
MonitorElement * hRechitEnergyEB_
Energy Distribution of rechits.
std::string folderName_
DQM folder name.
std::vector< EcalRecHit >::const_iterator const_iterator
void analyze(const edm::Event &e, const edm::EventSetup &c)
void endRun(const edm::Run &r, const edm::EventSetup &c)
void Fill(long long x)
edm::EDGetTokenT< EcalRecHitCollection > productMonitoredEBToken_
MonitorElement * hMeanRecHitEnergyEB_
Distribution of Mean energy per rechit.
int iEvent
Definition: GenABIO.cc:230
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
MonitorElement * hiEtaDistrEB_
Distribution of rechits in iEta.
MonitorElement * hiPhiDistrEB_
Distribution of rechits in iPhi.
MonitorElement * hMeanRecHitEnergyEE_
Distribution of Mean energy per rechit.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
bool isValid() const
Definition: HandleBase.h:76
HLTAlCaMonEcalPhiSym(const edm::ParameterSet &)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
MonitorElement * hNRecHitsEE_
Distribution of number of RecHits.
edm::InputTag productMonitoredEB_
object to monitor
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
std::string fileName_
Output file name if required.
edm::EDGetTokenT< EcalRecHitCollection > productMonitoredEEToken_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
MonitorElement * hNRecHitsEB_
Distribution of number of RecHits.
Definition: Run.h:41
unsigned int prescaleFactor_
Monitor every prescaleFactor_ events.