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