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