SSD: updated segmentation class and cleanup of ClusterFinder (M. Van Leeuwen). Elimin...
[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 ---
04236e67 27#include <TTree.h>
04236e67 28// --- Standard library ---
29
30// --- AliRoot header files ---
31#include "AliITSQADataMakerRec.h"
8c823e5a 32#include "AliITSQASPDDataMakerRec.h"
33#include "AliITSQASDDDataMakerRec.h"
34#include "AliITSQASSDDataMakerRec.h"
04236e67 35#include "AliLog.h"
36#include "AliQA.h"
37#include "AliQAChecker.h"
c71529b0 38#include "AliITSQAChecker.h"
04236e67 39#include "AliRawReader.h"
a90a332e 40#include "AliESDEvent.h"
41#include "AliESDtrack.h"
42#include "AliESDVertex.h"
43#include "AliMultiplicity.h"
04236e67 44
45ClassImp(AliITSQADataMakerRec)
46
47//____________________________________________________________________________
8c823e5a 48AliITSQADataMakerRec::AliITSQADataMakerRec(Bool_t kMode, Short_t subDet, Short_t ldc) :
49AliQADataMakerRec(AliQA::GetDetName(AliQA::kITS), "ITS Quality Assurance Data Maker"),
1aa7c4f5 50fkOnline(kMode),
8c823e5a 51fSubDetector(subDet),
1aa7c4f5 52fLDC(ldc),
8c823e5a 53fSPDDataMaker(NULL),
54fSDDDataMaker(NULL),
55fSSDDataMaker(NULL)
1aa7c4f5 56{
1aa7c4f5 57 //ctor used to discriminate OnLine-Offline analysis
8c823e5a 58 if(fSubDetector < 0 || fSubDetector > 3) {
59 AliError("Error: fSubDetector number out of range; return\n");
60 }
61
62 // Initialization for RAW data
63 if(fSubDetector == 0 || fSubDetector == 1) {
64 AliDebug(1,"AliITSQADM::Create SPD DataMakerRec\n");
65 fSPDDataMaker = new AliITSQASPDDataMakerRec(this,fkOnline);
66 }
67 if(fSubDetector == 0 || fSubDetector == 2) {
68 AliDebug(1,"AliITSQADM::Create SDD DataMakerRec\n");
69 fSDDDataMaker = new AliITSQASDDDataMakerRec(this,fkOnline);
70 }
71 if(fSubDetector == 0 || fSubDetector == 3) {
72 AliDebug(1,"AliITSQADM::Create SSD DataMakerRec\n");
73 fSSDDataMaker = new AliITSQASSDDataMakerRec(this,fkOnline);
74 }
1aa7c4f5 75}
76
77//____________________________________________________________________________
8c823e5a 78AliITSQADataMakerRec::~AliITSQADataMakerRec(){
79 // destructor
80 if(fSPDDataMaker)delete fSPDDataMaker;
81 if(fSDDDataMaker)delete fSDDDataMaker;
82 if(fSSDDataMaker)delete fSSDDataMaker;
04236e67 83}
84
85//____________________________________________________________________________
86AliITSQADataMakerRec::AliITSQADataMakerRec(const AliITSQADataMakerRec& qadm) :
8c823e5a 87AliQADataMakerRec(),
9db10425 88fkOnline(qadm.fkOnline),
8c823e5a 89fSubDetector(qadm.fSubDetector),
9db10425 90fLDC(qadm.fLDC),
8c823e5a 91fSPDDataMaker(NULL),
92fSDDDataMaker(NULL),
93fSSDDataMaker(NULL)
04236e67 94{
95 //copy ctor
96 SetName((const char*)qadm.GetName()) ;
8c823e5a 97 SetTitle((const char*)qadm.GetTitle());
04236e67 98}
99
100//__________________________________________________________________
101AliITSQADataMakerRec& AliITSQADataMakerRec::operator = (const AliITSQADataMakerRec& qac )
102{
103 // Equal operator.
104 this->~AliITSQADataMakerRec();
105 new(this) AliITSQADataMakerRec(qac);
106 return *this;
107}
108
109//____________________________________________________________________________
8c823e5a 110void AliITSQADataMakerRec::StartOfDetectorCycle()
04236e67 111{
112 //Detector specific actions at start of cycle
113 AliDebug(1,"AliITSQADM::Start of ITS Cycle\n");
8c823e5a 114 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->StartOfDetectorCycle();
115 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->StartOfDetectorCycle();
116 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->StartOfDetectorCycle();
04236e67 117}
118
119//____________________________________________________________________________
92a357bf 120void AliITSQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list)
04236e67 121{
122 // launch the QA checking
123 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
8c823e5a 124 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->EndOfDetectorCycle(task, list);
125 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->EndOfDetectorCycle(task, list);
126 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->EndOfDetectorCycle(task, list);
04236e67 127
c71529b0 128 AliQAChecker *qac = AliQAChecker::Instance();
129 AliITSQAChecker *qacb = (AliITSQAChecker *) qac->GetDetQAChecker(0);
3647765c 130 if(fSubDetector == 0 ){
131 qacb->SetTaskOffset(fSPDDataMaker->GetOffset(), fSDDDataMaker->GetOffset(), fSSDDataMaker->GetOffset()); //Setting the offset for the QAChecker list
132 }
c71529b0 133 qac->Run( AliQA::kITS , task, list); //temporary skipping the checking
04236e67 134}
135
136//____________________________________________________________________________
8c823e5a 137void AliITSQADataMakerRec::EndOfDetectorCycle(const char * /*fgDataName*/)
04236e67 138{
8c823e5a 139 //eventually used for different AliQAChecker::Instance()->Run
04236e67 140}
141
142//____________________________________________________________________________
143void AliITSQADataMakerRec::InitRaws()
144{
8c823e5a 145 // Initialization for RAW data
146 if(fSubDetector == 0 || fSubDetector == 1) {
147 AliDebug(1,"AliITSQADM:: SPD InitRaws\n");
148 fSPDDataMaker->InitRaws();
1aa7c4f5 149 }
8c823e5a 150 if(fSubDetector == 0 || fSubDetector == 2) {
151 AliDebug(1,"AliITSQADM:: SDD InitRaws\n");
152 fSDDDataMaker->InitRaws();
04236e67 153 }
8c823e5a 154 if(fSubDetector == 0 || fSubDetector == 3) {
155 AliDebug(1,"AliITSQADM:: SSD InitRaws\n");
156 fSSDDataMaker->InitRaws();
04236e67 157 }
1aa7c4f5 158}
159
04236e67 160//____________________________________________________________________________
161void AliITSQADataMakerRec::MakeRaws(AliRawReader* rawReader)
162{
8c823e5a 163 // Fill QA for RAW
164 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeRaws(rawReader);
165 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeRaws(rawReader);
166 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeRaws(rawReader);
1aa7c4f5 167}
04236e67 168
169//____________________________________________________________________________
170void AliITSQADataMakerRec::InitRecPoints()
171{
1aa7c4f5 172 // Initialization for RECPOINTS
8c823e5a 173 if(fSubDetector == 0 || fSubDetector == 1) {
174 AliDebug(1,"AliITSQADM:: SPD InitRecPoints\n");
175 fSPDDataMaker->InitRecPoints();
04236e67 176 }
8c823e5a 177 if(fSubDetector == 0 || fSubDetector == 2) {
178 AliDebug(1,"AliITSQADM:: SDD InitRecPoints\n");
179 fSDDDataMaker->InitRecPoints();
1aa7c4f5 180 }
8c823e5a 181 if(fSubDetector == 0 || fSubDetector == 3) {
182 AliDebug(1,"AliITSQADM:: SSD InitRecPoints\n");
183 fSSDDataMaker->InitRecPoints();
1aa7c4f5 184 }
1aa7c4f5 185}
04236e67 186
187//____________________________________________________________________________
188void AliITSQADataMakerRec::MakeRecPoints(TTree * clustersTree)
189{
1aa7c4f5 190 // Fill QA for recpoints
8c823e5a 191 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeRecPoints(clustersTree);
192 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeRecPoints(clustersTree);
193 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeRecPoints(clustersTree);
04236e67 194}
195
d7d87ceb 196
a90a332e 197//____________________________________________________________________________
198void AliITSQADataMakerRec::InitESDs()
199{
200 // Create ESDs histograms in ESDs subdir
201
202 TH1F *hESDClustersMI =
203 new TH1F("hESDClustersMI", "N ITS clusters per track (MI); N clusters; Counts",
204 7, -0.5, 6.5);
205 hESDClustersMI->Sumw2();
206 hESDClustersMI->SetMinimum(0);
207 Add2ESDsList(hESDClustersMI, 0);
208
209 TH1F *hESDClusterMapMI =
d7d87ceb 210 new TH1F("hESDClusterMapMI", "N tracks with point Layer (MI); Layer; N tracks",
a90a332e 211 6, -0.5, 5.5);
212 hESDClusterMapMI->Sumw2();
213 hESDClusterMapMI->SetMinimum(0);
214 Add2ESDsList(hESDClusterMapMI, 1);
215
216 TH1F *hESDClustersSA =
217 new TH1F("hESDClustersSA", "N ITS clusters per track (SA); N clusters; Counts",
218 7, -0.5, 6.5);
219 hESDClustersSA->Sumw2();
220 hESDClustersSA->SetMinimum(0);
221 Add2ESDsList(hESDClustersSA, 2);
222
223 TH1F *hESDClusterMapSA =
d7d87ceb 224 new TH1F("hESDClusterMapSA", "N tracks with point Layer (SA); Layer; N tracks",
a90a332e 225 6, -0.5, 5.5);
226 hESDClusterMapSA->Sumw2();
227 hESDClusterMapSA->SetMinimum(0);
228 Add2ESDsList(hESDClusterMapSA, 3);
229
230 TH1F *hSPDVertexX =
231 new TH1F("hSPDVertexX","SPD Vertex x; x [cm]; N events",
232 10000,-2,2);
233 hSPDVertexX->Sumw2();
234 Add2ESDsList(hSPDVertexX, 4);
235
236 TH1F *hSPDVertexY =
237 new TH1F("hSPDVertexY","SPD Vertex y; y [cm]; N events",
238 10000,-2,2);
239 hSPDVertexY->Sumw2();
240 Add2ESDsList(hSPDVertexY, 5);
241
242 TH1F *hSPDVertexZ =
d7d87ceb 243 new TH1F("hSPDVertexZ","SPD Vertex Z; z [cm]; N events",
a90a332e 244 10000,-20,20);
245 hSPDVertexZ->Sumw2();
246 Add2ESDsList(hSPDVertexZ, 6);
247
248 TH1F *hSPDVertexContrOverMult =
249 new TH1F("hSPDVertexContrOverMult","SPD Vertex: contributors / multiplicity; N contributors / SPD multiplicity; N events",
250 100,-4,20);
251 hSPDVertexContrOverMult->Sumw2();
252 Add2ESDsList(hSPDVertexContrOverMult, 7);
253
254 TH1F *hTrkVertexX =
255 new TH1F("hTrkVertexX","ITS+TPC Trk Vertex x; x [cm]; N events",
256 10000,-2,2);
257 hTrkVertexX->Sumw2();
258 Add2ESDsList(hTrkVertexX, 8);
259
260 TH1F *hTrkVertexY =
261 new TH1F("hTrkVertexY","ITS+TPC Trk Vertex y; y [cm]; N events",
262 10000,-2,2);
263 hTrkVertexY->Sumw2();
264 Add2ESDsList(hTrkVertexY, 9);
265
266 TH1F *hTrkVertexZ =
d7d87ceb 267 new TH1F("hTrkVertexZ","ITS+TPC Trk Vertex Z; z [cm]; N events",
a90a332e 268 10000,-20,20);
269 hTrkVertexZ->Sumw2();
270 Add2ESDsList(hTrkVertexZ, 10);
271
d7d87ceb 272 TH1F *hTrkVertexContrOverITSrefit5 =
273 new TH1F("hTrkVertexContrOverITSrefit5","ITS+TPC Trk Vertex: contributors / tracks; N contributors / N trks kITSrefit with 5 or 6 clusters; N events",
274 100,-4,2);
275 hTrkVertexContrOverITSrefit5->Sumw2();
276 Add2ESDsList(hTrkVertexContrOverITSrefit5, 11);
a90a332e 277
278 TH1F *hSPDTrkVertexDeltaX =
279 new TH1F("hSPDTrkVertexDeltaX","Comparison of SPD and Trk vertices: x; xSPD-xTrk [cm]; N events",
280 1000,-1,1);
281 hSPDTrkVertexDeltaX->Sumw2();
282 Add2ESDsList(hSPDTrkVertexDeltaX, 12);
283
284 TH1F *hSPDTrkVertexDeltaY =
285 new TH1F("hSPDTrkVertexDeltaY","Comparison of SPD and Trk vertices: y; ySPD-yTrk [cm]; N events",
286 1000,-1,1);
287 hSPDTrkVertexDeltaY->Sumw2();
288 Add2ESDsList(hSPDTrkVertexDeltaY, 13);
289
290 TH1F *hSPDTrkVertexDeltaZ =
291 new TH1F("hSPDTrkVertexDeltaZ","Comparison of SPD and Trk vertices: z; zSPD-zTrk [cm]; N events",
292 1000,-1,1);
293 hSPDTrkVertexDeltaZ->Sumw2();
294 Add2ESDsList(hSPDTrkVertexDeltaZ, 14);
295
a8100152 296 // SPD Tracklets
297
298 TH1F* hSPDTracklets =
299 new TH1F("hSPDTracklets","N SPD Tracklets; N tracklets; Counts",300,0.,300.);
300 hSPDTracklets->Sumw2();
301 Add2ESDsList(hSPDTracklets, 15);
302
303 TH1F* hSPDTrackletsDePhi =
304 new TH1F("hSPDTrackletsDePhi","DeltaPhi SPD Tracklets; DeltaPhi [rad]; N events",200,-0.2,0.2);
305 hSPDTrackletsDePhi->Sumw2();
306 Add2ESDsList(hSPDTrackletsDePhi, 16);
307
308 TH1F* hSPDTrackletsPhi =
309 new TH1F("hSPDTrackletsPhi","Phi SPD Tracklets; Phi [rad]; N events",1000,0.,2*TMath::Pi());
310 hSPDTrackletsPhi->Sumw2();
311 Add2ESDsList(hSPDTrackletsPhi, 17);
312
313 TH1F* hSPDTrackletsTheta =
314 new TH1F("hSPDTrackletsTheta","Theta SPD Tracklets; Theta [rad]; N events",500,0.,TMath::Pi());
315 hSPDTrackletsTheta->Sumw2();
316 Add2ESDsList(hSPDTrackletsTheta, 18);
317
a90a332e 318 return;
319}
320
321//____________________________________________________________________________
322void AliITSQADataMakerRec::MakeESDs(AliESDEvent *esd)
323{
324 // Make QA data from ESDs
325
326 const Int_t nESDTracks = esd->GetNumberOfTracks();
d7d87ceb 327 Int_t nITSrefit5 = 0;
a90a332e 328
329 // loop on tracks
330 for(Int_t i = 0; i < nESDTracks; i++) {
331
332 AliESDtrack *track = esd->GetTrack(i);
333
334 Int_t nclsITS = track->GetNcls(0);
335
336 Bool_t itsrefit=kFALSE,tpcin=kFALSE;
337 if ((track->GetStatus() & AliESDtrack::kITSrefit)) itsrefit=kTRUE;
338 if ((track->GetStatus() & AliESDtrack::kTPCin)) tpcin=kTRUE;
d7d87ceb 339 if(nclsITS>=5 && itsrefit) nITSrefit5++;
a90a332e 340
341 if(tpcin) {
342 GetESDsData(0)->Fill(nclsITS);
343 } else {
344 GetESDsData(2)->Fill(nclsITS);
345 }
346
347 for(Int_t layer=0; layer<6; layer++) {
348
349 if(TESTBIT(track->GetITSClusterMap(),layer)) {
350 if(tpcin) {
351 GetESDsData(1)->Fill(layer);
352 } else {
353 GetESDsData(3)->Fill(layer);
354 }
355 }
356
357 }
358
359 } // end loop on tracks
360
361 // vertices
362 const AliESDVertex *vtxSPD = esd->GetPrimaryVertexSPD();
363 const AliESDVertex *vtxTrk = esd->GetPrimaryVertex();
364
a90a332e 365 Int_t mult = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetNumberOfTracklets();
366 if(mult>0)
367 GetESDsData(7)->Fill((Float_t)(vtxSPD->GetNContributors())/(Float_t)mult);
368
d7d87ceb 369 if(nITSrefit5>0)
370 GetESDsData(11)->Fill((Float_t)(vtxTrk->GetNIndices())/(Float_t)nITSrefit5);
a90a332e 371
d7d87ceb 372 if(vtxSPD->GetNContributors()>0) {
373 GetESDsData(4)->Fill(vtxSPD->GetXv());
374 GetESDsData(5)->Fill(vtxSPD->GetYv());
375 GetESDsData(6)->Fill(vtxSPD->GetZv());
376 }
a90a332e 377
d7d87ceb 378 if(vtxTrk->GetNContributors()>0) {
379 GetESDsData(8)->Fill(vtxTrk->GetXv());
380 GetESDsData(9)->Fill(vtxTrk->GetYv());
381 GetESDsData(10)->Fill(vtxTrk->GetZv());
382 }
383
384 if(vtxSPD->GetNContributors()>0 &&
385 vtxTrk->GetNContributors()>0) {
386 GetESDsData(12)->Fill(vtxSPD->GetXv()-vtxTrk->GetXv());
387 GetESDsData(13)->Fill(vtxSPD->GetYv()-vtxTrk->GetYv());
388 GetESDsData(14)->Fill(vtxSPD->GetZv()-vtxTrk->GetZv());
389 }
a90a332e 390
a8100152 391 // SPD Tracklets
392
393 // Loop over tracklets
394 GetESDsData(15)->Fill(mult);
395 for (Int_t itr=0; itr<mult; ++itr) {
396 Float_t dePhiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetDeltaPhi(itr);
397 Float_t phiTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetPhi(itr);
398 Float_t thetaTr = ((AliMultiplicity*)(esd->GetMultiplicity()))->GetTheta(itr);
399 GetESDsData(16)->Fill(dePhiTr);
400 GetESDsData(17)->Fill(phiTr);
401 GetESDsData(18)->Fill(thetaTr);
402 } // end loop on tracklets
403
a90a332e 404 return;
405}