]>
Commit | Line | Data |
---|---|---|
4fc06b3a | 1 | ////////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | // * * | |
5 | // * Author: The ALICE Off-line Project. * | |
6 | // * Contributors are mentioned in the code where appropriate. * | |
7 | // * * | |
8 | // * Permission to use, copy, modify and distribute this software and its * | |
9 | // * documentation strictly for non-commercial purposes is hereby granted * | |
10 | // * without fee, provided that the above copyright notice appears in all * | |
11 | // * copies and that both the copyright notice and this permission notice * | |
12 | // * appear in the supporting documentation. The authors make no claims * | |
13 | // * about the suitability of this software for any purpose. It is * | |
14 | // * provided "as is" without express or implied warranty. * | |
15 | // **************************************************************************/ | |
16 | // | |
17 | ////////////////////////////////////////////////////////////////////////////// | |
18 | ||
19 | #include "TF1.h" | |
20 | #include "TFile.h" | |
21 | #include "TObjString.h" | |
22 | #include "TROOT.h" | |
23 | #include "TClonesArray.h" | |
24 | #include "TH1F.h" | |
25 | #include "TObjArray.h" | |
26 | #include "TTree.h" | |
7c11ad1f | 27 | #include "TMath.h" |
4fc06b3a | 28 | |
29 | // --- Standard library --- | |
30 | ||
31 | // --- AliRoot header files --- | |
32 | #include "AliDAQ.h" | |
33 | #include "AliLog.h" | |
34 | #include "AliRawReader.h" | |
35 | #include "AliPMDRawStream.h" | |
36 | #include "AliPMDddldata.h" | |
37 | #include "AliPMDCalibGain.h" | |
38 | ||
39 | ClassImp(AliPMDCalibGain) | |
40 | ||
1da50520 | 41 | AliPMDCalibGain::AliPMDCalibGain(): |
42 | TObject(), | |
43 | fpw(NULL) | |
4fc06b3a | 44 | { |
45 | // Standard Constructor | |
7c11ad1f | 46 | for(Int_t idet = 0; idet < kDet; idet++) |
4fc06b3a | 47 | { |
7c11ad1f | 48 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) |
4fc06b3a | 49 | { |
7c11ad1f | 50 | fSMIso[idet][ismn] = 0.; |
51 | fSMCount[idet][ismn] = 0.; | |
52 | fCountSm[idet][ismn]=0.; | |
53 | fTempnhit[idet][ismn]=0.; | |
54 | fTempnhitSq[idet][ismn]=0.; | |
55 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) | |
4fc06b3a | 56 | { |
7c11ad1f | 57 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) |
4fc06b3a | 58 | { |
7c11ad1f | 59 | fCellIso[idet][ismn][jrow][kcol] = 0.; |
60 | fCellCount[idet][ismn][jrow][kcol] = 0.; | |
61 | fNhitCell[idet][ismn][jrow][kcol] = 0.; | |
62 | fPedMeanRMS[idet][ismn][jrow][kcol] = 0.; | |
63 | fHotFlag[idet][ismn][jrow][kcol] = 0.; | |
64 | ||
4fc06b3a | 65 | } |
66 | } | |
67 | } | |
68 | } | |
7c11ad1f | 69 | |
4fc06b3a | 70 | } |
71 | // ------------------------------------------------------------------------ // | |
72 | AliPMDCalibGain::AliPMDCalibGain(const AliPMDCalibGain &pmdcalibgain): | |
1da50520 | 73 | TObject(pmdcalibgain), |
74 | fpw(NULL) | |
4fc06b3a | 75 | { |
7c11ad1f | 76 | for(Int_t idet = 0; idet < kDet; idet++) |
4fc06b3a | 77 | { |
7c11ad1f | 78 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) |
4fc06b3a | 79 | { |
7c11ad1f | 80 | fSMIso[idet][ismn] = pmdcalibgain.fSMIso[idet][ismn] ; |
81 | fSMCount[idet][ismn] = pmdcalibgain.fSMCount[idet][ismn] ; | |
82 | fCountSm[idet][ismn] = pmdcalibgain.fCountSm[idet][ismn]; | |
83 | fTempnhit[idet][ismn] = pmdcalibgain.fTempnhit[idet][ismn]; | |
84 | fTempnhitSq[idet][ismn] = pmdcalibgain.fTempnhitSq[idet][ismn]; | |
85 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) | |
4fc06b3a | 86 | { |
7c11ad1f | 87 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) |
4fc06b3a | 88 | { |
7c11ad1f | 89 | fCellIso[idet][ismn][jrow][kcol] = pmdcalibgain.fCellIso[idet][ismn][jrow][kcol]; |
90 | fCellCount[idet][ismn][jrow][kcol] = pmdcalibgain.fCellCount[idet][ismn][jrow][kcol]; | |
91 | fNhitCell[idet][ismn][jrow][kcol] = pmdcalibgain.fNhitCell[idet][ismn][jrow][kcol]; | |
92 | fPedMeanRMS[idet][ismn][jrow][kcol] = pmdcalibgain.fPedMeanRMS[idet][ismn][jrow][kcol]; | |
93 | fHotFlag[idet][ismn][jrow][kcol] = pmdcalibgain.fHotFlag[idet][ismn][jrow][kcol]; | |
94 | ||
4fc06b3a | 95 | } |
96 | } | |
97 | } | |
98 | } | |
7c11ad1f | 99 | |
4fc06b3a | 100 | } |
101 | // ------------------------------------------------------------------------ // | |
102 | AliPMDCalibGain &AliPMDCalibGain::operator=(const AliPMDCalibGain &pmdcalibgain) | |
103 | { | |
7c11ad1f | 104 | if(this != &pmdcalibgain) |
4fc06b3a | 105 | { |
1da50520 | 106 | this->fpw = pmdcalibgain.fpw; |
7c11ad1f | 107 | for(Int_t idet = 0; idet < kDet; idet++) |
4fc06b3a | 108 | { |
7c11ad1f | 109 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) |
4fc06b3a | 110 | { |
7c11ad1f | 111 | fSMIso[idet][ismn] = pmdcalibgain.fSMIso[idet][ismn]; |
112 | fSMCount[idet][ismn] = pmdcalibgain.fSMCount[idet][ismn]; | |
113 | fCountSm[idet][ismn] = pmdcalibgain.fCountSm[idet][ismn]; | |
114 | fTempnhit[idet][ismn] = pmdcalibgain.fTempnhit[idet][ismn]; | |
115 | fTempnhitSq[idet][ismn] = pmdcalibgain.fTempnhitSq[idet][ismn]; | |
116 | for(Int_t jrow = 0; jrow < kMaxRow;jrow++) | |
4fc06b3a | 117 | { |
7c11ad1f | 118 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) |
119 | { | |
120 | fCellIso[idet][ismn][jrow][kcol] = pmdcalibgain.fCellIso[idet][ismn][jrow][kcol]; | |
121 | fCellCount[idet][ismn][jrow][kcol] = pmdcalibgain.fCellCount[idet][ismn][jrow][kcol]; | |
122 | fNhitCell[idet][ismn][jrow][kcol] = pmdcalibgain.fNhitCell[idet][ismn][jrow][kcol]; //za | |
123 | fPedMeanRMS[idet][ismn][jrow][kcol] = pmdcalibgain.fPedMeanRMS[idet][ismn][jrow][kcol]; | |
124 | fHotFlag[idet][ismn][jrow][kcol] = pmdcalibgain.fHotFlag[idet][ismn][jrow][kcol]; | |
125 | ||
4fc06b3a | 126 | } |
127 | } | |
128 | } | |
129 | } | |
130 | } | |
7c11ad1f | 131 | return *this; |
4fc06b3a | 132 | } |
133 | // ------------------------------------------------------------------------ // | |
134 | AliPMDCalibGain::~AliPMDCalibGain() | |
135 | { | |
7c11ad1f | 136 | // dtor |
1da50520 | 137 | } |
138 | ||
139 | // ------------------------------------------------------------------------ // | |
140 | ||
d31b0352 | 141 | Int_t AliPMDCalibGain::ExtractPedestal(const Char_t *rootFile) |
1da50520 | 142 | { |
143 | // Pedestal extraction from the PMD_PED.root file | |
144 | // To be called once at the beginning | |
7c11ad1f | 145 | |
1da50520 | 146 | Int_t det, sm, row, col; |
147 | Float_t mean, rms; | |
7c11ad1f | 148 | |
d31b0352 | 149 | TFile *pedfile = new TFile(rootFile); |
7c11ad1f | 150 | |
1da50520 | 151 | if(!pedfile) |
152 | { | |
153 | printf("ERROR --- NO PEDESTAL (PMD_PED1.root) FILE IS FOUND --- STOP GAIN DA\n"); | |
154 | return -3; | |
155 | } | |
156 | ||
157 | ||
158 | TTree *ped =(TTree*)pedfile->Get("ped"); | |
159 | ||
160 | ped->SetBranchAddress("det",&det); | |
161 | ped->SetBranchAddress("sm",&sm); | |
162 | ped->SetBranchAddress("row",&row); | |
163 | ped->SetBranchAddress("col",&col); | |
164 | ped->SetBranchAddress("mean",&mean); | |
165 | ped->SetBranchAddress("rms",&rms); | |
166 | ||
167 | Int_t nentries = (Int_t)ped->GetEntries(); | |
168 | ||
169 | for (Int_t ient = 0; ient < nentries; ient++) | |
170 | { | |
171 | ped->GetEntry(ient); | |
172 | fPedMeanRMS[det][sm][row][col] = mean + 3.*rms; | |
173 | //printf("Mean= %f, RMS= %f, PedMeanRMS=%f\n",mean,rms,fPedMeanRMS[det][sm][row][col]); | |
174 | ||
175 | } | |
176 | ||
177 | pedfile->Close(); | |
178 | delete pedfile; | |
179 | pedfile = 0x0; | |
180 | ||
181 | return 1; | |
182 | } | |
7c11ad1f | 183 | //------------------------------------------------------------------------------------------------ |
184 | ||
185 | Int_t AliPMDCalibGain::ExtractHotChannel(const Char_t *rootFile) | |
186 | { | |
187 | // HotChannel extraction from the PMD_HOT.root file | |
188 | // To be called once at the beginning | |
189 | ||
190 | Int_t det, sm, row, col; | |
191 | Float_t flag; | |
192 | ||
193 | TFile *hotmapfile = new TFile(rootFile); | |
194 | ||
195 | if(!hotmapfile) | |
196 | { | |
637f01e6 | 197 | printf(" NO HOTCHANNEL MAP (PMD_HOT.root) FILE IS FOUND \n"); |
198 | ||
199 | for (Int_t idet = 0; idet < kDet; idet++) | |
200 | { | |
201 | for (Int_t ismn = 0; ismn < kMaxSMN; idet++) | |
202 | { | |
203 | for (Int_t irow = 0; irow < kMaxRow; idet++) | |
204 | { | |
205 | for (Int_t icol = 0; icol < kMaxCol; idet++) | |
206 | { | |
207 | fHotFlag[idet][kMaxSMN][kMaxRow][kMaxCol] = 0.; | |
208 | } | |
209 | } | |
210 | } | |
211 | } | |
7c11ad1f | 212 | } |
213 | ||
214 | ||
215 | TTree *hot =(TTree*)hotmapfile->Get("hot"); | |
216 | ||
217 | hot->SetBranchAddress("det",&det); | |
218 | hot->SetBranchAddress("sm",&sm); | |
219 | hot->SetBranchAddress("row",&row); | |
220 | hot->SetBranchAddress("col",&col); | |
221 | hot->SetBranchAddress("flag",&flag); | |
222 | ||
223 | Int_t nentries = (Int_t)hot->GetEntries(); | |
224 | ||
225 | for (Int_t ient = 0; ient < nentries; ient++) | |
226 | { | |
227 | hot->GetEntry(ient); | |
228 | fHotFlag[det][sm][row][col] = flag; | |
229 | ||
230 | //printf(" HotFlag=%f\n",fHotFlag[det][sm][row][col]); | |
231 | } | |
232 | ||
233 | hotmapfile->Close(); | |
234 | delete hotmapfile; | |
235 | hotmapfile = 0x0; | |
236 | ||
237 | return 1; | |
238 | } | |
239 | ||
240 | ||
1da50520 | 241 | // ------------------------------------------------------------------------ // |
242 | ||
d31b0352 | 243 | void AliPMDCalibGain::ReadTempFile(const Char_t *tempFile) |
1da50520 | 244 | { |
245 | // Read the variables from the file | |
246 | ||
d31b0352 | 247 | fpw = fopen(tempFile,"r"); |
7c11ad1f | 248 | |
1da50520 | 249 | Float_t smcount, smiso; |
250 | Float_t cellcount, celliso; | |
251 | ||
1da50520 | 252 | |
253 | for (Int_t idet = 0; idet < kDet; idet++) | |
254 | { | |
255 | for (Int_t ism = 0; ism < kMaxSMN; ism++) | |
256 | { | |
257 | fscanf(fpw,"%d %d %f %f",&idet,&ism,&smcount,&smiso); | |
7c11ad1f | 258 | |
1da50520 | 259 | fSMCount[idet][ism] = smcount; |
260 | fSMIso[idet][ism] = smiso; | |
261 | } | |
262 | } | |
263 | ||
264 | for (Int_t idet = 0; idet < kDet; idet++) | |
265 | { | |
266 | for (Int_t ism = 0; ism < kMaxSMN; ism++) | |
267 | { | |
268 | for (Int_t irow = 0; irow < kMaxRow; irow++) | |
269 | { | |
270 | for (Int_t icol = 0; icol < kMaxCol; icol++) | |
271 | { | |
272 | fscanf(fpw,"%d %d %d %d %f %f",&idet,&ism,&irow,&icol, | |
7c11ad1f | 273 | &cellcount,&celliso); |
274 | ||
1da50520 | 275 | fCellCount[idet][ism][irow][icol] = cellcount; |
276 | fCellIso[idet][ism][irow][icol] = celliso; | |
277 | } | |
278 | } | |
279 | } | |
280 | } | |
7c11ad1f | 281 | |
1da50520 | 282 | fclose(fpw); |
283 | ||
4fc06b3a | 284 | } |
285 | // ------------------------------------------------------------------------ // | |
d31b0352 | 286 | void AliPMDCalibGain::WriteTempFile(const Char_t *tempFile) |
1da50520 | 287 | { |
d31b0352 | 288 | // Write the Temporary file if the required statics is not achieved |
1da50520 | 289 | |
1da50520 | 290 | |
291 | /* | |
d31b0352 | 292 | Following variables to be written to a file |
1da50520 | 293 | fDetIso[idet] ; |
294 | fSMIso[idet][ismn]; | |
295 | fCellIso[idet][ismn][irow][icol]; | |
296 | ||
297 | fDetCount[idet]; | |
298 | fSMCount[idet][ismn]; | |
299 | fCellCount[idet][ismn][irow][icol]; | |
300 | */ | |
301 | ||
d31b0352 | 302 | |
303 | fpw = fopen(tempFile,"w+"); | |
7c11ad1f | 304 | |
1da50520 | 305 | for (Int_t idet = 0; idet < kDet; idet++) |
306 | { | |
7c11ad1f | 307 | // fprintf(fpw,"%d %f %f\n",idet,fDetCount[idet],fDetIso[idet]); |
1da50520 | 308 | } |
7c11ad1f | 309 | |
1da50520 | 310 | for (Int_t idet = 0; idet < kDet; idet++) |
311 | { | |
312 | for (Int_t ism = 0; ism < kMaxSMN; ism++) | |
313 | { | |
314 | fprintf(fpw,"%d %d %f %f\n",idet,ism, fSMCount[idet][ism],fSMIso[idet][ism]); | |
315 | } | |
316 | } | |
7c11ad1f | 317 | |
1da50520 | 318 | for (Int_t idet = 0; idet < kDet; idet++) |
319 | { | |
320 | for (Int_t ism = 0; ism < kMaxSMN; ism++) | |
321 | { | |
322 | for (Int_t irow = 0; irow < kMaxRow; irow++) | |
323 | { | |
324 | for (Int_t icol = 0; icol < kMaxCol; icol++) | |
325 | { | |
326 | fprintf(fpw,"%d %d %d %d %f %f\n",idet,ism,irow,icol, | |
327 | fCellCount[idet][ism][irow][icol], | |
328 | fCellIso[idet][ism][irow][icol]); | |
329 | } | |
330 | } | |
331 | } | |
332 | } | |
7c11ad1f | 333 | |
1da50520 | 334 | fclose(fpw); |
7c11ad1f | 335 | |
1da50520 | 336 | } |
337 | ||
338 | // ------------------------------------------------------------------------ // | |
339 | ||
338c285a | 340 | Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlcont) |
4fc06b3a | 341 | { |
342 | // Calculates the ADC of isolated cell | |
7c11ad1f | 343 | |
4fc06b3a | 344 | const Int_t kDDL = AliDAQ::NumberOfDdls("PMD"); |
345 | const Int_t kCellNeighbour = 6; | |
4fc06b3a | 346 | Int_t neibx[6] = {1,0,-1,-1,0,1}; |
347 | Int_t neiby[6] = {0,1,1,0,-1,-1}; | |
348 | ||
349 | Int_t id1,jd1; //neighbour row/col | |
350 | Int_t isocount; //number of neighbours with 0 signal | |
351 | ||
0ab3a530 | 352 | Float_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol]; |
7c11ad1f | 353 | |
4fc06b3a | 354 | for(Int_t idet = 0; idet < kDet; idet++) |
355 | { | |
356 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
357 | { | |
7c11ad1f | 358 | for(Int_t irow = 0; irow < kMaxRow; irow++) |
4fc06b3a | 359 | { |
360 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
361 | { | |
7c11ad1f | 362 | d1[idet][ismn][irow][icol] = 0.; |
4fc06b3a | 363 | } |
364 | } | |
365 | } | |
366 | } | |
7c11ad1f | 367 | |
4fc06b3a | 368 | AliPMDRawStream rawStream(rawReader); |
369 | ||
1da50520 | 370 | Int_t iddl = -1; |
7c11ad1f | 371 | |
722ccc67 | 372 | Int_t numberofDDLs = 0; |
373 | ||
7c11ad1f | 374 | while ((iddl = rawStream.DdlData(pmdddlcont)) >=0) { |
375 | numberofDDLs++; | |
376 | ||
377 | Int_t ientries = pmdddlcont->GetEntries(); | |
378 | ||
379 | for (Int_t ient = 0; ient < ientries; ient++) | |
4fc06b3a | 380 | { |
7c11ad1f | 381 | AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient); |
382 | ||
383 | Int_t idet = pmdddl->GetDetector(); | |
384 | Int_t ismn = pmdddl->GetSMN(); | |
385 | Int_t mcm = pmdddl->GetMCM(); | |
386 | //Int_t ichno = pmdddl->GetChannel(); | |
387 | Int_t irow = pmdddl->GetRow(); | |
388 | Int_t icol = pmdddl->GetColumn(); | |
389 | Int_t isig = pmdddl->GetSignal(); | |
390 | ||
391 | // This is the protection not to crash the code | |
392 | ||
393 | if(mcm == 0) continue; | |
394 | if (irow < 0 || icol < 0 || irow > 47 || icol > 95) continue; | |
395 | ||
396 | // Pedestal subtraction | |
397 | if(fHotFlag[idet][ismn][irow][icol] == 1.0) isig = 0; | |
398 | ||
399 | if (isig>0) | |
400 | { | |
401 | d1[idet][ismn][irow][icol] = | |
402 | (Float_t) isig - fPedMeanRMS[idet][ismn][irow][icol]; | |
403 | ||
404 | //printf("Signal_ped_subtracted=%f, pedestal=%f\n",d1[idet][ismn][irow][icol]),fPedMeanRMS[idet][ismn][irow][icol]; | |
405 | ||
406 | fNhitCell[idet][ismn][irow][icol]++; //cell hit frequency | |
407 | } | |
408 | ||
1da50520 | 409 | |
4fc06b3a | 410 | } |
7c11ad1f | 411 | pmdddlcont->Delete(); |
412 | } | |
4fc06b3a | 413 | |
414 | for(Int_t idet=0; idet < kDet; idet++) | |
7c11ad1f | 415 | { |
4fc06b3a | 416 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) |
7c11ad1f | 417 | { |
4fc06b3a | 418 | for(Int_t irow = 0; irow < kMaxRow; irow++) |
7c11ad1f | 419 | { |
4fc06b3a | 420 | for(Int_t icol = 0; icol < kMaxCol; icol++) |
7c11ad1f | 421 | { |
4fc06b3a | 422 | if(d1[idet][ismn][irow][icol] > 0) |
7c11ad1f | 423 | { |
4fc06b3a | 424 | isocount = 0; |
425 | for(Int_t ii = 0; ii < kCellNeighbour; ii++) | |
7c11ad1f | 426 | { |
4fc06b3a | 427 | id1 = irow + neibx[ii]; |
428 | jd1 = icol + neiby[ii]; | |
d55d21ef | 429 | if (id1 < 0) id1 = 0; |
430 | if (id1 > kMaxRow-1) id1 = kMaxRow - 1; | |
431 | if (jd1 < 0) jd1 = 0; | |
432 | if (jd1 > kMaxCol-1) jd1 = kMaxCol - 1; | |
4fc06b3a | 433 | if(d1[idet][ismn][id1][jd1] == 0) |
7c11ad1f | 434 | { |
4fc06b3a | 435 | isocount++; |
436 | if(isocount == kCellNeighbour) | |
7c11ad1f | 437 | { |
438 | //fDetIso[idet] += d1[idet][ismn][irow][icol]; | |
0ab3a530 | 439 | fSMIso[idet][ismn] += d1[idet][ismn][irow][icol]; |
440 | fCellIso[idet][ismn][irow][icol] += d1[idet][ismn][irow][icol]; | |
7c11ad1f | 441 | //fDetCount[idet]++; |
0ab3a530 | 442 | fSMCount[idet][ismn]++; |
443 | fCellCount[idet][ismn][irow][icol]++; | |
444 | ||
7c11ad1f | 445 | } |
446 | } | |
447 | } // neigh cell cond. | |
448 | } // d>0 cond. | |
449 | } | |
450 | } | |
451 | } | |
452 | } | |
453 | ||
454 | for(Int_t idet=0; idet < kDet; idet++) | |
455 | { | |
456 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
457 | { | |
458 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
459 | { | |
460 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
461 | { | |
462 | if(fNhitCell[idet][ismn][irow][icol]>0) | |
463 | { | |
464 | fCountSm[idet][ismn] += 1; | |
465 | fTempnhit[idet][ismn] += fNhitCell[idet][ismn][irow][icol]; | |
466 | fTempnhitSq[idet][ismn] += fNhitCell[idet][ismn][irow][icol] | |
467 | *fNhitCell[idet][ismn][irow][icol]; | |
468 | } | |
469 | } | |
470 | } | |
471 | } | |
472 | } | |
473 | ||
474 | if (numberofDDLs < kDDL) return kFALSE; | |
722ccc67 | 475 | return kTRUE; |
7c11ad1f | 476 | |
4fc06b3a | 477 | } |
478 | // ------------------------------------------------------------------------ // | |
9d1486e3 | 479 | void AliPMDCalibGain::Analyse(TTree *gaintree, TTree *meantree) |
4fc06b3a | 480 | { |
7c11ad1f | 481 | // Calculates the mean |
482 | Int_t det, sm, row, col; | |
483 | Float_t gain; | |
7c11ad1f | 484 | Float_t cellmean = 0.; |
485 | ||
9d1486e3 | 486 | Float_t modmean[2][24]; |
487 | ||
488 | for (Int_t idet=0; idet < 2; idet++) | |
489 | { | |
490 | for (Int_t ism = 0; ism < 24; ism++) | |
491 | { | |
492 | modmean[idet][ism] = 0.; | |
493 | } | |
494 | } | |
495 | ||
7c11ad1f | 496 | gaintree->Branch("det",&det,"det/I"); |
497 | gaintree->Branch("sm",&sm,"sm/I"); | |
498 | gaintree->Branch("row",&row,"row/I"); | |
499 | gaintree->Branch("col",&col,"col/I"); | |
500 | gaintree->Branch("gain",&gain,"gain/F"); | |
501 | ||
502 | for(Int_t idet = 0; idet < kDet; idet++) | |
503 | { | |
504 | for(Int_t ism = 0; ism < kMaxSMN; ism++) | |
505 | { | |
506 | if (fSMCount[idet][ism] > 0) | |
9d1486e3 | 507 | modmean[idet][ism] = fSMIso[idet][ism]/fSMCount[idet][ism]; |
7c11ad1f | 508 | for(Int_t irow = 0; irow < kMaxRow; irow++) |
509 | { | |
510 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
511 | { | |
512 | if (fCellCount[idet][ism][irow][icol] > 0.) | |
513 | { | |
514 | cellmean = fCellIso[idet][ism][irow][icol]/fCellCount[idet][ism][irow][icol]; | |
515 | } | |
516 | det = idet; | |
517 | sm = ism; | |
518 | row = irow; | |
519 | col = icol; | |
520 | if (cellmean > 0.0 && fCellCount[idet][ism][irow][icol]>0.) | |
521 | { | |
9d1486e3 | 522 | gain = cellmean/modmean[idet][ism]; |
7c11ad1f | 523 | } |
524 | else | |
525 | { | |
526 | gain = 0.; | |
527 | } | |
528 | //if(fCellCount[idet][ism][irow][icol]>0.) printf("CellCount =%f, gain= %f\n",fCellCount[idet][ism][irow][icol],gain); | |
529 | gaintree->Fill(); | |
530 | } | |
531 | } | |
532 | } | |
533 | } | |
9d1486e3 | 534 | |
535 | Float_t smmean; | |
536 | ||
537 | // Writing each module mean value | |
538 | meantree->Branch("det",&det,"det/I"); | |
539 | meantree->Branch("sm",&sm,"sm/I"); | |
540 | meantree->Branch("smmean",&smmean,"row/F"); | |
7c11ad1f | 541 | |
9d1486e3 | 542 | for(Int_t idet = 0; idet < kDet; idet++) |
543 | { | |
544 | for (Int_t ism = 0; ism < kMaxSMN; ism++) | |
545 | { | |
546 | det = idet; | |
547 | sm = ism; | |
548 | smmean = modmean[idet][ism]; | |
549 | meantree->Fill(); | |
550 | } | |
551 | } | |
552 | ||
4fc06b3a | 553 | } |
554 | // ------------------------------------------------------------------------ // | |
9d1486e3 | 555 | void AliPMDCalibGain::FindHotCell(TTree *hottree, Float_t xvar) |
7c11ad1f | 556 | { |
557 | // Calculates the mean | |
558 | Int_t det, sm, row, col; | |
559 | Float_t flag; | |
560 | Float_t meannhit; | |
561 | Float_t meanSqnhit; | |
562 | Float_t sigmanhit,nhitcut; | |
9d1486e3 | 563 | |
564 | //Float_t xvar = 5.; | |
565 | ||
7c11ad1f | 566 | hottree->Branch("det",&det,"det/I"); |
567 | hottree->Branch("sm",&sm,"sm/I"); | |
568 | hottree->Branch("row",&row,"row/I"); | |
569 | hottree->Branch("col",&col,"col/I"); | |
570 | hottree->Branch("flag",&flag,"flag/F"); | |
571 | ||
572 | for(Int_t idet = 0; idet < kDet; idet++) | |
573 | { | |
574 | for(Int_t ism = 0; ism < kMaxSMN; ism++) | |
575 | { | |
576 | if (fCountSm[idet][ism]> 0) | |
577 | { | |
578 | meannhit = fTempnhit[idet][ism]/fCountSm[idet][ism]; | |
579 | meanSqnhit = fTempnhitSq[idet][ism]/fCountSm[idet][ism]; | |
580 | sigmanhit = sqrt(meanSqnhit-(meannhit*meannhit)); | |
9d1486e3 | 581 | nhitcut = meannhit + xvar*sigmanhit; |
7c11ad1f | 582 | |
583 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
584 | { | |
585 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
586 | { | |
587 | det = idet; | |
588 | sm = ism; | |
589 | row = irow; | |
590 | col = icol; | |
591 | ||
592 | if(fNhitCell[idet][ism][irow][icol] > nhitcut) | |
593 | { | |
594 | flag = 1.0; | |
595 | } | |
596 | else | |
597 | { | |
598 | flag = 0.; | |
599 | } | |
600 | hottree->Fill(); | |
601 | } | |
602 | ||
603 | } | |
604 | } | |
605 | } | |
606 | } | |
607 | } | |
608 |