]>
Commit | Line | Data |
---|---|---|
1507771f | 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 Nov 2007 | |
24 | // INFN Torino | |
25 | ||
26 | // --- ROOT system --- | |
27 | #include <TH2D.h> | |
28 | #include <TBranch.h> | |
29 | #include <TTree.h> | |
30 | #include <TGaxis.h> | |
31 | ||
32 | // --- Standard library --- | |
33 | ||
34 | // --- AliRoot header files --- | |
35 | #include "AliITSQADataMaker.h" | |
b7b9d122 | 36 | #include "AliLog.h" |
1507771f | 37 | #include "AliQA.h" |
38 | #include "AliQAChecker.h" | |
39 | #include "AliRawReader.h" | |
40 | #include "AliITSRawStreamSDD.h" | |
41 | #include "AliITSRecPoint.h" | |
42 | #include "AliITSgeomTGeo.h" | |
43 | #include "AliRawReader.h" | |
44 | ||
45 | ClassImp(AliITSQADataMaker) | |
46 | ||
47 | //____________________________________________________________________________ | |
48 | AliITSQADataMaker::AliITSQADataMaker() : | |
49 | AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker") | |
50 | { | |
51 | // ctor | |
52 | } | |
53 | ||
54 | //____________________________________________________________________________ | |
55 | AliITSQADataMaker::AliITSQADataMaker(Bool_t kMode, Int_t ldc) : | |
56 | AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker") | |
57 | { | |
58 | //ctor used to discriminate OnLine-Offline analysis | |
59 | fkOnline = kMode; | |
60 | fLDC = ldc; | |
61 | } | |
62 | ||
63 | //____________________________________________________________________________ | |
64 | AliITSQADataMaker::AliITSQADataMaker(const AliITSQADataMaker& qadm) : | |
65 | AliQADataMaker() | |
66 | { | |
67 | //copy ctor | |
68 | SetName((const char*)qadm.GetName()) ; | |
69 | SetTitle((const char*)qadm.GetTitle()); | |
70 | } | |
71 | ||
72 | //__________________________________________________________________ | |
73 | AliITSQADataMaker& AliITSQADataMaker::operator = (const AliITSQADataMaker& qac ) | |
74 | { | |
75 | // Equal operator. | |
76 | this->~AliITSQADataMaker(); | |
77 | new(this) AliITSQADataMaker(qac); | |
78 | return *this; | |
79 | } | |
80 | ||
81 | //____________________________________________________________________________ | |
82 | void AliITSQADataMaker::StartOfDetectorCycle() const | |
83 | { | |
84 | //Detector specific actions at start of cycle | |
b7b9d122 | 85 | AliDebug(1,"AliITSQADM::Start of ITS Cycle\n"); |
1507771f | 86 | } |
87 | ||
88 | //____________________________________________________________________________ | |
89 | void AliITSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TList *list) | |
90 | { | |
91 | // launch the QA checking | |
b7b9d122 | 92 | AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n"); |
93 | ||
1507771f | 94 | AliQAChecker::Instance()->Run( AliQA::kITS , task, list); |
95 | } | |
96 | ||
97 | //____________________________________________________________________________ | |
98 | void AliITSQADataMaker::EndOfDetectorCycle(const char * fgDataName) | |
99 | { | |
100 | //eventually used for different AliQAChecker::Instance()->Run | |
101 | } | |
102 | ||
103 | //____________________________________________________________________________ | |
104 | void AliITSQADataMaker::InitRaws() | |
105 | { | |
106 | // create SDD histo of raw | |
107 | ||
108 | Int_t lay, lad, det; | |
109 | ||
b7b9d122 | 110 | if(fkOnline) { |
111 | AliInfo("Book Online Histograms\n"); | |
112 | } | |
113 | else { | |
114 | AliInfo("Book Offline Histograms\n "); | |
115 | } | |
1507771f | 116 | Char_t *hname[3][2 * fgknSDDmodules] ; |
117 | for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){ | |
118 | for(Int_t iside=0;iside<fgknSide;iside++){ | |
119 | Int_t index1 = moduleSDD * 2 + iside ; | |
120 | for(Int_t i=0; i<3; i++) hname[i][index1]= new Char_t[50]; | |
121 | sprintf(hname[0][index1],"chargeMap%dSide%d",moduleSDD,iside); | |
122 | sprintf(hname[1][index1],"Total Charge, module number %d , Side%d",moduleSDD,iside); | |
123 | sprintf(hname[2][index1],"hmonoDMap%dSide%d",moduleSDD,iside); | |
124 | fModuleChargeMap[index1] = new TH2D(hname[0][index1],hname[1][index1],256,-0.5,255.5,256,-0.5,255.5); | |
125 | fmonoD[index1] = new TH1D(hname[2][index1],hname[2][index1],256,-0.5,255.5); | |
126 | } | |
127 | } | |
128 | ||
129 | TH1F *h0 = new TH1F("ModPattern","Modules pattern",fgknSDDmodules,-0.5,259.5); | |
130 | Add2RawsList(h0,0); | |
131 | TH1F *h1 = new TH1F("ModPatternL3","Modules pattern L3",14,0.5,14.5); | |
132 | Add2RawsList(h1,1); | |
133 | TH1F *h2 = new TH1F("ModPatternL4","Modules pattern L4",22,0.5,22.5); | |
134 | Add2RawsList(h2,2); | |
135 | ||
136 | Char_t *hname0[fgkLADDonLAY3] ; | |
137 | TH1D *h3[fgkLADDonLAY3] ; | |
138 | for(Int_t i=1; i<=fgkLADDonLAY3; i++) { | |
b7b9d122 | 139 | hname0[i-1] = new Char_t[20]; |
140 | sprintf(hname0[i-1],"ModPattern_L3_%d",i); | |
141 | h3[i-1] = new TH1D(hname0[i-1],hname0[i-1],6,0.5,6.5); | |
142 | Add2RawsList(h3[i-1],i-1+3); | |
1507771f | 143 | } |
144 | ||
145 | Char_t *hname1[fgkLADDonLAY4] ; | |
146 | TH1D *h4[fgkLADDonLAY4] ; | |
147 | for(Int_t i=1; i<=fgkLADDonLAY4; i++) { | |
b7b9d122 | 148 | hname1[i-1] = new Char_t[20]; |
149 | sprintf(hname1[i-1],"ModPattern_L4_%d",i); | |
150 | h4[i-1] = new TH1D(hname1[i-1],hname1[i-1],8,0.5,8.5); | |
151 | Add2RawsList(h4[i-1],i-1+17); | |
1507771f | 152 | } |
153 | ||
154 | Char_t *hname2[fgknSDDmodules*2] ; | |
155 | TH1D *h5[fgknSDDmodules*2] ; | |
156 | for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){ | |
157 | for(Int_t iside=0; iside<fgknSide; iside++){ | |
158 | Int_t index1 = moduleSDD * 2 + iside; | |
159 | hname2[index1] = new Char_t[50]; | |
b7b9d122 | 160 | sprintf(hname2[index1],"ProjYMap%dSide%d",moduleSDD+1,iside); |
1507771f | 161 | h5[index1] = new TH1D(hname2[index1],hname2[index1],256,-0.5,255.5); |
162 | Add2RawsList(h5[index1],index1+39); | |
163 | } | |
164 | } | |
165 | Char_t *hname3[fgknSDDmodules*8] ; | |
166 | TH1D *h6[fgknSDDmodules*8] ; | |
b7b9d122 | 167 | for(Int_t htype=0; htype<4; htype++){ |
168 | for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){ | |
169 | for(Int_t iside=0; iside<fgknSide; iside++){ | |
170 | Int_t index1 = moduleSDD*2 + iside; | |
171 | hname3[index1 + htype*2*fgknSDDmodules] = new Char_t[50]; | |
172 | AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det); | |
173 | Int_t indextot = index1 + htype*2*fgknSDDmodules; | |
174 | if(htype == 0) sprintf(hname3[indextot],"CountsVSAnode_L%d_%d_%d_%d",lay,lad,det,iside); | |
175 | if(htype == 1) sprintf(hname3[indextot],"ChargeVSAnode_L%d_%d_%d_%d",lay,lad,det,iside); | |
176 | if(htype == 2) sprintf(hname3[indextot],"CountsVSTbin_L%d_%d_%d_%d",lay,lad,det,iside); | |
177 | if(htype == 3) sprintf(hname3[indextot],"ChargeVSTbin_L%d_%d_%d_%d",lay,lad,det,iside); | |
178 | h6[indextot] = new TH1D(hname3[indextot],hname3[indextot],256,-0.5,255.5); | |
179 | //cout << "add at index " << indextot+39+fgknSDDmodules*2 << " with name " << hname3[indextot] << endl; | |
180 | Add2RawsList(h6[indextot],39 + fgknSDDmodules*2 + indextot); | |
181 | } | |
182 | } | |
1507771f | 183 | } |
1507771f | 184 | |
b7b9d122 | 185 | Char_t *hname4[fgknSDDmodules*2]; |
186 | TH2D *h7[fgknSDDmodules*2] ; | |
187 | for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){ | |
188 | for(Int_t iside=0; iside<fgknSide; iside++){ | |
189 | Int_t index1 = moduleSDD * 2 + iside; | |
190 | AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det); | |
191 | hname4[index1] = new Char_t[50]; | |
192 | sprintf(hname4[index1],"Anode_vs_Charge_L%d_%d_%d_%d",lay,lad,det,iside); | |
193 | h7[index1] = new TH2D(hname4[index1],hname4[index1],fgknSDDmodules*2,-0.5,-0.5+fgknSDDmodules*2,256,0.5,256.5); | |
194 | Add2RawsList(h7[index1],2639 + index1); | |
195 | } | |
196 | } | |
1507771f | 197 | |
b7b9d122 | 198 | |
1507771f | 199 | } |
200 | ||
201 | //____________________________________________________________________________ | |
202 | void AliITSQADataMaker::MakeRaws(AliRawReader* rawReader) | |
203 | { | |
204 | //Fills Raw QA list of histos | |
205 | ||
b7b9d122 | 206 | AliDebug(1,"entering MakeRaws\n"); |
1507771f | 207 | rawReader->RequireHeader(kFALSE); |
208 | rawReader->SelectEvents(7); | |
209 | rawReader->SelectEquipment(17,fgkeqOffset+1,fgkeqOffset + fgkDDLidRange); | |
210 | rawReader->Reset(); | |
211 | AliITSRawStreamSDD s(rawReader); | |
212 | Int_t lay, lad, det; | |
213 | ||
214 | Int_t cnt = 0; | |
215 | while(s.Next()){ | |
b7b9d122 | 216 | Int_t iddl = rawReader->GetDDLID() - fgkDDLIDshift; |
1507771f | 217 | Int_t isddmod = s.GetModuleNumber(iddl,s.GetCarlosId()); |
b7b9d122 | 218 | Int_t coord1 = s.GetCoord1(); |
219 | Int_t coord2 = s.GetCoord2(); | |
220 | Int_t signal = s.GetSignal(); | |
221 | Int_t moduleSDD = isddmod - fgkmodoffset; | |
222 | if(moduleSDD < 0 || moduleSDD>fgknSDDmodules+fgkmodoffset) { | |
223 | AliDebug(1,Form( "Module SDD = %d, resetting it to 1 \n",moduleSDD)); | |
224 | moduleSDD = 1; | |
225 | } | |
226 | ||
227 | GetRawsData(0)->Fill(moduleSDD); | |
228 | ||
229 | AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det); | |
230 | //printf("modnumb %d, lay %d, lad %d, det %d \n",isddmod, lay, lad, det); | |
231 | Int_t ioffset = 3; | |
232 | Int_t iorder = 1; | |
233 | if(lay==4) { | |
234 | ioffset += 14; | |
235 | iorder = 2; | |
236 | } | |
237 | GetRawsData(iorder)->Fill(lad); | |
238 | GetRawsData(ioffset+lad-1)->Fill(det); //-1 because ladder# starts from 1 | |
239 | ||
240 | Short_t iside = s.GetChannel(); | |
241 | Int_t index1 = moduleSDD * 2 + iside; | |
242 | if(index1<0){ | |
243 | index1 = 0; | |
244 | AliWarning("Wrong index number - patched \n"); | |
245 | } | |
246 | // if(s.IsCompletedModule()) continue; | |
247 | ||
248 | fModuleChargeMap[index1]->Fill(coord2, coord1, signal); | |
249 | ||
250 | GetRawsData(39+ 2 * fgknSDDmodules + index1)->Fill(coord1); | |
251 | GetRawsData(39+ 4 * fgknSDDmodules + index1)->Fill(coord1,signal); | |
252 | GetRawsData(39+ 6 * fgknSDDmodules + index1)->Fill(coord2); | |
253 | GetRawsData(39+ 8 * fgknSDDmodules + index1)->Fill(coord2,signal); | |
254 | GetRawsData(2639+index1)->Fill(signal,coord1); | |
1507771f | 255 | |
1507771f | 256 | cnt++; |
b7b9d122 | 257 | if(!(cnt%10000)) AliDebug(1,Form(" %d raw digits read",cnt)); |
1507771f | 258 | } |
b7b9d122 | 259 | AliDebug(1,Form("Event completed, %d raw digits read",cnt)); |
1507771f | 260 | |
261 | for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){ | |
262 | for(Int_t iside=0; iside<fgknSide; iside++){ | |
263 | Int_t index1 = moduleSDD * 2 + iside; | |
264 | //if(s.IsCompletedModule()) continue; | |
265 | fmonoD[index1] = fModuleChargeMap[index1]->ProjectionY(); | |
266 | Int_t nBins = 256; | |
267 | for(Int_t bin=0; bin<nBins; bin++){ | |
b7b9d122 | 268 | GetRawsData(index1+39)->Fill(bin,fmonoD[index1]->GetBinContent(bin+1) ); |
1507771f | 269 | } |
270 | } | |
271 | } | |
b7b9d122 | 272 | for(Int_t i=0; i<3159; i++){ |
273 | Int_t entries = static_cast<Int_t>(GetRawsData(i)->GetEntries()); | |
274 | if(entries != 0){ | |
275 | AliDebug(1,Form("histo %d, name %s , entries %d ",i,GetRawsData(i)->GetName(),entries)); | |
276 | ||
277 | } | |
278 | } | |
279 | rawReader->RequireHeader(kTRUE); | |
1507771f | 280 | } |
281 | ||
282 | ||
283 | ||
284 | //____________________________________________________________________________ | |
285 | void AliITSQADataMaker::InitRecPoints() | |
286 | { | |
287 | // create SDD histo of RecPoints | |
288 | ||
289 | TH1F * h0 = new TH1F("Lay3TotCh","Layer 3 total charge",1000,-0.5, 499.5); | |
290 | Add2RecPointsList(h0, 0); | |
291 | ||
292 | TH1F * h1 = new TH1F("Lay4TotCh","Layer 4 total charge",1000,-0.5, 499.5); | |
293 | Add2RecPointsList(h1, 1); | |
294 | ||
295 | ||
296 | Char_t *hisnam[3]; | |
297 | TH1F *h2[3]; | |
298 | for(Int_t i=1; i<=3; i++){ | |
299 | hisnam[i] = new Char_t[50]; | |
300 | sprintf(hisnam[i],"Charge_L3_Strip%d",i); | |
301 | h2[i] = new TH1F(hisnam[i],hisnam[i],1000,-0.5, 499.5); | |
302 | Add2RecPointsList(h2[i],i+1); | |
303 | } | |
304 | ||
305 | Char_t *hisnam2[4] ; | |
306 | TH1F *h3[4]; | |
307 | for(Int_t i=1; i<=4; i++){ | |
308 | hisnam2[i] = new Char_t[50]; | |
309 | sprintf(hisnam2[i],"Charge_L4_Strip%d",i); | |
310 | h3[i] = new TH1F(hisnam2[i],hisnam2[i],1000,-0.5, 499.5); | |
311 | Add2RecPointsList(h3[i],i+4); | |
312 | } | |
313 | ||
314 | } | |
315 | ||
316 | ||
317 | //____________________________________________________________________________ | |
318 | void AliITSQADataMaker::MakeRecPoints(TTree * clustersTree) | |
319 | { | |
320 | // makes data from RecPoints | |
b7b9d122 | 321 | /* |
1507771f | 322 | TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints"); |
323 | if (!branchRecP) { | |
324 | AliError("can't get the branch with the ITS clusters !"); | |
325 | return; | |
326 | } | |
327 | TObjArray * recpoints = new TObjArray(100) ; | |
328 | branchRecP->SetAddress(&recpoints); | |
329 | branchRecP->GetEntry(0); | |
330 | ||
331 | TIter next(recpoints); | |
332 | AliITSRecPoint * rp; | |
333 | while ( rp = dynamic_cast<AliITSRecPoint *>(next()) ) { | |
334 | if(rp->GetLayer() ==3) GetRecPointsData(0)->Fill( rp->GetQ()) ; | |
335 | else if(rp->GetLayer() ==4) GetRecPointsData(1)->Fill( rp->GetQ()) ; | |
336 | } | |
337 | recpoints->Delete(); | |
338 | delete recpoints; | |
b7b9d122 | 339 | */ |
1507771f | 340 | } |