]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0QADataMakerRec.cxx
Using both CPHI7-I and CPHI7-B in LHC11d and as default
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMakerRec.cxx
CommitLineData
04236e67 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/* $Id$ */
18
19//---
20// Produces the data needed to calculate the quality assurance.
1d7681da 21// Alla.Maevskaya@cern.ch
04236e67 22//---
23
24// --- ROOT system ---
25#include <TClonesArray.h>
26#include <TFile.h>
27#include <TH1F.h>
1d7681da 28#include <TH2F.h>
04236e67 29#include <TDirectory.h>
02d51eff 30#include <TMath.h>
04236e67 31// --- Standard library ---
32
33// --- AliRoot header files ---
52ee500c 34
04236e67 35#include "AliESDEvent.h"
36#include "AliLog.h"
37#include "AliT0digit.h"
38#include "AliT0hit.h"
39#include "AliT0RecPoint.h"
40#include "AliT0QADataMakerRec.h"
41#include "AliQAChecker.h"
42#include "AliT0RawReader.h"
332b9234 43#include "AliT0RecoParam.h"
703bbd47 44#include "THnSparse.h"
04236e67 45
1d7681da 46#include "Riostream.h"
04236e67 47ClassImp(AliT0QADataMakerRec)
48
49//____________________________________________________________________________
50 AliT0QADataMakerRec::AliT0QADataMakerRec() :
4e25ac79 51AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kT0),
92664bc8 52 "T0 Quality Assurance Data Maker")
53// fnEventCal(0),
54// fnEventPhys(0)
04236e67 55{
56 // ctor
92664bc8 57 // RS: There is some inconsistency here: the separation of physics and calib. events/histos is done by
58 // fEventSpecie. Why do we book separate histos on different slots for calib and physics ?
59 // I am changing this in such way that we don't need local counters like fNumTriggers (the corresponding
60 // histos now incremented in the MakeRaws, and for the normalization I will use the framework's counters
61 // AliQADataMaker::GetEvCountCycle(...), AliQADataMaker::GetEvCountTotal(...)
62 // All these fTrEff.. feff.. will by directly filled in corresponding histos
332b9234 63
f542cc56 64 for(Int_t i=0; i<24; i++) fMeans[i]=2500;
04236e67 65}
66
f7350425 67
04236e67 68//____________________________________________________________________________
69AliT0QADataMakerRec::AliT0QADataMakerRec(const AliT0QADataMakerRec& qadm) :
92664bc8 70 AliQADataMakerRec()
52ee500c 71
04236e67 72{
73 //copy ctor
1d7681da 74 SetName((const char*)qadm.GetName()) ;
04236e67 75 SetTitle((const char*)qadm.GetTitle());
76}
77
78//__________________________________________________________________
79AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec& qadm )
80{
81 // Equal operator.
82 this->~AliT0QADataMakerRec();
83 new(this) AliT0QADataMakerRec(qadm);
84 return *this;
85}
59f47540 86//__________________________________________________________________
87AliT0QADataMakerRec::~AliT0QADataMakerRec()
88{
89 //destructor
59f47540 90}
04236e67 91//____________________________________________________________________________
4e25ac79 92void AliT0QADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
92664bc8 93{
94 //Detector specific actions at end of cycle
95 // do the QA checking
96 AliInfo(Form("Task: %d",task));
97 ResetEventTrigClasses();
98 AliQAChecker::Instance()->Run(AliQAv1::kT0, task, list) ;
99 // const Char_t *triggers[6] = {"mean", "vertex","ORA","ORC","central","semi-central"};
100 //
101 TH1* htmp = 0;
102 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
103 //
104 // RS: There is some inconsistency here: the separation of physics and calib. events/histos is done by
105 // fEventSpecie. Why do we book separate histos on different slots for calib and physics ?
106 // I am changing this in such way that we don't need local counters like fNumTriggers (the corresponding
107 // histos now incremented in the MakeRaws, and for the normalization I will use the framework's counters
108 // AliQADataMaker::GetEvCountCycle(...), AliQADataMaker::GetEvCountTotal(...)
109 //
110 // I think the histos xx+250 should be suppressed (the xx calib histos of specie==calibration will be
111 // used automatically)
112 //
113 if (! IsValidEventSpecie(specie, list)) continue;
114 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
115 //
116 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
117 //
118 if ( task == AliQAv1::kRAWS ) {
119 //
120 float nEvent = GetEvCountCycleRaws(itc); // counted events for given trigger class
121 if (nEvent>0) {
122 if ( (htmp=GetRawsData(169,itc)) ) htmp->Scale(1./nEvent); // RS
92664bc8 123 if ( (htmp=GetRawsData(207,itc)) ) htmp->Scale(1./nEvent); // RS // former feffPhysC count.
52ee500c 124 if ( (htmp=GetRawsData(208,itc)) ) htmp->Scale(1./nEvent); // RS // former feffA count. Remove?
125 if ( (htmp=GetRawsData(209,itc)) ) htmp->Scale(1./nEvent); // RS // former feffqtc count.
92664bc8 126 }
127 } // kRAWS
128 } // RS: loop over eventual clones per trigger class
129 } // loop over species
130 //
131}
132
92664bc8 133
04236e67 134//____________________________________________________________________________
135void AliT0QADataMakerRec::StartOfDetectorCycle()
136{
137 //Detector specific actions at start of cycle
138
139}
140
141//____________________________________________________________________________
142void AliT0QADataMakerRec::InitRaws()
143{
144 // create Raw histograms in Raw subdir
7d297381 145 const Bool_t expert = kTRUE ;
146 const Bool_t saveCorr = kTRUE ;
147 const Bool_t image = kTRUE ;
a46b18e9 148 Float_t low[500];
149 Float_t high[500];
92664bc8 150 //triggers
151 const Char_t *triggers[6] = {"mean", "vertex","ORA","ORC","central","semi-central"};
152
7d297381 153
a46b18e9 154 for (Int_t i=0; i<500; i++){
703bbd47 155 low[i] = 0;
be3ada9f 156 high[i] = 30000;
a46b18e9 157
158 }
159
1d7681da 160 TString timename, ampname, qtcname, ledname;
161 TString timeCalname, ampCalname, ledCalname, qtcCalname;
332b9234 162 TString qt1name, qt0name, qt1Calname, qt0Calname;
426a778b 163 TString nhits;
04236e67 164
be3ada9f 165 TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 10000, 0 ,50000);
92664bc8 166 fhRefPoint->SetLabelSize(0.02);
8825d145 167 Add2RawsList( fhRefPoint,0, expert, !image, !saveCorr);
703bbd47 168
be3ada9f 169 TH1F* fhRefPointcal = new TH1F("hRefPointcal","Ref Point laser", 5000, 0 ,20000);
170 Add2RawsList( fhRefPointcal,250, expert, !image, !saveCorr);
703bbd47 171
172 TH1F *fhRawCFD[24];
173 TH1F * fhRawLEDamp[24];
1d7681da 174 TH1F *fhRawQTC[24]; TH1F * fhRawLED[24];
332b9234 175 TH1F *fhRawQT1[24]; TH1F *fhRawQT0[24];
426a778b 176 TH1F* fhRawNhits[24];
703bbd47 177
04236e67 178 for (Int_t i=0; i<24; i++)
179 {
180 timename ="hRawCFD";
1d7681da 181 ledname = "hRawLED";
04236e67 182 qtcname = "hRawQTC";
332b9234 183 qt0name = "hRawQT0_";
184 qt1name = "hRawQT1_";
1d7681da 185 ampname = "hRawLEDminCFD";
426a778b 186 nhits = "hRawNhits";
332b9234 187 timename += i+1;
188 ampname += i+1;
189 qtcname += i+1;
190 qt0name += i+1;
191 qt1name += i+1;
192 ledname += i+1;
426a778b 193 nhits += i+1;
be3ada9f 194 fhRawCFD[i] = new TH1F(timename.Data(), Form("%s;CFD [#channels];Counts", timename.Data()),Int_t((high[i+1]-low[i+1])/4),low[i+1],high[i+1]);
f542cc56 195 // ForbidCloning(fhRawCFD[i]); //RS I don't know how histos 1-24 should be processed in MakeRaws, for the moment forbidding the cloning
be3ada9f 196 Add2RawsList( fhRawCFD[i],i+1, expert, !image, !saveCorr);
197 fhRawLED[i] = new TH1F(ledname.Data(), Form("%s;LED[#channels];Counts", ledname.Data()),Int_t((high[i+25]-low[i+25])/4),low[i+25],high[i+25]);
198 Add2RawsList( fhRawLED[i],i+25, expert, !image, !saveCorr);
332b9234 199 fhRawLEDamp[i] = new TH1F(ampname.Data(), Form("%s;LED-CFD [#channels];Counts", ampname.Data()),1000,0,1000);
be3ada9f 200 Add2RawsList( fhRawLEDamp[i],i+49, expert, !image, !saveCorr);
332b9234 201 fhRawQTC[i] = new TH1F(qtcname.Data(), Form("%s;QTC[#channels];Counts", qtcname.Data()),10000,0,10000);
be3ada9f 202 Add2RawsList( fhRawQTC[i],i+73, expert, !image, !saveCorr);
203 fhRawQT1[i] = new TH1F(qt1name.Data(), Form("%s;QT1[#channels];Counts", qt1name.Data()),Int_t((high[97+i]-low[97+i])/4),low[97+i],high[97+i]);
204 Add2RawsList( fhRawQT1[i],97+i, expert, !image, !saveCorr);
205 fhRawQT0[i] = new TH1F(qt0name.Data(), Form("%s;QT0[#channels];Counts", qt0name.Data()),Int_t((high[121+i]-low[121+i])/4),low[121+i],high[121+i]);
206 Add2RawsList( fhRawQT0[i],121+i, expert, !image, !saveCorr);
207
208 fhRawNhits[i] = new TH1F(nhits.Data(), Form("%s;#Hits;Events", nhits.Data()),20, 0, 20);
209 Add2RawsList( fhRawNhits[i],176+i, expert, !image, !saveCorr);
210
be3ada9f 211 }
212
52ee500c 213
214 TH1F* fhRawTrigger = new TH1F("hRawTrigger"," triggers;Trigger ;Counts",6,0,6);
92664bc8 215 for (Int_t itr=0; itr<6; itr++) fhRawTrigger->Fill(triggers[itr], 0); // RS Modified to allow cloning (no fNumTriggers member anymore)
52ee500c 216 fhRawTrigger->SetMinimum(0);
217 fhRawTrigger->SetMaximum(2);
218 Add2RawsList(fhRawTrigger ,169, !expert, image, !saveCorr);
be3ada9f 219
220 TH1F* fhRawMean = new TH1F("hRawMean","online mean signal, physics event;",Int_t((high[170]-low[170])/4),low[170],high[170]);
221 Add2RawsList( fhRawMean,170, expert, !image, !saveCorr);
a46b18e9 222
be3ada9f 223 TH1F* fhRawVertex = new TH1F("hRawVertex","online vertex signal; counts",Int_t((high[171]-low[171])/4),low[171],high[171]);
224 Add2RawsList( fhRawVertex,171, expert, image, !saveCorr);
1d7681da 225
be3ada9f 226 TH1F* fhRawORA = new TH1F("hRawORA","online OR A; counts",Int_t((high[172]-low[172])/4),low[172],high[172]);
227 Add2RawsList( fhRawORA,172, expert, !image, !saveCorr);
228 TH1F* fhRawORC = new TH1F("hRawORC","online OR C;counts",Int_t(( high[173]-low[173])/4),low[173],high[173]);
229 Add2RawsList( fhRawORC,173, expert, !image, !saveCorr);
230 TH1F* fhMultCentr = new TH1F("hMultCentr","online trigger Central;counts ",Int_t(( high[174]-low[174])/4),low[174],high[174]);
231 Add2RawsList( fhMultCentr,174, expert, !image, !saveCorr);
232 TH1F* fhMultSeCentr = new TH1F("hMultSemiCentr","online trigger SemiCentral;counts ",Int_t(( high[175]-low[175])/4),low[175],high[175]);
233 Add2RawsList( fhMultSeCentr,175, expert, !image, !saveCorr);
332b9234 234
be3ada9f 235 TH1F* fhMultA = new TH1F("hMultA","full mulltiplicity A side;Multiplicity;Entries", Int_t((high[201]-low[201])/4) ,low[201],high[201]);
236 Add2RawsList( fhMultA,201, expert, image, !saveCorr );
237
238 TH1F* fhMultAS = new TH1F("hMultASemi","full multiplicity with semi-central trigger A side ;Multiplicity;Entries",
239 Int_t((high[202]-low[202])/4),low[202],high[202] );
240 Add2RawsList( fhMultAS, 202, expert, !image, !saveCorr);
241 TH1F* fhMultAC = new TH1F("hMultACentr","full multiplicity with central trigger;Multiplicity;Entries",
242 Int_t((high[203]-low[203])/4),low[203],high[203]);
243 Add2RawsList( fhMultAC, 203, expert, !image, !saveCorr);
244
245
246 //side C
52ee500c 247 TH1F* fhMultC = new TH1F("hMultC","full mulltiplicity C side;Multiplicity;Entries", Int_t(high[204]-low[204]/4) ,low[204],high[204]);
be3ada9f 248 Add2RawsList( fhMultC,204, expert, image, !saveCorr );
249 TH1F* fhMultCS = new TH1F("hMultCSemi","full multiplicity with semi-central trigger C side;Multiplicity;Entries",
250 Int_t((high[205]-low[205])/4),low[205],high[205] );
251 Add2RawsList( fhMultCS,205, expert, !image, !saveCorr);
52ee500c 252 TH1F* fhMultCC = new TH1F("hMultCCentr","full multiplicity with central trigger C side;Multiplicity;Entries",
be3ada9f 253 Int_t((high[206]-low[206])/4),low[206],high[206]);
254 Add2RawsList( fhMultCC,206, expert, !image, !saveCorr);
255
256
257 //efficiency
52ee500c 258 TH1F* fhCFDeff= new TH1F("fhCFDeff"," CFD efficiency; #PMT; #CFD counts/nEvents",24, 0 ,24);
259 fhCFDeff->SetMinimum(0);
260 fhCFDeff->SetMaximum(2);
261 Add2RawsList( fhCFDeff, 207, !expert, image, !saveCorr);
262 TH1F* fhEffLED = new TH1F("hEffLED","LEDefficiecy; #PMT; #LED counts/nEvent",24, 0 ,24);
263 fhEffLED ->SetMinimum(0);
264 fhEffLED->SetMaximum(2);
265 Add2RawsList( fhEffLED,208, !expert, image, !saveCorr);
266
267 TH1F* fhEffQTC = new TH1F("hEffQTC","QTC efficiecy; #PMT; QTC efficiency%s;",24, 0 ,24);
268 fhEffQTC->SetMinimum(0);
269 fhEffQTC->SetMaximum(2);
270 Add2RawsList( fhEffQTC,209, !expert, image, !saveCorr);
271
272 TH2F* fhCFD = new TH2F("hCFD","CFD ; #PMT; CFD {#channnels}",25, 0 ,25,Int_t((high[210]-low[210])/4),low[210],high[210]);
be3ada9f 273 fhCFD->SetOption("COLZ");
274 Add2RawsList( fhCFD,210, expert, image, !saveCorr);
275
52ee500c 276 TH2F* fhLED = new TH2F("hLED","LED ; #PMT; LED [#channnels]",25, 0 ,25,Int_t((high[211]-low[211])/4),low[211],high[211]);
be3ada9f 277 fhLED->SetOption("COLZ");
278 Add2RawsList( fhLED,211, expert, image, !saveCorr);
a46b18e9 279
52ee500c 280 TH2F* fhQTC = new TH2F("hQTC","QTC ; #PMT; QTC [#channnels]",25, 0 ,25,Int_t( high[212]-low[212]),low[212],high[212]);
be3ada9f 281 fhQTC->SetOption("COLZ");
282 Add2RawsList( fhQTC,212, expert, image, !saveCorr);
be3ada9f 283
b9dd81a7 284 TH1F* fhNumPMTA= new TH1F("hNumPMTA","number of PMT hitted per event A side",13, 0 ,13);
be3ada9f 285 Add2RawsList(fhNumPMTA ,213, expert, image, !saveCorr);
286
b9dd81a7 287 TH1F* fhNumPMTC= new TH1F("hNumPMTC","number of PMT hitted per event C side",13, 0 ,13);
be3ada9f 288 Add2RawsList(fhNumPMTC ,214, expert, image, !saveCorr);
289
290 TH1F* fhHitsOrA= new TH1F("fhHitsOrA","T0_OR A hit multiplicitie",20, 0 ,20);
291 Add2RawsList( fhHitsOrA,215, expert, !image, !saveCorr);
292
293 TH1F* fhHitsOrC= new TH1F("fhHitsOrC","T0_OR C hit multiplicitie",20, 0 ,20);
294 Add2RawsList(fhHitsOrC ,216, expert, !image, !saveCorr);
295
296
fce2006a 297 TH1F* fhOrCminOrA= new TH1F("fhOrCminOrA","T0_OR C - T0_OR A",10000,-5000,5000);
be3ada9f 298 Add2RawsList( fhOrCminOrA,219, expert, !image, !saveCorr);
703bbd47 299
fce2006a 300 TH1F* fhOrCminOrATvdcOn= new TH1F("fhOrCminOrATvdcOn","T0_OR C - T0_OR A TVDC on",10000,-5000,5000);
be3ada9f 301 Add2RawsList( fhOrCminOrATvdcOn,217, expert, !image, !saveCorr);
302
703bbd47 303
fce2006a 304 TH1F* fhOrCminOrATvdcOff= new TH1F("fhOrCminOrATvdcOff","T0_OR C - T0_OR A TVDC off",10000,-5000,5000);
be3ada9f 305 Add2RawsList( fhOrCminOrATvdcOff,218, expert, !image, !saveCorr);
b2acd28d 306
faca085d 307 //satellite & beam background
f542cc56 308 TH2F* fhBeam = new TH2F("fhBeam", " Mean vs Vertex ", 120, -30, 30, 120, -30, 30);
309 fhBeam->SetOption("COLZ");
310 fhBeam->GetXaxis()->SetTitle("(T0C-T0A/2, ns");
311 fhBeam->GetYaxis()->SetTitle("(T0C+T0A/2, ns");
312 Add2RawsList( fhBeam,220, !expert, image, !saveCorr);
313 TH2F* fhBeamTVDCon = new TH2F("fhBeamTVDCon", " Mean vs Vertex TVDC on ",50, -5, 5, 50, -5, 5) ;
314 fhBeamTVDCon->SetOption("COLZ");
315 fhBeamTVDCon->GetXaxis()->SetTitle("(T0C-T0A/2, ns");
316 fhBeamTVDCon->GetYaxis()->SetTitle("(T0C+T0A/2, ns");
02d51eff 317 Add2RawsList( fhBeamTVDCon,221, expert, image, !saveCorr);
f542cc56 318 TH2F* fhBeamTVDCoff = new TH2F("fhBeamTVDCoff", " Mean vs Vertex TVDC off", 120, -30, 30, 120, -30, 30);
319 fhBeamTVDCoff->GetXaxis()->SetTitle("(T0C-T0A/2, ns");
320 fhBeamTVDCoff->GetYaxis()->SetTitle("(T0C+T0A/2, ns");
321 fhBeamTVDCoff->SetOption("COLZ");
02d51eff 322 Add2RawsList( fhBeamTVDCoff,222, expert, image, !saveCorr);
345c3cf8 323 TH1F* fhMean = new TH1F("fhMean", " (T0A+T0C)/2, ps ", 200, -2000, 2000);
faca085d 324 Add2RawsList( fhMean,223, !expert, image, !saveCorr);
b9dd81a7 325 //vertex 1st
326 TH1F* fhVertex1st = new TH1F("fhVertex1st", " (T0A-T0C)/2, ps 1st particle", 200, -2000, 2000);
327 Add2RawsList( fhVertex1st ,225, !expert, image, !saveCorr);
328 TH1F* fhVertexBest = new TH1F("fhVertexBest", " (T0A-T0C)/2, ps , best particle", 200, -2000, 2000);
329 Add2RawsList( fhVertexBest ,226, !expert, image, !saveCorr);
330 TH1F* fhMean1st = new TH1F("fhMean1st", " (T0A + T0C)/2, ps , 1st particle", 200, -2000, 2000);
331 Add2RawsList( fhMean1st ,227, expert, image, !saveCorr);
332
333 //
f542cc56 334 TH2F* fhBCID = new TH2F("fhBCID", "header BCID vs TRM BC ID ", 500, 0, 5000, 500, 0, 5000);
335 fhBCID->SetOption("COLZ");
336 fhBCID->GetXaxis()->SetTitle("TRM BC ID");
337 fhBCID->GetYaxis()->SetTitle("event header BC ID");
338 Add2RawsList(fhBCID ,224, !expert, image, !saveCorr);
339
92664bc8 340 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
44ed7a66 341}
be3ada9f 342
44ed7a66 343//____________________________________________________________________________
344void AliT0QADataMakerRec::InitDigits()
345{
346 // create Digits histograms in Digits subdir
347 const Bool_t expert = kTRUE ;
348 const Bool_t image = kTRUE ;
349
f628b9d2 350 TH2F * fhDigCFD = new TH2F("fhDigCFD", " CFD digits; #PMT; CFD digits[#channels]",25,-0.5,24.5,100,0,1000);
eca4fa66 351 fhDigCFD->SetOption("COLZ");
f628b9d2 352 Add2DigitsList( fhDigCFD,0, !expert, image);
353 TH2F *fhDigLEDamp = new TH2F("fhDigLEDamp", " LED-CFD digits; #PMT; LED-CFD amplitude ",25,-0.5,24.5,100,100,1000);
eca4fa66 354 fhDigLEDamp->SetOption("COLZ");
394c1a6d 355 Add2DigitsList( fhDigLEDamp,1, !expert, !image);
f628b9d2 356 TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits; #PMT; QTC amplitude",25,-0.5,24.5,100,100,10000);
eca4fa66 357 fhDigQTC->SetOption("COLZ");
b2acd28d 358 Add2DigitsList( fhDigQTC,2, !expert, !image);
92664bc8 359 //
360 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
b2acd28d 361}
04236e67 362
363//____________________________________________________________________________
364
365void AliT0QADataMakerRec::InitRecPoints()
366{
367 // create cluster histograms in RecPoint subdir
7d297381 368 const Bool_t expert = kTRUE ;
369 const Bool_t image = kTRUE ;
1d7681da 370
703bbd47 371 TH2F* fhRecCFD = new TH2F("hRecCFD"," CFD time;#PMT; CFD Time [ns];",24, 0 ,24,
b9024d69 372 100,-50,50);
eca4fa66 373 fhRecCFD->SetOption("COLZ");
7d297381 374 Add2RecPointsList ( fhRecCFD,0, !expert, image);
b9024d69 375
703bbd47 376 TH2F* fhRecAmpDiff = new TH2F("hRecAmpDiff"," LED-CFD min QTC amplitude;#PMT; difference [MIPs];",
b9024d69 377 24, 0 ,24, 200,-10,10);
eca4fa66 378 fhRecAmpDiff->SetOption("COLZ");
7d297381 379 Add2RecPointsList (fhRecAmpDiff, 1, !expert, image);
04236e67 380
f628b9d2 381 TH1F *fhMean = new TH1F("hMean","online - rec mean;online - rec mean[#channels];",2000, -1000, 1000);
7d297381 382 Add2RecPointsList ( fhMean,2, !expert, image);
92664bc8 383 //
384 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
eca4fa66 385}
04236e67 386
387//____________________________________________________________________________
388void AliT0QADataMakerRec::InitESDs()
389{
390 //create ESDs histograms in ESDs subdir
7d297381 391 const Bool_t expert = kTRUE ;
392 const Bool_t image = kTRUE ;
393
be3ada9f 394 TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean; mean time[%channels]",1000, -5, 5);
a581ca38 395 Add2ESDsList(fhESDMean, 0, expert, !image) ;
f628b9d2 396 TH1F * fhESDVertex = new TH1F("hESDvertex","ESDvertex; vertex[cm];",82,-30,30);
a581ca38 397 Add2ESDsList(fhESDVertex, 1, expert, !image) ;
c724dd64 398
be3ada9f 399 TH1F * fhESDResolution = new TH1F("hESDResolution","(T0A-T0C)/2 corrected by SPD vertex; ns",800,-2,2);
a581ca38 400 Add2ESDsList(fhESDResolution, 2, !expert, image) ;
92664bc8 401 //
402 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
04236e67 403}
404
405//____________________________________________________________________________
406void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
407{
02d51eff 408 Int_t time[24] ;
409 for(Int_t i=0; i<24; i++) time[i] = 0;
52ee500c 410
332b9234 411 rawReader->Reset() ;
04236e67 412 //fills QA histos for RAW
5ed41460 413 Int_t shift=0;
45c5ba2d 414 // Int_t refPointParam = GetRecoParam()->GetRefPoint();
332b9234 415 Int_t refpoint = 0;
45c5ba2d 416 Int_t refPointParam = 0;
52ee500c 417
86c020af 418 AliT0RawReader *start = new AliT0RawReader(rawReader);
332b9234 419
f542cc56 420 if (! start->Next()) {
5379c4a3 421 AliDebug(AliQAv1::GetQADebugLevel(),Form(" no raw data found!!"));
f542cc56 422 delete start;
423 return;
424 }
425 UInt_t type =rawReader->GetType();
426 if (GetEventSpecie()==AliRecoParam::kCalib && type!=8) {
52ee500c 427 delete start;
f542cc56 428 return;
429 }
430 //
431 // RS: Don't use custom counters, they create problems with trigger cloning
432 // Use instead framework counters, incremented in the end of this routine
433 // RS: There is some inconsistency here: the separation of physics and calib. events/histos is done by
434 // fEventSpecie. Why do we book separate histos on different slots for calib and physics ?
435 // I am changing this in such way that we don't need local counters like fNumTriggers (the corresponding
436 // histos now incremented in the MakeRaws, and for the normalization I will use the framework's counters
437 // AliQADataMaker::GetEvCountCycle(...), AliQADataMaker::GetEvCountTotal(...)
438 //
439 // I think the histos xx+250 should be suppressed (the xx calib histos of specie==calibration will be
440 // used automatically)
be3ada9f 441
52ee500c 442 //
f542cc56 443 //BC ID
52ee500c 444 // if (type == 7){
445 UInt_t bcid = rawReader->GetBCID();
446 UInt_t trmbcid = start->GetTRMBunchID();
447 FillRawsData(224,trmbcid, bcid);
448 // }
f542cc56 449 // if (type == 7){ shift=1; fnEventPhys++;}
450 Int_t allData[110][5];
451 for (Int_t i0=0; i0<110; i0++)
452 {
453 for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
454 }
455 for (Int_t i=0; i<107; i++)
456 for (Int_t iHit=0; iHit<5; iHit++)
457 allData[i][iHit]= start->GetData(i,iHit);
52ee500c 458
459 //if ( allData[0][0] > 0 && (type == 7))
f542cc56 460 FillRawsData(0, allData[0][0]);
f542cc56 461 refpoint = allData[refPointParam][0];
462 if (refPointParam < 0 ) refpoint=0;
463 if (refPointParam == 0 ) refpoint = allData[0][0] - 5000;
52ee500c 464
f542cc56 465 Int_t sideshift, sideshiftqtc;
466 Int_t numPmtC=0;
467 Int_t numPmtA=0;
468 for (Int_t ik = 0; ik<24; ik++) {
469 if(ik<12) {
470 sideshift=1;
471 sideshiftqtc=1;
52ee500c 472 if(allData[ik+sideshift][0]>0 /*&& type == 7 */ ) numPmtC++;
f542cc56 473 }
474 else {
52ee500c 475 if(allData[ik+45][0]>0 /*&& type == 7 */) numPmtA++;
f542cc56 476 sideshift=45;
477 sideshiftqtc=33;
478 }
479 Int_t nhitsPMT=0;
52ee500c 480
f542cc56 481 for (Int_t iHt=0; iHt<5; iHt++) {
482 //cfd
483 if(allData[ik+sideshift][iHt]>0) {
484 FillRawsData(shift+ik+1, allData[ik+sideshift][iHt]);
485 FillRawsData(210+shift, ik+1, allData[ik+sideshift][iHt]);
52ee500c 486 FillRawsData(207+shift,ik,1.); // instead of incrementing former feff's, increment histo directly
f542cc56 487 AliDebug(50,Form("%i CFD %i data %s",ik, ik+sideshift, GetRawsData(shift+ik+1)->GetName()));
52ee500c 488 nhitsPMT++;
92664bc8 489
f542cc56 490 }
491 //led
492 if(allData[ik+12+sideshift][iHt] > 0) {
493 FillRawsData(shift+ik+24+1,allData[ik+12+sideshift][iHt]);
494 FillRawsData(211+shift,ik+1, allData[ik+12+sideshift][iHt]);
495 AliDebug(50,Form("%i LED %i data %s",ik, ik+12+sideshift, GetRawsData(shift+ik+1+24)->GetName()));
52ee500c 496 FillRawsData(208+shift,ik,1.); // instead of incrementing former feff's, increment histo directly
497
f542cc56 498 }
499 //led -cfd
52ee500c 500
f542cc56 501 if(allData[ik+12+sideshift][iHt] > 0 && allData[ik+sideshift][iHt] >0 )
502 FillRawsData(shift+ik+48+1, allData[ik+12+sideshift][iHt]-allData[ik+sideshift][iHt]);
52ee500c 503
f542cc56 504 //qtc
505 if(allData[2*ik+sideshiftqtc+24][iHt] > 0 &&
506 allData[2*ik+sideshiftqtc+25][iHt] > 0) {
507 FillRawsData(shift+ik+72+1, allData[2*ik+sideshiftqtc+24][iHt]-allData[2*ik+sideshiftqtc+25][iHt]);
508 FillRawsData(212+shift,ik+1, allData[2*ik+sideshiftqtc+24][iHt]-allData[2*ik+sideshiftqtc+25][iHt]);
52ee500c 509
510 FillRawsData(209+shift,ik,1.); // instead of incrementing former feff's, increment histo directly
511
f542cc56 512 AliDebug(50,Form("%i QTC %i data %s",ik, 2*ik+sideshiftqtc+24, GetRawsData(shift+ik+1+72)->GetName()));
52ee500c 513
f542cc56 514 }
515 if(allData[2*ik+sideshiftqtc+24][iHt] > 0) {
516 AliDebug(50,Form("%i QT0 %i data %s",ik, 2*ik+sideshiftqtc+24, GetRawsData(shift+ik+1+96)->GetName()));
517 FillRawsData(shift+ik+96+1,allData[2*ik+sideshiftqtc+24][iHt]);
518 }
519 if(allData[2*ik+sideshiftqtc+25][iHt] > 0) {
520 AliDebug(50,Form("%i QT0 %i data %s",ik, 2*ik+sideshiftqtc+25, GetRawsData(shift+ik+1+120)->GetName()));
521 FillRawsData(shift+ik+120+1,allData[2*ik+sideshiftqtc+25][iHt]);
92664bc8 522 }
f542cc56 523 }
92664bc8 524
52ee500c 525 FillRawsData(ik+176,nhitsPMT);
b9dd81a7 526 FillRawsData(213,numPmtA);
527 FillRawsData(214,numPmtC);
f542cc56 528 }
52ee500c 529
f542cc56 530 Int_t trChannel[6] = {49,50,51,52,55,56};
531 Float_t ch2cm = 24.4*0.029979;
532 Int_t nhitsOrA=0;
533 Int_t nhitsOrC=0;
534 for (Int_t iHt=0; iHt<5; iHt++) {
52ee500c 535
f542cc56 536 //orA-orC phys tvdc 1
537 if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]>0) {
538 AliDebug(10,Form("orA-orC phys tvdc 1 %i data %s", 217+shift, GetRawsData(shift+217)->GetName()));
52ee500c 539
540 FillRawsData(217+shift,(allData[52][iHt] - allData[51][iHt])*ch2cm);
f542cc56 541 }
542 //orA-orC phys tvdc 0
543 if((allData[51][iHt]>0 && allData[52][iHt]>0) && allData[50][iHt]<=0) {
544 AliDebug(10,Form("orA-orC phys tvdc 0 %i data %s", 218+shift, GetRawsData(shift+218)->GetName()));
92664bc8 545
52ee500c 546 FillRawsData(218+shift,(allData[52][iHt] - allData[51][iHt])*ch2cm);
f542cc56 547 }
548 if(allData[51][iHt]>0 && allData[52][iHt]>0) {
549 AliDebug(50,Form("orA-orC phys tvdc all %i data %s", 219+shift, GetRawsData(shift+219)->GetName()));
52ee500c 550 FillRawsData(219+shift,(allData[52][iHt] - allData[51][iHt])*ch2cm);
f542cc56 551 }
552 for (Int_t itr=0; itr<6; itr++) {
553 if (allData[trChannel[itr]][iHt] >0) {
554 //
555 // RS instead of incremented custom counters, fill directly the specie-specific histos
52ee500c 556 // FillRawsData(169+shift, 0.5+itr, 1.); // RS: increment counters
557 FillRawsData(169+shift, itr, 1.); // RS: increment counters
f542cc56 558 AliDebug(50,Form(" triggers %i data %s", 170+itr+shift, GetRawsData(170+itr+shift)->GetName()));
52ee500c 559
f542cc56 560 FillRawsData(170+itr+shift,allData[trChannel[itr]][iHt]);
be3ada9f 561 }
f542cc56 562 }
52ee500c 563
564 /* if(type == 7) */if(allData[51][iHt] >0) nhitsOrA++;
565 /* if(type == 7) */if(allData[52][iHt] >0) nhitsOrC++;
566
f542cc56 567 //mult trigger signals phys
568 //C side
569 if(allData[53][iHt]>0 && allData[54][iHt]>0) {
570 AliDebug(50,Form(" mpdA %i data %s", 201+shift, GetRawsData(201+shift)->GetName()));
52ee500c 571
f542cc56 572 FillRawsData(201+shift,allData[53][iHt]-allData[54][iHt]);
573 if(allData[56][iHt]>0) FillRawsData(202+shift,allData[53][iHt]-allData[54][iHt]);
574 if(allData[55][iHt]>0) FillRawsData(203+shift,allData[53][iHt]-allData[54][iHt]);
575 }
52ee500c 576
f542cc56 577 //A side
578 if(allData[105][iHt]>0 && allData[106][iHt]>0) {
579 AliDebug(50,Form(" mpdC %i data %s", 204+shift, GetRawsData(204+shift)->GetName()));
92664bc8 580
f542cc56 581 FillRawsData(204+shift,allData[105][iHt]-allData[106][iHt]);
582 if(allData[56][iHt]>0) FillRawsData(205+shift,allData[105][iHt]-allData[106][iHt]);
583 if(allData[55][iHt]>0) FillRawsData(206+shift,allData[105][iHt]-allData[106][iHt]);
92664bc8 584 }
f542cc56 585 }
92664bc8 586
f542cc56 587 FillRawsData(215,nhitsOrA);
588 FillRawsData(216,nhitsOrC);
92664bc8 589
f542cc56 590 //draw satellite
591 for (int itr=-1;itr<GetNEventTrigClasses();itr++) { //RS loop over all active trigger classes, including the global one
592 int itrID = itr==-1 ? -1 : GetEventTrigClass(itr)->GetUniqueID();
593 int nEvent = GetEvCountCycleRaws(itrID);
594 //
52ee500c 595 // if(type == 7) { // RS Do we need here event type check, specie should do the job
596 if(nEvent == 1000) {
597 for (Int_t ik=0; ik<24; ik++) {
598 //
599 TH1* hik = (TH1*) GetRawsData(ik+1,itrID); if (!hik) continue;
600 hik->GetXaxis()->SetRangeUser(2000, 3000);
601 int maxBin = hik->GetMaximumBin();
602 double meanEstimate = hik->GetBinCenter( maxBin);
603 TF1* fit= new TF1("fit","gaus", meanEstimate - 40, meanEstimate + 40);
604 fit->SetParameters (hik->GetBinContent(maxBin), meanEstimate, 80);
605 hik->Fit("fit","RQ","Q", meanEstimate-40, meanEstimate+40);
606 fMeans[ik]= (Int_t) fit->GetParameter(1);
607 hik->GetXaxis()->SetRangeUser(0, 30000);
47e3851f 608 fit->Delete();
f542cc56 609 }
52ee500c 610 }
611 //
612 TH2 *h220 = (TH2*)GetRawsData(220,itrID);
613 TH2 *h221 = (TH2*)GetRawsData(221,itrID);
614 TH2 *h222 = (TH2*)GetRawsData(222,itrID);
615 TH1 *h223 = (TH1*)GetRawsData(223,itrID);
b9dd81a7 616 TH1 *h225 = (TH1*)GetRawsData(225,itrID);
617 TH1 *h226 = (TH1*)GetRawsData(226,itrID);
618 TH1 *h227 = (TH1*)GetRawsData(227,itrID);
619 if( nEvent>1000 && (h220 || h221 || h222 || h223 || h225 || h226|| h227) )
620 {
52ee500c 621 Int_t besttimeA=9999999;
622 Int_t besttimeC=9999999;
b9dd81a7 623 Int_t time1stA=9999999;
624 Int_t time1stC=9999999;
52ee500c 625 for (Int_t ipmt=0; ipmt<12; ipmt++){
626 if(allData[ipmt+1][0] > 1 ) {
627 // time[ipmt] = allData[ipmt+1][0] - Int_t(GetRawsData(1)->GetMean());
628 time[ipmt] = allData[ipmt+1][0] - fMeans[ipmt];
629 if(TMath::Abs(time[ipmt]) < TMath::Abs(besttimeC))
630 besttimeC=time[ipmt]; //timeC
b9dd81a7 631 if(time[ipmt] < time1stC) time1stC=time[ipmt]; //timeC
f542cc56 632 }
52ee500c 633 }
634 for ( Int_t ipmt=12; ipmt<24; ipmt++){
635 if(allData[ipmt+45][0] > 0) {
636 time[ipmt] = allData[ipmt+45][0] - fMeans[ipmt] ;
637 if(TMath::Abs(time[ipmt]) < TMath::Abs(besttimeA) )
638 besttimeA=time[ipmt]; //timeA
b9dd81a7 639 if(time[ipmt] < time1stA) time1stA=time[ipmt]; //timeC
f542cc56 640 }
52ee500c 641 }
642 if(besttimeA<99999 &&besttimeC< 99999) {
643 Float_t t0 = 24.4 * (Float_t( besttimeA+besttimeC)/2. );
b9dd81a7 644 Float_t ver = 24.4 * Float_t( besttimeC-besttimeA)/2.;
52ee500c 645 if (h220) h220->Fill(0.001*ver, 0.001*(t0));
646 if(allData[50][0] > 0) if (h221) h221->Fill(0.001*ver, 0.001*(t0));
647 if(allData[50][0] <= 0) if (h222) h222->Fill(0.001*ver, 0.001*(t0));
648 if (h223) h223->Fill(t0);
b9dd81a7 649 if (h226) h226->Fill(ver);
650 }
651 if(time1stA<99999 &&time1stC< 99999) {
652 Float_t t01st = 24.4 * (Float_t( time1stA + time1stC)/2. );
653 Float_t ver1st = 24.4 * Float_t( time1stC - time1stA)/2.;
654 if (h225) h225->Fill(ver1st);
655 if (h227) h227->Fill(t01st);
52ee500c 656 }
657 } //event >100
658 // } //type 7
f542cc56 659 } // RS loop over all active trigger classes, including the global one
52ee500c 660 //
661 IncEvCountCycleRaws();
662 IncEvCountTotalRaws();
663 //
5435cbd2 664 delete start;
332b9234 665}
52ee500c 666
44ed7a66 667//____________________________________________________________________________
668void AliT0QADataMakerRec::MakeDigits( TTree *digitsTree)
669{
670 //fills QA histos for Digits
eca4fa66 671
44ed7a66 672 TArrayI *digCFD = new TArrayI(24);
673 TArrayI *digLED = new TArrayI(24);
674 TArrayI *digQT0 = new TArrayI(24);
675 TArrayI *digQT1 = new TArrayI(24);
676 Int_t refpoint=0;
677
678 TBranch *brDigits=digitsTree->GetBranch("T0");
679 AliT0digit *fDigits = new AliT0digit() ;
680 if (brDigits) {
681 brDigits->SetAddress(&fDigits);
682 }else{
683 AliError(Form("EXEC Branch T0 digits not found"));
92664bc8 684 delete digCFD;
685 delete digLED;
686 delete digQT0;
687 delete digQT1;
44ed7a66 688 return;
689 }
690 digitsTree->GetEvent(0);
691 digitsTree->GetEntry(0);
692 brDigits->GetEntry(0);
693 fDigits->GetTimeCFD(*digCFD);
694 fDigits->GetTimeLED(*digLED);
695 fDigits->GetQT0(*digQT0);
696 fDigits->GetQT1(*digQT1);
697 refpoint = fDigits->RefPoint();
92664bc8 698 for (Int_t i=0; i<24; i++) {
44ed7a66 699 if (digCFD->At(i)>0) {
700 Int_t cfd=digCFD->At(i)- refpoint;
92664bc8 701 FillDigitsData(0,i,cfd);
702 FillDigitsData(1,i, (digLED->At(i) - digCFD->At(i)));
703 FillDigitsData(2,i, (digQT1->At(i) - digQT0->At(i)));
44ed7a66 704 }
92664bc8 705 }
44ed7a66 706
707 delete digCFD;
708 delete digLED;
709 delete digQT0;
710 delete digQT1;
92664bc8 711 //
712 IncEvCountCycleDigits();
5435cbd2 713 IncEvCountTotalDigits();
714 delete fDigits;
92664bc8 715 //
44ed7a66 716}
717
04236e67 718//____________________________________________________________________________
719void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
720{
721 //fills QA histos for clusters
722
446d6ec4 723 AliT0RecPoint* frecpoints= new AliT0RecPoint ();
f628b9d2 724 if (!frecpoints) {
394c1a6d 725 AliError(":MakeRecPoints >> no recpoints found");
04236e67 726 return;
727 }
728 TBranch *brRec =clustersTree ->GetBranch("T0");
729 if (brRec) {
730 brRec->SetAddress(&frecpoints);
731 }else{
f628b9d2 732 AliError(Form("EXEC Branch T0 rec not found "));
733 return;
04236e67 734 }
eca4fa66 735
04236e67 736 brRec->GetEntry(0);
f628b9d2 737
04236e67 738 for ( Int_t i=0; i<24; i++) {
1d7681da 739 if(i<12)
92664bc8 740 FillRecPointsData(0, i, frecpoints -> GetTime(i) - frecpoints -> GetTime(0));
1d7681da 741 if(i>11)
92664bc8 742 FillRecPointsData(0, i, frecpoints -> GetTime(i) - frecpoints -> GetTime(12));
743 FillRecPointsData(1, i, frecpoints -> GetAmp(i) - frecpoints->AmpLED(i));
04236e67 744 }
b9024d69 745 Double_t mmm=frecpoints->GetOnlineMean()- frecpoints->GetMeanTime();
92664bc8 746 FillRecPointsData(2,mmm);
747 //
748 IncEvCountCycleRecPoints();
749 IncEvCountTotalRecPoints();
750 //
5435cbd2 751 delete frecpoints;
04236e67 752}
753
754//____________________________________________________________________________
755void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
756{
757 //fills QA histos for ESD
f628b9d2 758
a581ca38 759 const Double32_t *mean;
760 mean = esd->GetT0TOF();
761 Double32_t t0time= 0.001*mean[0];
762 Double32_t orA= 0.001*mean[1];
763 Double32_t orC=0.001* mean[2];
764
92664bc8 765 if (t0time<99) FillESDsData(0,t0time);
766 if( esd->GetT0zVertex() <99) FillESDsData(1, esd->GetT0zVertex());
767 if( orA<99 && orC<99) FillESDsData(2,(orA-orC)/2.);
768 //
769 IncEvCountCycleESDs();
770 IncEvCountTotalESDs();
771 //
04236e67 772}
02d51eff 773//____________________________________________________________________________
345c3cf8 774//____________________________________________________________________________
775void AliT0QADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
776{
777
778 //reset the detector histograms for a given task
779 AliQADataMakerRec::ResetDetector(task);
780}
781
02d51eff 782
783/*
784void AliT0QADataMakerRec::GetMeanAndSigma(TH1F* hist, Float_t &mean, Float_t &sigma)
785{
786
787 const double window = 3.; //fit window
788
789 double meanEstimate, sigmaEstimate;
790 int maxBin;
791 maxBin = hist->GetMaximumBin(); //position of maximum
792 meanEstimate = hist->GetBinCenter( maxBin); // mean of gaussian sitting in maximum
793 sigmaEstimate = hist->GetRMS();
794 TF1* fit= new TF1("fit","gaus", meanEstimate - window*sigmaEstimate, meanEstimate + window*sigmaEstimate);
795 fit->SetParameters(hist->GetBinContent(maxBin), meanEstimate, sigmaEstimate);
796 hist->Fit("fit","RQ","Q");
797
798 mean = (Float_t) fit->GetParameter(1);
799 sigma = (Float_t) fit->GetParameter(2);
800
801 delete fit;
802}
803*/