]>
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 | { | |
47 | fHsmIso[idet][ismn] = new TH1F("","",100,0.,1000.); | |
48 | for(Int_t jrow = 0; jrow < kMaxRow; jrow++) | |
49 | { | |
50 | for(Int_t kcol = 0; kcol < kMaxCol; kcol++) | |
51 | { | |
52 | fHadcIso[idet][ismn][jrow][kcol] = new TH1F("","",100,0.,1000.); | |
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 | |
105 | if(fHsmIso) delete fHsmIso ; | |
106 | if(fHadcIso) delete fHadcIso ; | |
107 | } | |
108 | // ------------------------------------------------------------------------ // | |
109 | Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader) | |
110 | { | |
111 | // Calculates the ADC of isolated cell | |
112 | ||
113 | TObjArray pmdddlcont; | |
114 | ||
115 | const Int_t kDDL = AliDAQ::NumberOfDdls("PMD"); | |
116 | const Int_t kCellNeighbour = 6; | |
117 | ||
118 | Int_t neibx[6] = {1,0,-1,-1,0,1}; | |
119 | Int_t neiby[6] = {0,1,1,0,-1,-1}; | |
120 | ||
121 | Int_t id1,jd1; //neighbour row/col | |
122 | Int_t isocount; //number of neighbours with 0 signal | |
123 | ||
124 | Int_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol]; | |
125 | Bool_t streamout = kFALSE; | |
126 | ||
127 | for(Int_t idet = 0; idet < kDet; idet++) | |
128 | { | |
129 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
130 | { | |
131 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
132 | { | |
133 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
134 | { | |
135 | d1[idet][ismn][irow][icol] = 0; | |
136 | } | |
137 | } | |
138 | } | |
139 | } | |
140 | ||
141 | AliPMDRawStream rawStream(rawReader); | |
142 | ||
143 | for (Int_t iddl = 0; iddl < kDDL; iddl++) | |
144 | { | |
145 | rawReader->Select("PMD", iddl, iddl); | |
146 | streamout = rawStream.DdlData(iddl,&pmdddlcont); | |
147 | ||
148 | Int_t ientries = pmdddlcont.GetEntries(); | |
149 | for (Int_t ient = 0; ient < ientries; ient++) | |
150 | { | |
151 | AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient); | |
152 | ||
153 | Int_t idet = pmdddl->GetDetector(); | |
154 | Int_t ismn = pmdddl->GetSMN(); | |
155 | //Int_t mcm = pmdddl->GetMCM(); | |
156 | //Int_t ichno = pmdddl->GetChannel(); | |
157 | Int_t irow = pmdddl->GetRow(); | |
158 | Int_t icol = pmdddl->GetColumn(); | |
159 | Int_t isig = pmdddl->GetSignal(); | |
160 | ||
161 | if (isig>0) | |
162 | { | |
163 | d1[idet][ismn][irow][icol] = isig; | |
164 | } | |
165 | } | |
166 | pmdddlcont.Clear(); | |
167 | } | |
168 | ||
169 | for(Int_t idet=0; idet < kDet; idet++) | |
170 | { | |
171 | for(Int_t ismn = 0; ismn < kMaxSMN; ismn++) | |
172 | { | |
173 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
174 | { | |
175 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
176 | { | |
177 | if(d1[idet][ismn][irow][icol] > 0) | |
178 | { | |
179 | isocount = 0; | |
180 | for(Int_t ii = 0; ii < kCellNeighbour; ii++) | |
181 | { | |
182 | id1 = irow + neibx[ii]; | |
183 | jd1 = icol + neiby[ii]; | |
184 | if(d1[idet][ismn][id1][jd1] == 0) | |
185 | { | |
186 | isocount++; | |
187 | if(isocount == kCellNeighbour) | |
188 | { | |
189 | fHsmIso[idet][ismn]->Fill(d1[idet][ismn][irow][icol]); | |
190 | fHadcIso[idet][ismn][irow][icol]->Fill(d1[idet][ismn][irow][icol]); | |
191 | } | |
192 | } | |
193 | } // neigh cell cond. | |
194 | } // d>0 cond. | |
195 | } | |
196 | } | |
197 | } | |
198 | ||
199 | } | |
200 | return streamout; | |
201 | } | |
202 | // ------------------------------------------------------------------------ // | |
203 | void AliPMDCalibGain::Analyse(TTree *gaintree) | |
204 | { | |
205 | // Calculates the mean | |
206 | Int_t DET, SM, ROW, COL; | |
207 | Float_t GAIN; | |
208 | Float_t modmean, cellmean; | |
209 | ||
210 | gaintree->Branch("DET",&DET,"DET/I"); | |
211 | gaintree->Branch("SM",&SM,"SM/I"); | |
212 | gaintree->Branch("ROW",&ROW,"ROW/I"); | |
213 | gaintree->Branch("COL",&COL,"COL/I"); | |
214 | gaintree->Branch("GAIN",&GAIN,"GAIN/F"); | |
215 | ||
216 | for(Int_t idet = 0; idet < kDet; idet++) | |
217 | { | |
218 | for(Int_t ism = 0; ism < kMaxSMN; ism++) | |
219 | { | |
220 | modmean = fHsmIso[idet][ism]->GetMean(); | |
221 | for(Int_t irow = 0; irow < kMaxRow; irow++) | |
222 | { | |
223 | for(Int_t icol = 0; icol < kMaxCol; icol++) | |
224 | { | |
225 | cellmean = fHadcIso[idet][ism][irow][icol]->GetMean(); | |
226 | DET = idet; | |
227 | SM = ism; | |
228 | ROW = irow; | |
229 | COL = icol; | |
230 | GAIN = 0.; | |
231 | ||
232 | if(modmean > 0.0) | |
233 | { | |
234 | GAIN = cellmean/modmean; | |
235 | } | |
236 | gaintree->Fill(); | |
237 | } | |
238 | } | |
239 | } | |
240 | } | |
241 | ||
242 | } | |
243 | // ------------------------------------------------------------------------ // |