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