]>
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" |
b0d2c2d3 | 25 | #include "AliVZEROReconstructor.h" |
35b120ff | 26 | #include "AliESD.h" |
b0d2c2d3 | 27 | |
b0d2c2d3 | 28 | ClassImp(AliVZEROReconstructor) |
29 | ||
ce7090f5 | 30 | //_____________________________________________________________________________ |
cb2228e6 | 31 | AliVZEROReconstructor:: AliVZEROReconstructor(): AliReconstructor(), |
35b120ff | 32 | fESDVZERO(0x0), |
33 | fESD(0x0), | |
34 | fRunLoader(0x0), | |
cb2228e6 | 35 | fCalibData(GetCalibData()) |
ce7090f5 | 36 | { |
37 | // Default constructor | |
ce7090f5 | 38 | // Get calibration data |
39 | ||
35b120ff | 40 | // fCalibData = GetCalibData(); |
ce7090f5 | 41 | } |
42 | ||
43 | ||
44 | //_____________________________________________________________________________ | |
45 | AliVZEROReconstructor& AliVZEROReconstructor::operator = | |
46 | (const AliVZEROReconstructor& /*reconstructor*/) | |
47 | { | |
48 | // assignment operator | |
49 | ||
50 | Fatal("operator =", "assignment operator not implemented"); | |
51 | return *this; | |
52 | } | |
53 | ||
54 | //_____________________________________________________________________________ | |
55 | AliVZEROReconstructor::~AliVZEROReconstructor() | |
56 | { | |
57 | // destructor | |
35b120ff | 58 | delete fESDVZERO; |
59 | ||
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | void AliVZEROReconstructor::Init(AliRunLoader* runLoader) | |
64 | { | |
65 | /// initializer | |
ce7090f5 | 66 | |
35b120ff | 67 | fRunLoader = runLoader; |
68 | fESDVZERO = new AliESDVZERO; | |
69 | } | |
70 | ||
71 | //______________________________________________________________________ | |
72 | void AliVZEROReconstructor::Reconstruct(AliRunLoader* runLoader) const | |
73 | { | |
74 | ||
75 | AliVZEROLoader* loader = (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" ); | |
76 | // AliVZEROLoader* loader = (AliVZEROLoader* )fRunLoader->GetLoader( "VZEROLoader" ); | |
77 | ||
78 | loader->LoadDigits("READ"); | |
79 | TTree* vzeroDigitsTree = loader->TreeD(); | |
80 | if (!vzeroDigitsTree) return; | |
81 | ||
82 | TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000); | |
83 | TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit"); | |
84 | digitBranch->SetAddress(&vzeroDigits); | |
85 | ||
86 | Int_t NbPMV0A = 0; | |
87 | Int_t NbPMV0C = 0; | |
88 | Int_t MTotV0A = 0; | |
89 | Int_t MTotV0C = 0; | |
90 | Float_t ADCV0A = 0.0; | |
91 | Float_t ADCV0C = 0.0; | |
92 | Float_t MultV0A[4]; | |
93 | Float_t MultV0C[4]; | |
94 | Int_t MRingV0A[4]; | |
95 | Int_t MRingV0C[4]; | |
96 | ||
97 | Int_t ADC[64]; | |
98 | Float_t MIP[64]; | |
99 | for (Int_t i=0; i<64; i++){ | |
100 | ADC[i] = 0; | |
101 | MIP[i] = 110.0;} | |
102 | for (Int_t j=0; j<4; j++){ | |
103 | MultV0A[j] = 0.0; | |
104 | MultV0C[j] = 0.0; | |
105 | MRingV0A[j] = 0; | |
106 | MRingV0C[j] = 0;} | |
107 | ||
108 | // loop over VZERO entries | |
109 | Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries(); | |
110 | for (Int_t e=0; e<nEntries; e++) { | |
111 | vzeroDigitsTree->GetEvent(e); | |
112 | ||
113 | Int_t nDigits = vzeroDigits->GetEntriesFast(); | |
114 | ||
115 | for (Int_t d=0; d<nDigits; d++) { | |
116 | AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d); | |
117 | Int_t PMNumber = digit->PMNumber(); | |
118 | ADC[PMNumber] = digit->ADC(); | |
119 | if (PMNumber<=31) { | |
120 | if (PMNumber<=7) MultV0C[0]=MultV0C[0]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
121 | if (PMNumber>=8 && PMNumber<=15) MultV0C[1]=MultV0C[1]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
122 | if (PMNumber>=16 && PMNumber<=23) MultV0C[2]=MultV0C[2]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
123 | if (PMNumber>=24 && PMNumber<=31) MultV0C[3]=MultV0C[3]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
124 | ADCV0C = ADCV0C + float(ADC[PMNumber])/MIP[PMNumber]; | |
125 | if(ADC[PMNumber] > 4) NbPMV0C++; | |
126 | } | |
127 | if (PMNumber>=32) { | |
128 | if (PMNumber>=32 && PMNumber<=39) MultV0A[0]=MultV0A[0]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
129 | if (PMNumber>=40 && PMNumber<=47) MultV0A[1]=MultV0A[1]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
130 | if (PMNumber>=48 && PMNumber<=55) MultV0A[2]=MultV0A[2]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
131 | if (PMNumber>=56 && PMNumber<=63) MultV0A[3]=MultV0A[3]+ float(ADC[PMNumber])/MIP[PMNumber]; | |
132 | ADCV0A = ADCV0A + float(ADC[PMNumber])/MIP[PMNumber]; | |
133 | if(ADC[PMNumber] > 4) NbPMV0A++; | |
134 | } | |
135 | } // end of loop over digits | |
136 | ||
137 | } // end of loop over events in digits tree | |
138 | ||
139 | MTotV0A = int(ADCV0A + 0.5); | |
140 | MTotV0C = int(ADCV0C + 0.5); | |
141 | for (Int_t j=0; j<4; j++){ | |
142 | MRingV0A[j] = int(MultV0A[j] + 0.5); | |
143 | MRingV0C[j] = int(MultV0C[j] + 0.5);} | |
144 | ||
145 | AliDebug(1,Form("VZERO multiplicities : %d (V0A) %d (V0C)", MTotV0A, MTotV0C)); | |
146 | AliDebug(1,Form("Number of PMs fired : %d (V0A) %d (V0C)", NbPMV0A, NbPMV0C)); | |
147 | ||
148 | fESDVZERO->SetNbPMV0A(NbPMV0A); | |
149 | fESDVZERO->SetNbPMV0C(NbPMV0C); | |
150 | fESDVZERO->SetMTotV0A(MTotV0A); | |
151 | fESDVZERO->SetMTotV0C(MTotV0C); | |
152 | fESDVZERO->SetMRingV0A(MRingV0A); | |
153 | fESDVZERO->SetMRingV0C(MRingV0C); | |
154 | ||
ce7090f5 | 155 | } |
156 | ||
35b120ff | 157 | |
158 | //_____________________________________________________________________________ | |
159 | void AliVZEROReconstructor::FillESD(AliRunLoader* /*runLoader*/, | |
160 | AliESD* esd) const | |
161 | { | |
162 | // fill ESD | |
163 | ||
164 | if (esd) { | |
165 | AliDebug(1, Form("Writing VZERO data to ESD tree")); | |
166 | esd->SetVZEROData(fESDVZERO); | |
167 | } | |
ce7090f5 | 168 | |
35b120ff | 169 | } |
170 | ||
ce7090f5 | 171 | //_____________________________________________________________________________ |
172 | AliCDBStorage* AliVZEROReconstructor::SetStorage(const char *uri) | |
173 | { | |
174 | ||
175 | Bool_t deleteManager = kFALSE; | |
176 | ||
177 | AliCDBManager *manager = AliCDBManager::Instance(); | |
178 | AliCDBStorage *defstorage = manager->GetDefaultStorage(); | |
179 | ||
180 | if(!defstorage || !(defstorage->Contains("VZERO"))){ | |
181 | AliWarning("No default storage set or default storage doesn't contain VZERO!"); | |
182 | manager->SetDefaultStorage(uri); | |
183 | deleteManager = kTRUE; | |
184 | } | |
185 | ||
186 | AliCDBStorage *storage = manager->GetDefaultStorage(); | |
187 | ||
188 | if(deleteManager){ | |
189 | AliCDBManager::Instance()->UnsetDefaultStorage(); | |
190 | defstorage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy() | |
191 | } | |
192 | ||
193 | return storage; | |
194 | } | |
195 | ||
196 | //_____________________________________________________________________________ | |
197 | AliVZEROCalibData* AliVZEROReconstructor::GetCalibData() const | |
198 | { | |
199 | ||
200 | // Getting calibration object for VZERO set | |
201 | ||
c0b82b5a | 202 | AliCDBManager *man = AliCDBManager::Instance(); |
ce7090f5 | 203 | |
c0b82b5a | 204 | AliCDBEntry *entry=0; |
205 | ||
206 | entry = man->Get("VZERO/Calib/Data"); | |
207 | ||
208 | if(!entry){ | |
209 | AliWarning("Load of calibration data from default storage failed!"); | |
210 | AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)"); | |
211 | Int_t runNumber = man->GetRun(); | |
212 | entry = man->GetStorage("local://$ALICE_ROOT") | |
213 | ->Get("VZERO/Calib/Data",runNumber); | |
214 | ||
215 | } | |
216 | ||
217 | // Retrieval of data in directory VZERO/Calib/Data: | |
218 | ||
219 | ||
220 | AliVZEROCalibData *calibdata = 0; | |
221 | ||
222 | if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject(); | |
223 | if (!calibdata) AliError("No calibration data from calibration database !"); | |
ce7090f5 | 224 | |
225 | return calibdata; | |
226 | } |