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