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("","",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("","",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 if(fHsmIso) delete fHsmIso ;
106 if(fHadcIso) delete fHadcIso ;
108 // ------------------------------------------------------------------------ //
109 Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader)
111 // Calculates the ADC of isolated cell
113 TObjArray pmdddlcont;
115 const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
116 const Int_t kCellNeighbour = 6;
118 Int_t neibx[6] = {1,0,-1,-1,0,1};
119 Int_t neiby[6] = {0,1,1,0,-1,-1};
121 Int_t id1,jd1; //neighbour row/col
122 Int_t isocount; //number of neighbours with 0 signal
124 Int_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol];
125 Bool_t streamout = kFALSE;
127 for(Int_t idet = 0; idet < kDet; idet++)
129 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
131 for(Int_t irow = 0; irow < kMaxRow; irow++)
133 for(Int_t icol = 0; icol < kMaxCol; icol++)
135 d1[idet][ismn][irow][icol] = 0;
141 AliPMDRawStream rawStream(rawReader);
143 for (Int_t iddl = 0; iddl < kDDL; iddl++)
145 rawReader->Select("PMD", iddl, iddl);
146 streamout = rawStream.DdlData(iddl,&pmdddlcont);
148 Int_t ientries = pmdddlcont.GetEntries();
149 for (Int_t ient = 0; ient < ientries; ient++)
151 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
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();
163 d1[idet][ismn][irow][icol] = isig;
169 for(Int_t idet=0; idet < kDet; idet++)
171 for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
173 for(Int_t irow = 0; irow < kMaxRow; irow++)
175 for(Int_t icol = 0; icol < kMaxCol; icol++)
177 if(d1[idet][ismn][irow][icol] > 0)
180 for(Int_t ii = 0; ii < kCellNeighbour; ii++)
182 id1 = irow + neibx[ii];
183 jd1 = icol + neiby[ii];
184 if(d1[idet][ismn][id1][jd1] == 0)
187 if(isocount == kCellNeighbour)
189 fHsmIso[idet][ismn]->Fill(d1[idet][ismn][irow][icol]);
190 fHadcIso[idet][ismn][irow][icol]->Fill(d1[idet][ismn][irow][icol]);
193 } // neigh cell cond.
202 // ------------------------------------------------------------------------ //
203 void AliPMDCalibGain::Analyse(TTree *gaintree)
205 // Calculates the mean
206 Int_t DET, SM, ROW, COL;
208 Float_t modmean, cellmean;
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");
216 for(Int_t idet = 0; idet < kDet; idet++)
218 for(Int_t ism = 0; ism < kMaxSMN; ism++)
220 modmean = fHsmIso[idet][ism]->GetMean();
221 for(Int_t irow = 0; irow < kMaxRow; irow++)
223 for(Int_t icol = 0; icol < kMaxCol; icol++)
225 cellmean = fHadcIso[idet][ism][irow][icol]->GetMean();
234 GAIN = cellmean/modmean;
243 // ------------------------------------------------------------------------ //