]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFQADataMakerRec.cxx
Possibility to make PT sorting (Jochen)
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMakerRec.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 ///////////////////////////////////////////////////////////////////////
17 //                                                                   //
18 //  Produces the data needed to calculate the TOF quality assurance. //
19 //  QA objects are 1 & 2 Dimensional histograms.                     //
20 //  author: S.Arcelli                                                //
21 //                                                                   //
22 ///////////////////////////////////////////////////////////////////////
23
24 /*
25 Modified by fbellini & rshanoian on 06/07/2011
26 - changes for trigger classes implementation
27 - fRunNumber added as private member
28 - added time vs BCID plot
29
30 Modified by fbellini on 18/01/2011
31 - reduced histo binning to reduce size 
32 - added decoding errors plot
33 - added channel maps and options for DQM shifters
34 - new list of recPoints and ESDs plots
35 - removed hTrmChannels035 and hTrmChannels3671
36
37  Modified by bvonhall on 03/11/2010
38    - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
39      to prevent memory corruption
40    
41  Modified by adecaro on 18/10/2010
42    - fTOFRawStream object set as private member
43  
44 Modified by fbellini on 13/09/2010
45   - Set TLines as private members
46   - Set image flag for expert histos
47
48 Modified by fbellini on 14/06/2010
49   - Updated plots
50   - use LoadRawDataBuffersV2()
51
52   Modified by fbellini on 10/05/2010
53   - Fixed EndOfDetectorCycle() memory corruption bug
54
55   Modified by fbellini on 22/04/2010
56    - Added filter for physics events
57
58    Modified by fbellini on 16/04/2010
59    - Added EnableDqmShifterOpt() 
60    - Modified EndOfDetectorCycle() with options for DQM         
61    - Updated ESDs QA
62
63    Modified by fbellini on 30/03/2010
64    - Changed raws time histos range to 610ns
65    - Added FilterLTMData() and FilterSpare() methods
66    - Added check on enabled channels for raw data               
67    - Updated RecPoints QA
68
69    Modified by fbellini on 02/03/2010
70    - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
71    - Added filter for noisy channels and read map from OCDB
72    - Added GetCalibData() method
73    - Added CheckVolumeID() and CheckEquipID() methods  
74    - Updated Raw QA
75 */
76
77 #include <TClonesArray.h>
78 #include <TH1F.h> 
79 #include <TH2F.h> 
80 #include <TLine.h>
81 #include <TPaveText.h>
82
83 #include "AliCDBManager.h"
84 #include "AliCDBEntry.h"
85 #include "AliESDEvent.h"
86 #include "AliESDtrack.h"
87 #include "AliQAChecker.h"
88 #include "AliRawReader.h"
89 #include "AliTOFRawStream.h"
90 #include "AliTOFcluster.h"
91 #include "AliTOFQADataMakerRec.h"
92 #include "AliTOFrawData.h"
93 #include "AliTOFGeometry.h"
94 #include "AliTOFChannelOnlineStatusArray.h"
95 #include "AliTOFDecoderSummaryData.h"
96 #include "AliTOFDecoderV2.h"
97
98 ClassImp(AliTOFQADataMakerRec)
99            
100 //____________________________________________________________________________ 
101   AliTOFQADataMakerRec::AliTOFQADataMakerRec() : 
102   AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
103   fCalibData(0x0),
104   fEnableNoiseFiltering(kFALSE),
105   fEnableDqmShifterOpt(kFALSE),
106 //  fProcessedRawEventN(0),
107   fIsSOC(kFALSE),
108   fLineExpTimeMin(new TLine(200., 0., 200., 0.)),
109   fLineExpTimeMax(new TLine(250., 0., 250., 0.)),
110   fLineExpTotMin(new TLine(5., 0., 5., 0.)),
111   fLineExpTotMax(new TLine(20., 0., 20., 0.)),
112   fTOFRawStream(AliTOFRawStream()),
113   fDecoderSummary(0),
114   fRunNumber(-1)
115 {
116   //
117   // ctor
118   //   
119   for (Int_t sm=0;sm<17;sm++){
120     fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
121   }
122   //initialize all TRM counters to -1 i.e. invalid value
123   // for (Int_t trm=0;trm<720;trm++){
124   //   fTRMNoisyArray[trm]=-1;
125   //   fTRMHwOkArray[trm]=-1;
126   //   fTRMEnabledArray[trm]=-1;
127   // }
128   
129 }
130
131 //____________________________________________________________________________ 
132 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
133   AliQADataMakerRec(),
134   fCalibData(qadm.fCalibData),
135   fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
136   fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
137   //  fProcessedRawEventN(qadm.fProcessedRawEventN),
138   fIsSOC(qadm.fIsSOC),
139   fLineExpTimeMin(qadm.fLineExpTimeMin),
140   fLineExpTimeMax(qadm.fLineExpTimeMax),
141   fLineExpTotMin(qadm.fLineExpTotMin),
142   fLineExpTotMax(qadm.fLineExpTotMax),
143   fTOFRawStream(qadm.fTOFRawStream),
144   fDecoderSummary(qadm.fDecoderSummary),
145   fRunNumber(qadm.fRunNumber)
146 {
147   //
148   //copy ctor 
149   //
150   SetName((const char*)qadm.GetName()) ; 
151   SetTitle((const char*)qadm.GetTitle()); 
152    
153   for (Int_t sm=0;sm<17;sm++){
154     fLineSMid[sm]=qadm.fLineSMid[sm];
155   }
156   
157   // for (Int_t trm=0;trm<10;trm++){
158   //   fTRMNoisyArray[trm]=qadm.fTRMNoisyArray[trm];
159   //   fTRMHwOkArray[trm]=qadm.fTRMHwOkArray[trm];
160   //   fTRMEnabledArray[trm]=qadm.fTRMEnabledArray[trm];
161   // }
162   
163 }
164
165 //__________________________________________________________________
166 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
167 {
168   //
169   // assignment operator.
170   //
171   this->~AliTOFQADataMakerRec();
172   new(this) AliTOFQADataMakerRec(qadm);
173   return *this;
174 }
175  
176 //----------------------------------------------------------------------------
177 AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
178 {
179   //destructor
180   fTOFRawStream.Clear();
181   if (fLineExpTimeMin)
182     delete fLineExpTimeMin;
183   if (fLineExpTimeMax)
184     delete fLineExpTimeMax;
185   if (fLineExpTotMin)
186     delete fLineExpTotMin;
187   if (fLineExpTotMax)
188     delete fLineExpTotMax;
189   for (Int_t sm=0;sm<10;sm++){
190     if (fLineSMid[sm])
191       delete fLineSMid[sm];
192   }
193 }
194 //----------------------------------------------------------------------------
195 AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() 
196 {
197   //
198   // Retrive TOF calib objects from OCDB
199   //
200   AliCDBManager *man = AliCDBManager::Instance();
201   AliCDBEntry *cdbe=0;
202  
203   if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
204   else fRunNumber=fRun;
205   
206   if (man->GetRun()!=fRunNumber){
207     fRunNumber=man->GetRun();
208     AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
209   }
210   cdbe = man->Get("TOF/Calib/Status",fRunNumber);
211   
212   if(!cdbe){
213     // for DQM online
214     AliWarning("Load of calibration data from default (alien://) storage failed!");
215     printf("Calibration data will be loaded from local storage - ok if on DQM station!");
216     man->SetDefaultStorage("local:///local/cdb/");
217     cdbe = man->Get("TOF/Calib/Status",fRun);
218     
219     if(!cdbe){
220       AliWarning("Load of calibration data from local DQM machine storage failed!");
221       AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
222       man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
223       cdbe = man->Get("TOF/Calib/Status",fRunNumber);
224     }
225   }
226   // Retrieval of data in directory TOF/Calib/Data:
227   AliTOFChannelOnlineStatusArray * array = 0;
228   if (cdbe) {
229     printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
230     array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
231   }
232   if (!array)  AliFatal("No calibration data from calibration database !");
233   
234   return array;
235 }
236
237 //____________________________________________________________________________ 
238 void AliTOFQADataMakerRec::InitRaws()
239 {
240   //
241   // create Raws histograms in Raws subdir
242   //
243   const Bool_t expert   = kTRUE ; 
244   const Bool_t saveCorr = kTRUE ; 
245   const Bool_t image    = kTRUE ; 
246
247   TH1I * h0 =  new TH1I("hTOFRaws",      "TOF raw hit multiplicity; TOF raw hits number; Events ",200, 0, 200) ;
248
249   TH1I * h1 =  new TH1I("hTOFRawsIA",    "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Events ",200, 0, 200) ;
250   TH1I * h2 =  new TH1I("hTOFRawsOA",    "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Events ",200, 0, 200) ;
251   TH1I * h3 =  new TH1I("hTOFRawsIC",    "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Events ",200, 0, 200) ;
252   TH1I * h4 =  new TH1I("hTOFRawsOC",    "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Events ",200, 0, 200) ;
253
254   TH1F * h5  = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", 250,0. ,610.) ; 
255   TH1F * h6  = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
256   TH1F * h7  = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
257   TH1F * h8  = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
258   TH1F * h9  = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ; 
259   
260   TH1F * h10  = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
261   
262   TH1F * h11  = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
263   TH1F * h12  = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
264   TH1F * h13  = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
265   TH1F * h14  = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ; 
266   
267   TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts",  72, 0., 72.);
268   TH2F * h16  = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip",  72, 0., 18., 91, 0., 91.);
269   TH2F * h17  = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
270   TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
271   
272   h18->GetYaxis()->SetBinLabel(1,"DRM ");
273   h18->GetYaxis()->SetBinLabel(2,"LTM ");
274   h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
275   h18->GetYaxis()->SetBinLabel(4,"TRM 4");
276   h18->GetYaxis()->SetBinLabel(5,"TRM 5");
277   h18->GetYaxis()->SetBinLabel(6,"TRM 6");
278   h18->GetYaxis()->SetBinLabel(7,"TRM 7");
279   h18->GetYaxis()->SetBinLabel(8,"TRM 8");
280   h18->GetYaxis()->SetBinLabel(9,"TRM 9");
281   h18->GetYaxis()->SetBinLabel(10,"TRM 10");
282   h18->GetYaxis()->SetBinLabel(11,"TRM 11");
283   h18->GetYaxis()->SetBinLabel(12,"TRM 12");
284   h18->GetYaxis()->SetBinLabel(13,"recovered");
285   
286   TH1F * h19  = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits", 250, 0. ,610.) ; 
287   TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361., 250, 0., 610.0) ;
288   TH2F * h21 = new TH2F("hTOFRawTimeVsTRM3671", "TOF raws - Hit time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF raw time [ns]", 361, 360., 721., 250, 0., 610.0) ;
289   TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ; 
290   TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564., 250,0.,610);
291   
292   h0->Sumw2() ;
293   h1->Sumw2() ;
294   h2->Sumw2() ;
295   h3->Sumw2() ;
296   h4->Sumw2() ;
297   //  h5->Sumw2() ;
298   h6->Sumw2() ;
299   h7->Sumw2() ;
300   h8->Sumw2() ;
301   h9->Sumw2() ;
302   // h10->Sumw2() ;
303   h11->Sumw2() ;
304   h12->Sumw2() ;
305   h13->Sumw2() ;
306   h14->Sumw2() ;
307   h15->Sumw2() ;
308   h16->Sumw2() ;
309   h17->Sumw2() ;
310   h18->Sumw2() ;
311   h19->Sumw2() ;
312   h20->Sumw2() ;
313   h21->Sumw2() ;
314   h22->Sumw2() ;
315   h23->Sumw2() ;
316   
317   //add lines for DQM shifter
318   //fLineExpTimeMin = new TLine(200., 0., 200., 0.);
319   fLineExpTimeMin->SetLineColor(kGreen);
320   fLineExpTimeMin->SetLineWidth(2);
321   
322   //fLineExpTimeMax = new TLine(250., 0., 250., 0.);
323   fLineExpTimeMax->SetLineColor(kGreen);
324   fLineExpTimeMax->SetLineWidth(2);
325   
326   //fLineExpTotMin = new TLine( 5., 0., 5., 0.);
327   fLineExpTotMin->SetLineColor(kGreen);
328   fLineExpTotMin->SetLineWidth(2);
329   
330   //fLineExpTotMax = new TLine(20., 0., 20., 0.);
331   fLineExpTotMax->SetLineColor(kGreen);
332   fLineExpTotMax->SetLineWidth(2);
333   
334   for (Int_t sm=0;sm<17;sm++){
335     //fLineSMid[sm] = new TLine( 1+sm, 0., 1+sm, 91.);
336     fLineSMid[sm]->SetLineColor(kMagenta);
337     fLineSMid[sm]->SetLineWidth(2);
338   }
339   
340   h5->GetListOfFunctions()->Add(fLineExpTimeMin);
341   h5->GetListOfFunctions()->Add(fLineExpTimeMax);
342   h10->GetListOfFunctions()->Add(fLineExpTotMin);
343   h10->GetListOfFunctions()->Add(fLineExpTotMax);
344   
345   for (Int_t sm=0;sm<17;sm++){
346     h16->GetListOfFunctions()->Add(fLineSMid[sm]);
347     h17->GetListOfFunctions()->Add(fLineSMid[sm]);
348   }
349   
350   
351   TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");        
352   phosHoleBox->SetFillStyle(0);
353   phosHoleBox->SetFillColor(kWhite);
354   phosHoleBox->SetLineColor(kMagenta);
355   phosHoleBox->SetLineWidth(2);
356   phosHoleBox->AddText("PHOS"); 
357   h16->GetListOfFunctions()->Add(phosHoleBox);
358   h17->GetListOfFunctions()->Add(phosHoleBox);
359
360   // h0->SetDrawOption("logy");
361   // h5->SetDrawOption("logy");
362   // h10->SetDrawOption("logy");
363
364   Add2RawsList(h0,   0, !expert,  image, !saveCorr) ;
365   Add2RawsList(h1,   1,  expert,  !image, !saveCorr) ;
366   Add2RawsList(h2,   2,  expert,  !image, !saveCorr) ;
367   Add2RawsList(h3,   3,  expert,  !image, !saveCorr) ;
368   Add2RawsList(h4,   4,  expert,  !image, !saveCorr) ;
369   Add2RawsList(h5,   5, !expert,  image, !saveCorr) ;
370   Add2RawsList(h6,   6,  expert,  !image, !saveCorr) ;
371   Add2RawsList(h7,   7,  expert,  !image, !saveCorr) ;
372   Add2RawsList(h8,   8,  expert,  !image, !saveCorr) ;
373   Add2RawsList(h9,   9,  expert,  !image, !saveCorr) ;
374   Add2RawsList(h10, 10, !expert,  image, !saveCorr) ;
375   Add2RawsList(h11, 11,  expert, !image, !saveCorr) ;
376   Add2RawsList(h12, 12,  expert, !image, !saveCorr) ;
377   Add2RawsList(h13, 13,  expert, !image, !saveCorr) ;
378   Add2RawsList(h14, 14,  expert, !image, !saveCorr) ;
379   Add2RawsList(h15, 15, !expert,  image, !saveCorr) ;
380   Add2RawsList(h16, 16, !expert,  image, !saveCorr) ;
381   Add2RawsList(h17, 17, !expert,  image, !saveCorr) ;
382   Add2RawsList(h18, 18,  expert, !image, !saveCorr) ;
383   Add2RawsList(h19, 19,  expert, !image, !saveCorr) ;
384   Add2RawsList(h20, 20,  expert, !image, !saveCorr) ;
385   Add2RawsList(h21, 21,  expert, !image, !saveCorr) ;
386   Add2RawsList(h22, 22,  expert, !image, !saveCorr) ;
387   Add2RawsList(h23, 23,  expert, !image, !saveCorr) ;
388   //
389   ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
390 }
391
392 //____________________________________________________________________________ 
393 void AliTOFQADataMakerRec::InitRecPoints()
394 {
395   //
396   // create RecPoints histograms in RecPoints subdir
397   //
398   
399   const Bool_t expert   = kTRUE ; 
400   const Bool_t image    = kTRUE ; 
401
402   TH1I * h0 = new TH1I("hTOFRecPoints",    "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
403
404   TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ; 
405   TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
406   TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
407   TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
408   
409   TH1F * h5  = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
410   TH1F * h6  = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
411   TH1F * h7  = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
412   TH1F * h8  = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
413  
414   TH1F * h9   = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
415   TH1F * h10  = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
416   TH1F * h11  = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
417   TH1F * h12  = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
418   
419   TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ; 
420   TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
421   TH2F * h15 = new TH2F("hTOFRecPointsTimeVsTRM035","TOF RecPoints time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF time [ns]", 361, 0., 361., 250, 0., 610.0) ;
422   TH2F * h16 = new TH2F("hTOFRecPointsTimeVsTRM3671","TOF RecPoints time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF time [ns]", 361, 360., 721., 250, 0., 610.0) ;
423
424   h0->Sumw2() ;
425   h1->Sumw2() ;
426   h2->Sumw2() ;
427   h3->Sumw2() ;
428   h4->Sumw2() ;
429   h5->Sumw2() ;
430   h6->Sumw2() ;
431   h7->Sumw2() ;
432   h8->Sumw2() ;
433   h9->Sumw2() ;
434   h10->Sumw2() ;
435   h11->Sumw2() ;
436   h12->Sumw2() ;
437   h13->Sumw2() ;
438   h14->Sumw2() ;
439   h15->Sumw2() ;
440   h16->Sumw2() ;
441    
442   Add2RecPointsList(h0, 0,   !expert,  image) ;
443   Add2RecPointsList(h1, 1,   !expert,  image) ;
444   Add2RecPointsList(h2, 2,   !expert,  image) ;
445   Add2RecPointsList(h3, 3,   !expert,  image) ;
446   Add2RecPointsList(h4, 4,   !expert,  image) ;
447   Add2RecPointsList(h5, 5,    expert,  !image) ;
448   Add2RecPointsList(h6, 6,    expert, !image) ;
449   Add2RecPointsList(h7, 7,    expert, !image) ;
450   Add2RecPointsList(h8, 8,    expert, !image) ;
451   Add2RecPointsList(h9, 9,   !expert, !image) ;
452   Add2RecPointsList(h10, 10, !expert, !image) ;
453   Add2RecPointsList(h11, 11, !expert, !image) ;
454   Add2RecPointsList(h12, 12, !expert, !image) ;
455   Add2RecPointsList(h13, 13,  expert, !image) ;
456   Add2RecPointsList(h14, 14,  expert, image) ;
457   Add2RecPointsList(h15, 15,  expert, !image) ;
458   Add2RecPointsList(h16, 16,  expert, !image) ;
459   //
460   ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
461 }
462
463 //____________________________________________________________________________ 
464 void AliTOFQADataMakerRec::InitESDs()
465 {
466   //
467   //create ESDs histograms in ESDs subdir
468   //
469
470   const Bool_t expert   = kTRUE ; 
471   const Bool_t image    = kTRUE ; 
472
473   TH1I * h0  = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;  
474   TH1F * h1  = new TH1F("hTOFESDsTime", "Matched  ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ; 
475   TH1F * h2  = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ; 
476   TH1F * h3  = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ; 
477   TH1F * h4  = new TH1F("hTOFESDskTOFOUT", "p_{T}  distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
478   TH1F * h5  = new TH1F("hTOFESDskTIME", "p_{T}  distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
479   TH1F * h6  = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
480   TH1F * h7  = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%)  ;Counts",101, -1.0, 100) ;  
481   TH1F * h8  = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp,pi} spectrum in TOF (ps); t_{TOF}-t_{exp,pi} [ps];Counts", 200, -2440., 2440.) ; 
482   TH1F * h9  = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ; 
483
484   h0->Sumw2() ;
485   h1->Sumw2() ;
486   h2->Sumw2() ;
487   h3->Sumw2() ;
488   h4->Sumw2() ;
489   h5->Sumw2() ;
490   h6->Sumw2() ;
491   h7->Sumw2() ;
492   h8->Sumw2() ;
493   h9->Sumw2() ;
494
495   Add2ESDsList(h0, 0, !expert,  image) ;
496   Add2ESDsList(h1, 1, !expert,  image) ;
497   Add2ESDsList(h2, 2,  expert,  !image) ;
498   Add2ESDsList(h3, 3, !expert,  !image) ;
499   Add2ESDsList(h4, 4,  expert,  image) ;
500   Add2ESDsList(h5, 5,  expert,  image) ;
501   Add2ESDsList(h6, 6,  expert,  image) ; 
502   Add2ESDsList(h7, 7,  expert,  image) ; 
503   Add2ESDsList(h8, 8,  expert,  !image) ; 
504   Add2ESDsList(h9, 9, !expert,  !image) ;
505   //
506   ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line 
507 }
508
509
510 //____________________________________________________________________________
511 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
512 {
513   //
514   // makes data from Raws
515   //
516   if (rawReader->GetType()==7) {
517    
518     Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
519     Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
520     Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
521     for (Int_t j=0;j<5;j++){ ntof[j]=0;}
522     Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
523     Int_t volumeID[5];   //(sector,plate,strip,padX,padZ)
524     Int_t volumeID2[5];   //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
525     Int_t chIndex=-1;
526     
527     TClonesArray * clonesRawData;
528     fTOFRawStream.SetRawReader(rawReader);
529     Int_t BCID=rawReader->GetBCID();
530     
531     //uncomment if needed to apply DeltaBC correction
532     //fTOFRawStream.ApplyBCCorrections(kTRUE);
533     if (fDecoderSummary){
534       fDecoderSummary->Reset();
535     }
536     for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
537       rawReader->Reset();
538       fTOFRawStream.LoadRawDataBuffersV2(iDDL);
539       
540       //* get decoding error counters
541       fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
542       if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
543         Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
544         FillRawsData(18,iDDL,errorSlotID);
545         if (fDecoderSummary -> GetRecoverError() )              
546           FillRawsData(18,iDDL,13);
547       }     
548       
549       clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
550       for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
551         AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
552         
553         if (tofRawDatum->GetTOF()){
554           equipmentID[0]=iDDL;
555           equipmentID[1]=tofRawDatum->GetTRM(); 
556           equipmentID[2]=tofRawDatum->GetTRMchain();
557           equipmentID[3]=tofRawDatum->GetTDC();
558           equipmentID[4]=tofRawDatum->GetTDCchannel();
559           
560           if (CheckEquipID(equipmentID)){
561             fTOFRawStream.EquipmentId2VolumeId(iDDL, 
562                                                tofRawDatum->GetTRM(), 
563                                                tofRawDatum->GetTRMchain(),
564                                                tofRawDatum->GetTDC(), 
565                                                tofRawDatum->GetTDCchannel(), 
566                                                volumeID);
567             //LTM data
568             if (FilterLTMData(equipmentID)) { //counts LTM hits
569               if (equipmentID[2]==1)  //crate left, A-side or C-side
570                 FillRawsData(15,equipmentID[0]);
571               else 
572                 FillRawsData(15,equipmentID[0]-1);  
573               continue;
574             }
575             
576             //TRM data
577             if (CheckVolumeID(volumeID)){  
578               volumeID2[0]=volumeID[0];
579               volumeID2[1]=volumeID[1];
580               volumeID2[2]=volumeID[2];
581               volumeID2[3]=volumeID[4];
582               volumeID2[4]=volumeID[3];
583               chIndex=AliTOFGeometry::GetIndex(volumeID2);
584               
585               if (tofRawDatum->GetTOT()){           
586                 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
587                     && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
588                   ntof[0]++; //counter for tof hits
589                   
590                   //fill global spectra for DQM plots
591                   FillRawsData(5, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
592                   FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
593                   FillRawsData(23, BCID, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
594                   
595                   //fill side-related spectra for experts plots
596                   Int_t ddlACside=iDDL/36; // 0 or 1
597                   Int_t ddlPerSm=iDDL%4;
598                   
599                   if (volumeID2[0]>4 && volumeID2[0]<14){       //O side
600                     if (ddlPerSm<2){ //A side
601                       ntof[1]++;
602                       FillRawsData(6, tofRawDatum->GetTOF()*tdc2ns) ;
603                       FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
604                     } else {  //C side
605                       ntof[3]++;
606                       FillRawsData(8, tofRawDatum->GetTOF()*tdc2ns) ;
607                       FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
608                     }
609                   } else {                                    
610                     if (volumeID2[0]<5 || volumeID2[0]>13){   //I side
611                       if (ddlPerSm<2){ //A side
612                         ntof[2]++;
613                         FillRawsData(7, tofRawDatum->GetTOF()*tdc2ns) ;
614                         FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
615                       } else {//C side
616                         ntof[4]++;
617                         FillRawsData(9, tofRawDatum->GetTOF()*tdc2ns) ;
618                         FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
619                       }
620                     }   
621                   }
622                   
623                   //compute TRM offset
624                   Int_t trm= iDDL*10+(equipmentID[1]-3);
625                   FillRawsData(20+ddlACside,trm,tofRawDatum->GetTOF()*tdc2ns);
626                   FillRawsData(22,GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
627                   Short_t fea = volumeID2[4]/12;
628                   Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
629                   FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
630                 }//noise filter
631               }//end hit selection
632               else { //orphans
633                 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
634                     && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
635                   FillRawsData(19, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
636               }//end orphans
637             }//end volumeID check
638           }//end equipID check
639         }//end tof check
640       }//loop on raw data
641       clonesRawData->Clear();
642     } // DDL Loop
643     
644     for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
645     //    fProcessedRawEventN++; // RS Now the framework conters are use
646     fTOFRawStream.Clear();
647   } else {
648     AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType())); 
649   }
650   
651   //fill reference map for DQM shifter only once in a detector cycle 
652   if (fIsSOC) {
653     Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
654     Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
655     Int_t trmIndex=-1;
656     for (Int_t ch = 0; ch <  fCalibData->GetSize(); ch++) {
657       AliTOFGeometry::GetVolumeIndices(ch,geoId);
658       AliTOFRawStream::Geant2EquipmentId(geoId,detId); 
659       if ((detId[1]<0)||(detId[0]<0)) continue;
660       trmIndex=(detId[1]-3)+detId[0]*10;
661       
662       //set TRM counters
663       // if (fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
664       //        fTRMNoisyArray[trmIndex]+=1;
665       // if (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)
666       //        fTRMHwOkArray[trmIndex]+=1;
667       
668       if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
669            && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
670         //fTRMEnabledArray[trmIndex]+=1;        
671         //fill reference map with info from OCDB
672         Short_t fea = geoId[4]/12;
673         Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
674         FillRawsData(16,hitmapx, GetStripIndex(geoId));
675       }
676     }
677     //printf("Counters for noisy, enabled and good channels in TOF  TRMs read from OCDB.\n");
678     fIsSOC=kFALSE;
679   }
680     
681   //enable options for DQM shifter
682   EnableDqmShifterOpt(kTRUE);
683   //
684   IncEvCountCycleRaws();
685   IncEvCountTotalRaws();
686   //
687 }
688
689 //____________________________________________________________________________
690 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
691 {
692     //
693   // Make data from Clusters
694   //
695  
696   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
697   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
698   
699   Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
700   //Int_t volumeID[5];//(sm, plate,strip, padX,padZ) 
701     
702   TBranch *branch=clustersTree->GetBranch("TOF");
703   if (!branch) { 
704     AliError("can't get the branch with the TOF clusters !");
705     return;
706   }
707
708   static TClonesArray dummy("AliTOFcluster",10000);
709   dummy.Clear();
710   TClonesArray *clusters=&dummy;
711   branch->SetAddress(&clusters);
712   
713   // Import the tree
714   clustersTree->GetEvent(0);  
715  
716   FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ; 
717   
718   TIter next(clusters) ; 
719   AliTOFcluster * c ; 
720   while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
721    
722       // volumeID2[0] = c->GetDetInd(0);
723       // volumeID2[1] = c->GetDetInd(1);
724       // volumeID2[2] = c->GetDetInd(2);
725       // volumeID2[3] = c->GetDetInd(4); //padX
726       // volumeID2[4] = c->GetDetInd(3); //padZ 
727       
728       for (Int_t i=0;i<5;i++){
729         volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
730       }
731       //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
732       Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
733       Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
734       Short_t fea = volumeID2[4]/12;
735       Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
736       Int_t ddlACside=iDDL/36; // 0 or 1
737       Int_t ddlPerSm=iDDL%4;
738       
739       if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
740         if (volumeID2[0]>4 && volumeID2[0]<14){       //I side
741           if (ddlPerSm<2){ //A side
742             FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
743             FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
744             FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
745           } else {//C side
746             FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
747             FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
748             FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
749           }
750         } else {
751           if (volumeID2[0]<5 || volumeID2[0]>13){       //O side
752             if (ddlPerSm<2){ //A side
753               FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
754               FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
755               FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
756             } else { //C side
757               FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
758               FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
759               FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
760             }
761           }
762         }
763         FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
764         FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
765         Int_t trm= iDDL*10+(iTRM-3);
766         if (ddlACside==0) { //A side
767           FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
768         } else {//C side
769           FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
770         }
771       }//hit selection
772   }//end while   
773   EnableDqmShifterOpt(kFALSE);
774   //
775   IncEvCountCycleRecPoints();
776   IncEvCountTotalRecPoints();
777   //
778 }
779
780 //____________________________________________________________________________
781 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
782 {
783   //
784   // make QA data from ESDs
785   //  
786   const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
787   const Double_t pionMass = 0.13957018; //GeV/c^2
788
789   Int_t ntrk = esd->GetNumberOfTracks() ; 
790   Int_t ntpc=0;
791   Int_t ntofout=0;
792   
793     while (ntrk--) {
794       AliESDtrack *track=esd->GetTrack(ntrk);
795       Double_t tofTime=track->GetTOFsignal();//in ps
796       Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
797       Double_t tofToT=track->GetTOFsignalToT(); //in ps
798       
799       UInt_t status=track->GetStatus();
800       if (track->IsOn(AliESDtrack::kTPCrefit)) {
801         ntpc++;
802         Double_t y=track->Eta();
803         if (TMath::Abs(y)<0.9) { //select TOF acceptance
804           if ((status&AliESDtrack::kTOFout)!=0)  { //define matching
805             ntofout++;
806             FillESDsData(1,tofTime*1E-3);
807             FillESDsData(2,tofTimeRaw*1E-3); 
808             FillESDsData(3,tofToT*1E-3);
809             FillESDsData(4,track->Pt());
810             
811             Double_t length =track->GetIntegratedLength();
812             Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
813             Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
814             FillESDsData(8,tofTime-piTexp);
815             FillESDsData(9,length);
816             
817             if ((status&AliESDtrack::kTIME)!=0) 
818               FillESDsData(5,track->Pt());
819             
820             if (tofTime>0)
821               FillESDsData(6,track->Pt());
822           } //end check on matched tracks
823         } 
824       }//end check on TPCrefit
825     }
826     
827     FillESDsData(0,ntofout) ;
828     if(ntpc>0){
829       Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
830       FillESDsData(7,ratio) ;
831     }
832     
833     if(ntofout>0) {
834         Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
835         FillESDsData(8,ratio) ;
836     }
837     EnableDqmShifterOpt(kFALSE);
838     //
839     IncEvCountCycleESDs();
840     IncEvCountTotalESDs();
841     //
842 }
843
844 //____________________________________________________________________________ 
845 void AliTOFQADataMakerRec::StartOfDetectorCycle()
846 {
847   //
848   //Detector specific actions at start of cycle
849   // ResetAllTRMcounters();
850   fCalibData = GetCalibData();
851   fIsSOC=kTRUE;
852   return;
853 }  
854
855 //____________________________________________________________________________ 
856 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
857 {
858   //Detector specific actions at end of cycle
859   // do the QA checking
860   ResetEventTrigClasses();
861   //
862   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
863     if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;     
864     SetEventSpecie(AliRecoParam::ConvertIndex(specie));  
865
866     for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
867
868       if (fEnableDqmShifterOpt) {
869         // RS: fetch the histograms for given trigger class
870         TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
871         
872         // Help make the raw qa histogram easier to interpret for the DQM shifter
873         if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
874         
875         printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
876                GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
877         
878         //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
879       
880         if (fCalibData){
881           //set minima and maxima to allow log scale
882           Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
883           Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
884           fLineExpTimeMin->SetY2(yTimeMax);
885           fLineExpTimeMax->SetY2(yTimeMax);
886           fLineExpTotMin->SetY2(yTotMax);
887           fLineExpTotMax->SetY2(yTotMax);
888           //
889           for (Int_t j=0;j<18;j++){
890             if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
891               TH1* htmp = (TH1*)arrRW[j];
892               htmp->GetXaxis()->SetLabelOffset(0.005);
893               htmp->GetXaxis()->SetLabelSize(0.05);
894               htmp->GetXaxis()->SetTitleOffset(0.8);
895               htmp->GetXaxis()->SetTitleSize(0.05);
896               htmp->GetYaxis()->SetLabelOffset(0.005);
897               htmp->GetYaxis()->SetLabelSize(0.06);
898               htmp->GetYaxis()->SetTitleOffset(0.8);
899               htmp->GetYaxis()->SetTitleSize(0.06);       
900             }
901           }
902           //make up for all histos 
903           for(Int_t j=0;j<5;j++) {
904             TH1* htmp = (TH1*)arrRW[j];  
905             if (!htmp) continue;
906             htmp->SetMarkerColor(kBlue);
907             htmp->SetMarkerStyle(8);
908             htmp->SetMarkerSize(0.7);
909           }
910           for(Int_t j=5;j<15;j++) {
911             TH1* htmp = (TH1*)arrRW[j];
912             if (!htmp) continue;
913             htmp->SetLineColor(kBlue);
914             htmp->SetLineWidth(1);
915             htmp->SetMarkerColor(kBlue);
916           }
917           
918           TH1* htmp =  (TH1*)arrRW[15];  
919           htmp->SetLineColor(kBlue);
920           htmp->SetLineWidth(1);
921           htmp->SetMarkerStyle(8);
922           htmp->SetMarkerSize(0.7);
923           htmp->SetMarkerColor(kBlue);//Option("bar");
924           //
925           if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
926           if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
927           if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz"); 
928         }
929       }//END ENABLE DQM SHIFTER OPT
930     } // RS: loop over trigger classes
931   } //end for
932   //
933   AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
934   //
935 }
936 //____________________________________________________________________________
937 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
938 {
939   //
940   //return appropriate indeces for the theta-phi map
941   //
942
943   Int_t npadX = AliTOFGeometry::NpadX();
944   Int_t npadZ = AliTOFGeometry::NpadZ();
945   Int_t nStripA = AliTOFGeometry::NStripA();
946   Int_t nStripB = AliTOFGeometry::NStripB();
947   Int_t nStripC = AliTOFGeometry::NStripC();
948
949   Int_t isector = in[0];
950   Int_t iplate = in[1];
951   Int_t istrip = in[2];
952   Int_t ipadX = in[3]; 
953   Int_t ipadZ = in[4]; 
954   
955   Int_t stripOffset = 0;
956   switch (iplate) {
957   case 0:
958     stripOffset = 0;
959       break;
960   case 1:
961     stripOffset = nStripC;
962     break;
963   case 2:
964     stripOffset = nStripC+nStripB;
965     break;
966   case 3:
967     stripOffset = nStripC+nStripB+nStripA;
968     break;
969   case 4:
970     stripOffset = nStripC+nStripB+nStripA+nStripB;
971     break;
972   default:
973     AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
974     break;
975   };
976   Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
977   Int_t phiindex=npadX*isector+ipadX+1;
978   out[0]=zindex;  
979   out[1]=phiindex;  
980   
981 }
982
983 //---------------------------------------------------------------
984 Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
985 {
986     /* return tof strip index between 0 and 91 */
987
988   Int_t nStripA = AliTOFGeometry::NStripA();
989   Int_t nStripB = AliTOFGeometry::NStripB();
990   Int_t nStripC = AliTOFGeometry::NStripC();
991
992   // Int_t isector = in[0];
993   Int_t iplate = in[1];
994   Int_t istrip = in[2];
995   //Int_t ipadX = in[3]; 
996   //Int_t ipadZ = in[4]; 
997   
998   Int_t stripOffset = 0;
999   switch (iplate) {
1000   case 0:
1001     stripOffset = 0;
1002       break;
1003   case 1:
1004     stripOffset = nStripC;
1005     break;
1006   case 2:
1007     stripOffset = nStripC+nStripB;
1008     break;
1009   case 3:
1010     stripOffset = nStripC+nStripB+nStripA;
1011     break;
1012   case 4:
1013     stripOffset = nStripC+nStripB+nStripA+nStripB;
1014     break;
1015   default:
1016       AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
1017       stripOffset=-1;
1018       break;
1019   };
1020   
1021   if (stripOffset<0 || stripOffset>92) return -1;
1022   else 
1023       return (stripOffset+istrip);
1024   
1025 }
1026 //---------------------------------------------------------------
1027 Bool_t  AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
1028 {
1029     //
1030     //Checks volume ID validity
1031     //
1032    
1033     for (Int_t j=0;j<5;j++){
1034         if (volumeID[j]<0) {
1035             AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
1036             return kFALSE;
1037         }
1038     }
1039     return kTRUE;
1040     
1041 }
1042
1043 //---------------------------------------------------------------
1044 Bool_t  AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
1045 {
1046     //
1047     //Checks equipment ID validity
1048     
1049    for (Int_t j=0;j<5;j++){
1050         if (equipmentID[j]<0) {
1051           AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1052           return kFALSE;
1053         }
1054    }
1055    return kTRUE;
1056 }
1057 //---------------------------------------------------------------
1058 Bool_t  AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1059 {
1060   /*It returns kTRUE if data come from LTM.
1061     It thus filters trigger-related signals  */
1062
1063   Int_t ddl, trm, tdc;
1064   //if (!CheckEquipID(equipmentID)) return kFALSE;
1065   ddl = equipmentID[0];
1066   trm = equipmentID[1];
1067   tdc = equipmentID[3];
1068   
1069   if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1070     return kTRUE;
1071   else 
1072     return kFALSE;
1073  
1074 }
1075 //---------------------------------------------------------------
1076 Bool_t  AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1077 {
1078   /*It returns kTRUE if data come from spare 
1079     equipment ID. 
1080     So far only check on TRM 3 crate left is implemented */
1081
1082   Int_t ddl, trm, tdc;
1083   //if (!CheckEquipID(equipmentID)) return kFALSE;
1084   ddl = equipmentID[0];
1085   trm = equipmentID[1];
1086   tdc = equipmentID[3];
1087   
1088   if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
1089     return kTRUE;
1090   else 
1091     return kFALSE;
1092  
1093 }
1094 //----------------------------------------------------------------
1095 /*void  AliTOFQADataMakerRec::ResetAllTRMcounters()
1096 {
1097   //resets all TRM counters to 0
1098   for (Int_t trm=0;trm<720;trm++){
1099     fTRMNoisyArray[trm]=-1;
1100     fTRMHwOkArray[trm]=-1;
1101     fTRMEnabledArray[trm]=-1;
1102   } 
1103   return;
1104   
1105 }
1106 */