]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSQASDDDataMakerSim.cxx
Transfer of the initialisation of the QA Data objects in the framework; clean the...
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDDataMakerSim.cxx
... / ...
CommitLineData
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
16/* $Id$ */\r
17\r
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
33#include "AliQAv1.h"\r
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
54fSDDhHTask(0),\r
55fSDDhSTask(0),\r
56fSDDhDTask(0),\r
57fGenOffsetH(0),\r
58fGenOffsetS(0),\r
59fGenOffsetD(0)\r
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
68fSDDhHTask(qadm.fSDDhHTask),\r
69fSDDhSTask(qadm.fSDDhSTask),\r
70fSDDhDTask(qadm.fSDDhDTask),\r
71fGenOffsetH(qadm.fGenOffsetH),\r
72fGenOffsetS(qadm.fGenOffsetS),\r
73fGenOffsetD(qadm.fGenOffsetD)\r
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
93 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");\r
94}\r
95\r
96//____________________________________________________________________________ \r
97void AliITSQASDDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)\r
98{\r
99 // launch the QA checking\r
100 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n"); \r
101 //AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);\r
102}\r
103\r
104//____________________________________________________________________________ \r
105Int_t AliITSQASDDDataMakerSim::InitDigits()\r
106{ \r
107 // Initialization for DIGIT data - SDD - \r
108 const Bool_t expert = kTRUE ; \r
109 const Bool_t image = kTRUE ;\r
110 Int_t rv = 0 ; \r
111 //fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();\r
112 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List\r
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
116 rv = fAliITSQADataMakerSim->Add2DigitsList(h0,fGenOffsetD, !expert, image);\r
117 fSDDhDTask ++;\r
118 TH1F* h1=new TH1F("SDD Anode Distribution","SDD DIGITS Anode Distribution",512,-0.5,511.5); //hanocc\r
119 h1->GetXaxis()->SetTitle("Anode Number");\r
120 h1->GetYaxis()->SetTitle("# DIGITS");\r
121 rv = fAliITSQADataMakerSim->Add2DigitsList(h1,1+fGenOffsetD, !expert, image);\r
122 fSDDhDTask ++;\r
123 TH1F* h2=new TH1F("SDD Tbin Distribution","SDD DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc\r
124 h2->GetXaxis()->SetTitle("Tbin Number");\r
125 h2->GetYaxis()->SetTitle("# DIGITS");\r
126 rv = fAliITSQADataMakerSim->Add2DigitsList(h2,2+fGenOffsetD, !expert, image);\r
127 fSDDhDTask ++;\r
128 TH1F* h3=new TH1F("SDD ADC Counts Distribution","SDD DIGITS ADC Counts Distribution",200,0.,1024.); //hsig\r
129 h3->GetXaxis()->SetTitle("ADC Value");\r
130 h3->GetYaxis()->SetTitle("# DIGITS");\r
131 rv = fAliITSQADataMakerSim->Add2DigitsList(h3,3+fGenOffsetD, !expert, image);\r
132 fSDDhDTask ++;\r
133 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDTask));\r
134 return rv ; \r
135}\r
136\r
137//____________________________________________________________________________\r
138Int_t AliITSQASDDDataMakerSim::MakeDigits(TTree * digits)\r
139{ \r
140\r
141 // Fill QA for DIGIT - SDD -\r
142 Int_t rv = 0 ; \r
143\r
144 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
145 fITS->SetTreeAddress();\r
146 TClonesArray *iITSdigits = fITS->DigitsAddress(1);\r
147 for(Int_t i=0; i<260; i++){\r
148 Int_t nmod=i+240;\r
149 digits->GetEvent(nmod);\r
150 Int_t ndigits = iITSdigits->GetEntries();\r
151 fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD)->Fill(nmod,ndigits);\r
152 for (Int_t idig=0; idig<ndigits; idig++) {\r
153 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);\r
154 Int_t iz=dig->GetCoord1(); // cell number z\r
155 Int_t ix=dig->GetCoord2(); // cell number x\r
156 Int_t sig=dig->GetSignal();\r
157 fAliITSQADataMakerSim->GetDigitsData(1+fGenOffsetD)->Fill(iz);\r
158 fAliITSQADataMakerSim->GetDigitsData(2+fGenOffsetD)->Fill(ix);\r
159 fAliITSQADataMakerSim->GetDigitsData(3+fGenOffsetD)->Fill(sig);\r
160 }\r
161 }\r
162 return rv ; \r
163}\r
164\r
165//____________________________________________________________________________ \r
166Int_t AliITSQASDDDataMakerSim::InitSDigits()\r
167{ \r
168 // Initialization for SDIGIT data - SDD -\r
169 const Bool_t expert = kTRUE ; \r
170 const Bool_t image = kTRUE ;\r
171 Int_t rv = 0 ; \r
172 //fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();\r
173 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List\r
174 TH1F* h0=new TH1F("SDD SDIGITS Module Pattern","SDIGITS SDD Module Pattern",260,239.5,499.5); //hmod\r
175 h0->GetXaxis()->SetTitle("SDD Module Number");\r
176 h0->GetYaxis()->SetTitle("# SDIGITS");\r
177 rv = fAliITSQADataMakerSim->Add2SDigitsList(h0,fGenOffsetS, !expert, image);\r
178 fSDDhSTask ++;\r
179 TH1F* h1=new TH1F("SDD Anode Distribution","SDIGITS SDD Anode Distribution",512,-0.5,511.5); //hanocc\r
180 h1->GetXaxis()->SetTitle("Anode Number");\r
181 h1->GetYaxis()->SetTitle("# SDIGITS");\r
182 rv = fAliITSQADataMakerSim->Add2SDigitsList(h1,1+fGenOffsetS, !expert, image);\r
183 fSDDhSTask ++;\r
184 TH1F* h2=new TH1F("SDD Tbin Distribution","SDIGITS SDD Tbin Distribution",256,-0.5,255.5); //htbocc\r
185 h2->GetXaxis()->SetTitle("Tbin Number");\r
186 h2->GetYaxis()->SetTitle("# SDIGITS");\r
187 rv = fAliITSQADataMakerSim->Add2SDigitsList(h2,2+fGenOffsetS);\r
188 fSDDhSTask ++;\r
189 TH1F* h3=new TH1F("SDD ADC Counts Distribution","SDIGITS SDD ADC Counts Distribution",200,0.,1024.); //hsig\r
190 h3->GetXaxis()->SetTitle("ADC Value");\r
191 h3->GetYaxis()->SetTitle("# SDIGITS");\r
192 rv = fAliITSQADataMakerSim->Add2SDigitsList(h3,3+fGenOffsetS, !expert, image);\r
193 fSDDhSTask ++;\r
194\r
195 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD SDigits histograms booked\n",fSDDhSTask));\r
196 return rv ; \r
197}\r
198\r
199//____________________________________________________________________________\r
200Int_t AliITSQASDDDataMakerSim::MakeSDigits(TTree * sdigits)\r
201{ \r
202 // Fill QA for SDIGIT - SDD -\r
203 Int_t rv = 0 ; \r
204 \r
205 AliITSsegmentationSDD* seg = new AliITSsegmentationSDD();\r
206 Int_t nan=seg->Npz();\r
207 Int_t ntb=seg->Npx();\r
208 Int_t scaleSize=4;\r
209 AliITSpList* list=new AliITSpList(nan,ntb*scaleSize);\r
210\r
211 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
212 //fITS->SetTreeAddress();\r
213 //TClonesArray *ITSdigits = fITS->DigitsAddress(1);\r
214 //TFile *sper = new TFile("sper.root","CREATE"); //agginto a mano x prova\r
215 //digits->Write();\r
216 //sper->Close();\r
217\r
218\r
219 TBranch *brchSDigits = sdigits->GetBranch("ITS");\r
220 static TClonesArray * sdig ; \r
221 if (! sdig )\r
222 sdig = new TClonesArray( "AliITSpListItem",1000 );\r
223 for(Int_t id=0; id<260; id++){\r
224 Int_t nmod=id+240;\r
225 brchSDigits->SetAddress( &sdig );\r
226 brchSDigits->GetEvent(nmod);\r
227 Int_t nsdig=sdig->GetEntries();\r
228 fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS)->Fill(nmod,nsdig);\r
229 for(Int_t i=0;i<nsdig;i++){\r
230 AliITSpListItem *cell=(AliITSpListItem*)sdig->At(i);\r
231 Float_t sig=cell->GetSignal();\r
232 Int_t idx=cell->GetIndex();\r
233 Int_t ia,it;\r
234 list->GetCell(idx,ia,it);\r
235 fAliITSQADataMakerSim->GetSDigitsData(1+fGenOffsetS)->Fill(ia);\r
236 fAliITSQADataMakerSim->GetSDigitsData(2+fGenOffsetS)->Fill(it);\r
237 fAliITSQADataMakerSim->GetSDigitsData(3+fGenOffsetS)->Fill(sig);\r
238 }\r
239 sdig->Clear();\r
240 }\r
241 return rv ; \r
242}\r
243\r
244//____________________________________________________________________________ \r
245Int_t AliITSQASDDDataMakerSim::InitHits()\r
246{ \r
247\r
248 // Initialization for HITS data - SDD -\r
249 const Bool_t expert = kTRUE ; \r
250 const Bool_t image = kTRUE ;\r
251 Int_t rv = 0 ; \r
252\r
253 //fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();\r
254 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List\r
255 //printf("AliITSQASDDDataMakerSim::InitHits called \n");\r
256 TH1F *h0=new TH1F("SDD HITS Module Pattern","SDD HITS Module Pattern",260,239.5,499.5); \r
257 h0->GetXaxis()->SetTitle("SDD Module Number");\r
258 h0->GetYaxis()->SetTitle("# HITS");\r
259 rv = fAliITSQADataMakerSim->Add2HitsList(h0,fGenOffsetH, !expert, image);\r
260 fSDDhHTask ++;\r
261 TH1F *h1=new TH1F("SDD HIT lenght along local Y Coord","SDD HIT lenght along local Y Coord",200,0.,350.);\r
262 h1->GetXaxis()->SetTitle("HIT lenght (um)");\r
263 h1->GetYaxis()->SetTitle("# HITS");\r
264 rv = fAliITSQADataMakerSim->Add2HitsList(h1,1+fGenOffsetH, !expert, image);\r
265 fSDDhHTask ++;\r
266 TH1F *h2=new TH1F("SDD HIT lenght along local Y Coord - Zoom","SDD HIT lenght along local Y Coord - Zoom",200,250.,350.);\r
267 h2->GetXaxis()->SetTitle("HIT lenght (um)");\r
268 h2->GetYaxis()->SetTitle("# HITS");\r
269 rv = fAliITSQADataMakerSim->Add2HitsList(h2,2+fGenOffsetH, !expert, image);\r
270 fSDDhHTask ++;\r
271 TH1F *h3=new TH1F("SDD Deposited Energy Distribution (loc Y > 200um)","SDD HITS Deposited Energy Distribution (loc Y > 200um)",200,0.,350.);\r
272 h3->GetXaxis()->SetTitle("ADC counts ");\r
273 h3->GetYaxis()->SetTitle("# HITS");\r
274 rv = fAliITSQADataMakerSim->Add2HitsList(h3,3+fGenOffsetH, !expert, image);\r
275 fSDDhHTask ++;\r
276 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Hits histograms booked\n",fSDDhHTask));\r
277 return rv ; \r
278}\r
279\r
280//____________________________________________________________________________\r
281Int_t AliITSQASDDDataMakerSim::MakeHits(TTree * hits)\r
282{ \r
283 // Fill QA for HITS - SDD -\r
284 Int_t rv = 0 ; \r
285\r
286 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
287 fITS->SetTreeAddress();\r
288 Int_t nmodules;\r
289 if(!(fITS->InitModules(-1,nmodules))){\r
290 AliError("ITS geometry not available - nothing done");\r
291 return rv;\r
292 }\r
293 \r
294 fITS->FillModules(hits,0);\r
295\r
296 for(Int_t i=0; i<260; i++){\r
297 Int_t nmod=i+240;\r
298 AliITSmodule *modu = fITS->GetModule(nmod);\r
299 TObjArray *arrHits = modu->GetHits();\r
300 Int_t nhits = arrHits->GetEntriesFast();\r
301 ////printf("--w--AliITSQASDDDataMakerSim::MakeHits nhits = %d\n",nhits);\r
302 for (Int_t iHit=0;iHit<nhits;iHit++) {\r
303 AliITShit *hit = (AliITShit*) arrHits->At(iHit);\r
304 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH)->Fill(nmod);\r
305 Double_t xl,yl,zl,xl0,yl0,zl0;\r
306 Double_t tof,tof0;\r
307 hit->GetPositionL(xl,yl,zl,tof);\r
308 hit->GetPositionL0(xl0,yl0,zl0,tof0);\r
309 Float_t dyloc=TMath::Abs(yl-yl0)*10000.;\r
310 fAliITSQADataMakerSim->GetHitsData(1+fGenOffsetH)->Fill(dyloc);\r
311 Float_t edep=hit->GetIonization()*1000000;\r
312 if(dyloc>200.){ \r
313 fAliITSQADataMakerSim->GetHitsData(2+fGenOffsetH)->Fill(edep);\r
314 fAliITSQADataMakerSim->GetHitsData(3+fGenOffsetH)->Fill(dyloc);\r
315 }\r
316 }\r
317 }\r
318 return rv ; \r
319}\r
320\r
321//_______________________________________________________________\r
322\r
323Int_t AliITSQASDDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){\r
324 // Returns histogram offset according to the specified task\r
325 Int_t offset=0;\r
326 if( task == AliQAv1::kHITS){\r
327 offset=fGenOffsetH; \r
328 }\r
329 else if( task == AliQAv1::kSDIGITS) {\r
330 offset=fGenOffsetS; \r
331 }\r
332 else if( task == AliQAv1::kDIGITS) {\r
333 offset=fGenOffsetD; \r
334 }\r
335 else {\r
336 AliInfo("No task has been selected. TaskHisto set to zero.\n");\r
337 }\r
338\r
339 return offset;\r
340}\r
341\r
342//____________________________________________________________________________ \r
343void AliITSQASDDDataMakerSim::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset){\r
344 // Returns histogram offset according to the specified task\r
345 if( task == AliQAv1::kHITS){\r
346 fGenOffsetH = offset; \r
347 }\r
348 else if( task == AliQAv1::kSDIGITS) {\r
349 fGenOffsetS = offset; \r
350 }\r
351 else if( task == AliQAv1::kDIGITS) {\r
352 fGenOffsetD = offset; \r
353 }\r
354 else {\r
355 AliInfo("No task has been selected. TaskHisto set to zero.\n");\r
356 }\r
357}\r
358\r
359//_______________________________________________________________\r
360\r
361Int_t AliITSQASDDDataMakerSim::GetTaskHisto(AliQAv1::TASKINDEX_t task) {\r
362 // Returns the number of booked histograms for the selected task\r
363 Int_t histotot=0;\r
364 if( task == AliQAv1::kHITS) {\r
365 histotot=fSDDhHTask ; \r
366 }\r
367 else if( task == AliQAv1::kSDIGITS) {\r
368 histotot=fSDDhSTask; \r
369 }\r
370 else if( task == AliQAv1::kDIGITS) {\r
371 histotot=fSDDhDTask ; \r
372 }\r
373 else {\r
374 AliInfo("No task has been selected. TaskHisto set to zero.\n");\r
375 }\r
376 return histotot;\r
377\r
378}\r