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