1 //////////////////////////////////////////////////////////////////////////////
3 // * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 // * Author: The ALICE Off-line Project. *
6 // * Contributors are mentioned in the code where appropriate. *
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 // **************************************************************************/
17 //////////////////////////////////////////////////////////////////////////////
21 #include "TObjString.h"
23 #include "TClonesArray.h"
25 #include "TObjArray.h"
28 // --- Standard library ---
30 // --- AliRoot header files ---
33 #include "AliRawReader.h"
34 #include "AliPMDRawStream.h"
35 #include "AliPMDddldata.h"
36 #include "AliPMDCalibGain.h"
38 ClassImp(AliPMDCalibGain)
40 AliPMDCalibGain::AliPMDCalibGain(): TObject()
42 // Standard Constructor
43 for(Int_t idet = 0; idet < kDet; idet++)
45 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
47 fHsmIso[idet][ismn] = new TH1F(Form("HmsIso_%d_%d",idet,ismn),"",100,0.,1000.);
48 for(Int_t jrow = 0; jrow < kMaxRow; jrow++)
50 for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
52 fHadcIso[idet][ismn][jrow][kcol] = new TH1F(Form("HadcIso_%d_%d_%d_%d",idet,ismn,jrow,kcol),"",100,0.,1000.);
58 // ------------------------------------------------------------------------ //
59 AliPMDCalibGain::AliPMDCalibGain(const AliPMDCalibGain &pmdcalibgain):
62 for(Int_t idet = 0; idet < kDet; idet++)
64 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
66 fHsmIso[idet][ismn] = pmdcalibgain.fHsmIso[idet][ismn] ;
67 for(Int_t jrow = 0; jrow < kMaxRow; jrow++)
69 for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
71 fHadcIso[idet][ismn][jrow][kcol] = pmdcalibgain.fHadcIso[idet][ismn][jrow][kcol];
78 // ------------------------------------------------------------------------ //
79 AliPMDCalibGain &AliPMDCalibGain::operator=(const AliPMDCalibGain &pmdcalibgain)
81 if(this != &pmdcalibgain)
83 for(Int_t idet = 0; idet < kDet; idet++)
85 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
87 fHsmIso[idet][ismn] = pmdcalibgain.fHsmIso[idet][ismn] ;
88 for(Int_t jrow = 0; jrow < kMaxRow;jrow++)
90 for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
92 fHadcIso[idet][ismn][jrow][kcol] =
93 pmdcalibgain.fHadcIso[idet][ismn][jrow][kcol];
101 // ------------------------------------------------------------------------ //
102 AliPMDCalibGain::~AliPMDCalibGain()
105 for(Int_t idet = 0; idet < kDet; idet++)
107 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
109 delete fHsmIso[idet][ismn];
110 for(Int_t jrow = 0; jrow < kMaxRow; jrow++)
112 for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
114 delete fHadcIso[idet][ismn][jrow][kcol];
120 // ------------------------------------------------------------------------ //
121 Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader)
123 // Calculates the ADC of isolated cell
125 TObjArray pmdddlcont;
127 const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
128 const Int_t kCellNeighbour = 6;
130 Int_t neibx[6] = {1,0,-1,-1,0,1};
131 Int_t neiby[6] = {0,1,1,0,-1,-1};
133 Int_t id1,jd1; //neighbour row/col
134 Int_t isocount; //number of neighbours with 0 signal
136 Int_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol];
137 Bool_t streamout = kFALSE;
139 for(Int_t idet = 0; idet < kDet; idet++)
141 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
143 for(Int_t irow = 0; irow < kMaxRow; irow++)
145 for(Int_t icol = 0; icol < kMaxCol; icol++)
147 d1[idet][ismn][irow][icol] = 0;
153 AliPMDRawStream rawStream(rawReader);
155 for (Int_t iddl = 0; iddl < kDDL; iddl++)
157 rawReader->Select("PMD", iddl, iddl);
158 streamout = rawStream.DdlData(iddl,&pmdddlcont);
160 Int_t ientries = pmdddlcont.GetEntries();
161 for (Int_t ient = 0; ient < ientries; ient++)
163 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
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();
175 d1[idet][ismn][irow][icol] = isig;
181 for(Int_t idet=0; idet < kDet; idet++)
183 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
185 for(Int_t irow = 0; irow < kMaxRow; irow++)
187 for(Int_t icol = 0; icol < kMaxCol; icol++)
189 if(d1[idet][ismn][irow][icol] > 0)
192 for(Int_t ii = 0; ii < kCellNeighbour; ii++)
194 id1 = irow + neibx[ii];
195 jd1 = icol + neiby[ii];
196 if(d1[idet][ismn][id1][jd1] == 0)
199 if(isocount == kCellNeighbour)
201 fHsmIso[idet][ismn]->Fill(d1[idet][ismn][irow][icol]);
202 fHadcIso[idet][ismn][irow][icol]->Fill(d1[idet][ismn][irow][icol]);
205 } // neigh cell cond.
214 // ------------------------------------------------------------------------ //
215 void AliPMDCalibGain::Analyse(TTree *gaintree)
217 // Calculates the mean
218 Int_t DET, SM, ROW, COL;
220 Float_t modmean, cellmean;
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");
228 for(Int_t idet = 0; idet < kDet; idet++)
230 for(Int_t ism = 0; ism < kMaxSMN; ism++)
232 modmean = fHsmIso[idet][ism]->GetMean();
233 for(Int_t irow = 0; irow < kMaxRow; irow++)
235 for(Int_t icol = 0; icol < kMaxCol; icol++)
237 cellmean = fHadcIso[idet][ism][irow][icol]->GetMean();
246 GAIN = cellmean/modmean;
255 // ------------------------------------------------------------------------ //