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