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