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