]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQADataMakerRec.cxx
Fix mapping of column number
[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
04236e67 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()
1aa7c4f5 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()
1aa7c4f5 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
269 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
270 const Bool_t expert = kTRUE ;
271 const Bool_t image = kTRUE ;
272 Char_t name[50];
273 Char_t title[50];
274 TH2F**hPhiEta = new TH2F*[6];
275 for (Int_t iLay=0;iLay<6;iLay++) {
276 sprintf(name,"Phi_vs_Eta_ITS_Layer%d",iLay+1);
277 sprintf(title,"Phi vs Eta - ITS Layer %d",iLay+1);
278 hPhiEta[iLay]=new TH2F(name,title,30,-1.5,1.5,200,0.,2*TMath::Pi());
279 hPhiEta[iLay]->GetXaxis()->SetTitle("Pseudorapidity");
280 hPhiEta[iLay]->GetYaxis()->SetTitle("#varphi [rad]");
281 Add2RecPointsList((new TH2F(*hPhiEta[iLay])), iLay + offset, !expert, image);
4a903927 282
8b7e858c 283 delete hPhiEta[iLay];
284 }
4a903927 285
1aa7c4f5 286}
04236e67 287
288//____________________________________________________________________________
289void AliITSQADataMakerRec::MakeRecPoints(TTree * clustersTree)
1aa7c4f5 290{
7555afef 291
1aa7c4f5 292 // Fill QA for recpoints
eca4fa66 293 if(fSubDetector == 0 || fSubDetector == 1) {
8b7e858c 294 fSPDDataMaker->MakeRecPoints(clustersTree) ;
eca4fa66 295 }
8b7e858c 296
eca4fa66 297 if(fSubDetector == 0 || fSubDetector == 2) {
8b7e858c 298 fSDDDataMaker->MakeRecPoints(clustersTree) ;
eca4fa66 299 }
300
8c823e5a 301 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeRecPoints(clustersTree);
8b7e858c 302
f867e0d8 303
304
305
8b7e858c 306 // Check id histograms already created for this Event Specie
307 TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
308 if (!branchRecP) {
309 AliError("can't get the branch with the ITS clusters !");
310 return;
311 }
312
313 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
314 Float_t cluGlo[3] = {0.,0.,0.};
315 Int_t lay, lad, det;
316 static TClonesArray statRecpoints("AliITSRecPoint") ;
317 TClonesArray *recpoints = &statRecpoints;
318 branchRecP->SetAddress(&recpoints);
319 // Fill QA for recpoints
320 for(Int_t module=0; module<clustersTree->GetEntries();module++){
321 branchRecP->GetEvent(module);
322 AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
323 for(Int_t j=0;j<recpoints->GetEntries();j++){
324 AliITSRecPoint *rcp = (AliITSRecPoint*)recpoints->At(j);
f867e0d8 325 //Check id histograms already created for this Event Specie
8b7e858c 326 rcp->GetGlobalXYZ(cluGlo);
a4df7d05 327 Double_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]+cluGlo[2]*cluGlo[2]);
8b7e858c 328 Double_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
329 Double_t theta = TMath::ACos(cluGlo[2]/rad);
330 Double_t eta = 100.;
4a903927 331 if(AreEqual(rad,0.) == kFALSE) {
f867e0d8 332 if(theta<=1.e-14){ eta=30.; }
333 else { eta = -TMath::Log(TMath::Tan(theta/2.));}
334 }
8b7e858c 335 (GetRecPointsData( rcp->GetLayer() + offset - 6))->Fill(eta,phi);
336 }
337 }
338
339
340}
341
342//____________________________________________________________________________
343void AliITSQADataMakerRec::FillRecPoint(AliITSRecPoint rcp)
344{
345
346 // Fill QA for recpoints
347 Float_t cluGlo[3] = {0.,0.,0.};
348 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
349 // Check id histograms already created for this Event Specie
350 rcp.GetGlobalXYZ(cluGlo);
4a903927 351 Double_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]+cluGlo[2]*cluGlo[2]);
8b7e858c 352 Double_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
353 Double_t theta = TMath::ACos(cluGlo[2]/rad);
354 Double_t eta = 100.;
4a903927 355 if(AreEqual(rad,0.)==kFALSE) {
f867e0d8 356 if(theta<=1.e-14){eta=30.;}
357 else {eta = -TMath::Log(TMath::Tan(theta/2.));}
358 }
359 (GetRecPointsData( rcp.GetLayer() + offset - 6))->Fill(eta,phi);
4a903927 360
04236e67 361}
362
8b7e858c 363//____________________________________________________________________________
364TH2F *AliITSQADataMakerRec::GetITSGlobalHisto(Int_t layer)
365{
366
367 Int_t offset = fRecPointsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries();
368 return ((TH2F *) GetRecPointsData( layer + offset - 6));//local distribution
369}
d7d87ceb 370
a90a332e 371//____________________________________________________________________________
372void AliITSQADataMakerRec::InitESDs()
373{
7555afef 374
a90a332e 375 // Create ESDs histograms in ESDs subdir
376
585a6e79 377 Bool_t expertHistogram = kTRUE;
378
a90a332e 379 TH1F *hESDClustersMI =
380 new TH1F("hESDClustersMI", "N ITS clusters per track (MI); N clusters; Counts",
381 7, -0.5, 6.5);
382 hESDClustersMI->Sumw2();
383 hESDClustersMI->SetMinimum(0);
384 Add2ESDsList(hESDClustersMI, 0);
385
386 TH1F *hESDClusterMapMI =
d7d87ceb 387 new TH1F("hESDClusterMapMI", "N tracks with point Layer (MI); Layer; N tracks",
a90a332e 388 6, -0.5, 5.5);
389 hESDClusterMapMI->Sumw2();
390 hESDClusterMapMI->SetMinimum(0);
585a6e79 391 Add2ESDsList(hESDClusterMapMI, 1, expertHistogram);
a90a332e 392
393 TH1F *hESDClustersSA =
394 new TH1F("hESDClustersSA", "N ITS clusters per track (SA); N clusters; Counts",
395 7, -0.5, 6.5);
396 hESDClustersSA->Sumw2();
397 hESDClustersSA->SetMinimum(0);
398 Add2ESDsList(hESDClustersSA, 2);
399
400 TH1F *hESDClusterMapSA =
d7d87ceb 401 new TH1F("hESDClusterMapSA", "N tracks with point Layer (SA); Layer; N tracks",
a90a332e 402 6, -0.5, 5.5);
403 hESDClusterMapSA->Sumw2();
404 hESDClusterMapSA->SetMinimum(0);
585a6e79 405 Add2ESDsList(hESDClusterMapSA, 3, expertHistogram);
a90a332e 406
407 TH1F *hSPDVertexX =
408 new TH1F("hSPDVertexX","SPD Vertex x; x [cm]; N events",
409 10000,-2,2);
410 hSPDVertexX->Sumw2();
411 Add2ESDsList(hSPDVertexX, 4);
412
413 TH1F *hSPDVertexY =
414 new TH1F("hSPDVertexY","SPD Vertex y; y [cm]; N events",
415 10000,-2,2);
416 hSPDVertexY->Sumw2();
417 Add2ESDsList(hSPDVertexY, 5);
418
419 TH1F *hSPDVertexZ =
d7d87ceb 420 new TH1F("hSPDVertexZ","SPD Vertex Z; z [cm]; N events",
a90a332e 421 10000,-20,20);
422 hSPDVertexZ->Sumw2();
423 Add2ESDsList(hSPDVertexZ, 6);
424
425 TH1F *hSPDVertexContrOverMult =
426 new TH1F("hSPDVertexContrOverMult","SPD Vertex: contributors / multiplicity; N contributors / SPD multiplicity; N events",
427 100,-4,20);
428 hSPDVertexContrOverMult->Sumw2();
585a6e79 429 Add2ESDsList(hSPDVertexContrOverMult, 7, expertHistogram);
a90a332e 430
431 TH1F *hTrkVertexX =
432 new TH1F("hTrkVertexX","ITS+TPC Trk Vertex x; x [cm]; N events",
433 10000,-2,2);
434 hTrkVertexX->Sumw2();
585a6e79 435 Add2ESDsList(hTrkVertexX, 8, expertHistogram);
a90a332e 436
437 TH1F *hTrkVertexY =
438 new TH1F("hTrkVertexY","ITS+TPC Trk Vertex y; y [cm]; N events",
439 10000,-2,2);
440 hTrkVertexY->Sumw2();
585a6e79 441 Add2ESDsList(hTrkVertexY, 9, expertHistogram);
a90a332e 442
443 TH1F *hTrkVertexZ =
d7d87ceb 444 new TH1F("hTrkVertexZ","ITS+TPC Trk Vertex Z; z [cm]; N events",
a90a332e 445 10000,-20,20);
446 hTrkVertexZ->Sumw2();
585a6e79 447 Add2ESDsList(hTrkVertexZ, 10, expertHistogram);
a90a332e 448
d7d87ceb 449 TH1F *hTrkVertexContrOverITSrefit5 =
450 new TH1F("hTrkVertexContrOverITSrefit5","ITS+TPC Trk Vertex: contributors / tracks; N contributors / N trks kITSrefit with 5 or 6 clusters; N events",
451 100,-4,2);
452 hTrkVertexContrOverITSrefit5->Sumw2();
585a6e79 453 Add2ESDsList(hTrkVertexContrOverITSrefit5, 11, expertHistogram);
a90a332e 454
455 TH1F *hSPDTrkVertexDeltaX =
456 new TH1F("hSPDTrkVertexDeltaX","Comparison of SPD and Trk vertices: x; xSPD-xTrk [cm]; N events",
457 1000,-1,1);
458 hSPDTrkVertexDeltaX->Sumw2();
585a6e79 459 Add2ESDsList(hSPDTrkVertexDeltaX, 12, expertHistogram);
a90a332e 460
461 TH1F *hSPDTrkVertexDeltaY =
462 new TH1F("hSPDTrkVertexDeltaY","Comparison of SPD and Trk vertices: y; ySPD-yTrk [cm]; N events",
463 1000,-1,1);
464 hSPDTrkVertexDeltaY->Sumw2();
585a6e79 465 Add2ESDsList(hSPDTrkVertexDeltaY, 13, expertHistogram);
a90a332e 466
467 TH1F *hSPDTrkVertexDeltaZ =
468 new TH1F("hSPDTrkVertexDeltaZ","Comparison of SPD and Trk vertices: z; zSPD-zTrk [cm]; N events",
469 1000,-1,1);
470 hSPDTrkVertexDeltaZ->Sumw2();
471 Add2ESDsList(hSPDTrkVertexDeltaZ, 14);
472
a8100152 473 // SPD Tracklets
474
475 TH1F* hSPDTracklets =
476 new TH1F("hSPDTracklets","N SPD Tracklets; N tracklets; Counts",300,0.,300.);
477 hSPDTracklets->Sumw2();
478 Add2ESDsList(hSPDTracklets, 15);
e23412ab 479
480 TH2F* hSPDTrackletsvsFiredChips0 =
481 new TH2F("hSPDTrackletsvsFiredChips0","N SPD Tracklets vs N FiredChips Layer0",
482 300,0.,300.,300,0.,300.);
8bab7823 483 hSPDTrackletsvsFiredChips0->GetXaxis()->SetTitle("N FiredChips Layer0");
484 hSPDTrackletsvsFiredChips0->GetYaxis()->SetTitle("N SPD Tracklets");
e23412ab 485 hSPDTrackletsvsFiredChips0->Sumw2();
486 Add2ESDsList(hSPDTrackletsvsFiredChips0, 16, expertHistogram );
487
488 TH2F* hSPDTrackletsvsFiredChips1 =
489 new TH2F("hSPDTrackletsvsFiredChips1","N SPD Tracklets vs N FiredChips Layer1",
490 300,0.,300.,300,0.,300.);
8bab7823 491 hSPDTrackletsvsFiredChips1->GetXaxis()->SetTitle("N FiredChips Layer1");
492 hSPDTrackletsvsFiredChips1->GetYaxis()->SetTitle("N SPD Tracklets");
e23412ab 493 hSPDTrackletsvsFiredChips1->Sumw2();
494 Add2ESDsList(hSPDTrackletsvsFiredChips1, 17, expertHistogram);
8bab7823 495
496 TH2F* hSPDFiredChips1vsFiredChips0 =
497 new TH2F("hSPDFiredChips1vsFiredChips0","N FiredChips Layer1 vs N FiredChips Layer0",
498 300,0.,300.,300,0.,300.);
499 hSPDFiredChips1vsFiredChips0->GetXaxis()->SetTitle("N FiredChips Layer0");
500 hSPDFiredChips1vsFiredChips0->GetYaxis()->SetTitle("N FiredChips Layer1");
501 hSPDFiredChips1vsFiredChips0->Sumw2();
502 Add2ESDsList(hSPDFiredChips1vsFiredChips0, 18, expertHistogram );
a8100152 503
504 TH1F* hSPDTrackletsDePhi =
505 new TH1F("hSPDTrackletsDePhi","DeltaPhi SPD Tracklets; DeltaPhi [rad]; N events",200,-0.2,0.2);
506 hSPDTrackletsDePhi->Sumw2();
8bab7823 507 Add2ESDsList(hSPDTrackletsDePhi, 19);
a8100152 508
509 TH1F* hSPDTrackletsPhi =
510 new TH1F("hSPDTrackletsPhi","Phi SPD Tracklets; Phi [rad]; N events",1000,0.,2*TMath::Pi());
511 hSPDTrackletsPhi->Sumw2();
8bab7823 512 Add2ESDsList(hSPDTrackletsPhi, 20);
a8100152 513
8bab7823 514 TH1F* hSPDTrackletsDeTheta =
515 new TH1F("hSPDTrackletsDeTheta","DeltaTheta SPD Tracklets; DeltaTheta [rad]; N events",200,-0.2,0.2);
516 hSPDTrackletsDeTheta->Sumw2();
517 Add2ESDsList(hSPDTrackletsDeTheta, 21);
518
a8100152 519 TH1F* hSPDTrackletsTheta =
520 new TH1F("hSPDTrackletsTheta","Theta SPD Tracklets; Theta [rad]; N events",500,0.,TMath::Pi());
521 hSPDTrackletsTheta->Sumw2();
8bab7823 522 Add2ESDsList(hSPDTrackletsTheta, 22);
a8100152 523
882ac7f1 524 // map of layers skipped by tracking (set in AliITSRecoParam)
525 TH1F *hESDSkippedLayers =
526 new TH1F("hESDSkippedLayers", "Map of layers skipped by tracking; Layer; Skipped",
527 6, -0.5, 5.5);
528 hESDSkippedLayers->Sumw2();
529 hESDSkippedLayers->SetMinimum(0);
8bab7823 530 Add2ESDsList(hESDSkippedLayers, 23, expertHistogram);
882ac7f1 531
532
a90a332e 533 return;
534}
535
536//____________________________________________________________________________
537void AliITSQADataMakerRec::MakeESDs(AliESDEvent *esd)
538{
539 // Make QA data from ESDs
eca4fa66 540
541 // Check id histograms already created for this Event Specie
8b7e858c 542// if ( ! GetESDsData(0) )
543// InitESDs() ;
a90a332e 544
545 const Int_t nESDTracks = esd->GetNumberOfTracks();
d7d87ceb 546 Int_t nITSrefit5 = 0;
a90a332e 547
882ac7f1 548 Int_t idet,status;
549 Float_t xloc,zloc;
550
a90a332e 551 // loop on tracks
552 for(Int_t i = 0; i < nESDTracks; i++) {
553
554 AliESDtrack *track = esd->GetTrack(i);
555
556 Int_t nclsITS = track->GetNcls(0);
557
83ab496a 558 Bool_t itsrefit=kFALSE,tpcin=kFALSE,itsin=kFALSE;
a90a332e 559 if ((track->GetStatus() & AliESDtrack::kITSrefit)) itsrefit=kTRUE;
560 if ((track->GetStatus() & AliESDtrack::kTPCin)) tpcin=kTRUE;
83ab496a 561 if ((track->GetStatus() & AliESDtrack::kITSin)) itsin=kTRUE;
d7d87ceb 562 if(nclsITS>=5 && itsrefit) nITSrefit5++;
a90a332e 563
564 if(tpcin) {
565 GetESDsData(0)->Fill(nclsITS);
83ab496a 566 }
567 if(itsin && !tpcin){
a90a332e 568 GetESDsData(2)->Fill(nclsITS);
569 }
570
571 for(Int_t layer=0; layer<6; layer++) {
572
573 if(TESTBIT(track->GetITSClusterMap(),layer)) {
574 if(tpcin) {
575 GetESDsData(1)->Fill(layer);
576 } else {
577 GetESDsData(3)->Fill(layer);
578 }
579 }
882ac7f1 580 track->GetITSModuleIndexInfo(layer,idet,status,xloc,zloc);
8bab7823 581 if(status==3) GetESDsData(23)->SetBinContent(layer,1);
a90a332e 582 }
583
584 } // end loop on tracks
585
586 // vertices
587 const AliESDVertex *vtxSPD = esd->GetPrimaryVertexSPD();
3884ccc9 588 const AliESDVertex *vtxTrk = esd->GetPrimaryVertexTracks();
a90a332e 589
a90a332e 590 Int_t mult = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfTracklets();
591 if(mult>0)
592 GetESDsData(7)->Fill((Float_t)(vtxSPD->GetNContributors())/(Float_t)mult);
593
d7d87ceb 594 if(nITSrefit5>0)
595 GetESDsData(11)->Fill((Float_t)(vtxTrk->GetNIndices())/(Float_t)nITSrefit5);
a90a332e 596
d7d87ceb 597 if(vtxSPD->GetNContributors()>0) {
598 GetESDsData(4)->Fill(vtxSPD->GetXv());
599 GetESDsData(5)->Fill(vtxSPD->GetYv());
600 GetESDsData(6)->Fill(vtxSPD->GetZv());
601 }
a90a332e 602
d7d87ceb 603 if(vtxTrk->GetNContributors()>0) {
604 GetESDsData(8)->Fill(vtxTrk->GetXv());
605 GetESDsData(9)->Fill(vtxTrk->GetYv());
606 GetESDsData(10)->Fill(vtxTrk->GetZv());
607 }
608
609 if(vtxSPD->GetNContributors()>0 &&
610 vtxTrk->GetNContributors()>0) {
611 GetESDsData(12)->Fill(vtxSPD->GetXv()-vtxTrk->GetXv());
612 GetESDsData(13)->Fill(vtxSPD->GetYv()-vtxTrk->GetYv());
613 GetESDsData(14)->Fill(vtxSPD->GetZv()-vtxTrk->GetZv());
614 }
a90a332e 615
a8100152 616 // SPD Tracklets
e23412ab 617 GetESDsData(15)->Fill(mult);
618
619 Short_t nFiredChips0 = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfFiredChips(0);
620 Short_t nFiredChips1 = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfFiredChips(1);
621 GetESDsData(16)->Fill(nFiredChips0,mult);
622 GetESDsData(17)->Fill(nFiredChips1,mult);
8bab7823 623 GetESDsData(18)->Fill(nFiredChips0,nFiredChips1);
a8100152 624
625 // Loop over tracklets
a8100152 626 for (Int_t itr=0; itr<mult; ++itr) {
8bab7823 627 Float_t dePhiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetDeltaPhi(itr);
628 Float_t deThetaTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetDeltaTheta(itr);
a8100152 629 Float_t phiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetPhi(itr);
630 Float_t thetaTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetTheta(itr);
8bab7823 631 GetESDsData(19)->Fill(dePhiTr);
632 GetESDsData(20)->Fill(phiTr);
633 GetESDsData(21)->Fill(deThetaTr);
634 GetESDsData(22)->Fill(thetaTr);
a8100152 635 } // end loop on tracklets
636
a90a332e 637 return;
638}
614c7e17 639
640//_________________________________________________________________
4e25ac79 641Int_t AliITSQADataMakerRec::GetDetTaskOffset(Int_t subdet,AliQAv1::TASKINDEX_t task)
614c7e17 642{
643 switch(subdet)
644 {
645
646 Int_t offset;
647 case 1:
648 offset=fSPDDataMaker->GetOffset(task);
649 return offset;
650 break;
651 case 2:
652 offset=fSDDDataMaker->GetOffset(task);
653 return offset;
654 break;
655 case 3:
656 offset=fSSDDataMaker->GetOffset(task);
657 return offset;
658 break;
659 default:
660 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
661 offset=0;
662 return offset;
663 break;
664 }
665 //return offset;
666}
f867e0d8 667
668//____________________________________________________________________
669
4a903927 670Bool_t AliITSQADataMakerRec::AreEqual(Double_t a1,Double_t a2)
f867e0d8 671{
4a903927 672 const Double_t kEpsilon= 1.e-14;
f867e0d8 673 return TMath::Abs(a1-a2)<=kEpsilon*TMath::Abs(a1);
674}
675