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  * $Date: 2010/08/07 14:55:56 $
8  * $Revision: 1.5 $
9  *
10  *
11  * Description: Monitoring of Phi Symmetry Calibration Stream
12 */
13 
14 
19 
20 // DQM include files
21 
23 
24 // work on collections
28 
30 
33 
34 
35 using namespace std;
36 using namespace edm;
37 
38 
39 // ******************************************
40 // constructors
41 // *****************************************
42 
44 eventCounter_(0)
45 {
47  folderName_ = ps.getUntrackedParameter<std::string>("FolderName","ALCAStreamEcalPhiSym");
48  prescaleFactor_ = ps.getUntrackedParameter<int>("prescaleFactor",1);
51 
52  saveToFile_=ps.getUntrackedParameter<bool>("SaveToFile",false);
53  fileName_= ps.getUntrackedParameter<std::string>("FileName","MonitorAlCaEcalPhiSym.root");
54 
55  // histogram parameters
56 
57  // Distribution of rechits in iPhi
58  hiPhiDistrEB_nbin_= ps.getUntrackedParameter<int>("hiPhiDistrEB_nbin",361);
59  hiPhiDistrEB_min_= ps.getUntrackedParameter<double>("hiPhiDistrEB_min",1.);
60  hiPhiDistrEB_max_= ps.getUntrackedParameter<double>("hiPhiDistrEB_max",361.);
61 
62  // Distribution of rechits in iEta
63  hiEtaDistrEB_nbin_= ps.getUntrackedParameter<int>("hiEtaDistrEB_nbin",171);
64  hiEtaDistrEB_min_ = ps.getUntrackedParameter<double>("hiEtaDistrEB_min",-85);
65  hiEtaDistrEB_max_ = ps.getUntrackedParameter<double>("hiEtaDistrEB_max",85);
66 
67  // Energy Distribution of rechits
68  hRechitEnergyEB_nbin_=ps.getUntrackedParameter<int>("hRechitEnergyEB_nbin",160);
69  hRechitEnergyEB_min_=ps.getUntrackedParameter<double>("hRechitEnergyEB_min",0.);
70  hRechitEnergyEB_max_= ps.getUntrackedParameter<double>("hRechitEnergyEB_max",2.);
71 
72  // Distribution of total event energy
73  hEventEnergyEB_nbin_= ps.getUntrackedParameter<int>("hEventEnergyEB_nbin",100);
74  hEventEnergyEB_min_ = ps.getUntrackedParameter<double>("hEventEnergyEB_min",0.);
75  hEventEnergyEB_max_ = ps.getUntrackedParameter<double>("hEventEnergyEB_max",20.);
76 
77  // Distribution of number of RecHits
78  hNRecHitsEB_nbin_= ps.getUntrackedParameter<int>("hNRecHitsEB_nbin",100);
79  hNRecHitsEB_min_ = ps.getUntrackedParameter<double>("hNRecHitsEB_min",0);
80  hNRecHitsEB_max_ = ps.getUntrackedParameter<double>("hNRecHitsEB_max",250);
81 
82  // Distribution of Mean energy per rechit
83  hMeanRecHitEnergyEB_nbin_= ps.getUntrackedParameter<int>("hMeanRecHitEnergyEB_nbin",50);
84  hMeanRecHitEnergyEB_min_ = ps.getUntrackedParameter<int>("hMeanRecHitEnergyEB_min",0);
85  hMeanRecHitEnergyEB_max_ = ps.getUntrackedParameter<int>("hMeanRecHitEnergyEB_max",2);
86 
87  // Energy Distribution of rechits
88  hRechitEnergyEE_nbin_=ps.getUntrackedParameter<int>("hRechitEnergyEE_nbin",160);
89  hRechitEnergyEE_min_ =ps.getUntrackedParameter<double>("hRechitEnergyEE_min",0.);
90  hRechitEnergyEE_max_ =ps.getUntrackedParameter<double>("hRechitEnergyEE_max",3.);
91 
92  // Distribution of total event energy
93  hEventEnergyEE_nbin_= ps.getUntrackedParameter<int>("hEventEnergyEE_nbin",100);
94  hEventEnergyEE_min_ = ps.getUntrackedParameter<double>("hEventEnergyEE_min",0.);
95  hEventEnergyEE_max_ = ps.getUntrackedParameter<double>("hEventEnergyEE_max",20.);
96 
97  // Distribution of number of RecHits
98  hNRecHitsEE_nbin_= ps.getUntrackedParameter<int>("hNRecHitsEE_nbin",100);
99  hNRecHitsEE_min_ = ps.getUntrackedParameter<double>("hNRecHitsEE_min",0);
100  hNRecHitsEE_max_ = ps.getUntrackedParameter<double>("hNRecHitsEE_max",250);
101 
102  // Distribution of Mean energy per rechit
103  hMeanRecHitEnergyEE_nbin_= ps.getUntrackedParameter<int>("hMeanRecHitEnergyEE_nbin",50);
104  hMeanRecHitEnergyEE_min_ = ps.getUntrackedParameter<double>("hMeanRecHitEnergyEE_min",0);
105  hMeanRecHitEnergyEE_max_ = ps.getUntrackedParameter<double>("hMeanRecHitEnergyEE_max",5);
106 
107 
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.getByLabel(productMonitoredEB_, rhEB);
227  iEvent.getByLabel(productMonitoredEE_, 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:717
edm::InputTag productMonitoredEE_
object to monitor
bool saveToFile_
Write to file.
MonitorElement * hRechitEnergyEE_
Energy Distribution of rechits.
MonitorElement * hEventEnergyEE_
Distribution of total event energy.
MonitorElement * hRechitEnergyEB_
Energy Distribution of rechits.
std::string folderName_
DQM folder name.
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
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)
MonitorElement * hMeanRecHitEnergyEB_
Distribution of Mean energy per rechit.
int iEvent
Definition: GenABIO.cc:243
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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
std::string fileName_
Output file name if required.
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:429
MonitorElement * hNRecHitsEB_
Distribution of number of RecHits.
Definition: Run.h:33
unsigned int prescaleFactor_
Monitor every prescaleFactor_ events.