]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASDDDataMakerSim.cxx
Major upgrade (P. Cerello)
[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
33#include "AliQA.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
54fSDDhDigits(0),\r
55fSDDhSDigits(0),\r
56fSDDhHits(0),\r
57fDigitsOffset(0),\r
58fSDigitsOffset(0),\r
59fHitsOffset(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
68fSDDhDigits(qadm.fSDDhDigits),\r
69fSDDhSDigits(qadm.fSDDhSDigits),\r
70fSDDhHits(qadm.fSDDhHits),\r
71fDigitsOffset(qadm.fDigitsOffset),\r
72fSDigitsOffset(qadm.fSDigitsOffset),\r
73fHitsOffset(qadm.fHitsOffset)\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(1,"AliITSQADM::Start of SDD Cycle\n");\r
94}\r
95\r
96//____________________________________________________________________________ \r
97void AliITSQASDDDataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t /*task*/, TObjArray* /*list*/)\r
98{\r
99 // launch the QA checking\r
100 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n"); \r
101 //AliQAChecker::Instance()->Run( AliQA::kITS , task, list);\r
102}\r
103\r
104//____________________________________________________________________________ \r
105void AliITSQASDDDataMakerSim::InitDigits()\r
106{ \r
107 // Initialization for DIGIT data - SDD -\r
108 fDigitsOffset = (fAliITSQADataMakerSim->fDigitsQAList)->GetEntries();\r
109 //fSDDhDigits must be incremented by one unit every time a histogram is ADDED to the QA List\r
110 //printf("AliITSQASDDDataMakerSim::InitDigits called \n");\r
111 TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5); //hmod\r
112 h0->GetXaxis()->SetTitle("SDD Module Number");\r
113 h0->GetYaxis()->SetTitle("# DIGITS");\r
114 fAliITSQADataMakerSim->Add2DigitsList(h0,1+fDigitsOffset);\r
115 fSDDhDigits ++;\r
116 TH1F* h1=new TH1F("SDD Anode Distribution","DIGITS Anode Distribution",512,-0.5,511.5); //hanocc\r
117 h1->GetXaxis()->SetTitle("Anode Number");\r
118 h1->GetYaxis()->SetTitle("# DIGITS");\r
119 fAliITSQADataMakerSim->Add2DigitsList(h1,2+fDigitsOffset);\r
120 fSDDhDigits ++;\r
121 TH1F* h2=new TH1F("SDD Tbin Distribution","DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc\r
122 h2->GetXaxis()->SetTitle("Tbin Number");\r
123 h2->GetYaxis()->SetTitle("# DIGITS");\r
124 fAliITSQADataMakerSim->Add2DigitsList(h2,3+fDigitsOffset);\r
125 fSDDhDigits ++;\r
126 TH1F* h3=new TH1F("SDD ADC Counts Distribution","DIGITS ADC Counts Distribution",200,0.,1024.); //hsig\r
127 h3->GetXaxis()->SetTitle("ADC Value");\r
128 h3->GetYaxis()->SetTitle("# DIGITS");\r
129 fAliITSQADataMakerSim->Add2DigitsList(h3,4+fDigitsOffset);\r
130 fSDDhDigits ++;\r
131 AliDebug(1,Form("%d SDD Digits histograms booked\n",fSDDhDigits));\r
132}\r
133\r
134//____________________________________________________________________________\r
135void AliITSQASDDDataMakerSim::MakeDigits(TTree * digits)\r
136{ \r
137 // Fill QA for DIGIT - SDD -\r
6f5308d9 138 // printf("AliITSQASDDDataMakerSim::MakeDigits called \n");\r
8dc34e37 139 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
140 fITS->SetTreeAddress();\r
141 TClonesArray *iITSdigits = fITS->DigitsAddress(1);\r
142 for(Int_t i=0; i<260; i++){\r
143 Int_t nmod=i+240;\r
144 digits->GetEvent(nmod);\r
145 Int_t ndigits = iITSdigits->GetEntries();\r
146 fAliITSQADataMakerSim->GetDigitsData(1+fDigitsOffset)->Fill(nmod,ndigits);\r
147 for (Int_t idig=0; idig<ndigits; idig++) {\r
148 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);\r
149 Int_t iz=dig->GetCoord1(); // cell number z\r
150 Int_t ix=dig->GetCoord2(); // cell number x\r
151 Int_t sig=dig->GetSignal();\r
152 fAliITSQADataMakerSim->GetDigitsData(2+fDigitsOffset)->Fill(iz);\r
153 fAliITSQADataMakerSim->GetDigitsData(3+fDigitsOffset)->Fill(ix);\r
154 fAliITSQADataMakerSim->GetDigitsData(4+fDigitsOffset)->Fill(sig);\r
155 }\r
156 }\r
157}\r
158\r
159//____________________________________________________________________________ \r
160void AliITSQASDDDataMakerSim::InitSDigits()\r
161{ \r
162 // Initialization for SDIGIT data - SDD -\r
163 fSDigitsOffset = (fAliITSQADataMakerSim->fSDigitsQAList)->GetEntries();\r
164 //printf("AliITSQASDDDataMakerSim::InitSDigits called \n");\r
165 //fSDDhSDigits must be incremented by one unit every time a histogram is ADDED to the QA List\r
166 TH1F* h0=new TH1F("SDD SDIGITS Module Pattern","SDIGITS SDD Module Pattern",260,239.5,499.5); //hmod\r
167 h0->GetXaxis()->SetTitle("SDD Module Number");\r
168 h0->GetYaxis()->SetTitle("# SDIGITS");\r
169 fAliITSQADataMakerSim->Add2SDigitsList(h0,1+fSDigitsOffset);\r
170 fSDDhSDigits ++;\r
171 TH1F* h1=new TH1F("SDD Anode Distribution","SDIGITS Anode Distribution",512,-0.5,511.5); //hanocc\r
172 h1->GetXaxis()->SetTitle("Anode Number");\r
173 h1->GetYaxis()->SetTitle("# SDIGITS");\r
174 fAliITSQADataMakerSim->Add2SDigitsList(h1,2+fSDigitsOffset);\r
175 fSDDhSDigits ++;\r
176 TH1F* h2=new TH1F("SDD Tbin Distribution","SDIGITS Tbin Distribution",256,-0.5,255.5); //htbocc\r
177 h2->GetXaxis()->SetTitle("Tbin Number");\r
178 h2->GetYaxis()->SetTitle("# SDIGITS");\r
179 fAliITSQADataMakerSim->Add2SDigitsList(h2,3+fSDigitsOffset);\r
180 fSDDhSDigits ++;\r
181 TH1F* h3=new TH1F("SDD ADC Counts Distribution","SDIGITS ADC Counts Distribution",200,0.,1024.); //hsig\r
182 h3->GetXaxis()->SetTitle("ADC Value");\r
183 h3->GetYaxis()->SetTitle("# SDIGITS");\r
184 fAliITSQADataMakerSim->Add2SDigitsList(h3,4+fSDigitsOffset);\r
185 fSDDhSDigits ++;\r
186\r
187 AliDebug(1,Form("%d SDD SDigits histograms booked\n",fSDDhSDigits));\r
188}\r
189\r
190//____________________________________________________________________________\r
191void AliITSQASDDDataMakerSim::MakeSDigits(TTree * sdigits)\r
192{ \r
193 // Fill QA for SDIGIT - SDD -\r
6f5308d9 194 // printf("AliITSQASDDDataMakerSim::MakeSDigits called \n");\r
8dc34e37 195 AliITSsegmentationSDD* seg = new AliITSsegmentationSDD();\r
196 Int_t nan=seg->Npz();\r
197 Int_t ntb=seg->Npx();\r
198 Int_t scaleSize=4;\r
199 AliITSpList* list=new AliITSpList(nan,ntb*scaleSize);\r
200\r
201 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
202 //fITS->SetTreeAddress();\r
203 //TClonesArray *ITSdigits = fITS->DigitsAddress(1);\r
204 //TFile *sper = new TFile("sper.root","CREATE"); //agginto a mano x prova\r
205 //digits->Write();\r
206 //sper->Close();\r
207\r
208\r
209 TBranch *brchSDigits = sdigits->GetBranch("ITS");\r
210 for(Int_t id=0; id<260; id++){\r
211 Int_t nmod=id+240;\r
212 TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 );\r
213 brchSDigits->SetAddress( &sdig );\r
214 brchSDigits->GetEvent(nmod);\r
215 Int_t nsdig=sdig->GetEntries();\r
216 fAliITSQADataMakerSim->GetSDigitsData(1+fSDigitsOffset)->Fill(nmod,nsdig);\r
217 for(Int_t i=0;i<nsdig;i++){\r
218 AliITSpListItem *cell=(AliITSpListItem*)sdig->At(i);\r
219 Float_t sig=cell->GetSignal();\r
220 Int_t idx=cell->GetIndex();\r
221 Int_t ia,it;\r
222 list->GetCell(idx,ia,it);\r
223 fAliITSQADataMakerSim->GetSDigitsData(2+fSDigitsOffset)->Fill(ia);\r
224 fAliITSQADataMakerSim->GetSDigitsData(3+fSDigitsOffset)->Fill(it);\r
225 fAliITSQADataMakerSim->GetSDigitsData(4+fSDigitsOffset)->Fill(sig);\r
226 }\r
227 delete sdig;\r
228 }\r
229}\r
230\r
231//____________________________________________________________________________ \r
232void AliITSQASDDDataMakerSim::InitHits()\r
233{ \r
234 // Initialization for HITS data - SDD -\r
235 fHitsOffset = (fAliITSQADataMakerSim->fHitsQAList)->GetEntries();\r
236 //fSDDhHits must be incremented by one unit every time a histogram is ADDED to the QA List\r
237 //printf("AliITSQASDDDataMakerSim::InitHits called \n");\r
238 TH1F *h0=new TH1F("SDD HITS Module Pattern","SDD HITS Module Pattern",260,239.5,499.5); \r
239 h0->GetXaxis()->SetTitle("SDD Module Number");\r
240 h0->GetYaxis()->SetTitle("# HITS");\r
241 fAliITSQADataMakerSim->Add2HitsList(h0,1+fHitsOffset);\r
242 fSDDhHits ++;\r
243 TH1F *h1=new TH1F("SDD HIT lenght along local Y Coord","HIT lenght along local Y Coord",200,0.,350.);\r
244 h1->GetXaxis()->SetTitle("HIT lenght (um)");\r
245 h1->GetYaxis()->SetTitle("# HITS");\r
246 fAliITSQADataMakerSim->Add2HitsList(h1,2+fHitsOffset);\r
247 fSDDhHits ++;\r
248 TH1F *h2=new TH1F("SDD HIT lenght along local Y Coord - Zoom","SDD HIT lenght along local Y Coord - Zoom",200,250.,350.);\r
249 h2->GetXaxis()->SetTitle("HIT lenght (um)");\r
250 h2->GetYaxis()->SetTitle("# HITS");\r
251 fAliITSQADataMakerSim->Add2HitsList(h2,3+fHitsOffset);\r
252 fSDDhHits ++;\r
253 TH1F *h3=new TH1F("SDD Deposited Energy Distribution (loc Y > 200um)","SDD HITS Deposited Energy Distribution (loc Y > 200um)",200,0.,350.);\r
254 h3->GetXaxis()->SetTitle("ADC counts???");\r
255 h3->GetYaxis()->SetTitle("# HITS");\r
256 fAliITSQADataMakerSim->Add2HitsList(h3,4+fHitsOffset);\r
257 fSDDhHits ++;\r
258 //printf("%d SDD Hits histograms booked\n",fSDDhHits);\r
259 AliDebug(1,Form("%d SDD Hits histograms booked\n",fSDDhHits));\r
260}\r
261\r
262//____________________________________________________________________________\r
263void AliITSQASDDDataMakerSim::MakeHits(TTree * hits)\r
264{ \r
265 // Fill QA for HITS - SDD -\r
266 //printf("AliITSQASDDDataMakerSim::MakeHits called \n");\r
267 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
268 fITS->SetTreeAddress();\r
269 Int_t nmodules;\r
6f5308d9 270 if(!(fITS->InitModules(-1,nmodules))){\r
271 AliError("ITS geometry not available - nothing done");\r
272 return;\r
273 }\r
8dc34e37 274 \r
275 fITS->FillModules(hits,0);\r
276\r
277 for(Int_t i=0; i<260; i++){\r
278 Int_t nmod=i+240;\r
279 AliITSmodule *modu = fITS->GetModule(nmod);\r
280 TObjArray *arrHits = modu->GetHits();\r
281 Int_t nhits = arrHits->GetEntriesFast();\r
282 //printf("--w--AliITSQASDDDataMakerSim::MakeHits nhits = %d\n",nhits);\r
283 for (Int_t iHit=0;iHit<nhits;iHit++) {\r
284 AliITShit *hit = (AliITShit*) arrHits->At(iHit);\r
285 fAliITSQADataMakerSim->GetHitsData(1 + fHitsOffset)->Fill(nmod);\r
286 Double_t xl,yl,zl,xl0,yl0,zl0;\r
287 Double_t tof,tof0;\r
288 hit->GetPositionL(xl,yl,zl,tof);\r
289 hit->GetPositionL0(xl0,yl0,zl0,tof0);\r
290 Float_t dyloc=TMath::Abs(yl-yl0)*10000.;\r
291 fAliITSQADataMakerSim->GetHitsData(2 + fHitsOffset)->Fill(dyloc);\r
292 Float_t edep=hit->GetIonization()*1000000;\r
293 if(dyloc>200.){ \r
294 fAliITSQADataMakerSim->GetHitsData(4 + fHitsOffset)->Fill(edep);\r
295 fAliITSQADataMakerSim->GetHitsData(3 + fHitsOffset)->Fill(dyloc);\r
296 }\r
297 }\r
298 }\r
299}\r