]>
Commit | Line | Data |
---|---|---|
b0d2c2d3 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | /// // | |
20 | /// class for VZERO reconstruction // | |
21 | /// // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
35b120ff | 24 | #include "AliRunLoader.h" |
2eb38194 | 25 | #include "AliRawReader.h" |
b0d2c2d3 | 26 | #include "AliVZEROReconstructor.h" |
2eb38194 | 27 | #include "AliVZERORawStream.h" |
35b120ff | 28 | #include "AliESD.h" |
b0d2c2d3 | 29 | |
b0d2c2d3 | 30 | ClassImp(AliVZEROReconstructor) |
31 | ||
ce7090f5 | 32 | //_____________________________________________________________________________ |
cb2228e6 | 33 | AliVZEROReconstructor:: AliVZEROReconstructor(): AliReconstructor(), |
35b120ff | 34 | fESDVZERO(0x0), |
35 | fESD(0x0), | |
36 | fRunLoader(0x0), | |
cb2228e6 | 37 | fCalibData(GetCalibData()) |
ce7090f5 | 38 | { |
39 | // Default constructor | |
ce7090f5 | 40 | // Get calibration data |
41 | ||
35b120ff | 42 | // fCalibData = GetCalibData(); |
ce7090f5 | 43 | } |
44 | ||
45 | ||
46 | //_____________________________________________________________________________ | |
47 | AliVZEROReconstructor& AliVZEROReconstructor::operator = | |
48 | (const AliVZEROReconstructor& /*reconstructor*/) | |
49 | { | |
50 | // assignment operator | |
51 | ||
52 | Fatal("operator =", "assignment operator not implemented"); | |
53 | return *this; | |
54 | } | |
55 | ||
56 | //_____________________________________________________________________________ | |
57 | AliVZEROReconstructor::~AliVZEROReconstructor() | |
58 | { | |
59 | // destructor | |
35b120ff | 60 | delete fESDVZERO; |
61 | ||
62 | } | |
63 | ||
64 | //_____________________________________________________________________________ | |
65 | void AliVZEROReconstructor::Init(AliRunLoader* runLoader) | |
66 | { | |
67 | /// initializer | |
ce7090f5 | 68 | |
35b120ff | 69 | fRunLoader = runLoader; |
70 | fESDVZERO = new AliESDVZERO; | |
71 | } | |
72 | ||
73 | //______________________________________________________________________ | |
2e0ee64a | 74 | void AliVZEROReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const |
35b120ff | 75 | { |
2e0ee64a | 76 | if (!digitsTree) { |
77 | AliError("No digits tree!"); | |
78 | return; | |
79 | } | |
35b120ff | 80 | |
2e0ee64a | 81 | TClonesArray* digitsArray = new TClonesArray("AliVZEROdigit"); |
82 | digitsTree->Branch("VZERODigit", &digitsArray); | |
83 | ||
84 | rawReader->Reset(); | |
85 | AliVZERORawStream rawStream(rawReader); | |
86 | while (rawStream.Next()) { | |
87 | Int_t pmNumber = rawStream.GetCell(); | |
88 | Int_t adc = rawStream.GetADC(); | |
89 | Int_t time = rawStream.GetTime(); | |
90 | new ((*digitsArray)[digitsArray->GetEntriesFast()]) | |
91 | AliVZEROdigit(pmNumber,adc,time); | |
92 | } | |
93 | ||
94 | digitsTree->Fill(); | |
95 | } | |
96 | ||
97 | //______________________________________________________________________ | |
98 | void AliVZEROReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/, | |
99 | AliESD* esd) const | |
100 | { | |
101 | if (!digitsTree) { | |
102 | AliError("No digits tree!"); | |
103 | return; | |
104 | } | |
35b120ff | 105 | |
2e0ee64a | 106 | TClonesArray* digitsArray = NULL; |
107 | TBranch* digitBranch = digitsTree->GetBranch("VZERODigit"); | |
108 | digitBranch->SetAddress(&digitsArray); | |
35b120ff | 109 | |
110 | Int_t NbPMV0A = 0; | |
111 | Int_t NbPMV0C = 0; | |
112 | Int_t MTotV0A = 0; | |
113 | Int_t MTotV0C = 0; | |
114 | Float_t ADCV0A = 0.0; | |
115 | Float_t ADCV0C = 0.0; | |
116 | Float_t MultV0A[4]; | |
117 | Float_t MultV0C[4]; | |
118 | Int_t MRingV0A[4]; | |
119 | Int_t MRingV0C[4]; | |
120 | ||
121 | Int_t ADC[64]; | |
122 | Float_t MIP[64]; | |
123 | for (Int_t i=0; i<64; i++){ | |
124 | ADC[i] = 0; | |
125 | MIP[i] = 110.0;} | |
126 | for (Int_t j=0; j<4; j++){ | |
127 | MultV0A[j] = 0.0; | |
128 | MultV0C[j] = 0.0; | |
129 | MRingV0A[j] = 0; | |
130 | MRingV0C[j] = 0;} | |
131 | ||
132 | // loop over VZERO entries | |
2e0ee64a | 133 | Int_t nEntries = (Int_t)digitsTree->GetEntries(); |
35b120ff | 134 | for (Int_t e=0; e<nEntries; e++) { |
2e0ee64a | 135 | digitsTree->GetEvent(e); |
35b120ff | 136 | |
2e0ee64a | 137 | Int_t nDigits = digitsArray->GetEntriesFast(); |
35b120ff | 138 | |
139 | for (Int_t d=0; d<nDigits; d++) { | |
2e0ee64a | 140 | AliVZEROdigit* digit = (AliVZEROdigit*)digitsArray->At(d); |
35b120ff | 141 | Int_t PMNumber = digit->PMNumber(); |
142 | ADC[PMNumber] = digit->ADC(); | |
143 | if (PMNumber<=31) { | |
144 | if (PMNumber<=7) MultV0C[0]=MultV0C[0]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
145 | if (PMNumber>=8 && PMNumber<=15) MultV0C[1]=MultV0C[1]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
146 | if (PMNumber>=16 && PMNumber<=23) MultV0C[2]=MultV0C[2]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
147 | if (PMNumber>=24 && PMNumber<=31) MultV0C[3]=MultV0C[3]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
148 | ADCV0C = ADCV0C + float(ADC[PMNumber])/MIP[PMNumber]; | |
149 | if(ADC[PMNumber] > 4) NbPMV0C++; | |
150 | } | |
151 | if (PMNumber>=32) { | |
152 | if (PMNumber>=32 && PMNumber<=39) MultV0A[0]=MultV0A[0]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
153 | if (PMNumber>=40 && PMNumber<=47) MultV0A[1]=MultV0A[1]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
154 | if (PMNumber>=48 && PMNumber<=55) MultV0A[2]=MultV0A[2]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
155 | if (PMNumber>=56 && PMNumber<=63) MultV0A[3]=MultV0A[3]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
156 | ADCV0A = ADCV0A + float(ADC[PMNumber])/MIP[PMNumber]; | |
157 | if(ADC[PMNumber] > 4) NbPMV0A++; | |
158 | } | |
159 | } // end of loop over digits | |
160 | ||
161 | } // end of loop over events in digits tree | |
162 | ||
163 | MTotV0A = int(ADCV0A + 0.5); | |
164 | MTotV0C = int(ADCV0C + 0.5); | |
165 | for (Int_t j=0; j<4; j++){ | |
166 | MRingV0A[j] = int(MultV0A[j] + 0.5); | |
167 | MRingV0C[j] = int(MultV0C[j] + 0.5);} | |
168 | ||
169 | AliDebug(1,Form("VZERO multiplicities : %d (V0A) %d (V0C)", MTotV0A, MTotV0C)); | |
170 | AliDebug(1,Form("Number of PMs fired : %d (V0A) %d (V0C)", NbPMV0A, NbPMV0C)); | |
171 | ||
172 | fESDVZERO->SetNbPMV0A(NbPMV0A); | |
173 | fESDVZERO->SetNbPMV0C(NbPMV0C); | |
174 | fESDVZERO->SetMTotV0A(MTotV0A); | |
175 | fESDVZERO->SetMTotV0C(MTotV0C); | |
176 | fESDVZERO->SetMRingV0A(MRingV0A); | |
177 | fESDVZERO->SetMRingV0C(MRingV0C); | |
178 | ||
2e0ee64a | 179 | if (esd) { |
180 | AliDebug(1, Form("Writing VZERO data to ESD tree")); | |
181 | esd->SetVZEROData(fESDVZERO); | |
182 | } | |
35b120ff | 183 | } |
184 | ||
ce7090f5 | 185 | //_____________________________________________________________________________ |
186 | AliCDBStorage* AliVZEROReconstructor::SetStorage(const char *uri) | |
187 | { | |
188 | ||
189 | Bool_t deleteManager = kFALSE; | |
190 | ||
191 | AliCDBManager *manager = AliCDBManager::Instance(); | |
192 | AliCDBStorage *defstorage = manager->GetDefaultStorage(); | |
193 | ||
194 | if(!defstorage || !(defstorage->Contains("VZERO"))){ | |
195 | AliWarning("No default storage set or default storage doesn't contain VZERO!"); | |
196 | manager->SetDefaultStorage(uri); | |
197 | deleteManager = kTRUE; | |
198 | } | |
199 | ||
200 | AliCDBStorage *storage = manager->GetDefaultStorage(); | |
201 | ||
202 | if(deleteManager){ | |
203 | AliCDBManager::Instance()->UnsetDefaultStorage(); | |
204 | defstorage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy() | |
205 | } | |
206 | ||
207 | return storage; | |
208 | } | |
209 | ||
210 | //_____________________________________________________________________________ | |
211 | AliVZEROCalibData* AliVZEROReconstructor::GetCalibData() const | |
212 | { | |
213 | ||
214 | // Getting calibration object for VZERO set | |
215 | ||
c0b82b5a | 216 | AliCDBManager *man = AliCDBManager::Instance(); |
ce7090f5 | 217 | |
c0b82b5a | 218 | AliCDBEntry *entry=0; |
219 | ||
220 | entry = man->Get("VZERO/Calib/Data"); | |
221 | ||
222 | if(!entry){ | |
223 | AliWarning("Load of calibration data from default storage failed!"); | |
224 | AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)"); | |
225 | Int_t runNumber = man->GetRun(); | |
226 | entry = man->GetStorage("local://$ALICE_ROOT") | |
227 | ->Get("VZERO/Calib/Data",runNumber); | |
228 | ||
229 | } | |
230 | ||
231 | // Retrieval of data in directory VZERO/Calib/Data: | |
232 | ||
233 | ||
234 | AliVZEROCalibData *calibdata = 0; | |
235 | ||
236 | if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject(); | |
237 | if (!calibdata) AliError("No calibration data from calibration database !"); | |
ce7090f5 | 238 | |
239 | return calibdata; | |
240 | } |