re-introduce part on covariance matrix for real data
[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
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)
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.);
483 hSPDTrackletsvsFiredChips0->GetXaxis()->SetTitle("N SPD Tracklets");
484 hSPDTrackletsvsFiredChips0->GetYaxis()->SetTitle("N FiredChips Layer0");
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.);
491 hSPDTrackletsvsFiredChips1->GetXaxis()->SetTitle("N SPD Tracklets");
492 hSPDTrackletsvsFiredChips1->GetYaxis()->SetTitle("N FiredChips Layer1");
493 hSPDTrackletsvsFiredChips1->Sumw2();
494 Add2ESDsList(hSPDTrackletsvsFiredChips1, 17, expertHistogram);
a8100152 495
496 TH1F* hSPDTrackletsDePhi =
497 new TH1F("hSPDTrackletsDePhi","DeltaPhi SPD Tracklets; DeltaPhi [rad]; N events",200,-0.2,0.2);
498 hSPDTrackletsDePhi->Sumw2();
e23412ab 499 Add2ESDsList(hSPDTrackletsDePhi, 18);
a8100152 500
501 TH1F* hSPDTrackletsPhi =
502 new TH1F("hSPDTrackletsPhi","Phi SPD Tracklets; Phi [rad]; N events",1000,0.,2*TMath::Pi());
503 hSPDTrackletsPhi->Sumw2();
e23412ab 504 Add2ESDsList(hSPDTrackletsPhi, 19);
a8100152 505
506 TH1F* hSPDTrackletsTheta =
507 new TH1F("hSPDTrackletsTheta","Theta SPD Tracklets; Theta [rad]; N events",500,0.,TMath::Pi());
508 hSPDTrackletsTheta->Sumw2();
e23412ab 509 Add2ESDsList(hSPDTrackletsTheta, 20);
a8100152 510
882ac7f1 511 // map of layers skipped by tracking (set in AliITSRecoParam)
512 TH1F *hESDSkippedLayers =
513 new TH1F("hESDSkippedLayers", "Map of layers skipped by tracking; Layer; Skipped",
514 6, -0.5, 5.5);
515 hESDSkippedLayers->Sumw2();
516 hESDSkippedLayers->SetMinimum(0);
e23412ab 517 Add2ESDsList(hESDSkippedLayers, 21, expertHistogram);
882ac7f1 518
519
a90a332e 520 return;
521}
522
523//____________________________________________________________________________
524void AliITSQADataMakerRec::MakeESDs(AliESDEvent *esd)
525{
526 // Make QA data from ESDs
eca4fa66 527
528 // Check id histograms already created for this Event Specie
8b7e858c 529// if ( ! GetESDsData(0) )
530// InitESDs() ;
a90a332e 531
532 const Int_t nESDTracks = esd->GetNumberOfTracks();
d7d87ceb 533 Int_t nITSrefit5 = 0;
a90a332e 534
882ac7f1 535 Int_t idet,status;
536 Float_t xloc,zloc;
537
a90a332e 538 // loop on tracks
539 for(Int_t i = 0; i < nESDTracks; i++) {
540
541 AliESDtrack *track = esd->GetTrack(i);
542
543 Int_t nclsITS = track->GetNcls(0);
544
83ab496a 545 Bool_t itsrefit=kFALSE,tpcin=kFALSE,itsin=kFALSE;
a90a332e 546 if ((track->GetStatus() & AliESDtrack::kITSrefit)) itsrefit=kTRUE;
547 if ((track->GetStatus() & AliESDtrack::kTPCin)) tpcin=kTRUE;
83ab496a 548 if ((track->GetStatus() & AliESDtrack::kITSin)) itsin=kTRUE;
d7d87ceb 549 if(nclsITS>=5 && itsrefit) nITSrefit5++;
a90a332e 550
551 if(tpcin) {
552 GetESDsData(0)->Fill(nclsITS);
83ab496a 553 }
554 if(itsin && !tpcin){
a90a332e 555 GetESDsData(2)->Fill(nclsITS);
556 }
557
558 for(Int_t layer=0; layer<6; layer++) {
559
560 if(TESTBIT(track->GetITSClusterMap(),layer)) {
561 if(tpcin) {
562 GetESDsData(1)->Fill(layer);
563 } else {
564 GetESDsData(3)->Fill(layer);
565 }
566 }
882ac7f1 567 track->GetITSModuleIndexInfo(layer,idet,status,xloc,zloc);
e23412ab 568 if(status==3) GetESDsData(21)->SetBinContent(layer,1);
a90a332e 569 }
570
571 } // end loop on tracks
572
573 // vertices
574 const AliESDVertex *vtxSPD = esd->GetPrimaryVertexSPD();
3884ccc9 575 const AliESDVertex *vtxTrk = esd->GetPrimaryVertexTracks();
a90a332e 576
a90a332e 577 Int_t mult = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfTracklets();
578 if(mult>0)
579 GetESDsData(7)->Fill((Float_t)(vtxSPD->GetNContributors())/(Float_t)mult);
580
d7d87ceb 581 if(nITSrefit5>0)
582 GetESDsData(11)->Fill((Float_t)(vtxTrk->GetNIndices())/(Float_t)nITSrefit5);
a90a332e 583
d7d87ceb 584 if(vtxSPD->GetNContributors()>0) {
585 GetESDsData(4)->Fill(vtxSPD->GetXv());
586 GetESDsData(5)->Fill(vtxSPD->GetYv());
587 GetESDsData(6)->Fill(vtxSPD->GetZv());
588 }
a90a332e 589
d7d87ceb 590 if(vtxTrk->GetNContributors()>0) {
591 GetESDsData(8)->Fill(vtxTrk->GetXv());
592 GetESDsData(9)->Fill(vtxTrk->GetYv());
593 GetESDsData(10)->Fill(vtxTrk->GetZv());
594 }
595
596 if(vtxSPD->GetNContributors()>0 &&
597 vtxTrk->GetNContributors()>0) {
598 GetESDsData(12)->Fill(vtxSPD->GetXv()-vtxTrk->GetXv());
599 GetESDsData(13)->Fill(vtxSPD->GetYv()-vtxTrk->GetYv());
600 GetESDsData(14)->Fill(vtxSPD->GetZv()-vtxTrk->GetZv());
601 }
a90a332e 602
a8100152 603 // SPD Tracklets
e23412ab 604 GetESDsData(15)->Fill(mult);
605
606 Short_t nFiredChips0 = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfFiredChips(0);
607 Short_t nFiredChips1 = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfFiredChips(1);
608 GetESDsData(16)->Fill(nFiredChips0,mult);
609 GetESDsData(17)->Fill(nFiredChips1,mult);
a8100152 610
611 // Loop over tracklets
a8100152 612 for (Int_t itr=0; itr<mult; ++itr) {
613 Float_t dePhiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetDeltaPhi(itr);
614 Float_t phiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetPhi(itr);
615 Float_t thetaTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetTheta(itr);
e23412ab 616 GetESDsData(18)->Fill(dePhiTr);
617 GetESDsData(19)->Fill(phiTr);
618 GetESDsData(20)->Fill(thetaTr);
a8100152 619 } // end loop on tracklets
620
a90a332e 621 return;
622}
614c7e17 623
624//_________________________________________________________________
4e25ac79 625Int_t AliITSQADataMakerRec::GetDetTaskOffset(Int_t subdet,AliQAv1::TASKINDEX_t task)
614c7e17 626{
627 switch(subdet)
628 {
629
630 Int_t offset;
631 case 1:
632 offset=fSPDDataMaker->GetOffset(task);
633 return offset;
634 break;
635 case 2:
636 offset=fSDDDataMaker->GetOffset(task);
637 return offset;
638 break;
639 case 3:
640 offset=fSSDDataMaker->GetOffset(task);
641 return offset;
642 break;
643 default:
644 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
645 offset=0;
646 return offset;
647 break;
648 }
649 //return offset;
650}
f867e0d8 651
652//____________________________________________________________________
653
4a903927 654Bool_t AliITSQADataMakerRec::AreEqual(Double_t a1,Double_t a2)
f867e0d8 655{
4a903927 656 const Double_t kEpsilon= 1.e-14;
f867e0d8 657 return TMath::Abs(a1-a2)<=kEpsilon*TMath::Abs(a1);
658}
659