Fix for the case of non-existent calibration files
[u/mrichter/AliRoot.git] / ITS / AliITSQADataMakerRec.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 2007-2009, 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/* $Id$ */
17
18// *************************************************************
19// Checks the quality assurance
20// by comparing with reference data
21// contained in a DB
22// -------------------------------------------------------------
23// W. Ferrarese + P. Cerello Feb 2008
24// INFN Torino
25// Melinda Siciliano Aug 2008
26
27
28// --- ROOT system ---
29#include <TH2.h>
30// --- Standard library ---
31
32// --- AliRoot header files ---
33#include "AliITSQADataMakerRec.h"
34#include "AliITSQASPDDataMakerRec.h"
35#include "AliITSQASDDDataMakerRec.h"
36#include "AliITSQASSDDataMakerRec.h"
37#include "AliQAv1.h"
38#include "AliQAChecker.h"
39#include "AliITSQAChecker.h"
40#include "AliITSRecPoint.h"
41#include "AliITSRecPointContainer.h"
42#include "AliRawReader.h"
43#include "AliESDEvent.h"
44#include "AliESDtrack.h"
45#include "AliMultiplicity.h"
46#include "AliITSgeomTGeo.h"
47
48//class TH2;
49//class TH2F;
50class AliESDVertex;
51class AliLog;
52class TTree;
53
54ClassImp(AliITSQADataMakerRec)
55
56//____________________________________________________________________________
57AliITSQADataMakerRec::AliITSQADataMakerRec(Bool_t kMode, Short_t subDet, Short_t ldc) :
58AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kITS), "ITS Quality Assurance Data Maker"),
59 fkOnline(kMode),
60 fSubDetector(subDet),
61 fLDC(ldc),
62 fRunNumber(0),
63 fEventNumber(0),
64 fSelectedTaskIndex(AliQAv1::kNULLTASKINDEX),
65 fSPDDataMaker(NULL),
66 fSDDDataMaker(NULL),
67 fSSDDataMaker(NULL)
68
69{
70 //ctor used to discriminate OnLine-Offline analysis
71 if(fSubDetector < 0 || fSubDetector > 3) {
72 AliError("Error: fSubDetector number out of range; return\n");
73 }
74
75 // Initialization for RAW data
76 if(fSubDetector == 0 || fSubDetector == 1) {
77 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Create SPD DataMakerRec\n");
78 fSPDDataMaker = new AliITSQASPDDataMakerRec(this,fkOnline);
79 }
80 if(fSubDetector == 0 || fSubDetector == 2) {
81 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Create SDD DataMakerRec\n");
82 fSDDDataMaker = new AliITSQASDDDataMakerRec(this,fkOnline);
83 }
84 if(fSubDetector == 0 || fSubDetector == 3) {
85 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Create SSD DataMakerRec\n");
86 fSSDDataMaker = new AliITSQASSDDataMakerRec(this,fkOnline);
87 }
88}
89
90//____________________________________________________________________________
91AliITSQADataMakerRec::~AliITSQADataMakerRec(){
92 // destructor
93 if(fSPDDataMaker)delete fSPDDataMaker;
94 if(fSDDDataMaker)delete fSDDDataMaker;
95 if(fSSDDataMaker)delete fSSDDataMaker;
96}
97
98//____________________________________________________________________________
99AliITSQADataMakerRec::AliITSQADataMakerRec(const AliITSQADataMakerRec& qadm) :
100 AliQADataMakerRec(),
101 fkOnline(qadm.fkOnline),
102 fSubDetector(qadm.fSubDetector),
103 fLDC(qadm.fLDC),
104 fRunNumber(qadm.fRunNumber),
105 fEventNumber(qadm.fEventNumber),
106 fSelectedTaskIndex(qadm.fSelectedTaskIndex),
107 fSPDDataMaker(NULL),
108 fSDDDataMaker(NULL),
109 fSSDDataMaker(NULL)
110
111{
112 //copy ctor
113 SetName((const char*)qadm.GetName()) ;
114 SetTitle((const char*)qadm.GetTitle());
115}
116
117//__________________________________________________________________
118AliITSQADataMakerRec& AliITSQADataMakerRec::operator = (const AliITSQADataMakerRec& qac )
119{
120 // Equal operator.
121 this->~AliITSQADataMakerRec();
122 new(this) AliITSQADataMakerRec(qac);
123 return *this;
124}
125
126//____________________________________________________________________________
127void AliITSQADataMakerRec::StartOfDetectorCycle()
128{
129 //Detector specific actions at start of cycle
130 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of ITS Cycle\n");
131 ResetEventTrigClasses(); // reset triggers list to select all histos
132 ResetEvCountCycle();
133 //
134 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->StartOfDetectorCycle();
135 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->StartOfDetectorCycle();
136 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->StartOfDetectorCycle();
137}
138
139//____________________________________________________________________________
140void AliITSQADataMakerRec::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
141{
142 // Start a cycle of QA data acquistion
143 fSelectedTaskIndex=task;
144 AliQADataMakerRec::StartOfCycle(task,run,sameCycle);
145}
146
147//____________________________________________________________________________
148void AliITSQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
149{
150 // launch the QA checking
151 ResetEventTrigClasses();
152 //
153 AliInfo(Form("End of Dedetctor Cycle called for %s\n",AliQAv1::GetTaskName(task).Data() ));
154 //
155 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
156 //
157 if(!AliQAv1::Instance()->IsEventSpecieSet(specie)) continue;
158 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
159 Int_t idnumber=list[specie]->GetUniqueID();
160 //printf("specie %s \t id number == %d\n",AliRecoParam::GetEventSpecieName(specie),idnumber);
161 if(idnumber==40||idnumber==0){
162 //AliInfo(Form("No check for %s\n",AliQAv1::GetTaskName(task).Data() ))
163 continue;
164 } //skip kDigitsR and not filled TobjArray specie
165 else{
166 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list[specie])\n");
167 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->EndOfDetectorCycle(task, list);//[/*GetEventSpecie()*/specie]);
168 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->EndOfDetectorCycle(task, list);//[/*GetEventSpecie()*/specie]);
169 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->EndOfDetectorCycle(task, list);//[/*GetEventSpecie()*/specie]);
170
171
172 AliQAChecker *qac = AliQAChecker::Instance();
173 AliITSQAChecker *qacb = (AliITSQAChecker *) qac->GetDetQAChecker(0);
174 Int_t subdet=GetSubDet();
175 qacb->SetSubDet(subdet);
176
177 if(subdet== 0 ){
178 qacb->SetTaskOffset(fSPDDataMaker->GetOffset(task,specie), fSDDDataMaker->GetOffset(task,specie), fSSDDataMaker->GetOffset(task,specie)); //Setting the offset for the QAChecker list
179 qacb->SetHisto(fSPDDataMaker->GetTaskHisto(task), fSDDDataMaker->GetTaskHisto(task), fSSDDataMaker->GetTaskHisto(task));
180 }
181 else
182 if(subdet!=0){
183 Int_t offset=GetDetTaskOffset(subdet, task,specie);
184 qacb->SetDetTaskOffset(subdet,offset);
185 Int_t histo=GetDetTaskHisto(subdet, task);
186 qacb->SetDetHisto(subdet,histo);
187 }
188
189 qac->Run( AliQAv1::kITS , task, list);
190
191 }//end else unique id
192
193 }//end for
194}
195
196//____________________________________________________________________________
197//void AliITSQADataMakerRec::EndOfDetectorCycle(const char * /*fgDataName*/)
198//{
199//eventually used for different AliQAChecker::Instance()->Run
200//}
201
202//____________________________________________________________________________
203void AliITSQADataMakerRec::InitRaws() {
204 // Initialization of RAW data histograms
205
206 //if(fRawsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries()) return;
207
208 if(fSubDetector == 0 || fSubDetector == 1) {
209 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitRaws\n");
210 fSPDDataMaker->InitRaws();
211 }
212 if(fSubDetector == 0 || fSubDetector == 2) {
213 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitRaws\n");
214
215 fSDDDataMaker->SetOffset(AliQAv1::kRAWS, fRawsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
216 fSDDDataMaker->InitRaws();
217 }
218 if(fSubDetector == 0 || fSubDetector == 3) {
219 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitRaws\n");
220
221 fSSDDataMaker->SetOffset(AliQAv1::kRAWS, fRawsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
222 fSSDDataMaker->InitRaws();
223 }
224 fRawsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(10);
225 //
226 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
227}
228
229//____________________________________________________________________________
230void AliITSQADataMakerRec::MakeRaws(AliRawReader* rawReader)
231{
232 // Fill QA for RAW
233 //return ;
234
235 SetRunNumber(rawReader->GetRunNumber());
236
237 if(fSubDetector == 0 || fSubDetector == 1) {
238 fSPDDataMaker->MakeRaws(rawReader) ;
239 }
240
241 if(fSubDetector == 0 || fSubDetector == 2) {
242 fSDDDataMaker->MakeRaws(rawReader) ;
243 }
244
245 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeRaws(rawReader);
246 //
247 IncEvCountCycleRaws();
248 IncEvCountTotalRaws();
249 //
250}
251
252//____________________________________________________________________________
253void AliITSQADataMakerRec::InitDigits()
254{
255
256 // Initialization for DIGITS
257 if(fSubDetector == 0 || fSubDetector == 1) {
258 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitDigits\n");
259
260 fSPDDataMaker->InitDigits();
261 }
262 if(fSubDetector == 0 || fSubDetector == 2) {
263 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitDigits\n");
264 fSDDDataMaker->SetOffset(AliQAv1::kDIGITSR, fDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
265
266 fSDDDataMaker->InitDigits();
267 }
268 if(fSubDetector == 0 || fSubDetector == 3) {
269 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitDigits\n");
270 fSSDDataMaker->SetOffset(AliQAv1::kDIGITSR, fDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
271
272 fSSDDataMaker->InitDigits();
273 }
274 fDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(40);
275 //
276 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
277}
278
279//____________________________________________________________________________
280void AliITSQADataMakerRec::MakeDigits(TTree * digitsTree)
281{
282
283
284 // Fill QA for recpoints
285 if(fSubDetector == 0 || fSubDetector == 1) {
286 fSPDDataMaker->MakeDigits(digitsTree) ;
287 }
288
289 if(fSubDetector == 0 || fSubDetector == 2) {
290 fSDDDataMaker->MakeDigits(digitsTree) ;
291
292 }
293
294 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits(digitsTree);
295 //
296 IncEvCountCycleDigits();
297 IncEvCountTotalDigits();
298 //
299}
300
301//____________________________________________________________________________
302void AliITSQADataMakerRec::InitRecPoints()
303{
304
305 // Initialization for RECPOINTS
306
307
308 //if(fRecPointsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries()) return;
309 if(fSubDetector == 0 || fSubDetector == 1) {
310 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitRecPoints\n");
311 fSPDDataMaker->InitRecPoints();
312 }
313 if(fSubDetector == 0 || fSubDetector == 2) {
314 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitRecPoints\n");
315 fSDDDataMaker->SetOffset(AliQAv1::kRECPOINTS, fRecPointsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(), AliRecoParam::AConvert(fEventSpecie));
316 fSDDDataMaker->InitRecPoints();
317 }
318 if(fSubDetector == 0 || fSubDetector == 3) {
319 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitRecPoints\n");
320 fSSDDataMaker->SetOffset(AliQAv1::kRECPOINTS, fRecPointsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
321 fSSDDataMaker->InitRecPoints();
322 }
323
324 fRecPointsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(20);
325 if(fSubDetector == 0){
326 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
327 const Bool_t expert = kTRUE ;
328 const Bool_t image = kTRUE ;
329 TH2F* hPhiEta[6];
330 for (Int_t iLay=0;iLay<6;iLay++) {
331 hPhiEta[iLay]=new TH2F(Form("Phi_vs_Eta_ITS_Layer%d",iLay+1),Form("Phi_vs_Eta_ITS_Layer%d",iLay+1),30,-1.5,1.5,200,0.,2*TMath::Pi());
332 hPhiEta[iLay]->GetXaxis()->SetTitle("Pseudorapidity");
333 hPhiEta[iLay]->GetYaxis()->SetTitle("#varphi [rad]");
334 Add2RecPointsList(hPhiEta[iLay], iLay + offset, !expert, image);
335 //delete hPhiEta[iLay];
336 }
337
338 }
339 //
340 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
341}
342
343//____________________________________________________________________________
344void AliITSQADataMakerRec::MakeRecPoints(TTree * clustersTree)
345{
346 // Fill QA for recpoints
347
348 if(fSubDetector == 0 || fSubDetector == 1) {
349 fSPDDataMaker->MakeRecPoints(clustersTree) ;
350 }
351
352 if(fSubDetector == 0 || fSubDetector == 2) {
353 fSDDDataMaker->MakeRecPoints(clustersTree) ;
354 }
355
356 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeRecPoints(clustersTree);
357
358
359
360 if(fSubDetector == 0){
361
362 // Check id histograms already created for this Event Specie
363 AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
364 TClonesArray *recpoints =NULL;
365 if(fkOnline){
366 rpcont->FetchClusters(0,clustersTree,GetEventNumber());
367 }
368 else{
369 rpcont->FetchClusters(0,clustersTree);
370 }
371 if(!rpcont->GetStatusOK()){
372 AliError("cannot access to ITS recpoints");
373 return;
374 }
375
376 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
377 Float_t cluGlo[3] = {0.,0.,0.};
378 Int_t lay, lad, det;
379 // Fill QA for recpoints
380 for(Int_t module=0; module<rpcont->GetNumberOfModules();module++){
381 // AliInfo(Form("Module %d\n",module));
382 recpoints = rpcont->UncheckedGetClusters(module);
383 AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
384 for(Int_t j=0;j<recpoints->GetEntries();j++){
385 AliITSRecPoint *rcp = (AliITSRecPoint*)recpoints->At(j);
386 //Check id histograms already created for this Event Specie
387 rcp->GetGlobalXYZ(cluGlo);
388 Double_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]+cluGlo[2]*cluGlo[2]);
389 Double_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
390 Double_t theta = TMath::ACos(cluGlo[2]/rad);
391 Double_t eta = 100.;
392 if(AreEqual(rad,0.) == kFALSE) {
393 if(theta<=1.e-14){ eta=30.; }
394 else { eta = -TMath::Log(TMath::Tan(theta/2.));}
395 }
396 // printf("=========================>hlt rcp->GetLayer() = %d \n",rcp->GetLayer());
397 FillRecPointsData(rcp->GetLayer() + offset - 6,eta,phi);
398 }
399 }
400 }
401 //
402 IncEvCountCycleRecPoints();
403 IncEvCountTotalRecPoints();
404 //
405}
406
407//____________________________________________________________________________
408void AliITSQADataMakerRec::FillRecPoint(AliITSRecPoint rcp)
409{
410
411 // Fill QA for recpoints
412 Float_t cluGlo[3] = {0.,0.,0.};
413 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
414 // Check id histograms already created for this Event Specie
415 rcp.GetGlobalXYZ(cluGlo);
416 Double_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]+cluGlo[2]*cluGlo[2]);
417 Double_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
418 Double_t theta = TMath::ACos(cluGlo[2]/rad);
419 Double_t eta = 100.;
420 if(AreEqual(rad,0.)==kFALSE) {
421 if(theta<=1.e-14){eta=30.;}
422 else {eta = -TMath::Log(TMath::Tan(theta/2.));}
423 }
424 FillRecPointsData( rcp.GetLayer() + offset - 6, eta,phi);
425
426}
427
428//____________________________________________________________________________
429TH2F *AliITSQADataMakerRec::GetITSGlobalHisto(Int_t layer)
430{
431
432 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
433 return ((TH2F *) GetRecPointsData( layer + offset - 6));//local distribution
434}
435
436//____________________________________________________________________________
437void AliITSQADataMakerRec::InitESDs()
438{
439
440 // Create ESDs histograms in ESDs subdir
441
442 Bool_t expertHistogram = kTRUE;
443
444 TH1F *hESDClustersMI =
445 new TH1F("hESDClustersMI", "N ITS clusters per track (MI); N clusters; Counts",
446 7, -0.5, 6.5);
447 hESDClustersMI->Sumw2();
448 hESDClustersMI->SetMinimum(0);
449 Add2ESDsList(hESDClustersMI, 0);
450
451 TH1F *hESDClusterMapMI =
452 new TH1F("hESDClusterMapMI", "N tracks with point Layer (MI); Layer; N tracks",
453 6, -0.5, 5.5);
454 hESDClusterMapMI->Sumw2();
455 hESDClusterMapMI->SetMinimum(0);
456 Add2ESDsList(hESDClusterMapMI, 1, expertHistogram);
457
458 TH1F *hESDClustersSA =
459 new TH1F("hESDClustersSA", "N ITS clusters per track (SA); N clusters; Counts",
460 7, -0.5, 6.5);
461 hESDClustersSA->Sumw2();
462 hESDClustersSA->SetMinimum(0);
463 Add2ESDsList(hESDClustersSA, 2);
464
465 TH1F *hESDClusterMapSA =
466 new TH1F("hESDClusterMapSA", "N tracks with point Layer (SA); Layer; N tracks",
467 6, -0.5, 5.5);
468 hESDClusterMapSA->Sumw2();
469 hESDClusterMapSA->SetMinimum(0);
470 Add2ESDsList(hESDClusterMapSA, 3, expertHistogram);
471
472 TH1F *hSPDVertexX =
473 new TH1F("hSPDVertexX","SPD Vertex x; x [cm]; N events",
474 10000,-2,2);
475 hSPDVertexX->Sumw2();
476 Add2ESDsList(hSPDVertexX, 4);
477
478 TH1F *hSPDVertexY =
479 new TH1F("hSPDVertexY","SPD Vertex y; y [cm]; N events",
480 10000,-2,2);
481 hSPDVertexY->Sumw2();
482 Add2ESDsList(hSPDVertexY, 5);
483
484 TH1F *hSPDVertexZ =
485 new TH1F("hSPDVertexZ","SPD Vertex Z; z [cm]; N events",
486 10000,-20,20);
487 hSPDVertexZ->Sumw2();
488 Add2ESDsList(hSPDVertexZ, 6);
489
490 TH1F *hSPDVertexContrOverMult =
491 new TH1F("hSPDVertexContrOverMult","SPD Vertex: contributors / multiplicity; N contributors / SPD multiplicity; N events",
492 100,-4,20);
493 hSPDVertexContrOverMult->Sumw2();
494 Add2ESDsList(hSPDVertexContrOverMult, 7, expertHistogram);
495
496 TH1F *hTrkVertexX =
497 new TH1F("hTrkVertexX","ITS+TPC Trk Vertex x; x [cm]; N events",
498 10000,-2,2);
499 hTrkVertexX->Sumw2();
500 Add2ESDsList(hTrkVertexX, 8, expertHistogram);
501
502 TH1F *hTrkVertexY =
503 new TH1F("hTrkVertexY","ITS+TPC Trk Vertex y; y [cm]; N events",
504 10000,-2,2);
505 hTrkVertexY->Sumw2();
506 Add2ESDsList(hTrkVertexY, 9, expertHistogram);
507
508 TH1F *hTrkVertexZ =
509 new TH1F("hTrkVertexZ","ITS+TPC Trk Vertex Z; z [cm]; N events",
510 10000,-20,20);
511 hTrkVertexZ->Sumw2();
512 Add2ESDsList(hTrkVertexZ, 10, expertHistogram);
513
514 TH1F *hTrkVertexContrOverITSrefit5 =
515 new TH1F("hTrkVertexContrOverITSrefit5","ITS+TPC Trk Vertex: contributors / tracks; N contributors / N trks kITSrefit with 5 or 6 clusters; N events",
516 100,-4,2);
517 hTrkVertexContrOverITSrefit5->Sumw2();
518 Add2ESDsList(hTrkVertexContrOverITSrefit5, 11, expertHistogram);
519
520 TH1F *hSPDTrkVertexDeltaX =
521 new TH1F("hSPDTrkVertexDeltaX","Comparison of SPD and Trk vertices: x; xSPD-xTrk [cm]; N events",
522 1000,-1,1);
523 hSPDTrkVertexDeltaX->Sumw2();
524 Add2ESDsList(hSPDTrkVertexDeltaX, 12, expertHistogram);
525
526 TH1F *hSPDTrkVertexDeltaY =
527 new TH1F("hSPDTrkVertexDeltaY","Comparison of SPD and Trk vertices: y; ySPD-yTrk [cm]; N events",
528 1000,-1,1);
529 hSPDTrkVertexDeltaY->Sumw2();
530 Add2ESDsList(hSPDTrkVertexDeltaY, 13, expertHistogram);
531
532 TH1F *hSPDTrkVertexDeltaZ =
533 new TH1F("hSPDTrkVertexDeltaZ","Comparison of SPD and Trk vertices: z; zSPD-zTrk [cm]; N events",
534 1000,-1,1);
535 hSPDTrkVertexDeltaZ->Sumw2();
536 Add2ESDsList(hSPDTrkVertexDeltaZ, 14);
537
538 // SPD Tracklets
539
540 TH1F* hSPDTracklets =
541 new TH1F("hSPDTracklets","N SPD Tracklets; N tracklets; Counts",300,0.,300.);
542 hSPDTracklets->Sumw2();
543 Add2ESDsList(hSPDTracklets, 15);
544
545 TH2F* hSPDTrackletsvsFiredChips0 =
546 new TH2F("hSPDTrackletsvsFiredChips0","N SPD Tracklets vs N FiredChips Layer0",
547 300,0.,300.,300,0.,300.);
548 hSPDTrackletsvsFiredChips0->GetXaxis()->SetTitle("N FiredChips Layer0");
549 hSPDTrackletsvsFiredChips0->GetYaxis()->SetTitle("N SPD Tracklets");
550 hSPDTrackletsvsFiredChips0->Sumw2();
551 Add2ESDsList(hSPDTrackletsvsFiredChips0, 16, expertHistogram );
552
553 TH2F* hSPDTrackletsvsFiredChips1 =
554 new TH2F("hSPDTrackletsvsFiredChips1","N SPD Tracklets vs N FiredChips Layer1",
555 300,0.,300.,300,0.,300.);
556 hSPDTrackletsvsFiredChips1->GetXaxis()->SetTitle("N FiredChips Layer1");
557 hSPDTrackletsvsFiredChips1->GetYaxis()->SetTitle("N SPD Tracklets");
558 hSPDTrackletsvsFiredChips1->Sumw2();
559 Add2ESDsList(hSPDTrackletsvsFiredChips1, 17, expertHistogram);
560
561 TH2F* hSPDFiredChips1vsFiredChips0 =
562 new TH2F("hSPDFiredChips1vsFiredChips0","N FiredChips Layer1 vs N FiredChips Layer0",
563 300,0.,300.,300,0.,300.);
564 hSPDFiredChips1vsFiredChips0->GetXaxis()->SetTitle("N FiredChips Layer0");
565 hSPDFiredChips1vsFiredChips0->GetYaxis()->SetTitle("N FiredChips Layer1");
566 hSPDFiredChips1vsFiredChips0->Sumw2();
567 Add2ESDsList(hSPDFiredChips1vsFiredChips0, 18, expertHistogram );
568
569 TH1F* hSPDTrackletsDePhi =
570 new TH1F("hSPDTrackletsDePhi","DeltaPhi SPD Tracklets; DeltaPhi [rad]; N events",200,-0.2,0.2);
571 hSPDTrackletsDePhi->Sumw2();
572 Add2ESDsList(hSPDTrackletsDePhi, 19);
573
574 TH1F* hSPDTrackletsPhi =
575 new TH1F("hSPDTrackletsPhi","Phi SPD Tracklets; Phi [rad]; N events",1000,0.,2*TMath::Pi());
576 hSPDTrackletsPhi->Sumw2();
577 Add2ESDsList(hSPDTrackletsPhi, 20);
578
579 TH1F* hSPDTrackletsDeTheta =
580 new TH1F("hSPDTrackletsDeTheta","DeltaTheta SPD Tracklets; DeltaTheta [rad]; N events",200,-0.2,0.2);
581 hSPDTrackletsDeTheta->Sumw2();
582 Add2ESDsList(hSPDTrackletsDeTheta, 21);
583
584 TH1F* hSPDTrackletsTheta =
585 new TH1F("hSPDTrackletsTheta","Theta SPD Tracklets; Theta [rad]; N events",500,0.,TMath::Pi());
586 hSPDTrackletsTheta->Sumw2();
587 Add2ESDsList(hSPDTrackletsTheta, 22);
588
589 // map of layers skipped by tracking (set in AliITSRecoParam)
590 TH1F *hESDSkippedLayers =
591 new TH1F("hESDSkippedLayers", "Map of layers skipped by tracking; Layer; Skipped",
592 6, -0.5, 5.5);
593 hESDSkippedLayers->Sumw2();
594 hESDSkippedLayers->SetMinimum(0);
595 Add2ESDsList(hESDSkippedLayers, 23, expertHistogram);
596
597 fESDsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(30);
598 //
599 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
600}
601
602//____________________________________________________________________________
603void AliITSQADataMakerRec::MakeESDs(AliESDEvent *esd)
604{
605 // Make QA data from ESDs
606
607 // Check id histograms already created for this Event Specie
608 // if ( ! GetESDsData(0) )
609 // InitESDs() ;
610
611 const Int_t nESDTracks = esd->GetNumberOfTracks();
612 Int_t nITSrefit5 = 0;
613
614 Int_t idet,status;
615 Float_t xloc,zloc;
616
617 // loop on tracks
618 AliInfo(Form("Filling histograms for ESD. Number of tracks %d",nESDTracks));
619 for(Int_t i = 0; i < nESDTracks; i++) {
620
621 AliESDtrack *track = esd->GetTrack(i);
622
623 Int_t nclsITS = track->GetNcls(0);
624
625 Bool_t itsrefit=kFALSE,tpcin=kFALSE,itsin=kFALSE;
626 if ((track->GetStatus() & AliESDtrack::kITSrefit)) itsrefit=kTRUE;
627 if ((track->GetStatus() & AliESDtrack::kTPCin)) tpcin=kTRUE;
628 if ((track->GetStatus() & AliESDtrack::kITSin)) itsin=kTRUE;
629 if(nclsITS>=5 && itsrefit) nITSrefit5++;
630
631 if(tpcin) {
632 FillESDsData(0,nclsITS);
633 }
634 if(itsin && !tpcin){
635 FillESDsData(2,nclsITS);
636 }
637
638 for(Int_t layer=0; layer<6; layer++) {
639
640 if(TESTBIT(track->GetITSClusterMap(),layer)) {
641 if(tpcin) {
642 FillESDsData(1,layer);
643 } else {
644 FillESDsData(3,layer);
645 }
646 }
647 track->GetITSModuleIndexInfo(layer,idet,status,xloc,zloc);
648 if(status==3) SetESDsDataBinContent(23,layer,1);
649 }
650
651 } // end loop on tracks
652
653 // vertices
654 const AliESDVertex *vtxSPD = esd->GetPrimaryVertexSPD();
655 const AliESDVertex *vtxTrk = esd->GetPrimaryVertexTracks();
656
657 Int_t mult = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfTracklets();
658 AliInfo(Form("Multiplicity %d ; Number of SPD vert contributors %d",mult,vtxSPD->GetNContributors()));
659 if(mult>0)
660 FillESDsData(7,(Float_t)(vtxSPD->GetNContributors())/(Float_t)mult);
661
662 if(nITSrefit5>0)
663 FillESDsData(11,(Float_t)(vtxTrk->GetNIndices())/(Float_t)nITSrefit5);
664
665 if(vtxSPD->GetNContributors()>0) {
666 FillESDsData(4,vtxSPD->GetXv());
667 FillESDsData(5,vtxSPD->GetYv());
668 FillESDsData(6,vtxSPD->GetZv());
669 }
670
671 if(vtxTrk->GetNContributors()>0) {
672 FillESDsData(8,vtxTrk->GetXv());
673 FillESDsData(9,vtxTrk->GetYv());
674 FillESDsData(10,vtxTrk->GetZv());
675 }
676
677 if(vtxSPD->GetNContributors()>0 &&
678 vtxTrk->GetNContributors()>0) {
679 FillESDsData(12,vtxSPD->GetXv()-vtxTrk->GetXv());
680 FillESDsData(13,vtxSPD->GetYv()-vtxTrk->GetYv());
681 FillESDsData(14,vtxSPD->GetZv()-vtxTrk->GetZv());
682 }
683
684 // SPD Tracklets
685 FillESDsData(15,mult);
686
687 Short_t nFiredChips0 = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfFiredChips(0);
688 Short_t nFiredChips1 = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfFiredChips(1);
689 FillESDsData(16,nFiredChips0,mult);
690 FillESDsData(17,nFiredChips1,mult);
691 FillESDsData(18,nFiredChips0,nFiredChips1);
692
693 // Loop over tracklets
694 for (Int_t itr=0; itr<mult; ++itr) {
695 Float_t dePhiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetDeltaPhi(itr);
696 Float_t deThetaTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetDeltaTheta(itr);
697 Float_t phiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetPhi(itr);
698 Float_t thetaTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetTheta(itr);
699 FillESDsData(19,dePhiTr);
700 FillESDsData(20,phiTr);
701 FillESDsData(21,deThetaTr);
702 FillESDsData(22,thetaTr);
703 } // end loop on tracklets
704 //
705 IncEvCountCycleESDs();
706 IncEvCountTotalESDs();
707 //
708}
709
710//_________________________________________________________________
711Int_t AliITSQADataMakerRec::GetDetTaskOffset(Int_t subdet,AliQAv1::TASKINDEX_t task, Int_t specie)
712{
713 //number of booked histos for the QAchecking Raws offset
714 Int_t offset=0;
715 switch(subdet)
716 {
717 case 1:
718 offset=fSPDDataMaker->GetOffset(task,specie);
719 //return offset;
720 break;
721 case 2:
722 offset=fSDDDataMaker->GetOffset(task,specie);
723 //return offset;
724 break;
725 case 3:
726 offset=fSSDDataMaker->GetOffset(task,specie);
727 //return offset;
728 break;
729 default:
730 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
731 offset=0;
732 //return offset;
733 break;
734 }
735 return offset;
736}
737
738//____________________________________________________________________
739
740Bool_t AliITSQADataMakerRec::AreEqual(Double_t a1,Double_t a2)
741{
742 const Double_t kEpsilon= 1.e-14;
743 return TMath::Abs(a1-a2)<=kEpsilon*TMath::Abs(a1);
744}
745
746//_________________________________________________________________
747Int_t AliITSQADataMakerRec::GetDetTaskHisto(Int_t subdet,AliQAv1::TASKINDEX_t task)
748{
749 //return the number of histo booked for each the Raws Task
750
751 Int_t histo=0;
752 switch(subdet)
753 {
754 case 1:
755 histo=fSPDDataMaker->GetTaskHisto(task);
756 //return histo;
757 break;
758 case 2:
759 histo=fSDDDataMaker->GetTaskHisto(task);
760 //return histo;
761 break;
762 case 3:
763 histo=fSSDDataMaker->GetTaskHisto(task);
764 //return histo;
765 break;
766 default:
767 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
768 histo=0;
769 //return histo;
770 break;
771 }
772 //return offset;
773 return histo;
774}
775
776
777//____________________________________________________________________
778
779void AliITSQADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
780{
781 //reset the detector histograms for a given task
782 AliQADataMakerRec::ResetDetector(task);
783
784 if(fSubDetector==0||fSubDetector==1)fSPDDataMaker->ResetDetector(task);
785
786 if(fSubDetector==0||fSubDetector==2)fSDDDataMaker->ResetDetector(task);
787
788 if(fSubDetector==0||fSubDetector==3)fSSDDataMaker->ResetDetector(task);
789
790}
791
792
793//____________________________________________________________________
794
795AliITSDDLModuleMapSDD *AliITSQADataMakerRec::GetDDLSDDModuleMap()
796{
797 //return the SDD module map
798 if(fSubDetector==2){return fSDDDataMaker->GetDDLSDDModuleMap();}
799 else {return NULL;}
800}
801
802//____________________________________________________________________
803Bool_t AliITSQADataMakerRec::ListExists(AliQAv1::TASKINDEX_t task) const
804{
805 //Check the existence of a list for a given task
806 Bool_t havethelist=kFALSE;
807 if( ( task == AliQAv1::kRAWS && fRawsQAList ) ||
808 ( task == AliQAv1::kRECPOINTS && fRecPointsQAList ) ||
809 ( task == AliQAv1::kDIGITSR && fDigitsQAList ) ||
810 ( task == AliQAv1::kESDS && fESDsQAList ) ) havethelist=kTRUE;
811 return havethelist;
812
813}