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