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