DQM shifter histos based only on physics data
[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"
0353488e 44#include "AliQAThresholds.h"
45#include "AliDAQ.h"
46#include "AliCDBEntry.h"
47#include "AliQAManager.h"
703bbd47 48#include "THnSparse.h"
04236e67 49
f3d2feeb 50#include "TFitResultPtr.h"
51
1d7681da 52#include "Riostream.h"
04236e67 53ClassImp(AliT0QADataMakerRec)
54
55//____________________________________________________________________________
56 AliT0QADataMakerRec::AliT0QADataMakerRec() :
4e25ac79 57AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kT0),
0353488e 58 "T0 Quality Assurance Data Maker"),
59 fMeanRawVertexParam(0),
60 fMeanORAParam(0),
61 fMeanORCParam(0),
62 fCFDEffSubRangeLowParam(0),
63 fCFDEffSubRangeHighParam(3000),
64 fLEDEffSubRangeLowParam(0),
65 fLEDEffSubRangeHighParam(3000)
92664bc8 66// fnEventCal(0),
67// fnEventPhys(0)
04236e67 68{
69 // ctor
92664bc8 70 // RS: There is some inconsistency here: the separation of physics and calib. events/histos is done by
71 // fEventSpecie. Why do we book separate histos on different slots for calib and physics ?
72 // I am changing this in such way that we don't need local counters like fNumTriggers (the corresponding
73 // histos now incremented in the MakeRaws, and for the normalization I will use the framework's counters
74 // AliQADataMaker::GetEvCountCycle(...), AliQADataMaker::GetEvCountTotal(...)
75 // All these fTrEff.. feff.. will by directly filled in corresponding histos
332b9234 76
0353488e 77 for(Int_t i=0; i<24; i++){
78 fMeanCFDFromGoodRunParam[i]=0;
79 }
04236e67 80}
81
f7350425 82
04236e67 83//____________________________________________________________________________
84AliT0QADataMakerRec::AliT0QADataMakerRec(const AliT0QADataMakerRec& qadm) :
0353488e 85 AliQADataMakerRec(),
86 fMeanRawVertexParam(qadm.fMeanRawVertexParam),
87 fMeanORAParam(qadm.fMeanORAParam),
88 fMeanORCParam(qadm.fMeanORCParam),
89 fCFDEffSubRangeLowParam(qadm.fCFDEffSubRangeLowParam),
90 fCFDEffSubRangeHighParam(qadm.fCFDEffSubRangeHighParam),
91 fLEDEffSubRangeLowParam(qadm.fLEDEffSubRangeLowParam),
92 fLEDEffSubRangeHighParam(qadm.fLEDEffSubRangeHighParam)
04236e67 93{
94 //copy ctor
105ff51c 95 SetName((const char*)qadm.GetName()) ;
96 SetTitle((const char*)qadm.GetTitle());
0353488e 97 for(Int_t i=0; i<24; i++){
98 fMeanCFDFromGoodRunParam[i]=qadm.fMeanCFDFromGoodRunParam[i];
99 }
04236e67 100}
101
102//__________________________________________________________________
103AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec& qadm )
104{
105 // Equal operator.
106 this->~AliT0QADataMakerRec();
107 new(this) AliT0QADataMakerRec(qadm);
108 return *this;
109}
59f47540 110//__________________________________________________________________
111AliT0QADataMakerRec::~AliT0QADataMakerRec()
112{
113 //destructor
59f47540 114}
04236e67 115//____________________________________________________________________________
4e25ac79 116void AliT0QADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
04236e67 117{
118 //Detector specific actions at end of cycle
119 // do the QA checking
92664bc8 120 AliInfo(Form("Task: %d",task));
121 ResetEventTrigClasses();
0353488e 122
123 TH1* hcounter = 0;
124 TH1* heff = 0;
92664bc8 125 TH1* htmp = 0;
0353488e 126 TH1F* hEventCounter=NULL;
92664bc8 127 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
128 //
129 // RS: There is some inconsistency here: the separation of physics and calib. events/histos is done by
130 // fEventSpecie. Why do we book separate histos on different slots for calib and physics ?
131 // I am changing this in such way that we don't need local counters like fNumTriggers (the corresponding
132 // histos now incremented in the MakeRaws, and for the normalization I will use the framework's counters
133 // AliQADataMaker::GetEvCountCycle(...), AliQADataMaker::GetEvCountTotal(...)
134 //
135 // I think the histos xx+250 should be suppressed (the xx calib histos of specie==calibration will be
136 // used automatically)
137 //
138 if (! IsValidEventSpecie(specie, list)) continue;
139 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
140 //
141 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
142 //
143 if ( task == AliQAv1::kRAWS ) {
144 //
145 float nEvent = GetEvCountCycleRaws(itc); // counted events for given trigger class
0353488e 146 if(nEvent>0) {
147 Float_t numberOfEventsAllCycles = 0.0;
148 if((hEventCounter=(TH1F*) GetRawsData(240,itc))){
149 numberOfEventsAllCycles = hEventCounter->Integral() + nEvent;// count all events upto now
150 hEventCounter->SetBinContent(1,numberOfEventsAllCycles); // increase counter
151 }
152
153 SetEfficiency(169, 241, itc, numberOfEventsAllCycles);
154 SetEfficiency(207, 242, itc, numberOfEventsAllCycles);
155 SetEfficiency(208, 243, itc, numberOfEventsAllCycles);
156 SetEfficiency(237, 244, itc, numberOfEventsAllCycles);
157 SetEfficiency(238, 245, itc, numberOfEventsAllCycles);
158
159
160 //fk// orA and orC for given specie and trigger class
161 Float_t numberOfORAEndOfCycle = 0.0;
162 Float_t numberOfORCEndOfCycle = 0.0;
163 if((htmp=GetRawsData(172,itc))) numberOfORAEndOfCycle = htmp->Integral(); //ORA
164 if((htmp=GetRawsData(173,itc))) numberOfORCEndOfCycle = htmp->Integral(); //ORC
165
166 if((heff=GetRawsData(209,itc))){ //QTC efficiency
167 if((hcounter=GetRawsData(246,itc))){ //QTC counter
168 if(numberOfORCEndOfCycle>0){
169 for(int ipmt=0; ipmt<12; ipmt++){
170 Float_t val = hcounter->GetBinContent(ipmt+1); //first bin has consequtive number 1
171 heff->SetBinContent(ipmt+1,val/numberOfORCEndOfCycle);
172
173 }
174 }else{
175 for(int ipmt=0;ipmt<12; ipmt++)
176 heff->SetBinContent(ipmt+1,0);
177 }
178 if(numberOfORAEndOfCycle>0){
179 for(int ipmt=12;ipmt<24; ipmt++){
180 Float_t val = hcounter->GetBinContent(ipmt+1);
181 heff->SetBinContent(ipmt+1,val/numberOfORAEndOfCycle);
182 }
183 }else{
184 for(int ipmt=0;ipmt<12; ipmt++)
185 heff->SetBinContent(ipmt+1,0);
186 }
187 }
188 }
189 }//Evt >0
92664bc8 190 } // kRAWS
191 } // RS: loop over eventual clones per trigger class
192 } // loop over species
193 //
0353488e 194 AliQAChecker::Instance()->Run(AliQAv1::kT0, task, list); //FK
92664bc8 195}
196
92664bc8 197
04236e67 198//____________________________________________________________________________
199void AliT0QADataMakerRec::StartOfDetectorCycle()
200{
201 //Detector specific actions at start of cycle
0353488e 202 AliCDBManager* man = AliCDBManager::Instance();
203 //man->SetDefaultStorage(gSystem->Getenv("AMORE_CDB_URI"));
204 if(!man) return;
205 AliCDBEntry* entry = man->Get("GRP/Calib/QAThresholds");
206 TObjArray* t0branch = (TObjArray*) entry->GetObject();
207 AliQAThresholds* thresholds = (AliQAThresholds*) t0branch->FindObject("T00");
208 // here you should test that you got a non-null pointer
209
210
211if(!thresholds) return;
212 if(AliDAQ::DetectorID("T0")!= thresholds->GetDetectorId()){
213 AliInfo(Form("DETECTOR ID %d DOES NOT MATCH TO TZERO",thresholds->GetDetectorId()));
214 return;
215 }
216
217 int iparam = 0;
218 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
219 fMeanRawVertexParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
220 }
221
222 iparam = 76;
223 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
224 fMeanORAParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
225 }
226
227 iparam = 77;
228 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
229 fMeanORCParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
230 }
231
232 iparam = 78;
233 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
234 fCFDEffSubRangeLowParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
235 }
236
237 iparam = 79;
238 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
239 fCFDEffSubRangeHighParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
240 }
241
242 iparam = 80;
243 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
244 fLEDEffSubRangeLowParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
245 }
246
247 iparam = 81;
248 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean raw vertex
249 fLEDEffSubRangeHighParam = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
250 }
04236e67 251
0353488e 252 for(int ipmt=0; ipmt<24;ipmt++){
253 iparam = ipmt + 1; //current consecutive number of parameter
254 if((TParameter<float>*) thresholds->GetThreshold(iparam)){ // mean CFD from a good run
255 fMeanCFDFromGoodRunParam[ipmt] = ((TParameter<float>*) thresholds->GetThreshold(iparam))->GetVal();
256 }
257 }
04236e67 258}
259
260//____________________________________________________________________________
261void AliT0QADataMakerRec::InitRaws()
262{
0353488e 263
04236e67 264 // create Raw histograms in Raw subdir
7d297381 265 const Bool_t expert = kTRUE ;
266 const Bool_t saveCorr = kTRUE ;
267 const Bool_t image = kTRUE ;
a46b18e9 268 Float_t low[500];
269 Float_t high[500];
92664bc8 270 //triggers
0353488e 271 const Char_t *triggers[6] = {"T0 OR", "vertex","ORA","ORC","central","semi-central"};
92664bc8 272
7d297381 273
a46b18e9 274 for (Int_t i=0; i<500; i++){
703bbd47 275 low[i] = 0;
be3ada9f 276 high[i] = 30000;
a46b18e9 277
278 }
279
1d7681da 280 TString timename, ampname, qtcname, ledname;
281 TString timeCalname, ampCalname, ledCalname, qtcCalname;
332b9234 282 TString qt1name, qt0name, qt1Calname, qt0Calname;
426a778b 283 TString nhits;
04236e67 284
0353488e 285 TH1F* hRefPoint = new TH1F("hRefPoint","Ref Point", 10000, 0 ,50000);
286 hRefPoint->SetLabelSize(0.02);
287 Add2RawsList( hRefPoint,0, expert, !image, !saveCorr);
703bbd47 288
0353488e 289 TH1F *hRefPointcal = new TH1F("hRefPointcal","Ref Point laser", 5000, 0 ,20000);
290 Add2RawsList( hRefPointcal,250, expert, !image, !saveCorr);
703bbd47 291
0353488e 292 TH1F *hRawCFD[24];
293 TH1F *hRawLEDamp[24];
294 TH1F *hRawQTC[24]; TH1F *hRawLED[24];
295 TH1F *hRawQT1[24]; TH1F *hRawQT0[24];
296 TH1F* hRawNhits[24];
703bbd47 297
0353488e 298 for(Int_t i=0; i<24; i++){
299
04236e67 300 timename ="hRawCFD";
1d7681da 301 ledname = "hRawLED";
04236e67 302 qtcname = "hRawQTC";
332b9234 303 qt0name = "hRawQT0_";
304 qt1name = "hRawQT1_";
1d7681da 305 ampname = "hRawLEDminCFD";
426a778b 306 nhits = "hRawNhits";
332b9234 307 timename += i+1;
308 ampname += i+1;
309 qtcname += i+1;
310 qt0name += i+1;
311 qt1name += i+1;
312 ledname += i+1;
426a778b 313 nhits += i+1;
0353488e 314 hRawCFD[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]);
315 // ForbidCloning(hRawCFD[i]); //RS I don't know how histos 1-24 should be processed in MakeRaws, for the moment forbidding the cloning
316 Add2RawsList( hRawCFD[i],i+1, expert, !image, !saveCorr);
317 hRawLED[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]);
318 Add2RawsList( hRawLED[i],i+25, expert, !image, !saveCorr);
319 hRawLEDamp[i] = new TH1F(ampname.Data(), Form("%s;LED-CFD [#channels]; Counts", ampname.Data()),1000,0,1000);
320 Add2RawsList( hRawLEDamp[i],i+49, expert, !image, !saveCorr);
321 hRawQTC[i] = new TH1F(qtcname.Data(), Form("%s;QTC[#channels]; Counts", qtcname.Data()), 2500,0,10000); //fk
322 //QT0
323 Add2RawsList( hRawQTC[i],i+73, expert, !image, !saveCorr);
324 hRawQT0[i] = new TH1F(qt0name.Data(), Form("%s; QT0 [#channels]; Counts", qt0name.Data()),Int_t((high[97+i]-low[97+i])/4),low[97+i],high[97+i]);
325 Add2RawsList( hRawQT0[i],97+i, expert, !image, !saveCorr);
326 //QT1
327 hRawQT1[i] = new TH1F(qt1name.Data(), Form("%s; QT1 [#channels]; Counts", qt1name.Data()),Int_t((high[121+i]-low[121+i])/4),low[121+i],high[121+i]);
328 Add2RawsList( hRawQT1[i],121+i, expert, !image, !saveCorr);
be3ada9f 329
0353488e 330 hRawNhits[i] = new TH1F(nhits.Data(), Form("%s;#Hits;Events", nhits.Data()),20, 0, 20);
331 Add2RawsList( hRawNhits[i],176+i, expert, !image, !saveCorr);
332 }
be3ada9f 333
52ee500c 334
0353488e 335 TH1F* hRawTrigger = new TH1F("hRawTrigger"," triggers;Trigger ;Counts",6,0,6);
336 for (Int_t itr=0; itr<6; itr++) hRawTrigger->Fill(triggers[itr], 0); // RS Modified to allow cloning (no fNumTriggers member anymore)
337 Add2RawsList(hRawTrigger ,169, !expert, image, !saveCorr);
338 TH1F* hRawMean = new TH1F("hRawMean","online timer mean signal, physics event;",Int_t((high[170]-low[170])/4),low[170],high[170]);
339 Add2RawsList( hRawMean,170, expert, !image, !saveCorr);
340
341 TH1F* hRawVertex = new TH1F("hRawVertex","online 0TVX vertex signal; counts",Int_t((high[171]-low[171])/4),low[171],high[171]);
342 Add2RawsList( hRawVertex,171, expert, !image, !saveCorr);//FK
343
344 TH1F* hRawORA = new TH1F("hRawORA","online OR A; counts",Int_t((high[172]-low[172])/4),low[172],high[172]);
345 Add2RawsList( hRawORA,172, expert, !image, !saveCorr);
346 TH1F* hRawORC = new TH1F("hRawORC","online OR C;counts",Int_t(( high[173]-low[173])/4),low[173],high[173]);
347 Add2RawsList( hRawORC,173, expert, !image, !saveCorr);
348 TH1F* hMultCentr = new TH1F("hMultCentr","online trigger Central;counts ",Int_t(( high[174]-low[174])/4),low[174],high[174]);
349 Add2RawsList( hMultCentr,174, expert, !image, !saveCorr);
350 TH1F* hMultSeCentr = new TH1F("hMultSemiCentr","online trigger SemiCentral;counts ",Int_t(( high[175]-low[175])/4),low[175],high[175]);
351 Add2RawsList( hMultSeCentr,175, expert, !image, !saveCorr);
352
353 TH1F* hMultA = new TH1F("hMultA","full mulltiplicity A side;Multiplicity;Entries", Int_t((high[201]-low[201])/4) ,low[201],high[201]);
354 Add2RawsList( hMultA,201, expert, !image, !saveCorr );//FK
355
356 TH1F* hMultAS = new TH1F("hMultASemi","full multiplicity with semi-central trigger A side ;Multiplicity;Entries",
be3ada9f 357 Int_t((high[202]-low[202])/4),low[202],high[202] );
0353488e 358 Add2RawsList( hMultAS, 202, expert, !image, !saveCorr);
359 TH1F* hMultAC = new TH1F("hMultACentr","full multiplicity with central trigger;Multiplicity;Entries",
be3ada9f 360 Int_t((high[203]-low[203])/4),low[203],high[203]);
0353488e 361 Add2RawsList( hMultAC, 203, expert, !image, !saveCorr);
be3ada9f 362
363
364 //side C
0353488e 365 TH1F* hMultC = new TH1F("hMultC","full mulltiplicity C side;Multiplicity;Entries", Int_t(high[204]-low[204]/4) ,low[204],high[204]);
366 Add2RawsList( hMultC,204, expert, !image, !saveCorr );//FK
367 TH1F* hMultCS = new TH1F("hMultCSemi","full multiplicity with semi-central trigger C side;Multiplicity;Entries",
be3ada9f 368 Int_t((high[205]-low[205])/4),low[205],high[205] );
0353488e 369 Add2RawsList( hMultCS,205, expert, !image, !saveCorr);
370 TH1F* hMultCC = new TH1F("hMultCCentr","full multiplicity with central trigger C side;Multiplicity;Entries",
be3ada9f 371 Int_t((high[206]-low[206])/4),low[206],high[206]);
0353488e 372 Add2RawsList( hMultCC,206, expert, !image, !saveCorr);
be3ada9f 373
374
375 //efficiency
0353488e 376 TH1F* hCFDeff= new TH1F("hCFDeff"," CFD efficiency; #PMT; #CFD counts/nEvents",24, 0 ,24);
377 hCFDeff->SetMinimum(0);
378 hCFDeff->SetMaximum(2);
379 hCFDeff->SetMarkerStyle(20);//fk
380 hCFDeff->SetMarkerColor(2);//fk
381 hCFDeff->SetOption("p");//fk
382 Add2RawsList( hCFDeff, 207, expert, image, !saveCorr);//FK
383 TH1F* hEffLED = new TH1F("hEffLED","LED efficiency; #PMT; #LED counts/nEvent",24, 0 ,24);
384 hEffLED ->SetMinimum(0);
385 hEffLED->SetMaximum(2);
386 hEffLED->SetMarkerStyle(28);//fk
387 hEffLED->SetMarkerColor(1);//fk
388 hEffLED->SetOption("p,same");//fk
389 Add2RawsList( hEffLED, 208, expert, !image, !saveCorr);//FK is published attahced to the CFD efficiency
390
391 TH1F* hEffQTC = new TH1F("hEffQTC","QTC efficiency; #PMT; QTC efficiency%s;",24, 0 ,24);
392 hEffQTC->SetMinimum(0);
393 hEffQTC->SetMaximum(2);
394 Add2RawsList( hEffQTC,209, !expert, image, !saveCorr);
52ee500c 395
0353488e 396 TH2F* hCFD = new TH2F("hCFD","CFD ; #PMT; CFD {#channnels}", 24, 0 , 24,Int_t((high[210]-low[210])/4),low[210],high[210]);
397 hCFD->SetOption("COLZ");
398 Add2RawsList( hCFD,210, expert, !image, !saveCorr);//fk
be3ada9f 399
0353488e 400 TH2F* hLED = new TH2F("hLED","LED ; #PMT; LED [#channnels]", 24, 0 , 24,Int_t((high[211]-low[211])/4),low[211],high[211]);
401 hLED->SetOption("COLZ");
402 Add2RawsList( hLED,211, expert, !image, !saveCorr);//fk
a46b18e9 403
0353488e 404 TH2F* hQTC = new TH2F("hQTC","QTC ; #PMT; QTC [#channnels]", 24, 0, 24,Int_t( (high[212]-low[212])/4),low[212],high[212]);
405 hQTC->SetOption("COLZ");
406 Add2RawsList( hQTC,212, expert, !image, !saveCorr);//fk
be3ada9f 407
0353488e 408 TH1F* hNumPMTA= new TH1F("hNumPMTA","number of PMT hitted per event A side",13, 0 ,13);
409 Add2RawsList(hNumPMTA ,213, expert, image, !saveCorr);
be3ada9f 410
0353488e 411 TH1F* hNumPMTC= new TH1F("hNumPMTC","number of PMT hitted per event C side",13, 0 ,13);
412 Add2RawsList(hNumPMTC ,214, expert, image, !saveCorr);
be3ada9f 413
0353488e 414 TH1F* hHitsOrA= new TH1F("hHitsOrA","T0_OR A hit multiplicity",20, 0 ,20);
415 Add2RawsList( hHitsOrA,215, expert, !image, !saveCorr);
be3ada9f 416
0353488e 417 TH1F* hHitsOrC= new TH1F("hHitsOrC","T0_OR C hit multiplicity",20, 0 ,20);
418 Add2RawsList(hHitsOrC ,216, expert, !image, !saveCorr);
be3ada9f 419
420
0353488e 421 TH1F* hOrCminOrA= new TH1F("hOrCminOrA","T0_OR C - T0_OR A [cm]",10000,-5000,5000);
422 Add2RawsList( hOrCminOrA,219, expert, !image, !saveCorr); //FK
703bbd47 423
0353488e 424 TH1F* hOrCminOrATvdcOn= new TH1F("hOrCminOrATvdcOn","T0_OR C - T0_OR A TVDC on [cm]",10000,-5000,5000);
425 Add2RawsList( hOrCminOrATvdcOn,217, expert, !image, !saveCorr);//FK
be3ada9f 426
703bbd47 427
0353488e 428 TH1F* hOrCminOrATvdcOff= new TH1F("hOrCminOrATvdcOff","T0_OR C - T0_OR A TVDC off [cm]",10000,-5000,5000);
429 Add2RawsList( hOrCminOrATvdcOff,218, expert, !image, !saveCorr);//FK
b2acd28d 430
faca085d 431 //satellite & beam background
0353488e 432 TH2F* hBeam = new TH2F("hBeam", "Mean vs Vertex from 1st hit", 120, -30, 30, 120, -30, 30);
433 hBeam->SetOption("COLZ");
434 hBeam->GetXaxis()->SetTitle("(T0C-T0A)/2, ns from 1st"); //vtx
435 hBeam->GetYaxis()->SetTitle("(T0C+T0A)/2, ns"); //time
436 Add2RawsList( hBeam,220, !expert, image, !saveCorr);
437
438 TH2F* hBeamTVDCon = new TH2F("hBeamTVDCon", "Mean vs Vertex TVDC on from 1st hit",50, -5, 5, 50, -5, 5);//FK
439 hBeamTVDCon->SetOption("COLZ");
440 hBeamTVDCon->GetXaxis()->SetTitle("(T0C-T0A)/2, ns from 1st hit");
441 hBeamTVDCon->GetYaxis()->SetTitle("(T0C+T0A)/2, ns");
442 Add2RawsList( hBeamTVDCon,221, expert, image, !saveCorr);
443
444 TH2F* hBeamTVDCoff = new TH2F("hBeamTVDCoff", "Mean vs Vertex TVDC off from 1st hit", 120, -30, 30, 120, -30, 30);
445 hBeamTVDCoff->GetXaxis()->SetTitle("(T0C-T0A)/2, ns from 1st hit");
446 hBeamTVDCoff->GetYaxis()->SetTitle("(T0C+T0A)/2, ns");
447 hBeamTVDCoff->SetOption("COLZ");
448 Add2RawsList( hBeamTVDCoff,222, expert, image, !saveCorr);
449
450 //vertex 1st
451 TH1F* hVertex1stTVDCon = new TH1F("hVertex1stTVDCon", "(T0A-T0C)/2, ps, from 1st hit TVDC on", 200, -2000, 2000); //FK
452 Add2RawsList(hVertex1stTVDCon ,223, !expert, image, !saveCorr);
453 TH1F* hVertex1stTVDCoff = new TH1F("hVertex1stTVDCoff", "(T0A-T0C)/2, ps, from 1st hit TVDC off", 500, -2000, 2000);//FK
454 Add2RawsList( hVertex1stTVDCoff,225, !expert, image, !saveCorr);
455 TH1F* hMean1stTVDCon = new TH1F("hMean1stTVDCon", "(T0A+T0C)/2, ps, from 1st hit TVDC on", 200, -2000, 2000);//FK
456 Add2RawsList( hMean1stTVDCon, 226, !expert, image, !saveCorr);
457 TH1F* hMean1stTVDCoff = new TH1F("hMean1stTVDCoff", "(T0A+T0C)/2, ps, from 1st hit TVDC off", 200, -2000, 2000);//FK
458 Add2RawsList( hMean1stTVDCoff, 227, !expert, image, !saveCorr);
459
460
461 //FK histograms start from 230
462 TH1F* hRawVertexMinMean = new TH1F("hRawVertexMinMean","online 0TVX vertex signal minus mean; counts",200,-1000,1000);
463 Add2RawsList(hRawVertexMinMean,230, expert, image, !saveCorr);//FK
464
465 TH1F* hCFDSubtrMean = new TH1F("hCFDSubtrMean","CFD minus mean; #PMT; CFD - mean {#channnels}", 24, 0, 24);
466 hCFDSubtrMean->SetMarkerStyle(20);
467 hCFDSubtrMean->SetOption("p");
468 Add2RawsList( hCFDSubtrMean,231, !expert, image, !saveCorr);//fk filled in Checker
469
470 TH1F* hLEDSubtrMean = new TH1F("hLEDSubtrMean","LED minus mean; #PMT; LED - mean [#channnels]", 24, 0, 24);
471 hLEDSubtrMean->SetMarkerStyle(20);
472 hLEDSubtrMean->SetOption("p");
473 Add2RawsList( hLEDSubtrMean,232, expert, image, !saveCorr);//fk filled in Checker
474
475 TH1F* hQTCSubtrMean = new TH1F("hQTCSubtrMean","QTC minus mean; #PMT; QTC - mean [#channnels]", 24, 0, 24);
476 hQTCSubtrMean->SetMarkerStyle(20);
477 hQTCSubtrMean->SetOption("p");
478 Add2RawsList( hQTCSubtrMean,233, expert, image, !saveCorr);//fk filled in Checker
479
480 TH2F* hDiffOrCVersusDiffOrATvdcOn= new TH2F("hDiffOrCVersusDiffOrATvdcOn","ORC-meanORC versus ORA-meanORA (TVDC on)",50,-200,200,50,-200,200);
481 hDiffOrCVersusDiffOrATvdcOn->SetOption("COLZ");
482 hDiffOrCVersusDiffOrATvdcOn->GetXaxis()->SetTitle("ORA - mean ORA [channel]");
483 hDiffOrCVersusDiffOrATvdcOn->GetYaxis()->SetTitle("ORC - mean ORC [channel]");
484 Add2RawsList(hDiffOrCVersusDiffOrATvdcOn, 234, expert, image, !saveCorr);//FK
485
486 TH2F* hDiffOrCVersusDiffOrATvdcOff= new TH2F("hDiffOrCVersusDiffOrATvdcOff","ORC-meanORC vetsus ORA-meanORA (TVDC off)",50,-200,200,50,-200,200);
487 hDiffOrCVersusDiffOrATvdcOff->SetOption("COLZ");
488 hDiffOrCVersusDiffOrATvdcOff->GetXaxis()->SetTitle("ORA - mean ORA [channel]");
489 hDiffOrCVersusDiffOrATvdcOff->GetYaxis()->SetTitle("ORC - mean ORC [channel]");
490 Add2RawsList(hDiffOrCVersusDiffOrATvdcOff, 235, expert, image, !saveCorr);//FK
491
492 TH2F* hBCID = new TH2F("hBCID", "header BCID vs TRM BC ID ", 500, 0, 5000, 500, 0, 5000);
493 hBCID->SetOption("COLZ");
494 hBCID->GetXaxis()->SetTitle("TRM BC ID");
495 hBCID->GetYaxis()->SetTitle("event header BC ID");
496 Add2RawsList(hBCID ,236, !expert, image, !saveCorr);
497
498 //CFD and LED efficiency in range ~2000- ~3000
499 TH1F* hCFDeffSubRange = new TH1F("hCFDeffSubRange"," CFD eff in subrange; #PMT; #CFD counts/nEvents",24, 0 ,24);
500 Add2RawsList( hCFDeffSubRange, 237, expert, !image, !saveCorr);//FK
501
502
503 TH1F* hEffLEDSubRange = new TH1F("hEffLEDSubRange","LED eff in subrange; #PMT; #LED counts/nEvent",24, 0 ,24);
504 Add2RawsList( hEffLEDSubRange,238, expert, !image, !saveCorr);//FK
505 // ratio CDF eff /LEF eff in subragne
506 TH1F* hRatioCFDLEDeff = new TH1F("hRatioCFDLEDeff","Ratio CFD/LED eff in subrange; #PMT; ratio CDF/LED eff",24, 0 ,24);
507 hRatioCFDLEDeff->SetMinimum(0);
508 hRatioCFDLEDeff->SetMaximum(2);
509 Add2RawsList( hRatioCFDLEDeff, 239, !expert, image, !saveCorr);//FK
510
511 TH1F* hEventCounter = new TH1F("hEventCounter","Event counter for eff histos; X; number of events",1, 0 ,1);
512 Add2RawsList( hEventCounter, 240, expert, !image, !saveCorr);//FK
513
514 //counters
515 TH1F* hRawTriggerCounter = new TH1F("hRawTriggerCounter"," triggers;Trigger ;Counts",6,0,6);
516 for (Int_t itr=0; itr<6; itr++) hRawTriggerCounter->Fill(triggers[itr], 0);
517 Add2RawsList(hRawTriggerCounter ,241, expert, !image, !saveCorr);
518
519 TH1F* hCFDCounter= new TH1F("hCFDCounter"," CFD counter #PMT; #CFD counts",24, 0 ,24);
520 Add2RawsList( hCFDCounter, 242, expert, !image, !saveCorr);//FK
521 TH1F* hLEDCounter = new TH1F("hLEDCounter","LED counter; #PMT; #LED counts",24, 0 ,24);
522 Add2RawsList( hLEDCounter, 243, expert, !image, !saveCorr);//FK
523
524 TH1F* hCFDeffSubRangeCounter = new TH1F("hCFDeffSubRangeCounter"," CFD eff in subrange counter; #PMT; #CFD counts",24, 0 ,24);
525 Add2RawsList( hCFDeffSubRangeCounter, 244, expert, !image, !saveCorr);//FK
526 TH1F* hEffLEDSubRangeCounter = new TH1F("hEffLEDSubRangeCounter","LED eff in subrange counter; #PMT; #LED counts",24, 0 ,24);
527 Add2RawsList( hEffLEDSubRangeCounter,245, expert, !image, !saveCorr);//FK
528
529 TH1F* hQTCCounter = new TH1F("hQTCCounter","QTC counter; #PMT; QTC counts;",24, 0 ,24);
530 Add2RawsList( hQTCCounter,246, expert, !image, !saveCorr);
531
532 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
04236e67 533}
be3ada9f 534
04236e67 535//____________________________________________________________________________
44ed7a66 536void AliT0QADataMakerRec::InitDigits()
537{
538 // create Digits histograms in Digits subdir
539 const Bool_t expert = kTRUE ;
540 const Bool_t image = kTRUE ;
541
f628b9d2 542 TH2F * fhDigCFD = new TH2F("fhDigCFD", " CFD digits; #PMT; CFD digits[#channels]",25,-0.5,24.5,100,0,1000);
eca4fa66 543 fhDigCFD->SetOption("COLZ");
f628b9d2 544 Add2DigitsList( fhDigCFD,0, !expert, image);
545 TH2F *fhDigLEDamp = new TH2F("fhDigLEDamp", " LED-CFD digits; #PMT; LED-CFD amplitude ",25,-0.5,24.5,100,100,1000);
eca4fa66 546 fhDigLEDamp->SetOption("COLZ");
394c1a6d 547 Add2DigitsList( fhDigLEDamp,1, !expert, !image);
f628b9d2 548 TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits; #PMT; QTC amplitude",25,-0.5,24.5,100,100,10000);
eca4fa66 549 fhDigQTC->SetOption("COLZ");
b2acd28d 550 Add2DigitsList( fhDigQTC,2, !expert, !image);
92664bc8 551 //
552 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
b2acd28d 553}
44ed7a66 554
555//____________________________________________________________________________
04236e67 556
557void AliT0QADataMakerRec::InitRecPoints()
558{
559 // create cluster histograms in RecPoint subdir
7d297381 560 const Bool_t expert = kTRUE ;
561 const Bool_t image = kTRUE ;
1d7681da 562
703bbd47 563 TH2F* fhRecCFD = new TH2F("hRecCFD"," CFD time;#PMT; CFD Time [ns];",24, 0 ,24,
b9024d69 564 100,-50,50);
eca4fa66 565 fhRecCFD->SetOption("COLZ");
7d297381 566 Add2RecPointsList ( fhRecCFD,0, !expert, image);
b9024d69 567
703bbd47 568 TH2F* fhRecAmpDiff = new TH2F("hRecAmpDiff"," LED-CFD min QTC amplitude;#PMT; difference [MIPs];",
b9024d69 569 24, 0 ,24, 200,-10,10);
eca4fa66 570 fhRecAmpDiff->SetOption("COLZ");
7d297381 571 Add2RecPointsList (fhRecAmpDiff, 1, !expert, image);
04236e67 572
f628b9d2 573 TH1F *fhMean = new TH1F("hMean","online - rec mean;online - rec mean[#channels];",2000, -1000, 1000);
7d297381 574 Add2RecPointsList ( fhMean,2, !expert, image);
92664bc8 575 //
576 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
eca4fa66 577}
04236e67 578
579//____________________________________________________________________________
580void AliT0QADataMakerRec::InitESDs()
581{
582 //create ESDs histograms in ESDs subdir
7d297381 583 const Bool_t expert = kTRUE ;
584 const Bool_t image = kTRUE ;
585
be3ada9f 586 TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean; mean time[%channels]",1000, -5, 5);
a581ca38 587 Add2ESDsList(fhESDMean, 0, expert, !image) ;
f628b9d2 588 TH1F * fhESDVertex = new TH1F("hESDvertex","ESDvertex; vertex[cm];",82,-30,30);
a581ca38 589 Add2ESDsList(fhESDVertex, 1, expert, !image) ;
c724dd64 590
be3ada9f 591 TH1F * fhESDResolution = new TH1F("hESDResolution","(T0A-T0C)/2 corrected by SPD vertex; ns",800,-2,2);
a581ca38 592 Add2ESDsList(fhESDResolution, 2, !expert, image) ;
92664bc8 593 //
594 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
04236e67 595}
596
597//____________________________________________________________________________
598void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
599{
0353488e 600 //indices in lookup table lookUpTable_tanay.txt
601 enum { kTZeroRefPoint=0, kTZeroFirstCfdC=1, kTZeroFirstLedC=13, kTZeroFirstQT0C=25,kTZeroFirstQT1C=26,
602 kTZeroVertex=50, kTZeroOrA=51, kTZeroOrC=52, kT0multAQ0=53, kT0multAQ1=54, kTZeroMultCent=55, kTZeroMultSemi=56,
603 kTZeroFirstCfdA=57, kTZeroFirstLedA=69, kTZeroFirstQT0A=81,kTZeroFirstQT1A=82,
604 kT0multCQ0=105, kT0multCQ1=106
605 };
606
02d51eff 607 Int_t time[24] ;
608 for(Int_t i=0; i<24; i++) time[i] = 0;
332b9234 609 rawReader->Reset() ;
04236e67 610 //fills QA histos for RAW
0353488e 611 //Int_t shift=0;
45c5ba2d 612 // Int_t refPointParam = GetRecoParam()->GetRefPoint();
332b9234 613 Int_t refpoint = 0;
45c5ba2d 614 Int_t refPointParam = 0;
52ee500c 615
86c020af 616 AliT0RawReader *start = new AliT0RawReader(rawReader);
332b9234 617
f542cc56 618 if (! start->Next()) {
5379c4a3 619 AliDebug(AliQAv1::GetQADebugLevel(),Form(" no raw data found!!"));
f542cc56 620 delete start;
621 return;
622 }
623 UInt_t type =rawReader->GetType();
624 if (GetEventSpecie()==AliRecoParam::kCalib && type!=8) {
52ee500c 625 delete start;
f542cc56 626 return;
627 }
628 //
629 // RS: Don't use custom counters, they create problems with trigger cloning
630 // Use instead framework counters, incremented in the end of this routine
631 // RS: There is some inconsistency here: the separation of physics and calib. events/histos is done by
632 // fEventSpecie. Why do we book separate histos on different slots for calib and physics ?
633 // I am changing this in such way that we don't need local counters like fNumTriggers (the corresponding
634 // histos now incremented in the MakeRaws, and for the normalization I will use the framework's counters
635 // AliQADataMaker::GetEvCountCycle(...), AliQADataMaker::GetEvCountTotal(...)
636 //
637 // I think the histos xx+250 should be suppressed (the xx calib histos of specie==calibration will be
638 // used automatically)
be3ada9f 639
52ee500c 640 //
f542cc56 641 //BC ID
52ee500c 642 // if (type == 7){
643 UInt_t bcid = rawReader->GetBCID();
644 UInt_t trmbcid = start->GetTRMBunchID();
0353488e 645
646 FillRawsData(236,trmbcid, bcid);
647 //FillRawsData(236,100, bcid); fake error for testing
648
649 // }
f542cc56 650 // if (type == 7){ shift=1; fnEventPhys++;}
651 Int_t allData[110][5];
0353488e 652 for(Int_t i0=0; i0<110; i0++){
653 for(Int_t j0=0; j0<5; j0++){
654 allData[i0][j0]=0;
655 }
656 }
657
658 for(Int_t i=0; i<=kT0multCQ1; i++){
659 for(Int_t iHit=0; iHit<5; iHit++){
f542cc56 660 allData[i][iHit]= start->GetData(i,iHit);
0353488e 661 }
662 }
663
664 if( allData[kTZeroRefPoint][0] > 0 /*&& (type == 7)*/){
665 FillRawsData(0, allData[kTZeroRefPoint][0]); //Reference point
666 }
f542cc56 667 refpoint = allData[refPointParam][0];
0353488e 668 if(refPointParam < 0 ) refpoint=0;
669 if(refPointParam == 0 ) refpoint = allData[kTZeroRefPoint][0] - 5000;
52ee500c 670
0353488e 671 Int_t offsetCDF, offsetLED, offsetQT0, offsetQT1;
f542cc56 672 Int_t numPmtC=0;
0353488e 673 Int_t numPmtA=0;
674
675 for(Int_t ik = 0; ik<24; ik++){
676 Int_t ipmt = ik; //C side
f542cc56 677 if(ik<12) {
0353488e 678 offsetCDF = kTZeroFirstCfdC;
679 offsetLED = kTZeroFirstLedC;
680 offsetQT0 = kTZeroFirstQT0C;
681 offsetQT1 = kTZeroFirstQT1C;
682 if(allData[ipmt+offsetCDF][0]>0 /*&& type == 7 */ ) numPmtC++;
683 }else{
684 ipmt = ik - 12; //A side
685 offsetCDF = kTZeroFirstCfdA;
686 offsetLED = kTZeroFirstLedA;
687 offsetQT0 = kTZeroFirstQT0A;
688 offsetQT1 = kTZeroFirstQT1A;
689 if(allData[ipmt + offsetCDF][0]>0 /*&& type == 7 */) numPmtA++;
f542cc56 690 }
0353488e 691 Int_t nhitsPMT=0; //count hits for this pmt
692
f542cc56 693 for (Int_t iHt=0; iHt<5; iHt++) {
694 //cfd
0353488e 695 if(allData[ipmt+offsetCDF][iHt]>0){
696 FillRawsData(ik+1, allData[ipmt+offsetCDF][iHt]); //CFD for each PMT
697 FillRawsData(210, ik, allData[ipmt+offsetCDF][iHt]); //CFD vs PMT
698 FillRawsData(242,ik,1.); // CFD counter for efficiency
699 if( fCFDEffSubRangeLowParam<allData[ipmt+offsetCDF][iHt] && allData[ipmt+offsetCDF][iHt]<fCFDEffSubRangeHighParam){
700 FillRawsData(244,ik,1.); //count CDF entries in given subrange for CDF/LED eff ratio
701 }
702 AliDebug(50,Form("%i CFD %i data %s",ik, ipmt+offsetCDF, GetRawsData(ik+1)->GetName()));
52ee500c 703 nhitsPMT++;
f542cc56 704 }
705 //led
0353488e 706 if(allData[ipmt+offsetLED][iHt] > 0){
707 FillRawsData(ik+25,allData[ipmt+offsetLED][iHt]);
708 FillRawsData(211,ik, allData[ipmt+offsetLED][iHt]);
709 FillRawsData(243,ik,1.); //LED counter for LED efficiency
710 if(fLEDEffSubRangeLowParam < allData[ipmt+offsetLED][iHt] && allData[ipmt+offsetLED][iHt]<fLEDEffSubRangeHighParam){
711 FillRawsData(245,ik,1.); //count LED entries in given subrange for CDF/LED eff ratio
712 }
713 AliDebug(50,Form("%i LED %i data %s",ik, ipmt+offsetLED, GetRawsData(ik+25)->GetName()));
f542cc56 714 }
0353488e 715
f542cc56 716 //led -cfd
0353488e 717 if(allData[ipmt+offsetLED][iHt] > 0 && allData[ipmt+offsetCDF][iHt] > 0 )
718 FillRawsData(ik+49, allData[ipmt+offsetLED][iHt]-allData[ipmt+offsetCDF][iHt]);
52ee500c 719
f542cc56 720 //qtc
0353488e 721 if(allData[2*ipmt+offsetQT0][iHt] > 0 &&
722 allData[2*ipmt+offsetQT1][iHt] > 0 ) {
723
724 FillRawsData(ik+73, allData[2*ipmt+offsetQT0][iHt]-allData[2*ipmt+offsetQT1][iHt]); //QTC = QT0 - QT1 for each channel
725 FillRawsData(212,ik, allData[2*ipmt+offsetQT0][iHt]-allData[2*ipmt+offsetQT1][iHt]); //QTC vs pmt
52ee500c 726
0353488e 727 FillRawsData(246,ik,1.); // QTC counter for QTC efficiency
52ee500c 728
0353488e 729 AliDebug(50,Form("%i QTC %i data %s",ik, 2*ipmt+offsetQT0, GetRawsData(ik+73)->GetName()));
52ee500c 730
f542cc56 731 }
0353488e 732 if(allData[2*ipmt+offsetQT0][iHt] > 0) { //QT0
733 AliDebug(50,Form("%i QT0 %i data %s",ik, 2*ipmt+offsetQT0, GetRawsData(ik+97)->GetName()));
734 FillRawsData(ik+97,allData[2*ipmt+offsetQT0][iHt]);
f542cc56 735 }
0353488e 736 if(allData[2*ipmt+offsetQT1][iHt] > 0) {//QT1
737 AliDebug(50,Form("%i QT1 %i data %s",ik, 2*ipmt+offsetQT1, GetRawsData(ik+121)->GetName()));
738 FillRawsData(ik+121,allData[2*ipmt+offsetQT1][iHt]);
92664bc8 739 }
f542cc56 740 }
92664bc8 741
0353488e 742 FillRawsData(ik+176, nhitsPMT);
743 }
744 FillRawsData(213, numPmtA);
745 FillRawsData(214, numPmtC);
746
747
748 Int_t trChannel[6] = {kTZeroRefPoint, kTZeroVertex, kTZeroOrA, kTZeroOrC, kTZeroMultCent, kTZeroMultSemi};
f542cc56 749 Float_t ch2cm = 24.4*0.029979;
750 Int_t nhitsOrA=0;
751 Int_t nhitsOrC=0;
0353488e 752
f542cc56 753 for (Int_t iHt=0; iHt<5; iHt++) {
f542cc56 754 //orA-orC phys tvdc 1
0353488e 755 if((allData[kTZeroOrA][iHt]>0 && allData[kTZeroOrC][iHt]>0) && allData[kTZeroVertex][iHt]>0) {
756 AliDebug(10,Form("orA-orC phys tvdc 1 %i data %s", 217, GetRawsData(217)->GetName()));
52ee500c 757
0353488e 758 FillRawsData(217,(allData[kTZeroOrC][iHt] - allData[kTZeroOrA][iHt])*ch2cm);
f542cc56 759 }
760 //orA-orC phys tvdc 0
0353488e 761 if((allData[kTZeroOrA][iHt]>0 && allData[kTZeroOrC][iHt]>0) && allData[kTZeroVertex][iHt]<=0) {
762 AliDebug(10,Form("orA-orC phys tvdc 0 %i data %s", 218, GetRawsData(218)->GetName()));
92664bc8 763
0353488e 764 FillRawsData(218,(allData[kTZeroOrC][iHt] - allData[kTZeroOrA][iHt])*ch2cm);
f542cc56 765 }
0353488e 766 if(allData[kTZeroOrA][iHt]>0 && allData[kTZeroOrC][iHt]>0) {
767 AliDebug(50,Form("orA-orC phys tvdc all %i data %s", 219, GetRawsData(219)->GetName()));
768 FillRawsData(219,(allData[kTZeroOrC][iHt] - allData[kTZeroOrA][iHt])*ch2cm);
f542cc56 769 }
0353488e 770
771
772 for (Int_t itr=0; itr<6; itr++) {//T0_MEAN,TO_VERTX,ORA,ORC,T0_mult,T0_mult
f542cc56 773 if (allData[trChannel[itr]][iHt] >0) {
774 //
775 // RS instead of incremented custom counters, fill directly the specie-specific histos
52ee500c 776 // FillRawsData(169+shift, 0.5+itr, 1.); // RS: increment counters
0353488e 777 // FillRawsData(169+shift, itr, 1.); //hRawTrigger RS: increment counters
778 FillRawsData(241, itr, 1.); // fill trigger counter
779 AliDebug(50,Form(" triggers %i data %s", 170+itr, GetRawsData(170+itr)->GetName()));
52ee500c 780
0353488e 781 FillRawsData(170+itr,allData[trChannel[itr]][iHt]);
782
783 if( trChannel[itr] == kTZeroVertex){ //T0_VERTEX minus mean from config files
784 FillRawsData(230, allData[kTZeroVertex][iHt] - fMeanRawVertexParam );
785 }
786 }
787 }
788
789 if(allData[kTZeroOrA][iHt] > 0 && allData[kTZeroOrC][iHt] > 0 ){ //FK// ORC-mean ORA -mean
790 Float_t diffORA = allData[kTZeroOrA][iHt] - fMeanORAParam;
791 Float_t diffORC = allData[kTZeroOrC][iHt] - fMeanORCParam;
792 if(allData[kTZeroVertex][iHt]>0){ //TVDC on
793 FillRawsData(234, diffORA, diffORC);
794 //Estimate mean orA and orC based on these
795 //cout<<"ORA "<<allData[kTZeroOrA][iHt]<<endl;
796 //cout<<"ORC "<<allData[kTZeroOrC][iHt]<<endl;
797
798 }else{//TVDC off
799 FillRawsData(235, diffORA, diffORC);
be3ada9f 800 }
f542cc56 801 }
52ee500c 802
0353488e 803 /* if(type == 7) */if(allData[kTZeroOrA][iHt] >0){
804 nhitsOrA++;
805 }
806 /* if(type == 7) */if(allData[kTZeroOrC][iHt] >0){
807 nhitsOrC++;
808 }
f542cc56 809 //mult trigger signals phys
0353488e 810 //A side
811 if(allData[kT0multAQ0][iHt]>0 && allData[kT0multAQ1][iHt]>0) {
812 AliDebug(50,Form(" mpdA %i data %s", 201, GetRawsData(201)->GetName()));
52ee500c 813
0353488e 814 FillRawsData(201,allData[kT0multAQ0][iHt]-allData[kT0multAQ1][iHt]);
815 if(allData[kTZeroMultSemi][iHt]>0) FillRawsData(202,allData[kT0multAQ0][iHt]-allData[kT0multAQ1][iHt]);
816 if(allData[kTZeroMultCent][iHt]>0) FillRawsData(203,allData[kT0multAQ0][iHt]-allData[kT0multAQ1][iHt]);
f542cc56 817 }
52ee500c 818
0353488e 819 //C side
820 if(allData[kT0multCQ0][iHt]>0 && allData[kT0multCQ1][iHt]>0) {
821 AliDebug(50,Form(" mpdC %i data %s", 204, GetRawsData(204)->GetName()));
92664bc8 822
0353488e 823 FillRawsData(204,allData[kT0multCQ0][iHt]-allData[kT0multCQ1][iHt]);
824 if(allData[kTZeroMultSemi][iHt]>0) FillRawsData(205,allData[kT0multCQ0][iHt]-allData[kT0multCQ1][iHt]);
825 if(allData[kTZeroMultCent][iHt]>0) FillRawsData(206,allData[kT0multCQ0][iHt]-allData[kT0multCQ1][iHt]);
92664bc8 826 }
f542cc56 827 }
92664bc8 828
f542cc56 829 FillRawsData(215,nhitsOrA);
830 FillRawsData(216,nhitsOrC);
92664bc8 831
f542cc56 832 //draw satellite
833 for (int itr=-1;itr<GetNEventTrigClasses();itr++) { //RS loop over all active trigger classes, including the global one
d5008ebd 834 int itrID = itr==-1 ? -1 : int( GetEventTrigClass(itr)->GetUniqueID());
0353488e 835
836 TH2 *hBeam = (TH2*)GetRawsData(220,itrID);
837 TH2 *hBeamTVDCon = (TH2*)GetRawsData(221,itrID);
838 TH2 *hBeamTVDCoff = (TH2*)GetRawsData(222,itrID);
839 TH1 *hVertex1stTVDCon = (TH1*)GetRawsData(223,itrID);
840 TH1 *hVertex1stTVDCoff = (TH1*)GetRawsData(225,itrID);
841 TH1 *hMean1stTVDCon = (TH1*)GetRawsData(226,itrID);
842 TH1 *hMean1stTVDCoff = (TH1*)GetRawsData(227,itrID);
843 if(hBeam || hBeamTVDCon || hBeamTVDCoff || hVertex1stTVDCon || hVertex1stTVDCoff || hMean1stTVDCon || hMean1stTVDCoff){
844
b9dd81a7 845 Int_t time1stA=9999999;
846 Int_t time1stC=9999999;
0353488e 847 for(Int_t ipmt=0; ipmt<12; ipmt++){
848 if(allData[ipmt+kTZeroFirstCfdC][0] > 1 ) {
849 time[ipmt] = allData[ipmt+kTZeroFirstCfdC][0] - (Int_t) fMeanCFDFromGoodRunParam[ipmt]; //fk
b9dd81a7 850 if(time[ipmt] < time1stC) time1stC=time[ipmt]; //timeC
f542cc56 851 }
52ee500c 852 }
0353488e 853 for( Int_t ipmt=12; ipmt<24; ipmt++){
854 if(allData[ipmt-12+kTZeroFirstCfdA][0] > 0) {
855 time[ipmt] = allData[ipmt-12+kTZeroFirstCfdA][0] - (Int_t) fMeanCFDFromGoodRunParam[ipmt];//fk
b9dd81a7 856 if(time[ipmt] < time1stA) time1stA=time[ipmt]; //timeC
f542cc56 857 }
52ee500c 858 }
0353488e 859 if(time1stA<99999 && time1stC< 99999) { //From First
860 Float_t t01st = 24.4 * (Float_t) (( time1stA + time1stC)/2.0);
861 Float_t ver1st = 24.4 * (Float_t) (( time1stC - time1stA)/2.0);
862 if(hBeam) hBeam->Fill(0.001*ver1st, 0.001*(t01st)); //Mean versus vertex
863 if(allData[kTZeroVertex][0] > 0){//TVDC on
864 if(hBeamTVDCon) hBeamTVDCon->Fill(0.001*ver1st, 0.001*(t01st));//Mean versus TVDC on from first
865 if(hVertex1stTVDCon) hVertex1stTVDCon->Fill(ver1st);
866 //if(hVertex1stTVDCon) hVertex1stTVDCon->Fill(1500);//for testing AM
867
868 if(hMean1stTVDCon) hMean1stTVDCon->Fill(t01st);
869 // if(hMean1stTVDCon) hMean1stTVDCon->Fill(1800);//testing AM
870 }else{//TVDC off
871 if(hBeamTVDCoff) hBeamTVDCoff->Fill(0.001*ver1st, 0.001*(t01st));//FK// TVDC off from first
872 if(hVertex1stTVDCoff) hVertex1stTVDCoff->Fill(ver1st);
873 if(hMean1stTVDCoff) hMean1stTVDCoff->Fill(t01st);
874 }
52ee500c 875 }
0353488e 876 } //
f542cc56 877 } // RS loop over all active trigger classes, including the global one
52ee500c 878 //
879 IncEvCountCycleRaws();
880 IncEvCountTotalRaws();
881 //
5435cbd2 882 delete start;
332b9234 883}
52ee500c 884
04236e67 885//____________________________________________________________________________
44ed7a66 886void AliT0QADataMakerRec::MakeDigits( TTree *digitsTree)
887{
888 //fills QA histos for Digits
eca4fa66 889
44ed7a66 890 TArrayI *digCFD = new TArrayI(24);
891 TArrayI *digLED = new TArrayI(24);
892 TArrayI *digQT0 = new TArrayI(24);
893 TArrayI *digQT1 = new TArrayI(24);
894 Int_t refpoint=0;
895
896 TBranch *brDigits=digitsTree->GetBranch("T0");
897 AliT0digit *fDigits = new AliT0digit() ;
898 if (brDigits) {
899 brDigits->SetAddress(&fDigits);
900 }else{
901 AliError(Form("EXEC Branch T0 digits not found"));
92664bc8 902 delete digCFD;
903 delete digLED;
904 delete digQT0;
905 delete digQT1;
44ed7a66 906 return;
907 }
908 digitsTree->GetEvent(0);
909 digitsTree->GetEntry(0);
910 brDigits->GetEntry(0);
911 fDigits->GetTimeCFD(*digCFD);
912 fDigits->GetTimeLED(*digLED);
913 fDigits->GetQT0(*digQT0);
914 fDigits->GetQT1(*digQT1);
915 refpoint = fDigits->RefPoint();
92664bc8 916 for (Int_t i=0; i<24; i++) {
44ed7a66 917 if (digCFD->At(i)>0) {
918 Int_t cfd=digCFD->At(i)- refpoint;
92664bc8 919 FillDigitsData(0,i,cfd);
920 FillDigitsData(1,i, (digLED->At(i) - digCFD->At(i)));
921 FillDigitsData(2,i, (digQT1->At(i) - digQT0->At(i)));
44ed7a66 922 }
92664bc8 923 }
44ed7a66 924
925 delete digCFD;
926 delete digLED;
927 delete digQT0;
928 delete digQT1;
92664bc8 929 //
930 IncEvCountCycleDigits();
5435cbd2 931 IncEvCountTotalDigits();
932 delete fDigits;
92664bc8 933 //
44ed7a66 934}
935
936//____________________________________________________________________________
04236e67 937void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
938{
939 //fills QA histos for clusters
940
446d6ec4 941 AliT0RecPoint* frecpoints= new AliT0RecPoint ();
f628b9d2 942 if (!frecpoints) {
394c1a6d 943 AliError(":MakeRecPoints >> no recpoints found");
04236e67 944 return;
945 }
946 TBranch *brRec =clustersTree ->GetBranch("T0");
947 if (brRec) {
948 brRec->SetAddress(&frecpoints);
949 }else{
f628b9d2 950 AliError(Form("EXEC Branch T0 rec not found "));
951 return;
04236e67 952 }
eca4fa66 953
04236e67 954 brRec->GetEntry(0);
f628b9d2 955
04236e67 956 for ( Int_t i=0; i<24; i++) {
1d7681da 957 if(i<12)
92664bc8 958 FillRecPointsData(0, i, frecpoints -> GetTime(i) - frecpoints -> GetTime(0));
1d7681da 959 if(i>11)
92664bc8 960 FillRecPointsData(0, i, frecpoints -> GetTime(i) - frecpoints -> GetTime(12));
961 FillRecPointsData(1, i, frecpoints -> GetAmp(i) - frecpoints->AmpLED(i));
04236e67 962 }
b9024d69 963 Double_t mmm=frecpoints->GetOnlineMean()- frecpoints->GetMeanTime();
92664bc8 964 FillRecPointsData(2,mmm);
965 //
966 IncEvCountCycleRecPoints();
967 IncEvCountTotalRecPoints();
968 //
5435cbd2 969 delete frecpoints;
04236e67 970}
971
972//____________________________________________________________________________
973void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
974{
975 //fills QA histos for ESD
f628b9d2 976
a581ca38 977 const Double32_t *mean;
978 mean = esd->GetT0TOF();
979 Double32_t t0time= 0.001*mean[0];
980 Double32_t orA= 0.001*mean[1];
981 Double32_t orC=0.001* mean[2];
982
92664bc8 983 if (t0time<99) FillESDsData(0,t0time);
984 if( esd->GetT0zVertex() <99) FillESDsData(1, esd->GetT0zVertex());
985 if( orA<99 && orC<99) FillESDsData(2,(orA-orC)/2.);
986 //
987 IncEvCountCycleESDs();
988 IncEvCountTotalESDs();
989 //
04236e67 990}
02d51eff 991//____________________________________________________________________________
345c3cf8 992//____________________________________________________________________________
993void AliT0QADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
994{
995
996 //reset the detector histograms for a given task
997 AliQADataMakerRec::ResetDetector(task);
0353488e 998
999 for(int ih=0; ih<=250; ih++){
1000 for(int itr=-1; itr < GetNEventTrigClasses(); itr++){
1001 int itrID = itr==-1 ? -1 : int( GetEventTrigClass(itr)->GetUniqueID());
1002
1003 TH1 *htmp = (TH1*) GetRawsData(ih,itrID);
1004 if(htmp) htmp->Reset();
1005 }
1006 }
345c3cf8 1007}
1008
02d51eff 1009
1010/*
1011void AliT0QADataMakerRec::GetMeanAndSigma(TH1F* hist, Float_t &mean, Float_t &sigma)
1012{
1013
1014 const double window = 3.; //fit window
1015
1016 double meanEstimate, sigmaEstimate;
1017 int maxBin;
1018 maxBin = hist->GetMaximumBin(); //position of maximum
1019 meanEstimate = hist->GetBinCenter( maxBin); // mean of gaussian sitting in maximum
1020 sigmaEstimate = hist->GetRMS();
1021 TF1* fit= new TF1("fit","gaus", meanEstimate - window*sigmaEstimate, meanEstimate + window*sigmaEstimate);
1022 fit->SetParameters(hist->GetBinContent(maxBin), meanEstimate, sigmaEstimate);
1023 hist->Fit("fit","RQ","Q");
1024
1025 mean = (Float_t) fit->GetParameter(1);
1026 sigma = (Float_t) fit->GetParameter(2);
1027
1028 delete fit;
1029}
1030*/
0353488e 1031
1032void AliT0QADataMakerRec::SetEfficiency(Int_t idxEffHisto, Int_t idxCounterHisto, Int_t trigger, Float_t totNumOfEvts){
1033 //calculate efficiency = counts/number of events
1034 TH1* heff = GetRawsData(idxEffHisto,trigger);
1035 TH1* hcounter = GetRawsData(idxCounterHisto,trigger);
1036 if(heff && hcounter && (totNumOfEvts>0.0)){
1037 int nb = heff->GetNbinsX();
1038 for(int ib=1;ib<=nb;ib++){
1039 heff->SetBinContent(ib,((Float_t) hcounter->GetBinContent(ib))/((Float_t) totNumOfEvts));
1040 }
1041 }
1042 return;
1043}