1.The QA data created on demand according to the event species at filling time. 2...
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDDataMakerSim.cxx
CommitLineData
8dc34e37 1/**************************************************************************\r
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
6f5308d9 16/* $Id$ */\r
17\r
8dc34e37 18// *************************************************************\r
19// Checks the quality assurance \r
20// by comparing with reference data\r
21// contained in a DB\r
22// -------------------------------------------------------------\r
23// W. Ferrarese + P. Cerello Feb 2008\r
24// INFN Torino\r
25\r
26// --- ROOT system ---\r
27#include <TTree.h>\r
28// --- Standard library ---\r
29\r
30// --- AliRoot header files ---\r
31#include "AliITSQASDDDataMakerSim.h"\r
32#include "AliLog.h"\r
4e25ac79 33#include "AliQAv1.h"\r
8dc34e37 34#include "AliQAChecker.h"\r
35#include "AliQADataMakerSim.h"\r
36#include "AliITSQADataMakerSim.h"\r
37#include "AliRawReader.h"\r
38#include "AliITSdigit.h"\r
39#include "AliITS.h"\r
40#include "AliITSmodule.h"\r
41#include "AliITShit.h"\r
42#include "AliITSLoader.h"\r
43#include "AliRunLoader.h"\r
44#include "AliRun.h"\r
45#include "AliITSsegmentationSDD.h"\r
46#include "AliITSpList.h"\r
47\r
48ClassImp(AliITSQASDDDataMakerSim)\r
49\r
50//____________________________________________________________________________ \r
51AliITSQASDDDataMakerSim::AliITSQASDDDataMakerSim(AliITSQADataMakerSim *aliITSQADataMakerSim) :\r
52TObject(),\r
53fAliITSQADataMakerSim(aliITSQADataMakerSim),\r
ad300de9 54fSDDhHTask(0),\r
55fSDDhSTask(0),\r
56fSDDhDTask(0),\r
3f905799 57fGenOffsetH(0),\r
58fGenOffsetS(0),\r
59fGenOffsetD(0)\r
8dc34e37 60{\r
61 //ctor used to discriminate OnLine-Offline analysis \r
62}\r
63\r
64//____________________________________________________________________________ \r
65AliITSQASDDDataMakerSim::AliITSQASDDDataMakerSim(const AliITSQASDDDataMakerSim& qadm) :\r
66TObject(),\r
67fAliITSQADataMakerSim(qadm.fAliITSQADataMakerSim),\r
ad300de9 68fSDDhHTask(qadm.fSDDhHTask),\r
69fSDDhSTask(qadm.fSDDhSTask),\r
70fSDDhDTask(qadm.fSDDhDTask),\r
3f905799 71fGenOffsetH(qadm.fGenOffsetH),\r
72fGenOffsetS(qadm.fGenOffsetS),\r
73fGenOffsetD(qadm.fGenOffsetD)\r
8dc34e37 74{\r
75 //copy ctor \r
76 fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ; \r
77 fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());\r
78 }\r
79\r
80//__________________________________________________________________\r
81AliITSQASDDDataMakerSim& AliITSQASDDDataMakerSim::operator = (const AliITSQASDDDataMakerSim& qac )\r
82{\r
83 // Equal operator.\r
84 this->~AliITSQASDDDataMakerSim();\r
85 new(this) AliITSQASDDDataMakerSim(qac);\r
86 return *this;\r
87}\r
88\r
89//____________________________________________________________________________ \r
90void AliITSQASDDDataMakerSim::StartOfDetectorCycle()\r
91{\r
92 //Detector specific actions at start of cycle\r
5379c4a3 93 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");\r
8dc34e37 94}\r
95\r
96//____________________________________________________________________________ \r
4e25ac79 97void AliITSQASDDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)\r
8dc34e37 98{\r
99 // launch the QA checking\r
5379c4a3 100 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n"); \r
4e25ac79 101 //AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);\r
8dc34e37 102}\r
103\r
104//____________________________________________________________________________ \r
eca4fa66 105Int_t AliITSQASDDDataMakerSim::InitDigits()\r
8dc34e37 106{ \r
c71529b0 107 // Initialization for DIGIT data - SDD - \r
7d297381 108 const Bool_t expert = kTRUE ; \r
109 const Bool_t image = kTRUE ;\r
eca4fa66 110 Int_t rv = 0 ; \r
111 //fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();\r
3647765c 112 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List\r
8dc34e37 113 TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5); //hmod\r
114 h0->GetXaxis()->SetTitle("SDD Module Number");\r
115 h0->GetYaxis()->SetTitle("# DIGITS");\r
eca4fa66 116 rv = fAliITSQADataMakerSim->Add2DigitsList(h0,fGenOffsetD, !expert, image);\r
ad300de9 117 fSDDhDTask ++;\r
db72ff3b 118 TH1F* h1=new TH1F("SDD Anode Distribution","SDD DIGITS Anode Distribution",512,-0.5,511.5); //hanocc\r
8dc34e37 119 h1->GetXaxis()->SetTitle("Anode Number");\r
120 h1->GetYaxis()->SetTitle("# DIGITS");\r
eca4fa66 121 rv = fAliITSQADataMakerSim->Add2DigitsList(h1,1+fGenOffsetD, !expert, image);\r
ad300de9 122 fSDDhDTask ++;\r
db72ff3b 123 TH1F* h2=new TH1F("SDD Tbin Distribution","SDD DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc\r
8dc34e37 124 h2->GetXaxis()->SetTitle("Tbin Number");\r
125 h2->GetYaxis()->SetTitle("# DIGITS");\r
eca4fa66 126 rv = fAliITSQADataMakerSim->Add2DigitsList(h2,2+fGenOffsetD, !expert, image);\r
ad300de9 127 fSDDhDTask ++;\r
db72ff3b 128 TH1F* h3=new TH1F("SDD ADC Counts Distribution","SDD DIGITS ADC Counts Distribution",200,0.,1024.); //hsig\r
8dc34e37 129 h3->GetXaxis()->SetTitle("ADC Value");\r
130 h3->GetYaxis()->SetTitle("# DIGITS");\r
eca4fa66 131 rv = fAliITSQADataMakerSim->Add2DigitsList(h3,3+fGenOffsetD, !expert, image);\r
ad300de9 132 fSDDhDTask ++;\r
5379c4a3 133 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDTask));\r
eca4fa66 134 return rv ; \r
8dc34e37 135}\r
136\r
137//____________________________________________________________________________\r
eca4fa66 138Int_t AliITSQASDDDataMakerSim::MakeDigits(TTree * digits)\r
8dc34e37 139{ \r
ad300de9 140\r
8dc34e37 141 // Fill QA for DIGIT - SDD -\r
eca4fa66 142 Int_t rv = 0 ; \r
143 // Check id histograms already created for this Event Specie\r
144 if ( ! fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD) )\r
145 rv = InitDigits() ;\r
146 \r
8dc34e37 147 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
148 fITS->SetTreeAddress();\r
149 TClonesArray *iITSdigits = fITS->DigitsAddress(1);\r
150 for(Int_t i=0; i<260; i++){\r
151 Int_t nmod=i+240;\r
152 digits->GetEvent(nmod);\r
153 Int_t ndigits = iITSdigits->GetEntries();\r
3f905799 154 fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD)->Fill(nmod,ndigits);\r
8dc34e37 155 for (Int_t idig=0; idig<ndigits; idig++) {\r
156 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);\r
157 Int_t iz=dig->GetCoord1(); // cell number z\r
158 Int_t ix=dig->GetCoord2(); // cell number x\r
159 Int_t sig=dig->GetSignal();\r
3f905799 160 fAliITSQADataMakerSim->GetDigitsData(1+fGenOffsetD)->Fill(iz);\r
161 fAliITSQADataMakerSim->GetDigitsData(2+fGenOffsetD)->Fill(ix);\r
162 fAliITSQADataMakerSim->GetDigitsData(3+fGenOffsetD)->Fill(sig);\r
8dc34e37 163 }\r
164 }\r
eca4fa66 165 return rv ; \r
8dc34e37 166}\r
167\r
168//____________________________________________________________________________ \r
eca4fa66 169Int_t AliITSQASDDDataMakerSim::InitSDigits()\r
8dc34e37 170{ \r
171 // Initialization for SDIGIT data - SDD -\r
7d297381 172 const Bool_t expert = kTRUE ; \r
173 const Bool_t image = kTRUE ;\r
eca4fa66 174 Int_t rv = 0 ; \r
175 //fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();\r
3647765c 176 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List\r
8dc34e37 177 TH1F* h0=new TH1F("SDD SDIGITS Module Pattern","SDIGITS SDD Module Pattern",260,239.5,499.5); //hmod\r
178 h0->GetXaxis()->SetTitle("SDD Module Number");\r
179 h0->GetYaxis()->SetTitle("# SDIGITS");\r
eca4fa66 180 rv = fAliITSQADataMakerSim->Add2SDigitsList(h0,fGenOffsetS, !expert, image);\r
ad300de9 181 fSDDhSTask ++;\r
db72ff3b 182 TH1F* h1=new TH1F("SDD Anode Distribution","SDIGITS SDD Anode Distribution",512,-0.5,511.5); //hanocc\r
8dc34e37 183 h1->GetXaxis()->SetTitle("Anode Number");\r
184 h1->GetYaxis()->SetTitle("# SDIGITS");\r
eca4fa66 185 rv = fAliITSQADataMakerSim->Add2SDigitsList(h1,1+fGenOffsetS, !expert, image);\r
ad300de9 186 fSDDhSTask ++;\r
db72ff3b 187 TH1F* h2=new TH1F("SDD Tbin Distribution","SDIGITS SDD Tbin Distribution",256,-0.5,255.5); //htbocc\r
8dc34e37 188 h2->GetXaxis()->SetTitle("Tbin Number");\r
189 h2->GetYaxis()->SetTitle("# SDIGITS");\r
eca4fa66 190 rv = fAliITSQADataMakerSim->Add2SDigitsList(h2,2+fGenOffsetS);\r
ad300de9 191 fSDDhSTask ++;\r
db72ff3b 192 TH1F* h3=new TH1F("SDD ADC Counts Distribution","SDIGITS SDD ADC Counts Distribution",200,0.,1024.); //hsig\r
8dc34e37 193 h3->GetXaxis()->SetTitle("ADC Value");\r
194 h3->GetYaxis()->SetTitle("# SDIGITS");\r
eca4fa66 195 rv = fAliITSQADataMakerSim->Add2SDigitsList(h3,3+fGenOffsetS, !expert, image);\r
ad300de9 196 fSDDhSTask ++;\r
8dc34e37 197\r
5379c4a3 198 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD SDigits histograms booked\n",fSDDhSTask));\r
eca4fa66 199 return rv ; \r
8dc34e37 200}\r
201\r
202//____________________________________________________________________________\r
eca4fa66 203Int_t AliITSQASDDDataMakerSim::MakeSDigits(TTree * sdigits)\r
8dc34e37 204{ \r
205 // Fill QA for SDIGIT - SDD -\r
eca4fa66 206 Int_t rv = 0 ; \r
207 // Check id histograms already created for this Event Specie\r
208 if ( ! fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS) )\r
209 rv = InitSDigits() ;\r
210 \r
211 AliITSsegmentationSDD* seg = new AliITSsegmentationSDD();\r
8dc34e37 212 Int_t nan=seg->Npz();\r
213 Int_t ntb=seg->Npx();\r
214 Int_t scaleSize=4;\r
215 AliITSpList* list=new AliITSpList(nan,ntb*scaleSize);\r
216\r
217 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
218 //fITS->SetTreeAddress();\r
219 //TClonesArray *ITSdigits = fITS->DigitsAddress(1);\r
220 //TFile *sper = new TFile("sper.root","CREATE"); //agginto a mano x prova\r
221 //digits->Write();\r
222 //sper->Close();\r
223\r
224\r
225 TBranch *brchSDigits = sdigits->GetBranch("ITS");\r
226 for(Int_t id=0; id<260; id++){\r
227 Int_t nmod=id+240;\r
228 TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 );\r
229 brchSDigits->SetAddress( &sdig );\r
230 brchSDigits->GetEvent(nmod);\r
231 Int_t nsdig=sdig->GetEntries();\r
3f905799 232 fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS)->Fill(nmod,nsdig);\r
8dc34e37 233 for(Int_t i=0;i<nsdig;i++){\r
234 AliITSpListItem *cell=(AliITSpListItem*)sdig->At(i);\r
235 Float_t sig=cell->GetSignal();\r
236 Int_t idx=cell->GetIndex();\r
237 Int_t ia,it;\r
238 list->GetCell(idx,ia,it);\r
3f905799 239 fAliITSQADataMakerSim->GetSDigitsData(1+fGenOffsetS)->Fill(ia);\r
240 fAliITSQADataMakerSim->GetSDigitsData(2+fGenOffsetS)->Fill(it);\r
241 fAliITSQADataMakerSim->GetSDigitsData(3+fGenOffsetS)->Fill(sig);\r
8dc34e37 242 }\r
243 delete sdig;\r
244 }\r
eca4fa66 245 return rv ; \r
8dc34e37 246}\r
247\r
248//____________________________________________________________________________ \r
eca4fa66 249Int_t AliITSQASDDDataMakerSim::InitHits()\r
8dc34e37 250{ \r
ad300de9 251\r
8dc34e37 252 // Initialization for HITS data - SDD -\r
7d297381 253 const Bool_t expert = kTRUE ; \r
254 const Bool_t image = kTRUE ;\r
eca4fa66 255 Int_t rv = 0 ; \r
256\r
257 //fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();\r
3647765c 258 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List\r
8dc34e37 259 //printf("AliITSQASDDDataMakerSim::InitHits called \n");\r
260 TH1F *h0=new TH1F("SDD HITS Module Pattern","SDD HITS Module Pattern",260,239.5,499.5); \r
261 h0->GetXaxis()->SetTitle("SDD Module Number");\r
262 h0->GetYaxis()->SetTitle("# HITS");\r
eca4fa66 263 rv = fAliITSQADataMakerSim->Add2HitsList(h0,fGenOffsetH, !expert, image);\r
ad300de9 264 fSDDhHTask ++;\r
db72ff3b 265 TH1F *h1=new TH1F("SDD HIT lenght along local Y Coord","SDD HIT lenght along local Y Coord",200,0.,350.);\r
8dc34e37 266 h1->GetXaxis()->SetTitle("HIT lenght (um)");\r
267 h1->GetYaxis()->SetTitle("# HITS");\r
eca4fa66 268 rv = fAliITSQADataMakerSim->Add2HitsList(h1,1+fGenOffsetH, !expert, image);\r
ad300de9 269 fSDDhHTask ++;\r
8dc34e37 270 TH1F *h2=new TH1F("SDD HIT lenght along local Y Coord - Zoom","SDD HIT lenght along local Y Coord - Zoom",200,250.,350.);\r
271 h2->GetXaxis()->SetTitle("HIT lenght (um)");\r
272 h2->GetYaxis()->SetTitle("# HITS");\r
eca4fa66 273 rv = fAliITSQADataMakerSim->Add2HitsList(h2,2+fGenOffsetH, !expert, image);\r
ad300de9 274 fSDDhHTask ++;\r
8dc34e37 275 TH1F *h3=new TH1F("SDD Deposited Energy Distribution (loc Y > 200um)","SDD HITS Deposited Energy Distribution (loc Y > 200um)",200,0.,350.);\r
ad300de9 276 h3->GetXaxis()->SetTitle("ADC counts ");\r
8dc34e37 277 h3->GetYaxis()->SetTitle("# HITS");\r
eca4fa66 278 rv = fAliITSQADataMakerSim->Add2HitsList(h3,3+fGenOffsetH, !expert, image);\r
ad300de9 279 fSDDhHTask ++;\r
5379c4a3 280 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Hits histograms booked\n",fSDDhHTask));\r
eca4fa66 281 return rv ; \r
8dc34e37 282}\r
283\r
284//____________________________________________________________________________\r
eca4fa66 285Int_t AliITSQASDDDataMakerSim::MakeHits(TTree * hits)\r
8dc34e37 286{ \r
287 // Fill QA for HITS - SDD -\r
eca4fa66 288 Int_t rv = 0 ; \r
289 // Check id histograms already created for this Event Specie\r
290 if ( ! fAliITSQADataMakerSim->GetHitsData(fGenOffsetH) )\r
291 rv = InitHits() ;\r
292 \r
293 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
8dc34e37 294 fITS->SetTreeAddress();\r
295 Int_t nmodules;\r
6f5308d9 296 if(!(fITS->InitModules(-1,nmodules))){\r
297 AliError("ITS geometry not available - nothing done");\r
eca4fa66 298 return rv;\r
6f5308d9 299 }\r
8dc34e37 300 \r
301 fITS->FillModules(hits,0);\r
302\r
303 for(Int_t i=0; i<260; i++){\r
304 Int_t nmod=i+240;\r
305 AliITSmodule *modu = fITS->GetModule(nmod);\r
306 TObjArray *arrHits = modu->GetHits();\r
307 Int_t nhits = arrHits->GetEntriesFast();\r
ad300de9 308 ////printf("--w--AliITSQASDDDataMakerSim::MakeHits nhits = %d\n",nhits);\r
8dc34e37 309 for (Int_t iHit=0;iHit<nhits;iHit++) {\r
310 AliITShit *hit = (AliITShit*) arrHits->At(iHit);\r
3f905799 311 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH)->Fill(nmod);\r
8dc34e37 312 Double_t xl,yl,zl,xl0,yl0,zl0;\r
313 Double_t tof,tof0;\r
314 hit->GetPositionL(xl,yl,zl,tof);\r
315 hit->GetPositionL0(xl0,yl0,zl0,tof0);\r
316 Float_t dyloc=TMath::Abs(yl-yl0)*10000.;\r
3f905799 317 fAliITSQADataMakerSim->GetHitsData(1+fGenOffsetH)->Fill(dyloc);\r
8dc34e37 318 Float_t edep=hit->GetIonization()*1000000;\r
319 if(dyloc>200.){ \r
eca4fa66 320 fAliITSQADataMakerSim->GetHitsData(2+fGenOffsetH)->Fill(edep);\r
321 fAliITSQADataMakerSim->GetHitsData(3+fGenOffsetH)->Fill(dyloc);\r
8dc34e37 322 }\r
323 }\r
324 }\r
eca4fa66 325 return rv ; \r
8dc34e37 326}\r
ad300de9 327\r
328//_______________________________________________________________\r
329\r
4e25ac79 330Int_t AliITSQASDDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){\r
ad300de9 331 // Returns histogram offset according to the specified task\r
332 Int_t offset=0;\r
4e25ac79 333 if( task == AliQAv1::kHITS){\r
ad300de9 334 offset=fGenOffsetH; \r
335 }\r
4e25ac79 336 else if( task == AliQAv1::kSDIGITS) {\r
ad300de9 337 offset=fGenOffsetS; \r
338 }\r
4e25ac79 339 else if( task == AliQAv1::kDIGITS) {\r
ad300de9 340 offset=fGenOffsetD; \r
341 }\r
342 else {\r
343 AliInfo("No task has been selected. TaskHisto set to zero.\n");\r
344 }\r
345\r
346 return offset;\r
347}\r
348\r
eca4fa66 349//____________________________________________________________________________ \r
350void AliITSQASDDDataMakerSim::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset){\r
351 // Returns histogram offset according to the specified task\r
352 if( task == AliQAv1::kHITS){\r
353 fGenOffsetH = offset; \r
354 }\r
355 else if( task == AliQAv1::kSDIGITS) {\r
356 fGenOffsetS = offset; \r
357 }\r
358 else if( task == AliQAv1::kDIGITS) {\r
359 fGenOffsetD = offset; \r
360 }\r
361 else {\r
362 AliInfo("No task has been selected. TaskHisto set to zero.\n");\r
363 }\r
364}\r
ad300de9 365\r
366//_______________________________________________________________\r
367\r
4e25ac79 368Int_t AliITSQASDDDataMakerSim::GetTaskHisto(AliQAv1::TASKINDEX_t task) {\r
ad300de9 369 // Returns the number of booked histograms for the selected task\r
370 Int_t histotot=0;\r
4e25ac79 371 if( task == AliQAv1::kHITS) {\r
ad300de9 372 histotot=fSDDhHTask ; \r
373 }\r
4e25ac79 374 else if( task == AliQAv1::kSDIGITS) {\r
ad300de9 375 histotot=fSDDhSTask; \r
376 }\r
4e25ac79 377 else if( task == AliQAv1::kDIGITS) {\r
ad300de9 378 histotot=fSDDhDTask ; \r
379 }\r
380 else {\r
381 AliInfo("No task has been selected. TaskHisto set to zero.\n");\r
382 }\r
383 return histotot;\r
384\r
385}\r