]>
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 | { | |
f3646355 | 47 | fHsmIso[idet][ismn] = new TH1F(Form("HmsIso_%d_%d",idet,ismn),"",100,0.,1000.); |
4fc06b3a | 48 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) |
49 | { | |
50 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
51 | { | |
f3646355 | 52 | fHadcIso[idet][ismn][jrow][kcol] = new TH1F(Form("HadcIso_%d_%d_%d_%d",idet,ismn,jrow,kcol),"",100,0.,1000.); |
4fc06b3a | 53 | } |
54 | } | |
55 | } | |
56 | } | |
57 | } | |
58 | // ------------------------------------------------------------------------ // | |
59 | AliPMDCalibGain::AliPMDCalibGain(const AliPMDCalibGain &pmdcalibgain): | |
60 | TObject(pmdcalibgain) | |
61 | { | |
62 | for(Int_t idet = 0; idet < kDet; idet++) | |
63 | { | |
64 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
65 | { | |
66 | fHsmIso[idet][ismn] = pmdcalibgain.fHsmIso[idet][ismn] ; | |
67 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) | |
68 | { | |
69 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
70 | { | |
71 | fHadcIso[idet][ismn][jrow][kcol] = pmdcalibgain.fHadcIso[idet][ismn][jrow][kcol]; | |
72 | } | |
73 | } | |
74 | } | |
75 | } | |
76 | ||
77 | } | |
78 | // ------------------------------------------------------------------------ // | |
79 | AliPMDCalibGain &AliPMDCalibGain::operator=(const AliPMDCalibGain &pmdcalibgain) | |
80 | { | |
81 | if(this != &pmdcalibgain) | |
82 | { | |
83 | for(Int_t idet = 0; idet < kDet; idet++) | |
84 | { | |
85 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
86 | { | |
87 | fHsmIso[idet][ismn] = pmdcalibgain.fHsmIso[idet][ismn] ; | |
88 | for(Int_t jrow = 0; jrow < kMaxRow;jrow++) | |
89 | { | |
90 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
91 | { | |
92 | fHadcIso[idet][ismn][jrow][kcol] = | |
93 | pmdcalibgain.fHadcIso[idet][ismn][jrow][kcol]; | |
94 | } | |
95 | } | |
96 | } | |
97 | } | |
98 | } | |
99 | return *this; | |
100 | } | |
101 | // ------------------------------------------------------------------------ // | |
102 | AliPMDCalibGain::~AliPMDCalibGain() | |
103 | { | |
104 | // dtor | |
f3646355 | 105 | for(Int_t idet = 0; idet < kDet; idet++) |
106 | { | |
107 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
108 | { | |
109 | delete fHsmIso[idet][ismn]; | |
110 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) | |
111 | { | |
112 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
113 | { | |
114 | delete fHadcIso[idet][ismn][jrow][kcol]; | |
115 | } | |
116 | } | |
117 | } | |
118 | } | |
4fc06b3a | 119 | } |
120 | // ------------------------------------------------------------------------ // | |
121 | Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader) | |
122 | { | |
123 | // Calculates the ADC of isolated cell | |
124 | ||
125 | TObjArray pmdddlcont; | |
126 | ||
127 | const Int_t kDDL = AliDAQ::NumberOfDdls("PMD"); | |
128 | const Int_t kCellNeighbour = 6; | |
129 | ||
130 | Int_t neibx[6] = {1,0,-1,-1,0,1}; | |
131 | Int_t neiby[6] = {0,1,1,0,-1,-1}; | |
132 | ||
133 | Int_t id1,jd1; //neighbour row/col | |
134 | Int_t isocount; //number of neighbours with 0 signal | |
135 | ||
136 | Int_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol]; | |
137 | Bool_t streamout = kFALSE; | |
138 | ||
139 | for(Int_t idet = 0; idet < kDet; idet++) | |
140 | { | |
141 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
142 | { | |
143 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
144 | { | |
145 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
146 | { | |
147 | d1[idet][ismn][irow][icol] = 0; | |
148 | } | |
149 | } | |
150 | } | |
151 | } | |
152 | ||
153 | AliPMDRawStream rawStream(rawReader); | |
154 | ||
155 | for (Int_t iddl = 0; iddl < kDDL; iddl++) | |
156 | { | |
157 | rawReader->Select("PMD", iddl, iddl); | |
158 | streamout = rawStream.DdlData(iddl,&pmdddlcont); | |
159 | ||
160 | Int_t ientries = pmdddlcont.GetEntries(); | |
161 | for (Int_t ient = 0; ient < ientries; ient++) | |
162 | { | |
163 | AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient); | |
164 | ||
165 | Int_t idet = pmdddl->GetDetector(); | |
166 | Int_t ismn = pmdddl->GetSMN(); | |
167 | //Int_t mcm = pmdddl->GetMCM(); | |
168 | //Int_t ichno = pmdddl->GetChannel(); | |
169 | Int_t irow = pmdddl->GetRow(); | |
170 | Int_t icol = pmdddl->GetColumn(); | |
171 | Int_t isig = pmdddl->GetSignal(); | |
172 | ||
173 | if (isig>0) | |
174 | { | |
175 | d1[idet][ismn][irow][icol] = isig; | |
176 | } | |
177 | } | |
178 | pmdddlcont.Clear(); | |
179 | } | |
180 | ||
181 | for(Int_t idet=0; idet < kDet; idet++) | |
182 | { | |
183 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
184 | { | |
185 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
186 | { | |
187 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
188 | { | |
189 | if(d1[idet][ismn][irow][icol] > 0) | |
190 | { | |
191 | isocount = 0; | |
192 | for(Int_t ii = 0; ii < kCellNeighbour; ii++) | |
193 | { | |
194 | id1 = irow + neibx[ii]; | |
195 | jd1 = icol + neiby[ii]; | |
196 | if(d1[idet][ismn][id1][jd1] == 0) | |
197 | { | |
198 | isocount++; | |
199 | if(isocount == kCellNeighbour) | |
200 | { | |
201 | fHsmIso[idet][ismn]->Fill(d1[idet][ismn][irow][icol]); | |
202 | fHadcIso[idet][ismn][irow][icol]->Fill(d1[idet][ismn][irow][icol]); | |
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 | |
218 | Int_t DET, SM, ROW, COL; | |
219 | Float_t GAIN; | |
220 | Float_t modmean, cellmean; | |
221 | ||
222 | gaintree->Branch("DET",&DET,"DET/I"); | |
223 | gaintree->Branch("SM",&SM,"SM/I"); | |
224 | gaintree->Branch("ROW",&ROW,"ROW/I"); | |
225 | gaintree->Branch("COL",&COL,"COL/I"); | |
226 | gaintree->Branch("GAIN",&GAIN,"GAIN/F"); | |
227 | ||
228 | for(Int_t idet = 0; idet < kDet; idet++) | |
229 | { | |
230 | for(Int_t ism = 0; ism < kMaxSMN; ism++) | |
231 | { | |
232 | modmean = fHsmIso[idet][ism]->GetMean(); | |
233 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
234 | { | |
235 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
236 | { | |
237 | cellmean = fHadcIso[idet][ism][irow][icol]->GetMean(); | |
238 | DET = idet; | |
239 | SM = ism; | |
240 | ROW = irow; | |
241 | COL = icol; | |
242 | GAIN = 0.; | |
243 | ||
244 | if(modmean > 0.0) | |
245 | { | |
246 | GAIN = cellmean/modmean; | |
247 | } | |
248 | gaintree->Fill(); | |
249 | } | |
250 | } | |
251 | } | |
252 | } | |
253 | ||
254 | } | |
255 | // ------------------------------------------------------------------------ // |