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