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