]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASPDDataMakerSim.cxx
fix include file dependences and correct some inline methods
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDDataMakerSim.cxx
CommitLineData
379510c2 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// Checks the quality assurance
19// by comparing with reference data
20// contained in a DB
21// -------------------------------------------------------------
22// W. Ferrarese + P. Cerello INFN Torino Feb 2008
23// M. Nicassio D. Elia INFN Bari April 2008
24// maria.nicassio@ba.infn.it
25
26// --- ROOT system ---
27#include <TTree.h>
28#include <TH2.h>
29#include <TH1.h>
30// --- Standard library ---
31
32// --- AliRoot header files ---
33#include "AliRun.h"
34#include "AliITSQADataMakerSim.h"
35#include "AliITSQASPDDataMakerSim.h"
4e25ac79 36#include "AliQAv1.h"
379510c2 37#include "AliQAChecker.h"
38#include "AliITSdigit.h"
39#include "AliITSdigitSPD.h"
40#include "AliITS.h"
41#include "AliITSmodule.h"
42#include "AliITShit.h"
43#include "AliITSLoader.h"
44#include "AliRunLoader.h"
45
46ClassImp(AliITSQASPDDataMakerSim)
47
48//____________________________________________________________________________
49AliITSQASPDDataMakerSim::AliITSQASPDDataMakerSim(AliITSQADataMakerSim *aliITSQADataMakerSim) :
50TObject(),
51fAliITSQADataMakerSim(aliITSQADataMakerSim),
7a0e5776 52fSPDhHTask(0),
53fSPDhSTask(0),
54fSPDhDTask(0),
3f905799 55fGenOffsetH(0),
56fGenOffsetS(0),
57fGenOffsetD(0)
379510c2 58{
59 //ctor used to discriminate OnLine-Offline analysis
60}
61
62//____________________________________________________________________________
63AliITSQASPDDataMakerSim::AliITSQASPDDataMakerSim(const AliITSQASPDDataMakerSim& qadm) :
64TObject(),
65fAliITSQADataMakerSim(qadm.fAliITSQADataMakerSim),
7a0e5776 66fSPDhHTask(qadm.fSPDhHTask),
67fSPDhSTask(qadm.fSPDhSTask),
68fSPDhDTask(qadm.fSPDhDTask),
3f905799 69fGenOffsetH(qadm.fGenOffsetH),
70fGenOffsetS(qadm.fGenOffsetS),
71fGenOffsetD(qadm.fGenOffsetD)
379510c2 72{
73 //copy ctor
74 fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ;
75 fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());
76 }
77
78//__________________________________________________________________
79AliITSQASPDDataMakerSim& AliITSQASPDDataMakerSim::operator = (const AliITSQASPDDataMakerSim& qac )
80{
81 // Equal operator.
82 this->~AliITSQASPDDataMakerSim();
83 new(this) AliITSQASPDDataMakerSim(qac);
84 return *this;
85}
86
87//____________________________________________________________________________
88void AliITSQASPDDataMakerSim::StartOfDetectorCycle()
89{
90 //Detector specific actions at start of cycle
5379c4a3 91 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SPD Cycle\n");
379510c2 92}
93
94//____________________________________________________________________________
4e25ac79 95void AliITSQASPDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
379510c2 96{
97 // launch the QA checking
5379c4a3 98 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
379510c2 99
4e25ac79 100 //AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);
379510c2 101}
102
103//____________________________________________________________________________
104void AliITSQASPDDataMakerSim::InitDigits()
105{
106 // Initialization for DIGIT data - SPD -
7d297381 107 const Bool_t expert = kTRUE ;
108 const Bool_t image = kTRUE ;
109
57acd2d2 110 fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 111 //fSPDhDTask must be incremented by one unit every time a histogram is ADDED to the QA List
379510c2 112
113 Char_t name[50];
114 Char_t title[50];
115
26ee9565 116 TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
379510c2 117 hlayer->GetXaxis()->SetTitle("Layer number");
118 hlayer->GetYaxis()->SetTitle("Entries");
7d297381 119 fAliITSQADataMakerSim->Add2DigitsList(hlayer,fGenOffsetD, expert, !image);
7a0e5776 120 fSPDhDTask++;
379510c2 121
122 TH1F **hmod = new TH1F*[2];
123 for (Int_t iLay=0; iLay<2; iLay++) {
26ee9565 124 sprintf(name,"SPDModPattern_SPD%d",iLay+1);
379510c2 125 sprintf(title,"Module map - SPD Layer %d",iLay+1);
126 hmod[iLay]=new TH1F(name,title,240,0,240);
127 hmod[iLay]->GetXaxis()->SetTitle("Module number");
128 hmod[iLay]->GetYaxis()->SetTitle("Entries");
7d297381 129 fAliITSQADataMakerSim->Add2DigitsList(hmod[iLay],1+iLay+fGenOffsetD, !expert, image);
7a0e5776 130 fSPDhDTask++;
379510c2 131 }
132
26ee9565 133 TH1F *hcolumns = new TH1F("SPDColumns_SPD","Columns - SPD",160,0.,160.);
379510c2 134 hcolumns->GetXaxis()->SetTitle("Column number");
135 hcolumns->GetYaxis()->SetTitle("Entries");
7d297381 136 fAliITSQADataMakerSim->Add2DigitsList(hcolumns,3+fGenOffsetD, expert, !image);
7a0e5776 137 fSPDhDTask++;
379510c2 138
26ee9565 139 TH1F *hrows = new TH1F("SPDRows_SPD","Rows - SPD",256,0.,256.);
379510c2 140 hrows->GetXaxis()->SetTitle("Row number");
141 hrows->GetYaxis()->SetTitle("Entries");
7d297381 142 fAliITSQADataMakerSim->Add2DigitsList(hrows,4+fGenOffsetD, expert, !image);
7a0e5776 143 fSPDhDTask++;
379510c2 144
145 TH1F** hMultSPDdigits = new TH1F*[2];
146 for (Int_t iLay=0; iLay<2; ++iLay) {
26ee9565 147 sprintf(name,"SPDDigitMultiplicity_SPD%d",iLay+1);
379510c2 148 sprintf(title,"Digit multiplicity - SPD Layer %d",iLay+1);
149 hMultSPDdigits[iLay]=new TH1F(name,title,200,0.,200.);
150 hMultSPDdigits[iLay]->GetXaxis()->SetTitle("Digit multiplicity");
151 hMultSPDdigits[iLay]->GetYaxis()->SetTitle("Entries");
7d297381 152 fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdigits[iLay], 5+iLay+fGenOffsetD, !expert, image);
7a0e5776 153 fSPDhDTask++;
379510c2 154 }
155
954ef57a 156 TH2F *hMultSPDdig2MultSPDdig1
26ee9565 157 = new TH2F("SPDDigitMultCorrelation_SPD","Digit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
379510c2 158 hMultSPDdig2MultSPDdig1->GetXaxis()->SetTitle("Digit multiplicity (Layer 1)");
159 hMultSPDdig2MultSPDdig1->GetYaxis()->SetTitle("Digit multiplicity (Layer 2)");
7d297381 160 fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdig2MultSPDdig1,7+fGenOffsetD, !expert, image);
7a0e5776 161 fSPDhDTask++;
379510c2 162
5379c4a3 163 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Digits histograms booked\n",fSPDhDTask));
379510c2 164
165}
166
167//____________________________________________________________________________
168void AliITSQASPDDataMakerSim::MakeDigits(TTree *digits)
169{
170 // Fill QA for DIGIT - SPD -
171 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
172 fITS->SetTreeAddress();
173 TClonesArray *iITSdigits = fITS->DigitsAddress(0); // 0->SPD
174
175 Int_t nDigitsL1=0;
176 Int_t nDigitsL2=0;
177
178 for (Int_t imod=0; imod<240; ++imod){
179 digits->GetEvent(imod);
180 Int_t ndigits = iITSdigits->GetEntries();
181 if (imod<80) {
3f905799 182 fAliITSQADataMakerSim->GetDigitsData(0+fGenOffsetD)->Fill(0.5,ndigits);
183 fAliITSQADataMakerSim->GetDigitsData(1+fGenOffsetD)->Fill(imod,ndigits);
379510c2 184 nDigitsL1+=ndigits;
185 }
186 else {
3f905799 187 fAliITSQADataMakerSim->GetDigitsData(0+fGenOffsetD)->Fill(1,ndigits);
188 fAliITSQADataMakerSim->GetDigitsData(2+fGenOffsetD)->Fill(imod,ndigits);
379510c2 189 nDigitsL2+=ndigits;
190 }
191 for (Int_t idig=0; idig<ndigits; ++idig) {
192 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
193 Int_t col=dig->GetCoord1(); // cell number z
194 Int_t row=dig->GetCoord2(); // cell number x
3f905799 195 fAliITSQADataMakerSim->GetDigitsData(3+fGenOffsetD)->Fill(col);
196 fAliITSQADataMakerSim->GetDigitsData(4+fGenOffsetD)->Fill(row);
379510c2 197 }
198 }
3f905799 199 fAliITSQADataMakerSim->GetDigitsData(5+fGenOffsetD)->Fill(nDigitsL1);
200 fAliITSQADataMakerSim->GetDigitsData(6+fGenOffsetD)->Fill(nDigitsL2);
201 fAliITSQADataMakerSim->GetDigitsData(7+fGenOffsetD)->Fill(nDigitsL1,nDigitsL2);
379510c2 202}
203
204//____________________________________________________________________________
205void AliITSQASPDDataMakerSim::InitSDigits()
206{
207 // Initialization for SDIGIT data - SPD -
7d297381 208 const Bool_t expert = kTRUE ;
209 const Bool_t image = kTRUE ;
210
57acd2d2 211 fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();
c71529b0 212 //printf("--W-- AliITSQASPDDataMakerSim::InitSDigits() fGenOffset= %d \n",fGenOffset);
7a0e5776 213 //fSPDhSTask must be incremented by one unit every time a histogram is ADDED to the QA List
c71529b0 214
379510c2 215 Char_t name[50];
216 Char_t title[50];
217
26ee9565 218 TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
379510c2 219 hlayer->GetXaxis()->SetTitle("Layer number");
220 hlayer->GetYaxis()->SetTitle("Entries");
7d297381 221 fAliITSQADataMakerSim->Add2SDigitsList(hlayer,fGenOffsetS, expert, !image);
7a0e5776 222 fSPDhSTask++;
379510c2 223
224 TH1F **hmod = new TH1F*[2];
225 for (Int_t iLay=0; iLay<2; ++iLay) {
26ee9565 226 sprintf(name,"SPDModPattern_SPD%d",iLay+1);
379510c2 227 sprintf(title,"Module map - SPD Layer %d",iLay+1);
228 hmod[iLay]=new TH1F(name,title,240,0,240);
229 hmod[iLay]->GetXaxis()->SetTitle("Module number");
230 hmod[iLay]->GetYaxis()->SetTitle("Entries");
7d297381 231 fAliITSQADataMakerSim->Add2SDigitsList(hmod[iLay],1+iLay+fGenOffsetS, !expert, image);
7a0e5776 232 fSPDhSTask++;
379510c2 233 }
379510c2 234
5379c4a3 235 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD SDigits histograms booked\n",fSPDhSTask));
379510c2 236
237}
238
239//____________________________________________________________________________
240void AliITSQASPDDataMakerSim::MakeSDigits(TTree *sdigits)
241{
242 // Fill QA for SDIGIT - SPD -
243 TBranch *brchSDigits = sdigits->GetBranch("ITS");
244 for (Int_t imod=0; imod<240; ++imod){
245 TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 );
246 brchSDigits->SetAddress( &sdig );
247 brchSDigits->GetEvent(imod);
248 Int_t nsdig=sdig->GetEntries();
249 if (imod<80) {
3f905799 250 fAliITSQADataMakerSim->GetSDigitsData(0+fGenOffsetS)->Fill(0.5,nsdig);
251 fAliITSQADataMakerSim->GetSDigitsData(1+fGenOffsetS)->Fill(imod,nsdig);
379510c2 252 }
253 else {
3f905799 254 fAliITSQADataMakerSim->GetSDigitsData(0+fGenOffsetS)->Fill(1,nsdig);
255 fAliITSQADataMakerSim->GetSDigitsData(2+fGenOffsetS)->Fill(imod,nsdig);
379510c2 256 }
257 delete sdig;
258 }
259
260}
261
262//____________________________________________________________________________
263void AliITSQASPDDataMakerSim::InitHits()
264{
265 // Initialization for HITS data - SPD -
7d297381 266 const Bool_t expert = kTRUE ;
267 const Bool_t image = kTRUE ;
268
57acd2d2 269 fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();
c71529b0 270 //printf("--W-- AliITSQASPDDataMakerSim::InitHits() fGenOffset= %d \n",fGenOffset);
7a0e5776 271 //fSPDhHTask must be incremented by one unit every time a histogram is ADDED to the QA List
379510c2 272 Char_t name[50];
273 Char_t title[50];
274
26ee9565 275 TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
379510c2 276 hlayer->GetXaxis()->SetTitle("Layer number");
277 hlayer->GetYaxis()->SetTitle("Entries");
7d297381 278 fAliITSQADataMakerSim->Add2HitsList(hlayer,fGenOffsetH, expert, !image);
7a0e5776 279 fSPDhHTask++;
379510c2 280
281 TH1F **hmod = new TH1F*[2];
282 for (Int_t iLay=0; iLay<2; ++iLay) {
26ee9565 283 sprintf(name,"SPDModPattern_SPD%d",iLay+1);
379510c2 284 sprintf(title,"Module map - SPD Layer %d",iLay+1);
285 hmod[iLay]=new TH1F(name,title,240,0,240);
286 hmod[iLay]->GetXaxis()->SetTitle("Module number");
287 hmod[iLay]->GetYaxis()->SetTitle("Entries");
7d297381 288 fAliITSQADataMakerSim->Add2HitsList(hmod[iLay],1+iLay+fGenOffsetH, !expert, image);
7a0e5776 289 fSPDhHTask++;
379510c2 290 }
291
26ee9565 292 TH1F *hhitlenght = new TH1F("SPDLenght_SPD","Hit lenght along y_{loc} coord",210,0.,210.);
379510c2 293 hhitlenght->GetXaxis()->SetTitle("Hit lenght [#mum]");
294 hhitlenght->GetYaxis()->SetTitle("# hits");
7d297381 295 fAliITSQADataMakerSim->Add2HitsList(hhitlenght,3+fGenOffsetH, !expert, image);
7a0e5776 296 fSPDhHTask++;
379510c2 297
26ee9565 298 TH1F *hEdepos = new TH1F("SPDEnergyDeposit_SPD","Deposited energy distribution (y_{loc}>180 #mum)",150,0.,300.);
379510c2 299 hEdepos->GetXaxis()->SetTitle("Deposited energy [keV]");
300 hEdepos->GetYaxis()->SetTitle("# hits");
7d297381 301 fAliITSQADataMakerSim->Add2HitsList(hEdepos,4+fGenOffsetH, !expert, image);
7a0e5776 302 fSPDhHTask++;
379510c2 303
5379c4a3 304 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Hits histograms booked\n",fSPDhHTask));
379510c2 305
306}
307
308//____________________________________________________________________________
309void AliITSQASPDDataMakerSim::MakeHits(TTree *hits)
310{
311 // Fill QA for HITS - SPD -
312 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
313 fITS->SetTreeAddress();
314 Int_t nmodules;
315 fITS->InitModules(-1,nmodules); //-1->number of modules taken from AliITSgeom class kept in fITSgeom
316 //nmodules is set
317
318 fITS->FillModules(hits,0);
319
320 for (Int_t imod=0; imod<240; ++imod){
321 AliITSmodule *module = fITS->GetModule(imod);
322 TObjArray *arrHits = module->GetHits();
323 Int_t nhits = arrHits->GetEntriesFast();
324 if (imod<80) {
3f905799 325 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH)->Fill(0.5,nhits);
326 fAliITSQADataMakerSim->GetHitsData(1+fGenOffsetH)->Fill(imod,nhits);
379510c2 327 } else {
3f905799 328 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH)->Fill(1,nhits);
329 fAliITSQADataMakerSim->GetHitsData(2+fGenOffsetH)->Fill(imod,nhits);
379510c2 330 }
379510c2 331 for (Int_t iHit=0; iHit<nhits; ++iHit) {
332 AliITShit *hit = (AliITShit*) arrHits->At(iHit);
333 Double_t xl,yl,zl,xl0,yl0,zl0;
334 Double_t tof,tof0;
335 hit->GetPositionL(xl,yl,zl,tof);
336 hit->GetPositionL0(xl0,yl0,zl0,tof0);
337 Float_t dyloc=TMath::Abs(yl-yl0)*10000.;
3f905799 338 fAliITSQADataMakerSim->GetHitsData(3+fGenOffsetH)->Fill(dyloc);
379510c2 339 Float_t edep=hit->GetIonization()*1000000;
340 if(dyloc>180.){
3f905799 341 fAliITSQADataMakerSim->GetHitsData(4+fGenOffsetH)->Fill(edep);
379510c2 342 }
343 }
344 }
345}
7a0e5776 346
347
348//_______________________________________________________________
349
4e25ac79 350Int_t AliITSQASPDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
7a0e5776 351 // Returns histogram offset according to the specified task
352 Int_t offset=0;
4e25ac79 353 if( task == AliQAv1::kHITS){
7a0e5776 354 offset=fGenOffsetH;
355 }
4e25ac79 356 else if( task == AliQAv1::kSDIGITS) {
7a0e5776 357 offset=fGenOffsetS;
358 }
4e25ac79 359 else if( task == AliQAv1::kDIGITS) {
7a0e5776 360 offset=fGenOffsetD;
361 }
362 else {
363 AliInfo("No task has been selected. TaskHisto set to zero.\n");
364 }
365
366 return offset;
367}
368
369
370//_______________________________________________________________
371
4e25ac79 372Int_t AliITSQASPDDataMakerSim::GetTaskHisto(AliQAv1::TASKINDEX_t task) {
7a0e5776 373 // Returns the number of booked histograms for the selected task
374 Int_t histotot=0;
4e25ac79 375 if( task == AliQAv1::kHITS) {
7a0e5776 376 histotot=fSPDhHTask ;
377 }
4e25ac79 378 else if( task == AliQAv1::kSDIGITS) {
7a0e5776 379 histotot=fSPDhSTask;
380 }
4e25ac79 381 else if( task == AliQAv1::kDIGITS) {
7a0e5776 382 histotot=fSPDhDTask ;
383 }
384 else {
385 AliInfo("No task has been selected. TaskHisto set to zero.\n");
386 }
387 return histotot;
388
389}