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