]>
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" | |
27 | ||
28 | // --- Standard library --- | |
29 | ||
30 | // --- AliRoot header files --- | |
31 | #include "AliDAQ.h" | |
32 | #include "AliLog.h" | |
33 | #include "AliRawReader.h" | |
34 | #include "AliPMDRawStream.h" | |
35 | #include "AliPMDddldata.h" | |
36 | #include "AliPMDCalibGain.h" | |
37 | ||
38 | ClassImp(AliPMDCalibGain) | |
39 | ||
40 | AliPMDCalibGain::AliPMDCalibGain(): TObject() | |
41 | { | |
42 | // Standard Constructor | |
43 | for(Int_t idet = 0; idet < kDet; idet++) | |
44 | { | |
45 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
46 | { | |
0ab3a530 | 47 | fSMIso[idet][ismn] = 0.; |
48 | fSMCount[idet][ismn] = 0.; | |
4fc06b3a | 49 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) |
50 | { | |
51 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
52 | { | |
0ab3a530 | 53 | fCellIso[idet][ismn][jrow][kcol] = 0.; |
54 | fCellCount[idet][ismn][jrow][kcol] = 0.; | |
4fc06b3a | 55 | } |
56 | } | |
57 | } | |
58 | } | |
0ab3a530 | 59 | |
4fc06b3a | 60 | } |
61 | // ------------------------------------------------------------------------ // | |
62 | AliPMDCalibGain::AliPMDCalibGain(const AliPMDCalibGain &pmdcalibgain): | |
63 | TObject(pmdcalibgain) | |
64 | { | |
65 | for(Int_t idet = 0; idet < kDet; idet++) | |
66 | { | |
67 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
68 | { | |
0ab3a530 | 69 | fSMIso[idet][ismn] = pmdcalibgain.fSMIso[idet][ismn] ; |
70 | fSMCount[idet][ismn] = pmdcalibgain.fSMCount[idet][ismn] ; | |
4fc06b3a | 71 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) |
72 | { | |
73 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
74 | { | |
0ab3a530 | 75 | fCellIso[idet][ismn][jrow][kcol] = pmdcalibgain.fCellIso[idet][ismn][jrow][kcol]; |
76 | fCellCount[idet][ismn][jrow][kcol] = pmdcalibgain.fCellCount[idet][ismn][jrow][kcol]; | |
4fc06b3a | 77 | } |
78 | } | |
79 | } | |
80 | } | |
81 | ||
82 | } | |
83 | // ------------------------------------------------------------------------ // | |
84 | AliPMDCalibGain &AliPMDCalibGain::operator=(const AliPMDCalibGain &pmdcalibgain) | |
85 | { | |
86 | if(this != &pmdcalibgain) | |
87 | { | |
88 | for(Int_t idet = 0; idet < kDet; idet++) | |
89 | { | |
90 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
91 | { | |
0ab3a530 | 92 | fSMIso[idet][ismn] = pmdcalibgain.fSMIso[idet][ismn]; |
93 | fSMCount[idet][ismn] = pmdcalibgain.fSMCount[idet][ismn]; | |
4fc06b3a | 94 | for(Int_t jrow = 0; jrow < kMaxRow;jrow++) |
95 | { | |
96 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
97 | { | |
0ab3a530 | 98 | fCellIso[idet][ismn][jrow][kcol] = |
99 | pmdcalibgain.fCellIso[idet][ismn][jrow][kcol]; | |
100 | fCellCount[idet][ismn][jrow][kcol] = | |
101 | pmdcalibgain.fCellCount[idet][ismn][jrow][kcol]; | |
4fc06b3a | 102 | } |
103 | } | |
104 | } | |
105 | } | |
106 | } | |
107 | return *this; | |
108 | } | |
109 | // ------------------------------------------------------------------------ // | |
110 | AliPMDCalibGain::~AliPMDCalibGain() | |
111 | { | |
112 | // dtor | |
0ab3a530 | 113 | |
4fc06b3a | 114 | } |
115 | // ------------------------------------------------------------------------ // | |
116 | Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader) | |
117 | { | |
118 | // Calculates the ADC of isolated cell | |
119 | ||
120 | TObjArray pmdddlcont; | |
121 | ||
122 | const Int_t kDDL = AliDAQ::NumberOfDdls("PMD"); | |
123 | const Int_t kCellNeighbour = 6; | |
124 | ||
125 | Int_t neibx[6] = {1,0,-1,-1,0,1}; | |
126 | Int_t neiby[6] = {0,1,1,0,-1,-1}; | |
127 | ||
128 | Int_t id1,jd1; //neighbour row/col | |
129 | Int_t isocount; //number of neighbours with 0 signal | |
130 | ||
0ab3a530 | 131 | Float_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol]; |
132 | Bool_t streamout = kFALSE; | |
4fc06b3a | 133 | |
134 | for(Int_t idet = 0; idet < kDet; idet++) | |
135 | { | |
136 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
137 | { | |
138 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
139 | { | |
140 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
141 | { | |
0ab3a530 | 142 | d1[idet][ismn][irow][icol] = 0.; |
4fc06b3a | 143 | } |
144 | } | |
145 | } | |
146 | } | |
147 | ||
148 | AliPMDRawStream rawStream(rawReader); | |
149 | ||
150 | for (Int_t iddl = 0; iddl < kDDL; iddl++) | |
151 | { | |
152 | rawReader->Select("PMD", iddl, iddl); | |
153 | streamout = rawStream.DdlData(iddl,&pmdddlcont); | |
154 | ||
155 | Int_t ientries = pmdddlcont.GetEntries(); | |
156 | for (Int_t ient = 0; ient < ientries; ient++) | |
157 | { | |
158 | AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient); | |
159 | ||
160 | Int_t idet = pmdddl->GetDetector(); | |
161 | Int_t ismn = pmdddl->GetSMN(); | |
162 | //Int_t mcm = pmdddl->GetMCM(); | |
163 | //Int_t ichno = pmdddl->GetChannel(); | |
164 | Int_t irow = pmdddl->GetRow(); | |
165 | Int_t icol = pmdddl->GetColumn(); | |
166 | Int_t isig = pmdddl->GetSignal(); | |
167 | ||
168 | if (isig>0) | |
169 | { | |
0ab3a530 | 170 | d1[idet][ismn][irow][icol] = (Float_t) isig; |
4fc06b3a | 171 | } |
172 | } | |
173 | pmdddlcont.Clear(); | |
174 | } | |
175 | ||
176 | for(Int_t idet=0; idet < kDet; idet++) | |
177 | { | |
178 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
179 | { | |
180 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
181 | { | |
182 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
183 | { | |
184 | if(d1[idet][ismn][irow][icol] > 0) | |
185 | { | |
186 | isocount = 0; | |
187 | for(Int_t ii = 0; ii < kCellNeighbour; ii++) | |
188 | { | |
189 | id1 = irow + neibx[ii]; | |
190 | jd1 = icol + neiby[ii]; | |
191 | if(d1[idet][ismn][id1][jd1] == 0) | |
192 | { | |
193 | isocount++; | |
194 | if(isocount == kCellNeighbour) | |
195 | { | |
0ab3a530 | 196 | |
197 | fSMIso[idet][ismn] += d1[idet][ismn][irow][icol]; | |
198 | fCellIso[idet][ismn][irow][icol] += d1[idet][ismn][irow][icol]; | |
199 | ||
200 | fSMCount[idet][ismn]++; | |
201 | fCellCount[idet][ismn][irow][icol]++; | |
202 | ||
4fc06b3a | 203 | } |
204 | } | |
205 | } // neigh cell cond. | |
206 | } // d>0 cond. | |
207 | } | |
208 | } | |
209 | } | |
210 | ||
211 | } | |
212 | return streamout; | |
213 | } | |
214 | // ------------------------------------------------------------------------ // | |
215 | void AliPMDCalibGain::Analyse(TTree *gaintree) | |
216 | { | |
217 | // Calculates the mean | |
0ab3a530 | 218 | Int_t det, sm, row, col; |
219 | Float_t gain; | |
220 | Float_t modmean = 0.; | |
221 | Float_t cellmean = 0.; | |
4fc06b3a | 222 | |
0ab3a530 | 223 | gaintree->Branch("det",&det,"det/I"); |
224 | gaintree->Branch("sm",&sm,"sm/I"); | |
225 | gaintree->Branch("row",&row,"row/I"); | |
226 | gaintree->Branch("col",&col,"col/I"); | |
227 | gaintree->Branch("gain",&gain,"gain/F"); | |
4fc06b3a | 228 | |
229 | for(Int_t idet = 0; idet < kDet; idet++) | |
230 | { | |
231 | for(Int_t ism = 0; ism < kMaxSMN; ism++) | |
232 | { | |
0ab3a530 | 233 | |
234 | if (fSMCount[idet][ism] > 0) | |
235 | modmean = fSMIso[idet][ism]/fSMCount[idet][ism]; | |
236 | ||
4fc06b3a | 237 | for(Int_t irow = 0; irow < kMaxRow; irow++) |
238 | { | |
239 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
240 | { | |
0ab3a530 | 241 | if (fCellCount[idet][ism][irow][icol] > 0) |
242 | cellmean = fCellIso[idet][ism][irow][icol]/fCellCount[idet][ism][irow][icol]; | |
243 | ||
244 | ||
245 | det = idet; | |
246 | sm = ism; | |
247 | row = irow; | |
248 | col = icol; | |
249 | gain = 1.; | |
4fc06b3a | 250 | |
251 | if(modmean > 0.0) | |
252 | { | |
0ab3a530 | 253 | gain = cellmean/modmean; |
4fc06b3a | 254 | } |
255 | gaintree->Fill(); | |
256 | } | |
257 | } | |
258 | } | |
259 | } | |
260 | ||
261 | } | |
262 | // ------------------------------------------------------------------------ // |