CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalLedAnalysis.cc
Go to the documentation of this file.
1 
5 
7 #include "TFile.h"
8 #include <cmath>
9 using namespace std;
10 
11 
13 {
14  // init
15 
16  m_coder = 0;
17  m_ped = 0;
18  m_shape = 0;
19  evt=0;
20  sample=0;
21  m_file=0;
22  // output files
23  for(int k=0;k<4;k++) state.push_back(true); // 4 cap-ids (do we care?)
24  m_outputFileText = ps.getUntrackedParameter<string>("outputFileText", "");
25  m_outputFileX = ps.getUntrackedParameter<string>("outputFileXML","");
26  if ( m_outputFileText.size() != 0 ) {
27  cout << "Hcal LED results will be saved to " << m_outputFileText.c_str() << endl;
28  m_outFile.open(m_outputFileText.c_str());
29  }
30  m_outputFileROOT = ps.getUntrackedParameter<string>("outputFileHist", "");
31  if ( m_outputFileROOT.size() != 0 ) {
32  cout << "Hcal LED histograms will be saved to " << m_outputFileROOT.c_str() << endl;
33  }
34 
35  m_nevtsample = ps.getUntrackedParameter<int>("nevtsample",9999999);
36  if(m_nevtsample<1)m_nevtsample=9999999;
37  m_hiSaveflag = ps.getUntrackedParameter<int>("hiSaveflag",0);
38  if(m_hiSaveflag<0)m_hiSaveflag=0;
39  if(m_hiSaveflag>0)m_hiSaveflag=1;
40  m_fitflag = ps.getUntrackedParameter<int>("analysisflag",2);
41  if(m_fitflag<0)m_fitflag=0;
42  if(m_fitflag>4)m_fitflag=4;
43  m_startTS = ps.getUntrackedParameter<int>("firstTS", 0);
44  if(m_startTS<0) m_startTS=0;
45  m_endTS = ps.getUntrackedParameter<int>("lastTS", 9);
46  m_usecalib = ps.getUntrackedParameter<bool>("usecalib",false);
47  m_logFile.open("HcalLedAnalysis.log");
48 
49  int runNum = ps.getUntrackedParameter<int>("runNumber",999999);
50 
51  // histogram booking
52  hbHists.ALLLEDS = new TH1F("HBHE All LEDs","HB/HE All Leds",10,0,9);
53  hbHists.LEDRMS= new TH1F("HBHE All LED RMS","HB/HE All LED RMS",100,0,3);
54  hbHists.LEDMEAN= new TH1F("HBHE All LED Means","HB/HE All LED Means",100,0,9);
55  hbHists.CHI2= new TH1F("HBHE Chi2 by ndf for Landau fit","HB/HE Chi2/ndf Landau",200,0.,50.);
56 
57  hoHists.ALLLEDS = new TH1F("HO All LEDs","HO All Leds",10,0,9);
58  hoHists.LEDRMS= new TH1F("HO All LED RMS","HO All LED RMS",100,0,3);
59  hoHists.LEDMEAN= new TH1F("HO All LED Means","HO All LED Means",100,0,9);
60  hoHists.CHI2= new TH1F("HO Chi2 by ndf for Landau fit","HO Chi2/ndf Landau",200,0.,50.);
61 
62  hfHists.ALLLEDS = new TH1F("HF All LEDs","HF All Leds",10,0,9);
63  hfHists.LEDRMS= new TH1F("HF All LED RMS","HF All LED RMS",100,0,3);
64  hfHists.LEDMEAN= new TH1F("HF All LED Means","HF All LED Means",100,0,9);
65  hfHists.CHI2= new TH1F("HF Chi2 by ndf for Landau fit","HF Chi2/ndf Landau",200,0.,50.);
66 
67 
68  //XML file header
69  m_outputFileXML.open(m_outputFileX.c_str());
70 
71  m_outputFileXML << "<?xml version='1.0' encoding='UTF-8'?>" << endl;
72 
73  m_outputFileXML << "<ROOT>" << endl;
74 
75  m_outputFileXML << " <HEADER>" << endl;
76 
77  m_outputFileXML << " <TYPE>" << endl;
78 
79  m_outputFileXML << " <EXTENSION_TABLE_NAME>HCAL_LED_TIMING</EXTENSION_TABLE_NAME>" << endl;
80 
81  m_outputFileXML << " <NAME>HCAL LED Timing</NAME>" << endl;
82 
83  m_outputFileXML << " </TYPE>" << endl;
84 
85  m_outputFileXML << " <RUN>" << endl;
86 
87  m_outputFileXML << " <RUN_TYPE>hcal-led-timing-test</RUN_TYPE>" << endl;
88 
89  sprintf(output, " <RUN_NUMBER>%06i</RUN_NUMBER>", runNum);
90  m_outputFileXML << output << endl;
91 
92  m_outputFileXML << " <RUN_BEGIN_TIMESTAMP>2007-07-09 00:00:00.0</RUN_BEGIN_TIMESTAMP>" << endl;
93 
94  m_outputFileXML << " <COMMENT_DESCRIPTION></COMMENT_DESCRIPTION>" << endl;
95 
96  m_outputFileXML << " </RUN>" << endl;
97 
98  m_outputFileXML << " </HEADER>" << endl;
99 
100  m_outputFileXML << "<!-- Tags secton -->" << endl;
101 
102  m_outputFileXML << " <ELEMENTS>" << endl;
103 
104  m_outputFileXML << " <DATA_SET id='-1'/>" << endl;
105 
106  m_outputFileXML << " <IOV id='1'>" << endl;
107 
108  m_outputFileXML << " <INTERVAL_OF_VALIDITY_BEGIN>2147483647</INTERVAL_OF_VALIDITY_BEGIN>" << endl;
109 
110  m_outputFileXML << " <INTERVAL_OF_VALIDITY_END>0</INTERVAL_OF_VALIDITY_END>" << endl;
111 
112  m_outputFileXML << " </IOV>" << endl;
113 
114  m_outputFileXML << " <TAG id='2' mode='auto'>" << endl;
115 
116  sprintf(output, " <TAG_NAME>laser_led_%06i<TAG_NAME>", runNum);
117  m_outputFileXML << output << endl;
118 
119  m_outputFileXML << " <DETECTOR_NAME>HCAL</DETECTOR_NAME>" << endl;
120 
121  m_outputFileXML << " <COMMENT_DESCRIPTION></COMMENT_DESCRIPTION>" << endl;
122 
123  m_outputFileXML << " </TAG>" << endl;
124 
125  m_outputFileXML << " </ELEMENTS>" << endl;
126 
127  m_outputFileXML << " <MAPS>" << endl;
128 
129  m_outputFileXML << " <TAG idref ='2'>" << endl;
130 
131  m_outputFileXML << " <IOV idref='1'>" << endl;
132 
133  m_outputFileXML << " <DATA_SET idref='-1' />" << endl;
134 
135  m_outputFileXML << " </IOV>" << endl;
136 
137  m_outputFileXML << " </TAG>" << endl;
138 
139  m_outputFileXML << " </MAPS>" << endl;
140 
141 }
142 
143 //-----------------------------------------------------------------------------
146  for(_meol=hbHists.LEDTRENDS.begin(); _meol!=hbHists.LEDTRENDS.end(); _meol++){
147  for(int i=0; i<15; i++) _meol->second[i].first->Delete();
148  }
149  for(_meol=hoHists.LEDTRENDS.begin(); _meol!=hoHists.LEDTRENDS.end(); _meol++){
150  for(int i=0; i<15; i++) _meol->second[i].first->Delete();
151  }
152  for(_meol=hfHists.LEDTRENDS.begin(); _meol!=hfHists.LEDTRENDS.end(); _meol++){
153  for(int i=0; i<15; i++) _meol->second[i].first->Delete();
154  }
155  hbHists.ALLLEDS->Delete();
156  hbHists.LEDRMS->Delete();
157  hbHists.LEDMEAN->Delete();
158  hbHists.CHI2->Delete();
159 
160  hoHists.ALLLEDS->Delete();
161  hoHists.LEDRMS->Delete();
162  hoHists.LEDMEAN->Delete();
163  hoHists.CHI2->Delete();
164 
165  hfHists.ALLLEDS->Delete();
166  hfHists.LEDRMS->Delete();
167  hfHists.LEDMEAN->Delete();
168  hfHists.CHI2->Delete();
169 }
170 
171 //-----------------------------------------------------------------------------
172 void HcalLedAnalysis::LedSetup(const std::string& m_outputFileROOT) {
173  // open the histogram file, create directories within
174  m_file=new TFile(m_outputFileROOT.c_str(),"RECREATE");
175  m_file->mkdir("HBHE");
176  m_file->cd();
177  m_file->mkdir("HO");
178  m_file->cd();
179  m_file->mkdir("HF");
180  m_file->cd();
181  m_file->mkdir("Calib");
182  m_file->cd();
183 }
184 
185 //-----------------------------------------------------------------------------
186 /*
187 void HcalLedAnalysis::doPeds(const HcalPedestal* fInputPedestals){
188 // put all pedestals in a map m_AllPedVals, to be used in processLedEvent -
189 // sorry, this is the only way I was able to implement pedestal subtraction
190 
191 // DEPRECATED
192 // This is no longer useful, better ways of doing it -A
193  HcalDetId detid;
194  map<int,float> PedVals;
195  pedCan = fInputPedestals;
196  if(pedCan){
197  std::vector<DetId> Channs=pedCan->getAllChannels();
198  for (int i=0; i<(int)Channs.size(); i++){
199  detid=HcalDetId (Channs[i]);
200  for (int icap=0; icap<4; icap++) PedVals[icap]=pedCan->getValue(detid,icap);
201  m_AllPedVals[detid]=PedVals;
202  }
203  }
204 }
205 */
206 //-----------------------------------------------------------------------------
207 void HcalLedAnalysis::GetLedConst(map<HcalDetId, map<int,LEDBUNCH> > &toolT){
208  double time2=0; double time1=0; double time3=0; double time4=0;
209  double dtime2=0; double dtime1=0; double dtime3=0; double dtime4=0;
210 
211  if (m_outputFileText!=""){
212  if(m_fitflag==0 || m_fitflag==2) m_outFile<<"Det Eta,Phi,D Mean Error"<<std::endl;
213  else if(m_fitflag==1 || m_fitflag==3) m_outFile<<"Det Eta,Phi,D Peak Error"<<std::endl;
214  else if(m_fitflag==4) m_outFile<<"Det Eta,Phi,D Mean Error Peak Error MeanEv Error PeakEv Error"<<std::endl;
215  }
216  for(_meol=toolT.begin(); _meol!=toolT.end(); _meol++){
217 // scale the LED pulse to 1 event
218  _meol->second[10].first->Scale(1./evt_curr);
219  if(m_fitflag==0 || m_fitflag==4){
220  time1 = _meol->second[10].first->GetMean();
221  dtime1 = _meol->second[10].first->GetRMS()/sqrt((float)evt_curr*(m_endTS-m_startTS+1));
222  }
223  if(m_fitflag==1 || m_fitflag==4){
224 // put proper errors
225  for(int j=0; j<10; j++) _meol->second[10].first->SetBinError(j+1,_meol->second[j].first->GetRMS()/sqrt((float)evt_curr));
226  }
227  if(m_fitflag==1 || m_fitflag==3 || m_fitflag==4){
228  _meol->second[10].first->Fit("landau","Q");
229 // _meol->second[10].first->Fit("gaus","Q");
230  TF1 *fit = _meol->second[10].first->GetFunction("landau");
231 // TF1 *fit = _meol->second[10].first->GetFunction("gaus");
232  time2=fit->GetParameter(1);
233  dtime2=fit->GetParError(1);
234  }
235  if(m_fitflag==2 || m_fitflag==4){
236  time3 = _meol->second[12].first->GetMean();
237  dtime3 = _meol->second[12].first->GetRMS()/sqrt((float)_meol->second[12].first->GetEntries());
238  }
239  if(m_fitflag==3 || m_fitflag==4){
240  time4 = _meol->second[13].first->GetMean();
241  dtime4 = _meol->second[13].first->GetRMS()/sqrt((float)_meol->second[13].first->GetEntries());
242  }
243  for (int i=0; i<10; i++){
244  _meol->second[i].first->GetXaxis()->SetTitle("Pulse height (fC)");
245  _meol->second[i].first->GetYaxis()->SetTitle("Counts");
246 // if(m_hiSaveflag>0)_meol->second[i].first->Write();
247  }
248  _meol->second[10].first->GetXaxis()->SetTitle("Time slice");
249  _meol->second[10].first->GetYaxis()->SetTitle("Averaged pulse (fC)");
250  if(m_hiSaveflag>0)_meol->second[10].first->Write();
251  _meol->second[10].second.first[0].push_back(time1);
252  _meol->second[10].second.first[1].push_back(dtime1);
253  _meol->second[11].second.first[0].push_back(time2);
254  _meol->second[11].second.first[1].push_back(dtime2);
255  _meol->second[12].first->GetXaxis()->SetTitle("Mean TS");
256  _meol->second[12].first->GetYaxis()->SetTitle("Counts");
257  if(m_fitflag==2 && m_hiSaveflag>0)_meol->second[12].first->Write();
258  _meol->second[12].second.first[0].push_back(time3);
259  _meol->second[12].second.first[1].push_back(dtime3);
260  _meol->second[13].first->GetXaxis()->SetTitle("Peak TS");
261  _meol->second[13].first->GetYaxis()->SetTitle("Counts");
262  if(m_fitflag>2 && m_hiSaveflag>0)_meol->second[13].first->Write();
263  _meol->second[13].second.first[0].push_back(time4);
264  _meol->second[13].second.first[1].push_back(dtime4);
265  _meol->second[14].first->GetXaxis()->SetTitle("Peak TS error");
266  _meol->second[14].first->GetYaxis()->SetTitle("Counts");
267  if(m_fitflag>2 && m_hiSaveflag>0)_meol->second[14].first->Write();
268  _meol->second[15].first->GetXaxis()->SetTitle("Chi2/NDF");
269  _meol->second[15].first->GetYaxis()->SetTitle("Counts");
270  if(m_fitflag>2 && m_hiSaveflag>0)_meol->second[15].first->Write();
271  _meol->second[16].first->GetXaxis()->SetTitle("Integrated Signal");
272  _meol->second[16].first->Write();
273 
274 
275 // Ascii printout (need to modify to include new info)
276  HcalDetId detid = _meol->first;
277 
278  if (m_outputFileText!=""){
279  if(m_fitflag==0) {
280  m_outFile<<detid<<" "<<time1<<" "<<dtime1<<std::endl;
281  m_outputFileXML << " <DATA_SET>" << endl;
282  m_outputFileXML << " <VERSION>version:1</VERSION>" << endl;
283  m_outputFileXML << " <CHANNEL>" << endl;
284  m_outputFileXML << " <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>" << endl;
285  sprintf(output, " <ETA>%2i</ETA>", detid.ietaAbs() );
286  m_outputFileXML << output << endl;
287  sprintf(output, " <PHI>%2i</PHI>", detid.iphi() );
288  m_outputFileXML << output << endl;
289  sprintf(output, " <DEPTH>%2i</DEPTH>", detid.depth() );
290  m_outputFileXML << output << endl;
291  sprintf(output, " <Z>%2i</Z>", detid.zside() );
292  m_outputFileXML << output << endl;
293 
294  if(detid.subdet() == 1) m_outputFileXML << " <DETECTOR_NAME>HB</DETECTOR_NAME>" << endl;
295  if(detid.subdet() == 2) m_outputFileXML << " <DETECTOR_NAME>HE</DETECTOR_NAME>" << endl;
296  if(detid.subdet() == 3) m_outputFileXML << " <DETECTOR_NAME>HO</DETECTOR_NAME>" << endl;
297  if(detid.subdet() == 4) m_outputFileXML << " <DETECTOR_NAME>HF</DETECTOR_NAME>" << endl;
298  sprintf(output, " <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.rawId() );
299  m_outputFileXML << output << endl;
300  m_outputFileXML << " </CHANNEL>" << endl;
301  m_outputFileXML << " <DATA>" << endl;
302  sprintf(output, " <MEAN_TIME>%7f</MEAN_TIME>", time1);
303  m_outputFileXML << output << endl;
304  m_outputFileXML << " <OFFSET_TIME> 0</OFFSET_TIME>" << endl;
305  sprintf(output, " <ERROR_STAT>%7f</ERROR_STAT>", dtime1);
306  m_outputFileXML << output << endl;
307  sprintf(output, " <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag+1);
308  m_outputFileXML << output << endl;
309  m_outputFileXML << " <STATUS_WORD> 0</STATUS_WORD>" << endl;
310  m_outputFileXML << " </DATA>" << endl;
311  m_outputFileXML << " </DATA_SET>" << endl;
312 
313  }
314  else if(m_fitflag==1){
315  m_outFile<<detid<<" "<<time2<<" "<<dtime2<<std::endl;
316  m_outputFileXML << " <DATA_SET>" << endl;
317  m_outputFileXML << " <VERSION>version:1</VERSION>" << endl;
318  m_outputFileXML << " <CHANNEL>" << endl;
319  m_outputFileXML << " <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>" << endl;
320  sprintf(output, " <ETA>%2i</ETA>", detid.ietaAbs() );
321  m_outputFileXML << output << endl;
322  sprintf(output, " <PHI>%2i</PHI>", detid.iphi() );
323  m_outputFileXML << output << endl;
324  sprintf(output, " <DEPTH>%2i</DEPTH>", detid.depth() );
325  m_outputFileXML << output << endl;
326  sprintf(output, " <Z>%2i</Z>", detid.zside() );
327  m_outputFileXML << output << endl;
328  if(detid.subdet() == 1) m_outputFileXML << " <DETECTOR_NAME>HB</DETECTOR_NAME>"<< endl;
329  if(detid.subdet() == 2) m_outputFileXML << " <DETECTOR_NAME>HE</DETECTOR_NAME>"<< endl;
330  if(detid.subdet() == 3) m_outputFileXML << " <DETECTOR_NAME>HO</DETECTOR_NAME>"<< endl;
331  if(detid.subdet() == 4) m_outputFileXML << " <DETECTOR_NAME>HF</DETECTOR_NAME>"<< endl;
332  sprintf(output, " <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.rawId() );
333  m_outputFileXML << output << endl;
334  m_outputFileXML << " </CHANNEL>" << endl;
335  m_outputFileXML << " <DATA>" << endl;
336  sprintf(output, " <MEAN_TIME>%7f</MEAN_TIME>", time2);
337  m_outputFileXML << output << endl;
338  m_outputFileXML << " <OFFSET_TIME> 0</OFFSET_TIME>" << endl;
339  sprintf(output, " <ERROR_STAT>%7f</ERROR_STAT>", dtime2);
340  m_outputFileXML << output << endl;
341  sprintf(output, " <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag+1);
342  m_outputFileXML << output << endl;
343  m_outputFileXML << " <STATUS_WORD> 0</STATUS_WORD>" << endl;
344  m_outputFileXML << " </DATA>" << endl;
345  m_outputFileXML << " </DATA_SET>" << endl;
346  }
347 
348  else if(m_fitflag==2){
349  m_outFile<<detid<<" "<<time3<<" "<<dtime3<<std::endl;
350  m_outputFileXML << " <DATA_SET>" << endl;
351  m_outputFileXML << " <VERSION>version:1</VERSION>" << endl;
352  m_outputFileXML << " <CHANNEL>" << endl;
353  m_outputFileXML << " <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>" << endl;
354  sprintf(output, " <ETA>%2i</ETA>", detid.ietaAbs() );
355  m_outputFileXML << output << endl;
356  sprintf(output, " <PHI>%2i</PHI>", detid.iphi() );
357  m_outputFileXML << output << endl;
358  sprintf(output, " <DEPTH>%2i</DEPTH>", detid.depth() );
359  m_outputFileXML << output << endl;
360  sprintf(output, " <Z>%2i</Z>", detid.zside() );
361  m_outputFileXML << output << endl;
362  if(detid.subdet() == 1) m_outputFileXML << " <DETECTOR_NAME>HB</DETECTOR_NAME>" << endl;
363  if(detid.subdet() == 2) m_outputFileXML << " <DETECTOR_NAME>HE</DETECTOR_NAME>" << endl;
364  if(detid.subdet() == 3) m_outputFileXML << " <DETECTOR_NAME>HO</DETECTOR_NAME>" << endl;
365  if(detid.subdet() == 4) m_outputFileXML << " <DETECTOR_NAME>HF</DETECTOR_NAME>" << endl;
366  sprintf(output, " <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.rawId() );
367  m_outputFileXML << output << endl;
368  m_outputFileXML << " </CHANNEL>" << endl;
369  m_outputFileXML << " <DATA>" << endl;
370  sprintf(output, " <MEAN_TIME>%7f</MEAN_TIME>", time3);
371  m_outputFileXML << output << endl;
372  m_outputFileXML << " <OFFSET_TIME> 0</OFFSET_TIME>" << endl;
373  sprintf(output, " <ERROR_STAT>%7f</ERROR_STAT>", dtime3);
374  m_outputFileXML << output << endl;
375  sprintf(output, " <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag+1);
376  m_outputFileXML << output << endl;
377  m_outputFileXML << " <STATUS_WORD> 0</STATUS_WORD>" << endl;
378  m_outputFileXML << " </DATA>" << endl;
379  m_outputFileXML << " </DATA_SET>" << endl;
380  }
381  else if(m_fitflag==3){
382  m_outFile<<detid<<" "<<time4<<" "<<dtime4<<std::endl;
383  m_outputFileXML << " <DATA_SET>" << endl;
384  m_outputFileXML <<" <VERSION>version:1</VERSION>" << endl;
385  m_outputFileXML << " <CHANNEL>" << endl;
386  m_outputFileXML << " <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>" << endl;
387  sprintf(output, " <ETA>%2i</ETA>", detid.ietaAbs() );
388  m_outputFileXML << output << endl;
389  sprintf(output, " <PHI>%2i</PHI>", detid.iphi() );
390  m_outputFileXML << output << endl;
391  sprintf(output, " <DEPTH>%2i</DEPTH>", detid.depth() );
392  m_outputFileXML << output << endl;
393  sprintf(output, " <Z>%2i</Z>", detid.zside() );
394  m_outputFileXML << output << endl;
395  if(detid.subdet() == 1) m_outputFileXML <<" <DETECTOR_NAME>HB</DETECTOR_NAME>" << endl;
396  if(detid.subdet() == 2) m_outputFileXML <<" <DETECTOR_NAME>HE</DETECTOR_NAME>" << endl;
397  if(detid.subdet() == 3) m_outputFileXML <<" <DETECTOR_NAME>HO</DETECTOR_NAME>" << endl;
398  if(detid.subdet() == 4) m_outputFileXML <<" <DETECTOR_NAME>HF</DETECTOR_NAME>" << endl;
399  sprintf(output, " <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.rawId() );
400  m_outputFileXML << output << endl;
401  m_outputFileXML << " </CHANNEL>" << endl;
402  m_outputFileXML << " <DATA>" << endl;
403  sprintf(output, " <MEAN_TIME>%7f</MEAN_TIME>", time4);
404  m_outputFileXML << output << endl;
405  m_outputFileXML << " <OFFSET_TIME> 0</OFFSET_TIME>" << endl;
406  sprintf(output, " <ERROR_STAT>%7f</ERROR_STAT>", dtime4);
407  m_outputFileXML << output << endl;
408  sprintf(output, " <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag+1);
409  m_outputFileXML << output << endl;
410  m_outputFileXML << " <STATUS_WORD> 0</STATUS_WORD>" << endl;
411  m_outputFileXML << " </DATA>" << endl;
412  m_outputFileXML << " </DATA_SET>" << endl;
413  }
414 
415  else if(m_fitflag==4){
416  m_outFile<<detid<<" "<<time1<<" "<<dtime1<<" "<<time2<<" "<<dtime2<<" "<<time3<<" "<<dtime3<<" "<<time4<<" "<<dtime4<<std::endl;
417  }
418  }
419  }
420 }
421 
422 //-----------------------------------------------------------------------------
424  // it is called every m_nevtsample events (a sample) and the end of run
425  char LedSampleNum[20];
426 
427  sprintf(LedSampleNum,"LedSample_%d",sample);
428  m_file->cd();
429  m_file->mkdir(LedSampleNum);
430  m_file->cd(LedSampleNum);
431 
432 // Compute LED constants for each HB/HE, HO, HF
433  GetLedConst(hbHists.LEDTRENDS);
434  GetLedConst(hoHists.LEDTRENDS);
435  GetLedConst(hfHists.LEDTRENDS);
436 }
437 
438 //-----------------------------------------------------------------------------
439 void HcalLedAnalysis::LedTrendings(map<HcalDetId, map<int,LEDBUNCH> > &toolT)
440 {
441 
442  for(_meol=toolT.begin(); _meol!=toolT.end(); _meol++){
443  char name[1024];
444  HcalDetId detid = _meol->first;
445  sprintf(name,"LED timing trend, eta=%d phi=%d depth=%d",detid.ieta(),detid.iphi(),detid.depth());
446  int bins = _meol->second[10+m_fitflag].second.first[0].size();
447  float lo =0.5;
448  float hi = (float)bins+0.5;
449  _meol->second[10+m_fitflag].second.second.push_back(new TH1F(name,name,bins,lo,hi));
450 
451  std::vector<double>::iterator sample_it;
452 // LED timing - put content and errors
453  int j=0;
454  for(sample_it=_meol->second[10+m_fitflag].second.first[0].begin();
455  sample_it!=_meol->second[10+m_fitflag].second.first[0].end();sample_it++){
456  _meol->second[10+m_fitflag].second.second[0]->SetBinContent(++j,*sample_it);
457  }
458  j=0;
459  for(sample_it=_meol->second[10+m_fitflag].second.first[1].begin();
460  sample_it!=_meol->second[10+m_fitflag].second.first[1].end();sample_it++){
461  _meol->second[10+m_fitflag].second.second[0]->SetBinError(++j,*sample_it);
462  }
463  sprintf(name,"Sample (%d events)",m_nevtsample);
464  _meol->second[10+m_fitflag].second.second[0]->GetXaxis()->SetTitle(name);
465  _meol->second[10+m_fitflag].second.second[0]->GetYaxis()->SetTitle("Peak position");
466  _meol->second[10+m_fitflag].second.second[0]->Write();
467  }
468 }
469 
470 //-----------------------------------------------------------------------------
472 {
473 
474 // First process the last sample (remaining events).
475  if(evt%m_nevtsample!=0) LedSampleAnalysis();
476 
477 // Now do the end of run analysis: trending histos
478  if(sample>1 && m_fitflag!=4){
479  m_file->cd();
480  m_file->cd("HBHE");
481  LedTrendings(hbHists.LEDTRENDS);
482  m_file->cd();
483  m_file->cd("HO");
484  LedTrendings(hoHists.LEDTRENDS);
485  m_file->cd();
486  m_file->cd("HF");
487  LedTrendings(hfHists.LEDTRENDS);
488  }
489 
490  // Write other histograms.
491  // HB
492  m_file->cd();
493  m_file->cd("HBHE");
494  hbHists.ALLLEDS->Write();
495  hbHists.LEDRMS->Write();
496  hbHists.LEDMEAN->Write();
497  // HO
498  m_file->cd();
499  m_file->cd("HO");
500  hoHists.ALLLEDS->Write();
501  hoHists.LEDRMS->Write();
502  hoHists.LEDMEAN->Write();
503  // HF
504  m_file->cd();
505  m_file->cd("HF");
506  hfHists.ALLLEDS->Write();
507  hfHists.LEDRMS->Write();
508  hfHists.LEDMEAN->Write();
509  // Calib
510  m_file->cd();
511  m_file->cd("Calib");
512  for(_meca=calibHists.begin(); _meca!=calibHists.end(); _meca++){
513  _meca->second.avePulse->Write();
514  _meca->second.integPulse->Write();
515  }
516 
517  // Write the histo file and close it
518 // m_file->Write();
519  m_file->Close();
520  cout << "Hcal histograms written to " << m_outputFileROOT.c_str() << endl;
521 }
522 
523 //-----------------------------------------------------------------------------
525  const HODigiCollection& ho,
526  const HFDigiCollection& hf,
528  const HcalDbService& cond)
529 {
530  evt++;
531  sample = (evt-1)/m_nevtsample +1;
532  evt_curr = evt%m_nevtsample;
533  if(evt_curr==0)evt_curr=m_nevtsample;
534 
535  // Calib
536 
537  if (m_usecalib){
538  try{
539  if(!calib.size()) throw (int)calib.size();
540  // this is effectively a loop over electronic channels
541  for (HcalCalibDigiCollection::const_iterator j=calib.begin(); j!=calib.end(); j++){
542  const HcalCalibDataFrame digi = (const HcalCalibDataFrame)(*j);
543  HcalElectronicsId elecId = digi.elecId();
544  HcalCalibDetId calibId = digi.id();
545  ProcessCalibEvent(elecId.fiberChanId(),calibId,digi); //Shouldn't depend on anything in elecId but not sure how else to do it
546  }
547  }
548  catch (int i ) {
549  // m_logFile<< "Event with " << i<<" Calib Digis passed." << std::endl;
550  }
551  }
552 
553 
554  // HB + HE
555  try{
556  if(!hbhe.size()) throw (int)hbhe.size();
557 // this is effectively a loop over electronic channels
558  for (HBHEDigiCollection::const_iterator j=hbhe.begin(); j!=hbhe.end(); j++){
559  const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
560  for(int k=0; k<(int)state.size();k++) state[k]=true;
561  // See if histos exist for this channel, and if not, create them
562  _meol = hbHists.LEDTRENDS.find(digi.id());
563  if (_meol==hbHists.LEDTRENDS.end()){
564  SetupLEDHists(0,digi.id(),hbHists.LEDTRENDS);
565  }
566  LedHBHEHists(digi.id(),digi,hbHists.LEDTRENDS,cond);
567  }
568  }
569  catch (int i ) {
570 // m_logFile<< "Event with " << i<<" HBHE Digis passed." << std::endl;
571  }
572 
573  // HO
574  try{
575  if(!ho.size()) throw (int)ho.size();
576  for (HODigiCollection::const_iterator j=ho.begin(); j!=ho.end(); j++){
577  const HODataFrame digi = (const HODataFrame)(*j);
578  _meol = hoHists.LEDTRENDS.find(digi.id());
579  if (_meol==hoHists.LEDTRENDS.end()){
580  SetupLEDHists(1,digi.id(),hoHists.LEDTRENDS);
581  }
582  LedHOHists(digi.id(),digi,hoHists.LEDTRENDS,cond);
583  }
584  }
585  catch (int i ) {
586 // m_logFile << "Event with " << i<<" HO Digis passed." << std::endl;
587  }
588 
589  // HF
590  try{
591  if(!hf.size()) throw (int)hf.size();
592  for (HFDigiCollection::const_iterator j=hf.begin(); j!=hf.end(); j++){
593  const HFDataFrame digi = (const HFDataFrame)(*j);
594  _meol = hfHists.LEDTRENDS.find(digi.id());
595  if (_meol==hfHists.LEDTRENDS.end()){
596  SetupLEDHists(2,digi.id(),hfHists.LEDTRENDS);
597  }
598  LedHFHists(digi.id(),digi,hfHists.LEDTRENDS,cond);
599  }
600  }
601  catch (int i ) {
602 // m_logFile << "Event with " << i<<" HF Digis passed." << std::endl;
603  }
604 
605  // Call the function every m_nevtsample events
606  if(evt%m_nevtsample==0) LedSampleAnalysis();
607 
608 }
609 //----------------------------------------------------------------------------
610 void HcalLedAnalysis::SetupLEDHists(int id, const HcalDetId detid, map<HcalDetId, map<int,LEDBUNCH> > &toolT) {
611 
612  string type = "HBHE";
613  if(id==1) type = "HO";
614  if(id==2) type = "HF";
615 
616  _meol = toolT.find(detid);
617  if (_meol==toolT.end()){
618 // if histos for this channel do not exist, create them
619  map<int,LEDBUNCH> insert;
620  char name[1024];
621  for(int i=0; i<10; i++){
622  sprintf(name,"%s Pulse height, eta=%d phi=%d depth=%d TS=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth(),i);
623  insert[i].first = new TH1F(name,name,200,0.,2000.);
624  }
625  sprintf(name,"%s LED Mean pulse, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
626  insert[10].first = new TH1F(name,name,10,-0.5,9.5);
627  sprintf(name,"%s LED Pulse, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
628  insert[11].first = new TH1F(name,name,10,-0.5,9.5);
629  sprintf(name,"%s Mean TS, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
630  insert[12].first = new TH1F(name,name,200,0.,10.);
631  sprintf(name,"%s Peak TS, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
632  insert[13].first = new TH1F(name,name,200,0.,10.);
633  sprintf(name,"%s Peak TS error, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
634  insert[14].first = new TH1F(name,name,200,0.,0.05);
635  sprintf(name,"%s Fit chi2, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
636  insert[15].first = new TH1F(name,name,100,0.,50.);
637  sprintf(name,"%s Integrated Signal, eta=%d phi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());
638  insert[16].first = new TH1F(name,name,500,0.,5000.);
639 
640  toolT[detid] = insert;
641  }
642 }
643 //-----------------------------------------------------------------------------
644 void HcalLedAnalysis::LedHBHEHists(const HcalDetId& detid, const HBHEDataFrame& ledDigi, map<HcalDetId, map<int,LEDBUNCH> > &toolT, const HcalDbService& cond){
645 
646  map<int,LEDBUNCH> _mei;
647  _meol = toolT.find(detid);
648  _mei = _meol->second;
649 
650  // Reset the histos if we're at the end of a 'bunch'
651  if((evt-1)%m_nevtsample==0 && state[0]){
652  for(int k=0; k<(int)state.size();k++) state[k]=false;
653  for(int i=0; i<16; i++) _mei[i].first->Reset();
654  }
655 
656  // Most of this is borrowed from HcalSimpleReconstructor, so thanks Jeremy/Phil
657 
658 
659  // int maxTS = -1;
660  float max_fC = 0;
661  float ta = 0;
662  m_coder = cond.getHcalCoder(detid);
663  m_ped = cond.getPedestal(detid);
664  m_shape = cond.getHcalShape(m_coder);
665  for (int TS = m_startTS; TS < m_endTS && TS < ledDigi.size(); TS++){
666  int capid = ledDigi[TS].capid();
667  int adc = ledDigi[TS].adc();
668  double fC = m_coder->charge(*m_shape,adc,capid);
669  ta = (fC - m_ped->getValue(capid));
670  //cout << "DetID: " << detid << " CapID: " << capid << " ADC: " << adc << " fC: " << fC << endl;
671  _mei[TS].first->Fill(ta);
672  _mei[10].first->AddBinContent(TS+1,ta); // This is average pulse, could probably do better (Profile?)
673  if(m_fitflag>1){
674  if(TS==m_startTS)_mei[11].first->Reset();
675  _mei[11].first->SetBinContent(TS+1,ta);
676  }
677  // keep track of max TS and max amplitude (in fC)
678  if (ta > max_fC){
679  max_fC = ta;
680  // maxTS = TS;
681  }
682  }
683 
684  // Now we have a sample with pedestals subtracted and in units of fC
685  // If we are using a weighted mean (m_fitflag = 2) to extraxt timing
686  // we now want to use Phil's timing correction. This is not necessary
687  // if we are performing a Landau fit (m_fitflag = 3)
688 
689  float sum=0.;
690  for(int i=0; i<10; i++)sum=sum+_mei[11].first->GetBinContent(i+1);
691  if(sum>100){
692  if(m_fitflag==2 || m_fitflag==4){
693  float timmean=_mei[11].first->GetMean(); // let's use Phil's way instead
694  float timmeancorr=BinsizeCorr(timmean);
695  _mei[12].first->Fill(timmeancorr);
696  }
697  _mei[16].first->Fill(_mei[11].first->Integral()); // Integrated charge (may be more usfull to convert to Energy first?)
698  if(m_fitflag==3 || m_fitflag==4){
699  _mei[11].first->Fit("landau","Q");
700  TF1 *fit = _mei[11].first->GetFunction("landau");
701  _mei[13].first->Fill(fit->GetParameter(1));
702  _mei[14].first->Fill(fit->GetParError(1));
703  _mei[15].first->Fill(fit->GetChisquare()/fit->GetNDF());
704  }
705  }
706 
707 }
708 
709 //-----------------------------------------------------------------------------
710 void HcalLedAnalysis::LedHOHists(const HcalDetId& detid, const HODataFrame& ledDigi, map<HcalDetId, map<int,LEDBUNCH> > &toolT, const HcalDbService& cond) {
711 
712  map<int,LEDBUNCH> _mei;
713  _meol = toolT.find(detid);
714  _mei = _meol->second;
715  // Rest the histos if we're at the end of a 'bunch'
716  if((evt-1)%m_nevtsample==0 && state[0]){
717  for(int k=0; k<(int)state.size();k++) state[k]=false;
718  for(int i=0; i<16; i++) _mei[i].first->Reset();
719  }
720 
721  // now we have the signal in fC, let's get rid of that darn pedestal
722  // Most of this is borrowed from HcalSimpleReconstructor, so thanks Jeremy/Phil
723 
724  // int maxTS = -1;
725  float max_fC = 0;
726  float ta = 0;
727  m_coder = cond.getHcalCoder(detid);
728  m_ped = cond.getPedestal(detid);
729  m_shape = cond.getHcalShape(m_coder);
730  for (int TS = m_startTS; TS < m_endTS && TS < ledDigi.size(); TS++){
731  int capid = ledDigi[TS].capid();
732  int adc = ledDigi[TS].adc();
733  double fC = m_coder->charge(*m_shape,adc,capid);
734  ta = (fC - m_ped->getValue(capid));
735  _mei[TS].first->Fill(ta);
736  _mei[10].first->AddBinContent(TS+1,ta); // This is average pulse, could probably do better (Profile?)
737  if(m_fitflag>1){
738  if(TS==m_startTS)_mei[11].first->Reset();
739  _mei[11].first->SetBinContent(TS+1,ta);
740  }
741  // keep track of max TS and max amplitude (in fC)
742  if (ta > max_fC){
743  max_fC = ta;
744  // maxTS = TS;
745  }
746  }
747 
748  // Now we have a sample with pedestals subtracted and in units of fC
749  // If we are using a weighted mean (m_fitflag = 2) to extraxt timing
750  // we now want to use Phil's timing correction. This is not necessary
751  // if we are performing a Landau fit (m_fitflag = 3)
752 
753  float sum=0.;
754  for(int i=0; i<10; i++)sum=sum+_mei[11].first->GetBinContent(i+1);
755  if(sum>100){
756  if(m_fitflag==2 || m_fitflag==4){
757  float timmean=_mei[11].first->GetMean(); // let's use Phil's way instead
758  float timmeancorr=BinsizeCorr(timmean);
759  _mei[12].first->Fill(timmeancorr);
760  }
761  _mei[16].first->Fill(_mei[11].first->Integral()); // Integrated charge (may be more usfull to convert to Energy first?)
762  if(m_fitflag==3 || m_fitflag==4){
763  _mei[11].first->Fit("landau","Q");
764  TF1 *fit = _mei[11].first->GetFunction("landau");
765  _mei[13].first->Fill(fit->GetParameter(1));
766  _mei[14].first->Fill(fit->GetParError(1));
767  _mei[15].first->Fill(fit->GetChisquare()/fit->GetNDF());
768  }
769  }
770 
771 }
772 
773 //-----------------------------------------------------------------------------
774 void HcalLedAnalysis::LedHFHists(const HcalDetId& detid, const HFDataFrame& ledDigi, map<HcalDetId, map<int,LEDBUNCH> > &toolT, const HcalDbService& cond) {
775 
776  map<int,LEDBUNCH> _mei;
777  _meol = toolT.find(detid);
778  _mei = _meol->second;
779  // Rest the histos if we're at the end of a 'bunch'
780  if((evt-1)%m_nevtsample==0 && state[0]){
781  for(int k=0; k<(int)state.size();k++) state[k]=false;
782  for(int i=0; i<16; i++) _mei[i].first->Reset();
783  }
784 
785  // now we have the signal in fC, let's get rid of that darn pedestal
786  // Most of this is borrowed from HcalSimpleReconstructor, so thanks Jeremy/Phil
787 
788  // int maxTS = -1;
789  float max_fC = 0;
790  float ta = 0;
791  m_coder = cond.getHcalCoder(detid);
792  m_ped = cond.getPedestal(detid);
793  m_shape = cond.getHcalShape(m_coder);
794  //cout << "New Digi!!!!!!!!!!!!!!!!!!!!!!" << endl;
795  for (int TS = m_startTS; TS < m_endTS && TS < ledDigi.size(); TS++){
796  int capid = ledDigi[TS].capid();
797  // BE CAREFUL: this is assuming peds are stored in ADCs
798  int adc = (int)(ledDigi[TS].adc() - m_ped->getValue(capid));
799  if (adc < 0){ adc = 0; } // to prevent negative adcs after ped subtraction, which should really only happen
800  // if you're using the wrong peds.
801  double fC = m_coder->charge(*m_shape,adc,capid);
802  //ta = (fC - m_ped->getValue(capid));
803  ta = fC;
804  //cout << "DetID: " << detid << " CapID: " << capid << " ADC: " << adc << " Ped: " << m_ped->getValue(capid) << " fC: " << fC << endl;
805  _mei[TS].first->Fill(ta);
806  _mei[10].first->AddBinContent(TS+1,ta); // This is average pulse, could probably do better (Profile?)
807  if(m_fitflag>1){
808  if(TS==m_startTS)_mei[11].first->Reset();
809  _mei[11].first->SetBinContent(TS+1,ta);
810  }
811 
812  // keep track of max TS and max amplitude (in fC)
813  if (ta > max_fC){
814  max_fC = ta;
815  // maxTS = TS;
816  }
817  }
818 
819  // Now we have a sample with pedestals subtracted and in units of fC
820  // If we are using a weighted mean (m_fitflag = 2) to extraxt timing
821  // we now want to use Phil's timing correction. This is not necessary
822  // if we are performing a Landau fit (m_fitflag = 3)
823 
824  float sum=0.;
825  for(int i=0; i<10; i++)sum=sum+_mei[11].first->GetBinContent(i+1);
826  if(sum>100){
827  if(m_fitflag==2 || m_fitflag==4){
828  float timmean=_mei[11].first->GetMean(); // let's use Phil's way instead
829  float timmeancorr=BinsizeCorr(timmean);
830  _mei[12].first->Fill(timmeancorr);
831  }
832  _mei[16].first->Fill(_mei[11].first->Integral()); // Integrated charge (may be more usfull to convert to Energy first?)
833  if(m_fitflag==3 || m_fitflag==4){
834  _mei[11].first->Fit("landau","Q");
835  TF1 *fit = _mei[11].first->GetFunction("landau");
836  _mei[13].first->Fill(fit->GetParameter(1));
837  _mei[14].first->Fill(fit->GetParError(1));
838  _mei[15].first->Fill(fit->GetChisquare()/fit->GetNDF());
839  }
840  }
841 
842 
843 
844 }
845 
846 
847 //-----------------------------------------------------------------------------
849 
850 // this is the bin size correction to be applied for laser data (from Andy),
851 // it comes from a pulse shape measured from TB04 data (from Jordan)
852 // This should eventually be replaced with the more thorough treatment from Phil
853 
854  float corrtime=0.;
855  static const float tstrue[32]={0.003, 0.03425, 0.06548, 0.09675, 0.128,
856  0.15925, 0.1905, 0.22175, 0.253, 0.28425, 0.3155, 0.34675, 0.378, 0.40925,
857  0.4405, 0.47175, 0.503, 0.53425, 0.5655, 0.59675, 0.628, 0.65925, 0.6905,
858  0.72175, 0.753, 0.78425, 0.8155, 0.84675, 0.878, 0.90925, 0.9405, 0.97175};
859  static const float tsreco[32]={-0.00422, 0.01815, 0.04409, 0.07346, 0.09799,
860  0.12192, 0.15072, 0.18158, 0.21397, 0.24865, 0.28448, 0.31973, 0.35449,
861  0.39208, 0.43282, 0.47244, 0.5105, 0.55008, 0.58827, 0.62828, 0.6717, 0.70966,
862  0.74086, 0.77496, 0.80843, 0.83472, 0.86044, 0.8843, 0.90674, 0.92982,
863  0.95072, 0.9726};
864 
865  int inttime=(int)time;
866  float restime=time-inttime;
867  for(int i=0; i<=32; i++) {
868  float lolim=0.; float uplim=1.; float tsdown; float tsup;
869  if(i>0){
870  lolim=tsreco[i-1];
871  tsdown=tstrue[i-1];
872  }
873  else tsdown=tstrue[31]-1.;
874  if(i<32){
875  uplim=tsreco[i];
876  tsup=tstrue[i];
877  }
878  else tsup=tstrue[0]+1.;
879  if(restime>=lolim && restime<uplim){
880  corrtime=(tsdown*(uplim-restime)+tsup*(restime-lolim)) / (uplim-lolim);
881  }
882  }
883  corrtime+=inttime;
884 
885  return corrtime;
886 }
887 //-----------------------------------------------------------------------------
888 
889 // Will try to implement Phil's time slew correction here at some point
890 
891 
892 //-----------------------------------------------------------------------------
893 void HcalLedAnalysis::ProcessCalibEvent(int fiberChan, HcalCalibDetId calibId, const HcalCalibDataFrame& digi){
894 
895  _meca = calibHists.find(calibId);
896  if (_meca==calibHists.end()){
897  // if histos for this channel do not exist, first create them
898  char name[1024];
901  std::string sector=(calibId.hcalSubdet()==HcalBarrel)?("HB"):
902  (calibId.hcalSubdet()==HcalEndcap)?("HE"):
903  (calibId.hcalSubdet()==HcalOuter)?("HO"):
904  (calibId.hcalSubdet()==HcalForward)?("HF"):"";
905  sprintf(name,"%s %+d iphi=%d %s",sector.c_str(),calibId.ieta(),calibId.iphi(),calibId.cboxChannelString().c_str());
906  prefix=name;
907  }
908 
909  sprintf(name,"%s Pin Diode Mean",prefix.c_str());
910  calibHists[calibId].avePulse = new TProfile(name,name,10,-0.5,9.5,0,1000);
911  sprintf(name,"%s Pin Diode Current Pulse",prefix.c_str());
912  calibHists[calibId].thisPulse = new TH1F(name,name,10,-0.5,9.5);
913  sprintf(name,"%s Pin Diode Integrated Pulse",prefix.c_str());
914  calibHists[calibId].integPulse = new TH1F(name,name,200,0,500);
915  }
916  else {
917  for (int i=m_startTS; i<digi.size() && i<=m_endTS; i++) {
918  calibHists[calibId].avePulse->Fill(i,digi.sample(i).adc());
919  calibHists[calibId].thisPulse->SetBinContent(i+1,digi.sample(i).adc());
920  }
921  calibHists[calibId].integPulse->Fill(calibHists[calibId].thisPulse->Integral());
922  }
923 }
924 
int adc(sample_type sample)
get the ADC sample (12 bits)
type
Definition: HCALResponse.h:21
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void LedHBHEHists(const HcalDetId &detid, const HBHEDataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const HcalDbService &cond)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
CalibDetType calibFlavor() const
get the flavor of this calibration detid
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:32
void LedSetup(const std::string &m_outputFileROOT)
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
void processLedEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalCalibDigiCollection &calib, const HcalDbService &cond)
std::vector< HcalCalibDataFrame >::const_iterator const_iterator
~HcalLedAnalysis()
Destructor.
int ieta() const
get the rbx name (if relevant)
HcalLedAnalysis(const edm::ParameterSet &ps)
Constructor.
const HcalDetId & id() const
Definition: HODataFrame.h:23
const HcalElectronicsId & elecId() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int size() const
total number of samples in the digi
int depth() const
get the tower depth
Definition: HcalDetId.h:40
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
std::string cboxChannelString() const
get the calibration box channel as a string (if relevant)
void SetupLEDHists(int id, const HcalDetId detid, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
void GetLedConst(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
void ProcessCalibEvent(int fiberChan, HcalCalibDetId calibId, const HcalCalibDataFrame &digi)
T sqrt(T t)
Definition: SSEVec.h:48
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
const HcalQIESample & sample(int i) const
access a sample
int size() const
total number of samples in the digi
Definition: HODataFrame.h:27
const HcalCalibDetId & id() const
int j
Definition: DBlmapReader.cc:9
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
int fiberChanId() const
get the fiber channel id (which of three channels on a readout fiber) (valid only for non-trigger-cha...
bool first
Definition: L1TdeRCT.cc:79
int k[5][pyjets_maxn]
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:34
int iphi() const
get the low-edge iphi (if relevant)
const_iterator end() const
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
float BinsizeCorr(float time)
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
void LedHFHists(const HcalDetId &detid, const HFDataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const HcalDbService &cond)
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
size_type size() const
void LedTrendings(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
tuple cout
Definition: gather_cfg.py:121
void LedHOHists(const HcalDetId &detid, const HODataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const HcalDbService &cond)
HcalSubdetector hcalSubdet() const
get the HcalSubdetector (if relevant)
const HcalDetId & id() const
Definition: HFDataFrame.h:22
const HcalPedestal * getPedestal(const HcalGenericDetId &fId) const
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const