ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HFmon2012/src/HcalRaddamAnalyzer.cc
Revision: 1.4
Committed: Wed Aug 15 15:31:01 2012 UTC (12 years, 8 months ago) by makbiyik
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +17 -69 lines
Error occurred while calculating annotation data.
Log Message:
crash fixed

File Contents

# Content
1 //
2 #include <memory>
3 #include <string>
4 #include <iostream>
5 #include <cmath>
6 #include <iosfwd>
7 #include <bitset>
8 #include <map>
9 #include <fstream>
10 #include <vector>
11 #include <TMath.h>
12 #include <TSystem.h>
13 #include <TROOT.h>
14 #include <TRint.h>
15
16 #include "TTree.h"
17 #include "TH1F.h"
18 #include "TH2D.h"
19 #include "TProfile.h"
20 #include "TProfile2D.h"
21 #include "FWCore/ServiceRegistry/interface/Service.h"
22 #include "CommonTools/UtilAlgos/interface/TFileService.h"
23 #include "FWCore/Framework/interface/MakerMacros.h"
24 #include "FWCore/Framework/interface/Frameworkfwd.h"
25 #include "FWCore/Framework/interface/Event.h"
26 #include "FWCore/ParameterSet/interface/ParameterSet.h"
27 #include "FWCore/Framework/interface/ESHandle.h"
28 #include "FWCore/Utilities/interface/Exception.h"
29 #include "FWCore/Framework/interface/Frameworkfwd.h"
30 #include "FWCore/Framework/interface/EDAnalyzer.h"
31 #include "FWCore/ServiceRegistry/interface/Service.h"
32 #include "FWCore/Framework/interface/EventSetup.h"
33 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
34 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h"
35 #include "DataFormats/DetId/interface/DetId.h"
36 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
37 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
38 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
39 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
40 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
41 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
42 #include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
43 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
44 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
45 #include "DataFormats/EcalDetId/interface/EBDetId.h"
46 #include "DataFormats/EcalDetId/interface/EEDetId.h"
47 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
48 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
49 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
50 #include "DataFormats/EcalDetId/interface/EBDetId.h"
51 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
52 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
53 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
54 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
55 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
56 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
57 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
58 #include "CondFormats/HcalObjects/interface/HcalQIECoder.h"
59 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
60
61 #include "DataFormats/HcalDigi/interface/HcalLaserDigi.h"
62 #include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h"
63 #include "TF1.h"
64
65
66 #define TRIG_DT 2
67 #define TRIG_RPC 3
68 #define TRIG_RPCDT 4
69 #define TRIG_HB 5
70 #define TRIG_CSC 6
71 #define TRIG_MUON 1
72 #define _TOWERS_ 57
73
74 const int MAXGEN = 10;
75 const int MAXRPC = 20;
76 const int MAXDTBX = 20;
77 const int MAXCSC = 20;
78 const int MAXGMT = 20;
79
80 using std::vector;
81 using std::cout;
82 using std::map;
83 using std::endl;
84 using namespace edm;
85
86 using namespace std;
87
88 /*
89 ////////////////////////////////////////////////////////////////////////////////////////////
90 ////////////////////////////////////////////////////////////////////////////////////////////
91 // Hardware working with ADC counts (Lin.ADC) (anything from HCAL reconstruction is not used)
92 // for trigger LookupTables 1 Gev == 5 lin.adc
93 // actually this old style adc2fC convertion is ADC->Lin.ADC
94 // Before this convertion table was in DB hardcore (now adc2fC/0.92, later - nobody knows...)
95 // To not work with "Black Box", better to have this conversion table here...
96 // "static" defines adc2fC as local variable (only inside this file...)
97 static const float adc2fC[128]={-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5, 10.5,11.5,12.5,
98 13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
99 64.5,59.5,64.5,69.5,74.5,79.5,84.5,89.5,94.5,99.5,104.5,109.5,114.5,119.5,
100 124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
101 292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
102 559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
103 1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
104 1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
105 3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
106 5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
107 ////////////////////////////////////////////////////////////////////////////////////////////
108 ////////////////////////////////////////////////////////////////////////////////////////////
109 */
110
111 static const float HFQIEConst = 2.6;
112 using namespace edm;
113
114 Double_t langaufun(Double_t *x, Double_t *par) {
115
116 //Fit parameters:
117 //par[0]=Width (scale) parameter of Landau density
118 //par[1]=Most Probable (MP, location) parameter of Landau density
119 //par[2]=Total area (integral -inf to inf, normalization constant)
120 //par[3]=Width (sigma) of convoluted Gaussian function
121 //
122 //In the Landau distribution (represented by the CERNLIB approximation),
123 //the maximum is located at x=-0.22278298 with the location parameter=0.
124 //This shift is corrected within this function, so that the actual
125 //maximum is identical to the MP parameter.
126
127 // Numeric constants
128 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
129 Double_t mpshift = -0.22278298; // Landau maximum location
130
131 // Control constants
132 Double_t np = 100.0; // number of convolution steps
133 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
134
135 // Variables
136 Double_t xx;
137 Double_t mpc;
138 Double_t fland;
139 Double_t sum = 0.0;
140 Double_t xlow,xupp;
141 Double_t step;
142 Double_t i;
143
144
145 // MP shift correction
146 mpc = par[1] - mpshift * par[0];
147
148 // Range of convolution integral
149 xlow = x[0] - sc * par[3];
150 xupp = x[0] + sc * par[3];
151
152 step = (xupp-xlow) / np;
153
154 // Convolution integral of Landau and Gaussian by sum
155 for(i=1.0; i<=np/2; i++) {
156 xx = xlow + (i-.5) * step;
157 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
158 sum += fland * TMath::Gaus(x[0],xx,par[3]);
159
160 xx = xupp - (i-.5) * step;
161 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
162 sum += fland * TMath::Gaus(x[0],xx,par[3]);
163 }
164
165 return (par[2] * step * sum * invsq2pi / par[3]);
166 }
167 ////////////////////
168 class HcalRaddamAnalyzer : public edm::EDAnalyzer {
169 public:
170 explicit HcalRaddamAnalyzer (const edm::ParameterSet&);
171 ~HcalRaddamAnalyzer();
172
173
174 private:
175 virtual void analyze(const edm::Event&, const edm::EventSetup&);
176 virtual void endJob() ;
177 //////////////////////////////////////////////////////////////////////////////////////
178 void processHCALEvent();
179
180 int evnt;
181 int hbevnt;
182 int ishb;
183 int local_event;
184 int global_event;
185 int run_number;
186 double TrTreshold1;
187 double TrTreshold2;
188 double TrTreshold3;
189 double ADCTreshold;
190 int EventsToStore;
191 int EventsStored;
192 int TPdigiTS;
193 double HF_Treshold;
194 double adcthr;
195 int TriggerType;
196 int TriggerTypeM;
197 int ADCdigiTS;
198 double DHB_Treshold;
199 double DHE_Treshold;
200 double DHO_Treshold;
201 double DHFL_Treshold;
202 double DHFS_Treshold;
203
204 double HB_Treshold;
205 double HE_Treshold;
206 double HO_Treshold;
207 double HFL_Treshold;
208 double HFS_Treshold;
209 double dsigma;
210 double rsigma;
211 int pnoise;
212 int psnoise;
213 int ptnoise;
214 int pfnoise;
215
216
217 int ihbhit;
218 int ihehit;
219 int ihohit;
220 int ihfhit;
221 int iebhit;
222 int ieehit;
223 int calohit;
224
225 float RecEEieta[200000];
226 float RecEEiphi[200000];
227 float RecEBenergy[200000];
228 float RecEBieta[200000];
229 float RecEBiphi[200000];
230 ///xxxxxxxxxx
231
232 int ico;
233 int icb;
234 int icf;
235 int ice;
236 int nevt;
237
238 float enhfphi[4000];
239 float enhfeta[4000];
240
241 float enhf[4000];
242
243 float menhf[4000];
244
245
246
247 float mtimehf[4000];
248 float timehf[4000];
249
250 float enhfdep[4000];
251
252
253 //laser part
254
255 edm::InputTag inputLabelLaser_;
256 TH1D *numChannels_;
257 TH1D *trigger_;
258 TH1D *clockOptosync_;
259 TH1D *rawOptosync_ ;
260 TH1D *rawOptosync_Trigger_ ;
261
262 TProfile *tratios[_TOWERS_];
263 //TProfile *tshapes[_TOWERS_];
264 TH1D *tshapes[_TOWERS_];
265 TH1D *tsratios[_TOWERS_];
266
267 bool LASERON;
268 int radfib1;
269 int radfib2;
270 int ieta;
271 int iphi;
272 int dep;
273
274 //////////////////////////////////////////////////////////////////////////////////////
275
276 // Some common plots to estimate quality of the data
277
278 TH1D *hfRaw;
279 TH1D *hfEn;
280
281 TF1 *g1;
282 TF1 *g2;
283 TF1 *func;
284 // some common TP plots
285
286 TH2D *ratio_m30_15_2;
287 TH2D *ratio_m30_35_1;
288 TH2D *ratio_m30_51_2;
289 TH2D *ratio_m30_71_1;
290 TH2D *ratio_m32_15_1;
291 TH2D *ratio_m32_35_2;
292 TH2D *ratio_m32_51_1;
293 TH2D *ratio_m32_71_2;
294 TH2D *ratio_m34_15_2;
295 TH2D *ratio_m34_35_1;
296 TH2D *ratio_m34_51_2;
297 TH2D *ratio_m34_71_1;
298 TH2D *ratio_m36_15_1;
299 TH2D *ratio_m36_35_2;
300 TH2D *ratio_m36_51_1;
301 TH2D *ratio_m36_71_2;
302 TH2D *ratio_m38_15_2;
303 TH2D *ratio_m38_35_1;
304 TH2D *ratio_m38_51_2;
305 TH2D *ratio_m38_71_1;
306 TH2D *ratio_m40_15_1;
307 TH2D *ratio_m40_35_2;
308 TH2D *ratio_m40_51_1;
309 TH2D *ratio_m40_71_2;
310 TH2D *ratio_m41_15_2;
311 TH2D *ratio_m41_35_1;
312 TH2D *ratio_m41_51_2;
313 TH2D *ratio_m41_71_1;
314 TH2D *ratio_30_1_2 ;
315 TH2D *ratio_30_21_1 ;
316 TH2D *ratio_30_37_2 ;
317 TH2D *ratio_30_57_1 ;
318 TH2D *ratio_32_1_1 ;
319 TH2D *ratio_32_21_2 ;
320 TH2D *ratio_32_37_1 ;
321 TH2D *ratio_32_57_2 ;
322 TH2D *ratio_34_1_2 ;
323 TH2D *ratio_34_21_1 ;
324 TH2D *ratio_34_37_2 ;
325 TH2D *ratio_34_57_1 ;
326 TH2D *ratio_36_1_1 ;
327 TH2D *ratio_36_21_2 ;
328 TH2D *ratio_36_37_1 ;
329 TH2D *ratio_36_57_2 ;
330 TH2D *ratio_38_1_2 ;
331 TH2D *ratio_38_21_1 ;
332 TH2D *ratio_38_37_2 ;
333 TH2D *ratio_38_57_1 ;
334 TH2D *ratio_40_19_2 ;
335 TH2D *ratio_40_35_1 ;
336 TH2D *ratio_40_55_2 ;
337 TH2D *ratio_40_71_1 ;
338 TH2D *ratio_41_19_1 ;
339 TH2D *ratio_41_35_2 ;
340 TH2D *ratio_41_55_1 ;
341 TH2D *ratio_41_71_2 ;
342
343 ////
344
345 ////
346
347
348
349 TH1D *dthfRaw;
350 TH1D *dthfEn;
351 TH1D *dthfEnshort;
352
353 TH1D *dthfRawshort;
354 TH1D *dthfEnlong;
355
356 TH1D *dthfRawlong;
357 TH1D *dthfpedsadclinRawlong;
358 TH1D *dthfpedsadclinRawshort;
359 TH1D *dthfpedsadclinRaw;
360
361
362
363
364
365 //////////////////////////////////////////////////////////////////////////////////////
366
367 std::string textoutputFileName;
368 std::ofstream textoutTextFile;
369
370 TTree* tree_;
371
372 TTree* fTree;
373 int fRunNo;
374 int fEventNo;
375 int fNumDigis;
376 int fCharge[1728][10];
377 int fCharge_fc[1728][10];
378 int fEta[1728];
379 int fPhi[1728];
380 int fDepth[1728];
381
382 int tNumLaser;
383 int tHitChannel[1728];
384 float tHitNS[1728];
385
386 float tClockOpto;
387 float tRawOpto;
388 float tTrig;
389 int fPedestal[1728][10];
390 int fPedestal_fc[1728][10];
391
392 int fPedestalDB[1728];
393 int fPedestalDB_fc[1728];
394
395
396 //////////////////////////////////////////////////////////////////////////////////////
397 // to not loop over all digi collecections several times
398 // we can fill some event data "structure" to use it outside "digi loop"
399 // it makes code possibly slower??, but for offline it's not so important...
400
401 //HB: eta range: -16..-1, 1..16 , phi range 1..72, depth range 1..2
402 //HE: eta range: -29..-16, 16..29 , phi range 1..72, depth range 1..3
403 //HF: eta range: -41..-29, 29..41 , phi range 1..72, depth range 1..2
404 //HO: eta range: -15..-1, 1..15 , phi range 1..72, depth range 4
405 float hbhe_adc[61][73][2][10];
406 float hf_adc [83][73][2][10];
407 float ho_adc [31][73][10];
408 float tp_digis[83][73][10];
409 bool is_hbhe [61][73][2];
410 bool is_hf [83][73][2];
411 bool is_ho [31][73];
412 bool is_tp [83][73];
413 void clearEventData();
414 void set_hbhe_adc(int eta,int phi,int depth,float *val);
415 void set_hf_adc(int eta,int phi,int depth,float *val);
416 void set_ho_adc(int eta,int phi,float *val);
417 void set_tp_digi(int eta,int phi,float *val);
418 bool isset_hbhe(int eta,int phi,int depth);
419 bool isset_hf(int eta,int phi,int depth);
420 bool isset_ho(int eta,int phi);
421 bool isset_tp(int eta,int phi);
422 float *get_hbhe_adc(int eta,int phi,int depth);
423 float *get_hf_adc(int eta,int phi,int depth);
424 float *get_ho_adc(int eta,int phi);
425 float *get_tp_digi(int eta,int phi);
426 float na[100];
427 float nb[100];
428 float nc[100];
429 float nd[100];
430
431 // Extra analysis
432
433
434 };
435 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
436 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
437 void HcalRaddamAnalyzer ::clearEventData(){
438
439 memset(hf_adc, 0,(sizeof(float)*83*73*2*10));
440
441 memset(is_hf, 0,(sizeof(bool)*83*73*2));
442 for(int i=0;i<101;i++) {
443 na[i]=0;
444 nb[i]=0;
445 nc[i]=0;
446 nd[i]=0;
447 }
448 }
449
450 void HcalRaddamAnalyzer ::set_hf_adc(int eta,int phi,int depth,float *val){
451 if(eta<-41 || eta>41 || (eta>-29 && eta<29) || phi <1 || phi>72 || depth<1 || depth>2) return;
452 for(int i=0;i<10;i++) hf_adc[eta+41][phi][depth][i]=val[i];
453 is_hf[eta+41][phi][depth]=true;
454 }
455
456
457
458 bool HcalRaddamAnalyzer ::isset_hf(int eta,int phi,int depth) { return is_hf[eta+41][phi][depth]; }
459
460 float *HcalRaddamAnalyzer ::get_hf_adc(int eta,int phi,int depth) { return hf_adc[eta+41][phi][depth]; }
461
462 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
463 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
464
465 HcalRaddamAnalyzer::HcalRaddamAnalyzer(const edm::ParameterSet& iConfig){
466 local_event=0;
467 evnt=0;
468 hbevnt=0;
469 ishb=0;
470 EventsStored=0;
471 TrTreshold1 = iConfig.getUntrackedParameter<double>("TriggerTreshold1",5.0);
472 TrTreshold2 = iConfig.getUntrackedParameter<double>("TriggerTreshold2",10.0);
473 TrTreshold3 = iConfig.getUntrackedParameter<double>("TriggerTreshold3",20.0);
474 ADCTreshold = iConfig.getUntrackedParameter<double>("ADCTreshold",20.0);
475 EventsToStore = (int)iConfig.getUntrackedParameter<double>("EventsToStore",100.0);
476 TPdigiTS = (int)iConfig.getUntrackedParameter<double>("TPdigiTS",3);
477 ADCdigiTS = (int)iConfig.getUntrackedParameter<double>("ADCdigiTS",5);
478 HF_Treshold = iConfig.getUntrackedParameter<double>("HF_Treshold",0);
479 adcthr = iConfig.getUntrackedParameter<double>("adcthr",0);
480 DHB_Treshold = iConfig.getUntrackedParameter<double>("HB_Treshold",0);
481 DHE_Treshold = iConfig.getUntrackedParameter<double>("HE_Treshold",0);
482 DHO_Treshold = iConfig.getUntrackedParameter<double>("HO_Treshold",0);
483 DHFS_Treshold = iConfig.getUntrackedParameter<double>("HFS_Treshold",0);
484 DHFL_Treshold = iConfig.getUntrackedParameter<double>("HFL_Treshold",0);
485
486 HB_Treshold = iConfig.getUntrackedParameter<double>("HB_Treshold",0);
487 HE_Treshold = iConfig.getUntrackedParameter<double>("HE_Treshold",0);
488 HO_Treshold = iConfig.getUntrackedParameter<double>("HO_Treshold",0);
489 HFS_Treshold = iConfig.getUntrackedParameter<double>("HFS_Treshold",0);
490 HFL_Treshold = iConfig.getUntrackedParameter<double>("HFL_Treshold",0);
491
492 rsigma = iConfig.getUntrackedParameter<double>("rsigma",1);
493 dsigma = iConfig.getUntrackedParameter<double>("dsigma",1);
494 pnoise = (int)iConfig.getUntrackedParameter<double>("pnoise",1);
495 psnoise = (int)iConfig.getUntrackedParameter<double>("psnoise",4);
496 ptnoise = (int)iConfig.getUntrackedParameter<double>("ptnoise",2);
497 pfnoise = (int)iConfig.getUntrackedParameter<double>("pfnoise",3);
498 radfib1 = iConfig.getUntrackedParameter<int>("radfib1",4);
499 radfib2 = iConfig.getUntrackedParameter<int>("radfib2",4);
500 //m_GTdigi = iConfig.getParameter<string>("gtDigis");
501 textoutputFileName=iConfig.getParameter<std::string>("textoutputFileName");
502 inputLabelLaser_ = iConfig.getParameter<edm::InputTag>("hcalLaserLabel");
503 LASERON = iConfig.getParameter<bool>("LASERON");
504
505
506 char str[100];
507
508 edm::Service<TFileService> fs;
509 // sprintf(str,"run%06i.root",NumRun);
510
511
512 TFileDirectory subDir = fs->mkdir( "HCAL_ADC_Plots" );
513 //Laser part
514 TFileDirectory subDir7 = fs->mkdir("LASERPART");
515 numChannels_ = subDir7.make<TH1D>( "TDC Number of Channels", "TDC Number of Channels", 4, -0.5, 3.5 );
516 trigger_ = subDir7.make<TH1D>( "TDC Trigger", "TDC Trigger", 40,0, 0 ); //40, 12715, 12747 );
517 clockOptosync_ = subDir7.make<TH1D>( "TDC Clock Optosync", "TDC Clock Optosync", 40,0, 0 ); //265, 13930, 14142 );
518 rawOptosync_ = subDir7.make<TH1D>( "TDC Raw Optosync", "TDC Raw Optosync", 40,0, 0 ); //265, 13820, 14032 );
519 rawOptosync_Trigger_ = subDir7.make<TH1D>( "TDC Raw Optosync Minus Trigger", "TDC Raw Optosync Minus Trigger", 40,9, 0 ); //125, 1099, 1199 );
520 //ratio =subDir7.make<TH2D>("ratio"," ratio",84,-42,42,74,0,74);
521 ratio_m30_15_2 =subDir7.make<TH2D>("ratio_-30_15_2","ratio_-30_15_2",1000,1099, 1199,1000,0, 110);
522 ratio_m30_35_1 =subDir7.make<TH2D>("ratio_-30_35_1","ratio_-30_35_1",1000,1099, 1199,1000,0, 100);
523 ratio_m30_51_2 =subDir7.make<TH2D>("ratio_-30_51_2","ratio_-30_51_2",1000,1099, 1199,1000,0, 100);
524 ratio_m30_71_1 =subDir7.make<TH2D>("ratio_-30_71_1","ratio_-30_71_1",1000,1099, 1199,1000,0, 100);
525 ratio_m32_15_1 =subDir7.make<TH2D>("ratio_-32_15_1","ratio_-32_15_1",1000,1099, 1199,1000,0, 100);
526 ratio_m32_35_2 =subDir7.make<TH2D>("ratio_-32_35_2","ratio_-32_35_2",1000,1099, 1199,1000,0, 100);
527 ratio_m32_51_1 =subDir7.make<TH2D>("ratio_-32_51_1","ratio_-32_51_1",1000,1099, 1199,1000,0, 100);
528 ratio_m32_71_2 =subDir7.make<TH2D>("ratio_-32_71_2","ratio_-32_71_2",1000,1099, 1199,1000,0, 100);
529 ratio_m34_15_2 =subDir7.make<TH2D>("ratio_-34_15_2","ratio_-34_15_2",1000,1099, 1199,1000,0, 100);
530 ratio_m34_35_1 =subDir7.make<TH2D>("ratio_-34_35_1","ratio_-34_35_1",1000,1099, 1199,1000,0, 100);
531 ratio_m34_51_2 =subDir7.make<TH2D>("ratio_-34_51_2","ratio_-34_51_2",1000,1099, 1199,1000,0, 100);
532 ratio_m34_71_1 =subDir7.make<TH2D>("ratio_-34_71_1","ratio_-34_71_1",1000,1099, 1199,1000,0, 100);
533 ratio_m36_15_1 =subDir7.make<TH2D>("ratio_-36_15_1","ratio_-36_15_1",1000,1099, 1199,1000,0, 100);
534 ratio_m36_35_2 =subDir7.make<TH2D>("ratio_-36_35_2","ratio_-36_35_2",1000,1099, 1199,1000,0, 100);
535 ratio_m36_51_1 =subDir7.make<TH2D>("ratio_-36_51_1","ratio_-36_51_1",1000,1099, 1199,1000,0, 100);
536 ratio_m36_71_2 =subDir7.make<TH2D>("ratio_-36_71_2","ratio_-36_71_2",1000,1099, 1199,1000,0, 100);
537 ratio_m38_15_2 =subDir7.make<TH2D>("ratio_-38_15_2","ratio_-38_15_2",1000,1099, 1199,1000,0, 100);
538 ratio_m38_35_1 =subDir7.make<TH2D>("ratio_-38_35_1","ratio_-38_35_1",1000,1099, 1199,1000,0, 100);
539 ratio_m38_51_2 =subDir7.make<TH2D>("ratio_-38_51_2","ratio_-38_51_2",1000,1099, 1199,1000,0, 100);
540 ratio_m38_71_1 =subDir7.make<TH2D>("ratio_-38_71_1","ratio_-38_71_1",1000,1099, 1199,1000,0, 100);
541 ratio_m40_15_1 =subDir7.make<TH2D>("ratio_-40_15_1","ratio_-40_15_1",1000,1099, 1199,1000,0, 100);
542 ratio_m40_35_2 =subDir7.make<TH2D>("ratio_-40_35_2","ratio_-40_35_2",1000,1099, 1199,1000,0, 100);
543 ratio_m40_51_1 =subDir7.make<TH2D>("ratio_-40_51_1","ratio_-40_51_1",1000,1099, 1199,1000,0, 100);
544 ratio_m40_71_2 =subDir7.make<TH2D>("ratio_-40_71_2","ratio_-40_71_2",1000,1099, 1199,1000,0, 100);
545 ratio_m41_15_2 =subDir7.make<TH2D>("ratio_-41_15_2","ratio_-41_15_2",1000,1099, 1199,1000,0, 100);
546 ratio_m41_35_1 =subDir7.make<TH2D>("ratio_-41_35_1","ratio_-41_35_1",1000,1099, 1199,1000,0, 100);
547 ratio_m41_51_2 =subDir7.make<TH2D>("ratio_-41_51_2","ratio_-41_51_2",1000,1099, 1199,1000,0, 100);
548 ratio_m41_71_1 =subDir7.make<TH2D>("ratio_-41_71_1","ratio_-41_71_1",1000,1099, 1199,1000,0, 100);
549 ratio_30_1_2 =subDir7.make<TH2D>("ratio_30_1_2 ","ratio_30_1_2 ",1000,1099, 1199,1000,0, 100);
550 ratio_30_21_1 =subDir7.make<TH2D>("ratio_30_21_1","ratio_30_21_1",1000,1099, 1199,1000,0, 100);
551 ratio_30_37_2 =subDir7.make<TH2D>("ratio_30_37_2","ratio_30_37_2",1000,1099, 1199,1000,0, 100);
552 ratio_30_57_1 =subDir7.make<TH2D>("ratio_30_57_1","ratio_30_57_1",1000,1099, 1199,1000,0, 100);
553 ratio_32_1_1 =subDir7.make<TH2D>("ratio_32_1_1 ","ratio_32_1_1 ",1000,1099, 1199,1000,0, 100);
554 ratio_32_21_2 =subDir7.make<TH2D>("ratio_32_21_2","ratio_32_21_2",1000,1099, 1199,1000,0, 100);
555 ratio_32_37_1 =subDir7.make<TH2D>("ratio_32_37_1","ratio_32_37_1",1000,1099, 1199,1000,0, 100);
556 ratio_32_57_2 =subDir7.make<TH2D>("ratio_32_57_2","ratio_32_57_2",1000,1099, 1199,1000,0, 100);
557 ratio_34_1_2 =subDir7.make<TH2D>("ratio_34_1_2 ","ratio_34_1_2 ",1000,1099, 1199,1000,0, 100);
558 ratio_34_21_1 =subDir7.make<TH2D>("ratio_34_21_1","ratio_34_21_1",1000,1099, 1199,1000,0, 100);
559 ratio_34_37_2 =subDir7.make<TH2D>("ratio_34_37_2","ratio_34_37_2",1000,1099, 1199,1000,0, 100);
560 ratio_34_57_1 =subDir7.make<TH2D>("ratio_34_57_1","ratio_34_57_1",1000,1099, 1199,1000,0, 100);
561 ratio_36_1_1 =subDir7.make<TH2D>("ratio_36_1_1 ","ratio_36_1_1 ",1000,1099, 1199,1000,0, 100);
562 ratio_36_21_2 =subDir7.make<TH2D>("ratio_36_21_2","ratio_36_21_2",1000,1099, 1199,1000,0, 100);
563 ratio_36_37_1 =subDir7.make<TH2D>("ratio_36_37_1","ratio_36_37_1",1000,1099, 1199,1000,0, 100);
564 ratio_36_57_2 =subDir7.make<TH2D>("ratio_36_57_2","ratio_36_57_2",1000,1099, 1199,1000,0, 100);
565 ratio_38_1_2 =subDir7.make<TH2D>("ratio_38_1_2 ","ratio_38_1_2 ",1000,1099, 1199,1000,0, 100);
566 ratio_38_21_1 =subDir7.make<TH2D>("ratio_38_21_1","ratio_38_21_1",1000,1099, 1199,1000,0, 100);
567 ratio_38_37_2 =subDir7.make<TH2D>("ratio_38_37_2","ratio_38_37_2",1000,1099, 1199,1000,0, 100);
568 ratio_38_57_1 =subDir7.make<TH2D>("ratio_38_57_1","ratio_38_57_1",1000,1099, 1199,1000,0, 100);
569 ratio_40_19_2 =subDir7.make<TH2D>("ratio_40_19_2","ratio_40_19_2",1000,1099, 1199,1000,0, 100);
570 ratio_40_35_1 =subDir7.make<TH2D>("ratio_40_35_1","ratio_40_35_1",1000,1099, 1199,1000,0, 100);
571 ratio_40_55_2 =subDir7.make<TH2D>("ratio_40_55_2","ratio_40_55_2",1000,1099, 1199,1000,0, 100);
572 ratio_40_71_1 =subDir7.make<TH2D>("ratio_40_71_1","ratio_40_71_1",1000,1099, 1199,1000,0, 100);
573 ratio_41_19_1 =subDir7.make<TH2D>("ratio_41_19_1","ratio_41_19_1",1000,1099, 1199,1000,0, 100);
574 ratio_41_35_2 =subDir7.make<TH2D>("ratio_41_35_2","ratio_41_35_2",1000,1099, 1199,1000,0, 100);
575 ratio_41_55_1 =subDir7.make<TH2D>("ratio_41_55_1","ratio_41_55_1",1000,1099, 1199,1000,0, 100);
576 ratio_41_71_2 =subDir7.make<TH2D>("ratio_41_71_2","ratio_41_71_2",1000,1099, 1199,1000,0, 100);
577
578 for (int i=1; i<29 ; i++) {
579 sprintf(str," HFP Raddam_Channel %d bx(%d)/bx(%d)_vs_phase",i,radfib1,radfib1+1);
580 tratios[i] = subDir7.make<TProfile>( str, str, 50,-10.5,50.*25./32.-10.5);
581 tratios[i]->GetXaxis()->SetTitle("Phase, ns");
582 tratios[i]->GetYaxis()->SetTitle("Ratio (S2/S1)");
583 tratios[i]->SetMarkerColor(4);
584 tratios[i]->SetMarkerStyle(24);
585 tratios[i]->SetMarkerSize(0.5);
586 tratios[i]->SetLineWidth(1);
587 tratios[i]->SetLineStyle(1);
588 tratios[i]->SetLineColor(4);
589 }
590 for (int i=29; i<_TOWERS_ ; i++) {
591 sprintf(str," HFM Raddam_Channel %d bx(%d)/bx(%d)_vs_phase",i,radfib2,radfib2+1);
592 tratios[i] = subDir7.make<TProfile>( str, str, 50,-10.5,50.*25./32.-10.5);
593 tratios[i]->GetXaxis()->SetTitle("Phase, ns");
594 tratios[i]->GetYaxis()->SetTitle("Ratio (S2/S1)");
595 tratios[i]->SetMarkerColor(4);
596 tratios[i]->SetMarkerStyle(24);
597 tratios[i]->SetMarkerSize(0.5);
598 tratios[i]->SetLineWidth(1);
599 tratios[i]->SetLineStyle(1);
600 tratios[i]->SetLineColor(4);
601 }
602 ///shapes:
603 for (int i=1; i<29 ; i++) {
604 sprintf(str," HFP Pulse Shape Raddam_Channel %d ",i);
605 tshapes[i] = subDir7.make<TH1D>( str, str,10,0.,10.);
606 tshapes[i]->GetXaxis()->SetTitle("TS");
607 tshapes[i]->GetYaxis()->SetTitle("fC");
608 tshapes[i]->SetMarkerColor(4);
609 tshapes[i]->SetMarkerStyle(24);
610 tshapes[i]->SetMarkerSize(0.5);
611 tshapes[i]->SetLineWidth(1);
612 tshapes[i]->SetLineStyle(1);
613 tshapes[i]->SetLineColor(4);
614 }
615 for (int i=29; i<_TOWERS_ ; i++) {
616 sprintf(str," HFM Pulse Shape Raddam_Channel %d",i);
617 tshapes[i] = subDir7.make<TH1D>( str, str, 10,0.,10.);
618 tshapes[i]->GetXaxis()->SetTitle("TS");
619 tshapes[i]->GetYaxis()->SetTitle("fC");
620 tshapes[i]->SetMarkerColor(4);
621 tshapes[i]->SetMarkerStyle(24);
622 tshapes[i]->SetMarkerSize(0.5);
623 tshapes[i]->SetLineWidth(1);
624 tshapes[i]->SetLineStyle(1);
625 tshapes[i]->SetLineColor(4);
626 }
627 ///
628
629 for (int i=1; i<29 ; i++) {
630 sprintf(str," HFP Raddam_Channel %d bx(%d)/bx(%d) from root ",i,radfib1,radfib1+1);
631 tsratios[i] = subDir7.make<TH1D>( str, str, 100,-1,9);
632 tsratios[i]->GetXaxis()->SetTitle("Ratio (S2/S1)");
633 tsratios[i]->GetYaxis()->SetTitle("");
634 tsratios[i]->SetMarkerColor(4);
635 tsratios[i]->SetMarkerStyle(24);
636 tsratios[i]->SetMarkerSize(0.5);
637 tsratios[i]->SetLineWidth(1);
638 tsratios[i]->SetLineStyle(1);
639 tsratios[i]->SetLineColor(4);
640 }
641 for (int i=29; i<_TOWERS_ ; i++) {
642 sprintf(str," HFM Raddam_Channel %d bx(%d)/bx(%d) from root",i,radfib2,radfib2+1);
643 tsratios[i] = subDir7.make<TH1D>( str, str,100,-1,9);
644 tsratios[i]->GetXaxis()->SetTitle("Ratio (S2/S1)");
645 tsratios[i]->GetYaxis()->SetTitle("");
646 tsratios[i]->SetMarkerColor(4);
647 tsratios[i]->SetMarkerStyle(24);
648 tsratios[i]->SetMarkerSize(0.5);
649 tsratios[i]->SetLineWidth(1);
650 tsratios[i]->SetLineStyle(1);
651 tsratios[i]->SetLineColor(4);
652 }
653 ///
654 //
655
656
657 ////////////
658 if ( textoutputFileName.size() != 0 ) {
659 cout << "HF raddam text output will be saved to " << textoutputFileName.c_str() << endl;
660 textoutTextFile.open(textoutputFileName.c_str());
661 //textoutTextFile<<"tChannel\tRatio_phase\tError\tRatio_s2_s1\tError "<<std::endl;
662 textoutTextFile<<"tChannel\tRatio_s2_s1 "<<std::endl;
663 }
664
665 tree_ = fs->make<TTree>("t","t");
666
667 tree_->Branch("icf", &icf, "icf/I");
668 tree_->Branch("enhfphi", enhfphi, "enhfphi[icf]/F");
669 tree_->Branch("enhfeta", enhfeta, "enhfeta[icf]/F");
670 tree_->Branch("enhfdep", enhfdep, "enhfdep[icf]/F");
671 tree_->Branch("enhf", enhf, "enhf[icf]/F");
672 tree_->Branch("timehf", timehf, "timehf[icf]/F");
673 tree_->Branch("mtimehf", mtimehf, "mtimehf[icf]/F");
674 tree_->Branch("ihfhit", &ihfhit, "ihfhit/I");
675
676
677 tree_->Branch("ClockOpto", &tClockOpto, "ClockOpto/F");
678 tree_->Branch("RawOpto", &tRawOpto, "RawOpto/F");
679 tree_->Branch("Trig", &tTrig, "Trig/F");
680 tree_->Branch("NumDigis", &fNumDigis, "NumDigis/I");
681 tree_->Branch("Eta", fEta, "Eta[NumDigis]/I");
682 tree_->Branch("Phi", fPhi, "Phi[NumDigis]/I");
683 tree_->Branch("Depth", fDepth, "Depth[NumDigis]/I");
684 tree_->Branch("Charge", fCharge, "Charge[NumDigis][10]/I");
685 tree_->Branch("ChargeFC", fCharge_fc, "ChargeFC[NumDigis][10]/I");
686 tree_->Branch("PedestalFC", fPedestal_fc, "PedestalFC[NumDigis][10]/I");
687 tree_->Branch("Pedestal", fPedestal, "Pedestal[NumDigis][10]/I");
688 tree_->Branch("PedestalDBFC", fPedestalDB_fc, "PedestalFCDB[NumDigis][10]/I");
689 tree_->Branch("PedestalDB", fPedestalDB, "PedestalDB[NumDigis][10]/I");
690
691 }
692
693 HcalRaddamAnalyzer::~HcalRaddamAnalyzer(){
694 }
695
696
697 void HcalRaddamAnalyzer ::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
698 int HFcnt=0,eta,phi,depth,nTS,phase=0,tphase=0;
699 float data[20];
700
701 edm::ESHandle<HcalDbService> conditions;
702 iSetup.get<HcalDbRecord>().get(conditions);
703
704
705 clearEventData();
706 run_number=iEvent.id().run();
707 global_event=iEvent.id().event();
708
709 //cout<<"run= "<<run_number<<"event ======== "<<global_event<<endl;
710
711 //if(!shape_) shape_ = COND->getHcalShape();
712 using namespace edm;
713
714 //cout<<"run= "<<run_number<<"event laser starts= "<<global_event<<endl;
715 // laser part
716 if(LASERON){
717 edm::Handle<HcalLaserDigi> laserDigi;
718 iEvent.getByType(laserDigi);
719 //cout<<"run= "<<run_number<<"event laserDigi------- starts= "<<global_event<<endl;
720 // HcalLaserDigi laserDigi= *laser_digi;
721 //numChannels_->Fill( laserDigi.tdcHits() );
722
723 tClockOpto = -99;
724 tTrig = -99;
725 tRawOpto = -99;
726
727 for( uint i = 0; i < laserDigi->tdcHits(); ++i ) {
728 if( laserDigi->hitChannel(i) == 1 && tClockOpto < 0 ) {
729 tClockOpto = laserDigi->hitNS(i);
730 clockOptosync_->Fill( tClockOpto );
731 }
732 if( laserDigi->hitChannel(i) == 2 && tTrig < 0 ) {
733 tTrig = laserDigi->hitNS(i);
734 trigger_->Fill( tTrig );
735 }
736 if( laserDigi->hitChannel(i) == 3 && tRawOpto < 0 ) {
737 tRawOpto = laserDigi->hitNS(i);
738 rawOptosync_->Fill( tRawOpto );
739 }
740 }
741
742 // cout<<"run= "<<run_number<<"event ==middle==== "<<global_event<<endl;
743
744 if( tRawOpto > 0 && tTrig > 0 ) rawOptosync_Trigger_->Fill( tRawOpto - tTrig );
745 phase=tRawOpto - tTrig ;
746 tphase=phase-1140;
747 // cout<<"phase in the laser digi = "<< phase <<endl;
748 }
749
750 // cout<<"run= "<<run_number<<"event ===end of laser "<<global_event<<endl;
751
752 //end laser
753
754 try{
755 edm::Handle<HFDigiCollection> hf;
756 iEvent.getByType(hf);
757 icf=(int)hf->size();
758 int jf=0;
759 for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
760 eta=digi->id().ieta();
761 phi=digi->id().iphi();
762 depth=digi->id().depth();
763 nTS=digi->size();
764
765 fEta[jf]=digi->id().ieta();
766 fPhi[jf]=digi->id().iphi();
767 fDepth[jf]=digi->id().depth();
768
769 const HFDataFrame Fram = (const HFDataFrame)(*digi);
770
771 HcalDetId id = Fram.id();
772 const HcalCalibrations& calibrations=conditions->getHcalCalibrations(id);
773
774 float Energy=0;
775
776 //cout<<"eta== "<<eta<<" phi== "<<phi<<" depth= "<<depth<<endl;
777 float EnergY=0;
778 float raw=0; float rawshort=0; float rawlong=0;
779 float pslADCraw= 0; float pslADCrawlong= 0; float pslADCrawshort= 0;
780 float ts =0; float bs=0;
781 float signal = 0;
782 //cout<<"eta== "<<eta<<" phi== "<<phi<<" depth========== 3.nd "<<depth<<endl;
783
784
785 for(int i=0;i<nTS;i++){
786
787 double pedestal = calibrations.pedestal(Fram[i].capid());
788
789 data[i] = HFQIEConst*Fram[i].nominal_fC();
790 float fC = data[i];
791 //data[i]=fC-m_ped->getValue(capid);
792 // peds =m_ped->getValue(capid);
793 signal = data[i]-pedestal;
794 // signal-= pedestal;
795
796 fCharge[jf][i] = Fram[i].adc();
797 fCharge_fc[jf][i] = Fram[i].nominal_fC();
798 fPedestal[jf][i] = pedestal;
799
800 if (signal>10) {
801 // cout<<"i= "<<i<<" rawadc-> "<<rawadc<<" linadc-> "<<linadc<<" signal-in-fC-> "<<data[i]<<endl;
802
803 }
804 ////shapes
805
806 if(eta==30 && phi==1 && depth==2){
807 tshapes[1]->Fill(i,signal);
808 }
809 if(eta==30 && phi==21 && depth==1) {
810 tshapes[2]->Fill(i,signal);
811 }
812 if(eta==30 && phi==37 && depth==2){
813 tshapes[3]->Fill(i,signal);
814 }
815 if(eta==30 && phi==57 && depth==1) {
816 tshapes[4]->Fill(i,signal);
817 }
818 if(eta==32 && phi==1 && depth==1) {
819 tshapes[5]->Fill(i,signal);
820 }
821 if(eta==32 && phi==21 && depth==2) {
822 tshapes[6]->Fill(i,signal);
823 }
824 if(eta==32 && phi==37 && depth==1) {
825 tshapes[7]->Fill(i,signal);
826
827 }
828 if(eta==32 && phi==57 && depth==2) {
829 tshapes[8]->Fill(i,signal);
830
831 }
832 if(eta==34 && phi==1 && depth==2) {
833 tshapes[9]->Fill(i,signal);
834
835 }
836 if(eta==34 && phi==21 && depth==1) {
837 tshapes[10]->Fill(i,signal);
838
839 }
840 if(eta==34 && phi==37 && depth==2) {
841 tshapes[11]->Fill(i,signal);
842
843 }
844 if(eta==34 && phi==57 && depth==1) {
845 tshapes[12]->Fill(i,signal);
846
847 }
848 if(eta==36 && phi==1 && depth==1){
849 tshapes[13]->Fill(i,signal);
850
851 }
852 if(eta==36 && phi==21 && depth==2){
853 tshapes[14]->Fill(i,signal);
854
855 }
856 if(eta==36 && phi==37 && depth==1){
857 tshapes[15]->Fill(i,signal);
858
859 }
860 if(eta==36 && phi==57 && depth==2){
861 tshapes[16]->Fill(i,signal);
862
863 }
864 if(eta==38 && phi==1 && depth==2){
865 tshapes[17]->Fill(i,signal);
866
867 }
868 if(eta==38 && phi==21 && depth==1){
869 tshapes[18]->Fill(i,signal);
870
871 }
872 if(eta==38 && phi==37 && depth==2){
873 tshapes[19]->Fill(i,signal);
874
875 }
876 if(eta==38 && phi==57 && depth==1){
877 tshapes[20]->Fill(i,signal);
878
879 }
880 if(eta==40 && phi==19 && depth==2){
881 tshapes[21]->Fill(i,signal);
882
883 }
884 if(eta==40 && phi==35 && depth==1){
885 tshapes[22]->Fill(i,signal);
886
887 }
888 if(eta==40 && phi==55 && depth==2){
889 tshapes[23]->Fill(i,signal);
890
891 }
892 if(eta==40 && phi==71 && depth==1){
893 tshapes[24]->Fill(i,signal);
894
895 }
896 if(eta==41 && phi==19 && depth==1){
897 tshapes[25]->Fill(i,signal);
898
899 }
900 if(eta==41 && phi==35 && depth==2){
901 tshapes[26]->Fill(i,signal);
902
903 }
904 if(eta==41 && phi==55 && depth==1){
905 tshapes[27]->Fill(i,signal);
906
907 }
908 if(eta==41 && phi==71 && depth==2){
909 tshapes[28]->Fill(i,signal);
910
911 }
912
913 if(eta==-30 && phi==15 && depth==2) {
914 //cout<<"phase = "<<phase<<endl;
915 tshapes[29]->Fill(i,signal);
916 }
917 if(eta==-30 && phi==35 && depth==1){
918
919 tshapes[30]->Fill(i,signal);
920 }
921 if(eta==-30 && phi==51 && depth==2){
922 tshapes[31]->Fill(i,signal);
923
924 }
925 if(eta==-30 && phi==71 && depth==1){
926 tshapes[32]->Fill(i,signal);
927
928 }
929 if(eta==-32 && phi==15 && depth==1){
930 tshapes[33]->Fill(i,signal);
931
932 }
933 if(eta==-32 && phi==35 && depth==2){
934 tshapes[34]->Fill(i,signal);
935
936 }
937 if(eta==-32 && phi==51 && depth==1){
938 tshapes[35]->Fill(i,signal);
939
940 }
941 if(eta==-32 && phi==71 && depth==2){
942 tshapes[36]->Fill(i,signal);
943
944 }
945 if(eta==-34 && phi==15 && depth==2){
946 tshapes[37]->Fill(i,signal);
947
948 }
949 if(eta==-34 && phi==35 && depth==1){
950 tshapes[38]->Fill(i,signal);
951
952 }
953 if(eta==-34 && phi==51 && depth==2){
954 tshapes[39]->Fill(i,signal);
955
956 }
957 if(eta==-34 && phi==71 && depth==1){
958 tshapes[40]->Fill(i,signal);
959
960 }
961 if(eta==-36 && phi==15 && depth==1){
962 tshapes[41]->Fill(i,signal);
963
964 }
965 if(eta==-36 && phi==35 && depth==2){
966 tshapes[42]->Fill(i,signal);
967
968 }
969 if(eta==-36 && phi==51 && depth==1){
970 tshapes[43]->Fill(i,signal);
971
972 }
973 if(eta==-36 && phi==71 && depth==2){
974 tshapes[44]->Fill(i,signal);
975
976 }
977 if(eta==-38 && phi==15 && depth==2){
978 tshapes[45]->Fill(i,signal);
979
980 }
981 if(eta==-38 && phi==35 && depth==1){
982 tshapes[46]->Fill(i,signal);
983
984 }
985 if(eta==-38 && phi==51 && depth==2){
986 tshapes[47]->Fill(i,signal);
987
988 }
989 if(eta==-38 && phi==71 && depth==1){
990 tshapes[48]->Fill(i,signal);
991
992 }
993 if(eta==-40 && phi==15 && depth==1){
994 tshapes[49]->Fill(i,signal);
995
996 }
997 if(eta==-40 && phi==35 && depth==2){
998 tshapes[50]->Fill(i,signal);
999
1000 }
1001 if(eta==-40 && phi==51 && depth==1){
1002 tshapes[51]->Fill(i,signal);
1003
1004 }
1005 if(eta==-40 && phi==71 && depth==2){
1006 tshapes[52]->Fill(i,signal);
1007
1008 }
1009 if(eta==-41 && phi==15 && depth==2){
1010 tshapes[53]->Fill(i,signal);
1011
1012 }
1013 if(eta==-41 && phi==35 && depth==1){
1014 tshapes[54]->Fill(i,signal);
1015
1016 }
1017 if(eta==-41 && phi==51 && depth==2){
1018 tshapes[55]->Fill(i,signal);
1019
1020 }
1021 if(eta==-41 && phi==71 && depth==1){
1022 tshapes[56]->Fill(i,signal);
1023
1024 }
1025
1026 } //end of TS loop
1027
1028 enhfphi[jf] = phi;
1029 enhfeta[jf] = eta;
1030 enhf[jf] = EnergY;
1031 enhfdep[jf]= depth;
1032 if(bs!=0)timehf[jf]= ts/bs;
1033 jf++;
1034
1035 //End F.O. HF digi part
1036
1037 //float tphase=phase-1127;
1038 double rat3p=0.0;
1039 // float na,nb,nc,nd;
1040 if(LASERON) {
1041 double rat=0.0;
1042
1043 if(data[radfib1]>10 && data[radfib2]>10){
1044
1045 if(eta>0){
1046 if(data[radfib1]!=0)rat=data[radfib1+1]/data[radfib1];
1047 // na+=data[radfib1-1];
1048 // nb+=data[radfib1];
1049 // nc+=data[radfib1+1];
1050 // nd+=data[radfib1+2];
1051 }
1052 else if(eta<0){
1053 if(data[radfib2]!=0) rat=data[radfib2+1]/data[radfib2];
1054 // na+=data[radfib2-1];
1055 //nb+=data[radfib2];
1056 //nc+=data[radfib2+1];
1057 //nd+=data[radfib2+2];
1058 }
1059
1060
1061 rat3p = rat;
1062
1063 //cout<<"rat3p ====== "<<rat3p<<endl;
1064 if(eta==30 && phi==1 && depth==2){
1065 cout<<"radfib1->"<<data[radfib1]<<"radfib1+1->"<<data[radfib1+1]<<" oran->"<<rat<<endl;
1066 tratios[1]->Fill(tphase,rat);
1067 tsratios[1]->Fill(rat3p);
1068 ratio_30_1_2 ->Fill(phase,rat);
1069 na[1]+=data[radfib1-1];
1070 nb[1]+=data[radfib1];
1071 nc[1]+=data[radfib1+1];
1072 nd[1]+=data[radfib1+2];
1073 }
1074 if(eta==30 && phi==21 && depth==1) {
1075 tratios[2]->Fill(tphase,rat);
1076 tsratios[2]->Fill(rat3p);
1077 ratio_30_21_1 ->Fill(phase,rat);
1078 na[1]+=data[radfib1-1];
1079 nb[2]+=data[radfib1];
1080 nc[2]+=data[radfib1+1];
1081 nd[2]+=data[radfib1+2];
1082 }
1083 if(eta==30 && phi==37 && depth==2){
1084 tratios[3]->Fill(tphase,rat);
1085 tsratios[3]->Fill(rat3p);
1086 na[3]+=data[radfib1-1];
1087 nb[3]+=data[radfib1];
1088 nc[3]+=data[radfib1+1];
1089 nd[3]+=data[radfib1+2];
1090 ratio_30_37_2 ->Fill(phase,rat);
1091 }
1092 if(eta==30 && phi==57 && depth==1) {
1093 tratios[4]->Fill(tphase,rat);
1094 tsratios[4]->Fill(rat3p);
1095 na[4]+=data[radfib1-1];
1096 nb[4]+=data[radfib1];
1097 nc[4]+=data[radfib1+1];
1098 nd[4]+=data[radfib1+2];
1099 ratio_30_57_1 ->Fill(phase,rat);
1100 }
1101 if(eta==32 && phi==1 && depth==1) {
1102 tratios[5]->Fill(tphase,rat);
1103 tsratios[5]->Fill(rat3p);
1104 na[5]+=data[radfib1-1];
1105 nb[5]+=data[radfib1];
1106 nc[5]+=data[radfib1+1];
1107 nd[5]+=data[radfib1+2];
1108
1109 ratio_32_1_1 ->Fill(phase,rat);
1110 }
1111 if(eta==32 && phi==21 && depth==2) {
1112 tratios[6]->Fill(tphase,rat);
1113 tsratios[6]->Fill(rat3p);
1114 na[6]+=data[radfib1-1];
1115 nb[6]+=data[radfib1];
1116 nc[6]+=data[radfib1+1];
1117 nd[6]+=data[radfib1+2];
1118
1119 ratio_32_21_2 ->Fill(phase,rat);
1120 }
1121 if(eta==32 && phi==37 && depth==1) {
1122 tratios[7]->Fill(tphase,rat);
1123 tsratios[7]->Fill(rat3p);
1124 na[7]+=data[radfib1-1];
1125 nb[7]+=data[radfib1];
1126 nc[7]+=data[radfib1+1];
1127 nd[7]+=data[radfib1+2];
1128 ratio_32_37_1 ->Fill(phase,rat);
1129 }
1130 if(eta==32 && phi==57 && depth==2) {
1131 tratios[8]->Fill(tphase,rat);
1132 tsratios[8]->Fill(rat3p);
1133 na[8]+=data[radfib1-1];
1134 nb[8]+=data[radfib1];
1135 nc[8]+=data[radfib1+1];
1136 nd[8]+=data[radfib1+2];
1137 ratio_32_57_2 ->Fill(phase,rat);
1138 }
1139 if(eta==34 && phi==1 && depth==2) {
1140 tratios[9]->Fill(tphase,rat);
1141 tsratios[9]->Fill(rat3p);
1142 na[9]+=data[radfib1-1];
1143 nb[9]+=data[radfib1];
1144 nc[9]+=data[radfib1+1];
1145 nd[9]+=data[radfib1+2];
1146 ratio_34_1_2 ->Fill(phase,rat);
1147 }
1148 if(eta==34 && phi==21 && depth==1) {
1149 tratios[10]->Fill(tphase,rat);
1150 tsratios[10]->Fill(rat3p);
1151 na[10]+=data[radfib1-1];
1152 nb[10]+=data[radfib1];
1153 nc[10]+=data[radfib1+1];
1154 nd[10]+=data[radfib1+2];
1155 ratio_34_21_1 ->Fill(phase,rat);
1156 }
1157 if(eta==34 && phi==37 && depth==2) {
1158 tratios[11]->Fill(tphase,rat);
1159 tsratios[11]->Fill(rat3p);
1160 na[11]+=data[radfib1-1];
1161 nb[11]+=data[radfib1];
1162 nc[11]+=data[radfib1+1];
1163 nd[11]+=data[radfib1+2];
1164 ratio_34_37_2 ->Fill(phase,rat);
1165 }
1166 if(eta==34 && phi==57 && depth==1) {
1167 tratios[12]->Fill(tphase,rat);
1168 tsratios[12]->Fill(rat3p);
1169 na[12]+=data[radfib1-1];
1170 nb[12]+=data[radfib1];
1171 nc[12]+=data[radfib1+1];
1172 nd[12]+=data[radfib1+2];
1173 ratio_34_57_1 ->Fill(phase,rat);
1174 }
1175 if(eta==36 && phi==1 && depth==1){
1176 tratios[13]->Fill(tphase,rat);
1177 tsratios[13]->Fill(rat3p);
1178 na[13]+=data[radfib1-1];
1179 nb[13]+=data[radfib1];
1180 nc[13]+=data[radfib1+1];
1181 nd[13]+=data[radfib1+2];
1182 ratio_36_1_1 ->Fill(phase,rat);
1183 }
1184 if(eta==36 && phi==21 && depth==2){
1185 tratios[14]->Fill(tphase,rat);
1186 tsratios[14]->Fill(rat3p);
1187 na[14]+=data[radfib1-1];
1188 nb[14]+=data[radfib1];
1189 nc[14]+=data[radfib1+1];
1190 nd[14]+=data[radfib1+2];
1191 ratio_36_21_2 ->Fill(phase,rat);
1192 }
1193 if(eta==36 && phi==37 && depth==1){
1194 tratios[15]->Fill(tphase,rat);
1195 tsratios[15]->Fill(rat3p);
1196 na[15]+=data[radfib1-1];
1197 nb[15]+=data[radfib1];
1198 nc[15]+=data[radfib1+1];
1199 nd[15]+=data[radfib1+2];
1200 ratio_36_37_1 ->Fill(phase,rat);
1201 }
1202 if(eta==36 && phi==57 && depth==2){
1203 tratios[16]->Fill(tphase,rat);
1204 tsratios[16]->Fill(rat3p);
1205 na[16]+=data[radfib1-1];
1206 nb[16]+=data[radfib1];
1207 nc[16]+=data[radfib1+1];
1208 nd[16]+=data[radfib1+2];
1209 ratio_36_57_2 ->Fill(phase,rat);
1210 }
1211 if(eta==38 && phi==1 && depth==2){
1212 tratios[17]->Fill(tphase,rat);
1213 tsratios[17]->Fill(rat3p);
1214 na[17]+=data[radfib1-1];
1215 nb[17]+=data[radfib1];
1216 nc[17]+=data[radfib1+1];
1217 nd[17]+=data[radfib1+2];
1218 ratio_38_1_2 ->Fill(phase,rat);
1219 }
1220 if(eta==38 && phi==21 && depth==1){
1221 tratios[18]->Fill(tphase,rat);
1222 tsratios[18]->Fill(rat3p);
1223 na[18]+=data[radfib1-1];
1224 nb[18]+=data[radfib1];
1225 nc[18]+=data[radfib1+1];
1226 nd[18]+=data[radfib1+2];
1227 ratio_38_21_1 ->Fill(phase,rat);
1228 }
1229 if(eta==38 && phi==37 && depth==2){
1230 tratios[19]->Fill(tphase,rat);
1231 tsratios[19]->Fill(rat3p);
1232 na[19]+=data[radfib1-1];
1233 nb[19]+=data[radfib1];
1234 nc[19]+=data[radfib1+1];
1235 nd[19]+=data[radfib1+2];
1236 ratio_38_37_2 ->Fill(phase,rat);
1237 }
1238 if(eta==38 && phi==57 && depth==1){
1239 tratios[20]->Fill(tphase,rat);
1240 tsratios[20]->Fill(rat3p);
1241 na[20]+=data[radfib1-1];
1242 nb[20]+=data[radfib1];
1243 nc[20]+=data[radfib1+1];
1244 nd[20]+=data[radfib1+2];
1245 ratio_38_57_1 ->Fill(phase,rat);
1246 }
1247 if(eta==40 && phi==19 && depth==2){
1248 tratios[21]->Fill(tphase,rat);
1249 tsratios[21]->Fill(rat3p);
1250 na[21]+=data[radfib1-1];
1251 nb[21]+=data[radfib1];
1252 nc[21]+=data[radfib1+1];
1253 nd[21]+=data[radfib1+2];
1254 ratio_40_19_2 ->Fill(phase,rat);
1255 }
1256 if(eta==40 && phi==35 && depth==1){
1257 tratios[22]->Fill(tphase,rat);
1258 tsratios[22]->Fill(rat3p);
1259 na[22]+=data[radfib1-1];
1260 nb[22]+=data[radfib1];
1261 nc[22]+=data[radfib1+1];
1262 nd[22]+=data[radfib1+2];
1263 ratio_40_35_1 ->Fill(phase,rat);
1264 }
1265 if(eta==40 && phi==55 && depth==2){
1266 tratios[23]->Fill(tphase,rat);
1267 tsratios[23]->Fill(rat3p);
1268 na[23]+=data[radfib1-1];
1269 nb[23]+=data[radfib1];
1270 nc[23]+=data[radfib1+1];
1271 nd[23]+=data[radfib1+2];
1272 ratio_40_55_2 ->Fill(phase,rat);
1273 }
1274 if(eta==40 && phi==71 && depth==1){
1275 tratios[24]->Fill(tphase,rat);
1276 tsratios[24]->Fill(rat3p);
1277 na[24]+=data[radfib1-1];
1278 nb[24]+=data[radfib1];
1279 nc[24]+=data[radfib1+1];
1280 nd[24]+=data[radfib1+2];
1281 ratio_40_71_1 ->Fill(phase,rat);
1282 }
1283 if(eta==41 && phi==19 && depth==1){
1284 tratios[25]->Fill(tphase,rat);
1285 tsratios[25]->Fill(rat3p);
1286 na[25]+=data[radfib1-1];
1287 nb[25]+=data[radfib1];
1288 nc[25]+=data[radfib1+1];
1289 nd[25]+=data[radfib1+2];
1290 ratio_41_19_1 ->Fill(phase,rat);
1291 }
1292 if(eta==41 && phi==35 && depth==2){
1293 tratios[26]->Fill(tphase,rat);
1294 tsratios[26]->Fill(rat3p);
1295 na[26]+=data[radfib1-1];
1296 nb[26]+=data[radfib1];
1297 nc[26]+=data[radfib1+1];
1298 nd[26]+=data[radfib1+2];
1299 ratio_41_35_2 ->Fill(phase,rat);
1300 }
1301 if(eta==41 && phi==55 && depth==1){
1302 tratios[27]->Fill(tphase,rat);
1303 tsratios[27]->Fill(rat3p);
1304 na[27]+=data[radfib1-1];
1305 nb[27]+=data[radfib1];
1306 nc[27]+=data[radfib1+1];
1307 nd[27]+=data[radfib1+2];
1308 ratio_41_55_1 ->Fill(phase,rat);
1309 }
1310 if(eta==41 && phi==71 && depth==2){
1311 tratios[28]->Fill(tphase,rat);
1312 tsratios[28]->Fill(rat3p);
1313 na[28]+=data[radfib1-1];
1314 nb[28]+=data[radfib1];
1315 nc[28]+=data[radfib1+1];
1316 nd[28]+=data[radfib1+2];
1317 ratio_41_71_2 ->Fill(phase,rat);
1318 }
1319
1320 if(eta==-30 && phi==15 && depth==2) {
1321 //cout<<"phase = "<<phase<<endl;
1322 // cout<<"tphase = "<<tphase<<endl;
1323 // cout<<"rat = "<<rat<<endl;
1324 ratio_m30_15_2->Fill(phase,rat);
1325 tratios[29]->Fill(tphase,rat);
1326 na[29]+=data[radfib2-1];
1327 nb[29]+=data[radfib2];
1328 nc[29]+=data[radfib2+1];
1329 nd[29]+=data[radfib2+2];
1330 tsratios[29]->Fill(rat3p);
1331 }
1332
1333 if(eta==-30 && phi==35 && depth==1){
1334 ratio_m30_35_1->Fill(phase,rat);
1335 tratios[30]->Fill(tphase,rat);
1336 tsratios[30]->Fill(rat3p);
1337 na[30]+=data[radfib2-1];
1338 nb[30]+=data[radfib2];
1339 nc[30]+=data[radfib2+1];
1340 nd[30]+=data[radfib2+2];
1341 }
1342 if(eta==-30 && phi==51 && depth==2){
1343 tratios[31]->Fill(tphase,rat);
1344 tsratios[31]->Fill(rat3p);
1345 ratio_m30_51_2->Fill(phase,rat);
1346 na[31]+=data[radfib2-1];
1347 nb[31]+=data[radfib2];
1348 nc[31]+=data[radfib2+1];
1349 nd[31]+=data[radfib2+2];
1350
1351 }
1352 if(eta==-30 && phi==71 && depth==1){
1353 tratios[32]->Fill(tphase,rat);
1354 tsratios[32]->Fill(rat3p);
1355 na[32]+=data[radfib2-1];
1356 nb[32]+=data[radfib2];
1357 nc[32]+=data[radfib2+1];
1358 nd[32]+=data[radfib2+2];
1359 ratio_m30_71_1->Fill(phase,rat);
1360 }
1361 if(eta==-32 && phi==15 && depth==1){
1362 tratios[33]->Fill(tphase,rat);
1363 tsratios[33]->Fill(rat3p);
1364 na[33]+=data[radfib2-1];
1365 nb[33]+=data[radfib2];
1366 nc[33]+=data[radfib2+1];
1367 nd[33]+=data[radfib2+2];
1368 ratio_m32_15_1->Fill(phase,rat);
1369 }
1370 if(eta==-32 && phi==35 && depth==2){
1371 tratios[34]->Fill(tphase,rat);
1372 tsratios[34]->Fill(rat3p);
1373 na[34]+=data[radfib2-1];
1374 nb[34]+=data[radfib2];
1375 nc[34]+=data[radfib2+1];
1376 nd[34]+=data[radfib2+2];
1377 ratio_m32_35_2->Fill(phase,rat);
1378 }
1379 if(eta==-32 && phi==51 && depth==1){
1380 tratios[35]->Fill(tphase,rat);
1381 tsratios[35]->Fill(rat3p);
1382 na[35]+=data[radfib2-1];
1383 nb[35]+=data[radfib2];
1384 nc[35]+=data[radfib2+1];
1385 nd[35]+=data[radfib2+2];
1386 ratio_m32_51_1->Fill(phase,rat);
1387 }
1388 if(eta==-32 && phi==71 && depth==2){
1389 tratios[36]->Fill(tphase,rat);
1390 tsratios[36]->Fill(rat3p);
1391 na[36]+=data[radfib2-1];
1392 nb[36]+=data[radfib2];
1393 nc[36]+=data[radfib2+1];
1394 nd[36]+=data[radfib2+2];
1395 ratio_m32_71_2->Fill(phase,rat);
1396 }
1397 if(eta==-34 && phi==15 && depth==2){
1398 tratios[37]->Fill(tphase,rat);
1399 tsratios[37]->Fill(rat3p);
1400 na[37]+=data[radfib2-1];
1401 nb[37]+=data[radfib2];
1402 nc[37]+=data[radfib2+1];
1403 nd[37]+=data[radfib2+2];
1404 ratio_m34_15_2->Fill(phase,rat);
1405 }
1406 if(eta==-34 && phi==35 && depth==1){
1407 tratios[38]->Fill(tphase,rat);
1408 tsratios[38]->Fill(rat3p);
1409 na[38]+=data[radfib2-1];
1410 nb[38]+=data[radfib2];
1411 nc[38]+=data[radfib2+1];
1412 nd[38]+=data[radfib2+2];
1413 ratio_m34_35_1->Fill(phase,rat);
1414 }
1415 if(eta==-34 && phi==51 && depth==2){
1416 tratios[39]->Fill(tphase,rat);
1417 tsratios[39]->Fill(rat3p);
1418 na[39]+=data[radfib2-1];
1419 nb[39]+=data[radfib2];
1420 nc[39]+=data[radfib2+1];
1421 nd[39]+=data[radfib2+2];
1422 ratio_m34_51_2->Fill(phase,rat);
1423 }
1424 if(eta==-34 && phi==71 && depth==1){
1425 tratios[40]->Fill(tphase,rat);
1426 tsratios[40]->Fill(rat3p);
1427 na[40]+=data[radfib2-1];
1428 nb[40]+=data[radfib2];
1429 nc[40]+=data[radfib2+1];
1430 nd[40]+=data[radfib2+2];
1431 ratio_m34_71_1->Fill(phase,rat);
1432 }
1433 if(eta==-36 && phi==15 && depth==1){
1434 tratios[41]->Fill(tphase,rat);
1435 tsratios[41]->Fill(rat3p);
1436 na[41]+=data[radfib2-1];
1437 nb[41]+=data[radfib2];
1438 nc[41]+=data[radfib2+1];
1439 nd[41]+=data[radfib2+2];
1440 ratio_m36_15_1->Fill(phase,rat);
1441 }
1442 if(eta==-36 && phi==35 && depth==2){
1443 tratios[42]->Fill(tphase,rat);
1444 tsratios[42]->Fill(rat3p);
1445 na[42]+=data[radfib2-1];
1446 nb[42]+=data[radfib2];
1447 nc[42]+=data[radfib2+1];
1448 nd[42]+=data[radfib2+2];
1449 ratio_m36_35_2->Fill(phase,rat);
1450 }
1451 if(eta==-36 && phi==51 && depth==1){
1452 tratios[43]->Fill(tphase,rat);
1453 tsratios[43]->Fill(rat3p);
1454 na[43]+=data[radfib2-1];
1455 nb[43]+=data[radfib2];
1456 nc[43]+=data[radfib2+1];
1457 nd[43]+=data[radfib2+2];
1458 ratio_m36_51_1->Fill(phase,rat);
1459 }
1460 if(eta==-36 && phi==71 && depth==2){
1461 tratios[44]->Fill(tphase,rat);
1462 tsratios[44]->Fill(rat3p);
1463 na[44]+=data[radfib2-1];
1464 nb[44]+=data[radfib2];
1465 nc[44]+=data[radfib2+1];
1466 nd[44]+=data[radfib2+2];
1467 ratio_m36_71_2->Fill(phase,rat);
1468 }
1469 if(eta==-38 && phi==15 && depth==2){
1470 tratios[45]->Fill(tphase,rat);
1471 tsratios[45]->Fill(rat3p);
1472 na[45]+=data[radfib2-1];
1473 nb[45]+=data[radfib2];
1474 nc[45]+=data[radfib2+1];
1475 nd[45]+=data[radfib2+2];
1476 ratio_m38_15_2->Fill(phase,rat);
1477 }
1478 if(eta==-38 && phi==35 && depth==1){
1479 tratios[46]->Fill(tphase,rat);
1480 tsratios[46]->Fill(rat3p);
1481 na[46]+=data[radfib2-1];
1482 nb[46]+=data[radfib2];
1483 nc[46]+=data[radfib2+1];
1484 nd[46]+=data[radfib2+2];
1485 ratio_m38_35_1->Fill(phase,rat);
1486 }
1487 if(eta==-38 && phi==51 && depth==2){
1488 tratios[47]->Fill(tphase,rat);
1489 tsratios[47]->Fill(rat3p);
1490 na[47]+=data[radfib2-1];
1491 nb[47]+=data[radfib2];
1492 nc[47]+=data[radfib2+1];
1493 nd[47]+=data[radfib2+2];
1494 ratio_m38_51_2->Fill(phase,rat);
1495 }
1496 if(eta==-38 && phi==71 && depth==1){
1497 tratios[48]->Fill(tphase,rat);
1498 tsratios[48]->Fill(rat3p);
1499 na[48]+=data[radfib2-1];
1500 nb[48]+=data[radfib2];
1501 nc[48]+=data[radfib2+1];
1502 nd[48]+=data[radfib2+2];
1503 ratio_m38_71_1->Fill(phase,rat);
1504 }
1505 if(eta==-40 && phi==15 && depth==1){
1506 tratios[49]->Fill(tphase,rat);
1507 tsratios[49]->Fill(rat3p);
1508 na[49]+=data[radfib2-1];
1509 nb[49]+=data[radfib2];
1510 nc[49]+=data[radfib2+1];
1511 nd[49]+=data[radfib2+2];
1512 ratio_m40_15_1->Fill(phase,rat);
1513 }
1514 if(eta==-40 && phi==35 && depth==2){
1515 tratios[50]->Fill(tphase,rat);
1516 tsratios[50]->Fill(rat3p);
1517 na[50]+=data[radfib2-1];
1518 nb[50]+=data[radfib2];
1519 nc[50]+=data[radfib2+1];
1520 nd[50]+=data[radfib2+2];
1521 ratio_m40_35_2->Fill(phase,rat);
1522 }
1523 if(eta==-40 && phi==51 && depth==1){
1524 tratios[51]->Fill(tphase,rat);
1525 tsratios[51]->Fill(rat3p);
1526 na[51]+=data[radfib2-1];
1527 nb[51]+=data[radfib2];
1528 nc[51]+=data[radfib2+1];
1529 nd[51]+=data[radfib2+2];
1530 ratio_m40_51_1->Fill(phase,rat);
1531 }
1532 if(eta==-40 && phi==71 && depth==2){
1533 tratios[52]->Fill(tphase,rat);
1534 tsratios[52]->Fill(rat3p);
1535 na[52]+=data[radfib2-1];
1536 nb[52]+=data[radfib2];
1537 nc[52]+=data[radfib2+1];
1538 nd[52]+=data[radfib2+2];
1539 ratio_m40_71_2->Fill(phase,rat);
1540 }
1541 if(eta==-41 && phi==15 && depth==2){
1542 tratios[53]->Fill(tphase,rat);
1543 tsratios[53]->Fill(rat3p);
1544 na[53]+=data[radfib2-1];
1545 nb[53]+=data[radfib2];
1546 nc[53]+=data[radfib2+1];
1547 nd[53]+=data[radfib2+2];
1548 ratio_m41_15_2->Fill(phase,rat);
1549 }
1550 if(eta==-41 && phi==35 && depth==1){
1551 tratios[54]->Fill(tphase,rat);
1552 tsratios[54]->Fill(rat3p);
1553 na[54]+=data[radfib2-1];
1554 nb[54]+=data[radfib2];
1555 nc[54]+=data[radfib2+1];
1556 nd[54]+=data[radfib2+2];
1557 ratio_m41_35_1->Fill(phase,rat);
1558 }
1559 if(eta==-41 && phi==51 && depth==2){
1560 tratios[55]->Fill(tphase,rat);
1561 tsratios[55]->Fill(rat3p);
1562 na[55]+=data[radfib2-1];
1563 nb[55]+=data[radfib2];
1564 nc[55]+=data[radfib2+1];
1565 nd[55]+=data[radfib2+2];
1566 ratio_m41_51_2->Fill(phase,rat);
1567 }
1568 if(eta==-41 && phi==71 && depth==1){
1569 tratios[56]->Fill(tphase,rat);
1570 tsratios[56]->Fill(rat3p);
1571 na[56]+=data[radfib2-1];
1572 nb[56]+=data[radfib2];
1573 nc[56]+=data[radfib2+1];
1574 nd[56]+=data[radfib2+2];
1575 ratio_m41_71_1->Fill(phase,rat);
1576 }
1577
1578
1579
1580 }
1581
1582
1583
1584 }
1585 set_hf_adc(eta,phi,depth,data);
1586
1587 fNumDigis = jf;
1588
1589
1590 }
1591 }catch(...){}
1592
1593 tree_->Fill();
1594
1595 }
1596
1597 void HcalRaddamAnalyzer ::endJob() {
1598
1599 return;
1600 Double_t par[2]; Double_t parg[3];
1601 g1 = new TF1("g1","pol0",-5,5);
1602 g2 = new TF1("g2","pol0",-5,5);
1603 //g3 = new TF1("g3","landau",0,10);
1604 func = new TF1("func",langaufun,-1,10,4);
1605 //func = new TF1("func",langaufun,-1,10);
1606 func->SetParameters(1.8,1.1,3000,0.1);
1607 // run 66558: g1 =new TF1("g1","pol0",1,12);
1608 g1->SetLineColor(2);
1609 for (int i=1; i<_TOWERS_ ; i++) {
1610 if (i>28) {
1611 tratios[i]->Fit(g2,"R");
1612 g2->GetParameters(&(*par));
1613 // g2->GetParameters(&par[1]);
1614 Double_t e1 = g2->GetParError(0);
1615 tsratios[i]->Fit(func,"R");
1616 func->GetParameters(&(*parg));
1617 // func->GetParameters(&parg[1]);
1618 // func->GetParameters(&parg[2]);
1619 Double_t e2 = func->GetParError(0);
1620 //cout<<"raddam channel i= "<< i <<" fit par ="<<par[0] <<" error ="<<e1<<" landau0 ="<<parg[0]<<" landau1 ="<<parg[1]<<" landau2 ="<<parg[2]<<endl;
1621 //textoutTextFile<<i<<"\t"<<par[0]<<"\t"<<e1<<"\t"<<parg[0]<<"\t"<<e2<<std::endl;
1622 textoutTextFile<<i<<"\t""\t"<<parg[0]<<std::endl;
1623 }
1624 else {
1625 tratios[i]->Fit(g1,"R");
1626 g1->GetParameters(&(*par));
1627 // g1->GetParameters(&par[1]);
1628 Double_t e1 = g1->GetParError(0);
1629 tsratios[i]->Fit(func,"R");
1630 func->GetParameters(&(*parg));
1631 //func->GetParameters(&parg[1]);
1632 // func->GetParameters(&parg[2]);
1633 Double_t e2 = func->GetParError(0);
1634
1635 //cout<<"raddam channel i= "<< i <<" fit par ="<<par[0] <<" error ="<<e1<<" landau0 ="<<parg[0]<<" landau1 ="<<parg[1]<<" landau2 ="<<parg[2]<<endl;
1636 // textoutTextFile<<i<<"\t"<<par[0]<<"\t"<<"\t"<<e1<<std::endl;
1637 // textoutTextFile<<i<<"\t"<<par[0]<<"\t"<<e1<<"\t"<<parg[0]<<"\t"<<e2<<std::endl;
1638 //textoutTextFile<<i<<"\t"<<par[0]<<"\t"<<e1<<std::endl;
1639 textoutTextFile<<i<<"\t""\t"<<parg[0]<<std::endl;
1640 // printf(str," HFP Raddam_Channel %d bx(%d)/bx(%d)_vs_phase",i,radfib1,radfib1+1);
1641
1642 }
1643
1644 }
1645
1646
1647
1648 }
1649 DEFINE_FWK_MODULE(HcalRaddamAnalyzer);