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