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