]>
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" |
b14e6eb4 | 28 | #include "AliESDEvent.h" |
a055ee24 | 29 | #include "AliVZEROTriggerMask.h" |
b0d2c2d3 | 30 | |
b0d2c2d3 | 31 | ClassImp(AliVZEROReconstructor) |
32 | ||
ce7090f5 | 33 | //_____________________________________________________________________________ |
cb2228e6 | 34 | AliVZEROReconstructor:: AliVZEROReconstructor(): AliReconstructor(), |
35b120ff | 35 | fESDVZERO(0x0), |
36 | fESD(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 | //_____________________________________________________________________________ | |
d76c31f4 | 65 | void AliVZEROReconstructor::Init() |
35b120ff | 66 | { |
ef314913 | 67 | // initializer |
ce7090f5 | 68 | |
35b120ff | 69 | fESDVZERO = new AliESDVZERO; |
70 | } | |
71 | ||
72 | //______________________________________________________________________ | |
2e0ee64a | 73 | void AliVZEROReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const |
35b120ff | 74 | { |
ef314913 | 75 | // converts to digits |
76 | ||
2e0ee64a | 77 | if (!digitsTree) { |
78 | AliError("No digits tree!"); | |
79 | return; | |
80 | } | |
35b120ff | 81 | |
2e0ee64a | 82 | TClonesArray* digitsArray = new TClonesArray("AliVZEROdigit"); |
83 | digitsTree->Branch("VZERODigit", &digitsArray); | |
84 | ||
85 | rawReader->Reset(); | |
86 | AliVZERORawStream rawStream(rawReader); | |
726d762c | 87 | if (rawStream.Next()) { |
88 | for(Int_t iChannel = 0; iChannel < 64; iChannel++) { | |
a055ee24 | 89 | Int_t adc = rawStream.GetADC(iChannel); |
90 | Int_t time = rawStream.GetTime(iChannel); | |
91 | new ((*digitsArray)[digitsArray->GetEntriesFast()]) | |
92 | AliVZEROdigit(iChannel,adc,time); | |
726d762c | 93 | } |
2e0ee64a | 94 | } |
95 | ||
96 | digitsTree->Fill(); | |
97 | } | |
98 | ||
99 | //______________________________________________________________________ | |
100 | void AliVZEROReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/, | |
b14e6eb4 | 101 | AliESDEvent* esd) const |
2e0ee64a | 102 | { |
ef314913 | 103 | // fills multiplicities to the ESD |
104 | ||
2e0ee64a | 105 | if (!digitsTree) { |
106 | AliError("No digits tree!"); | |
107 | return; | |
108 | } | |
a055ee24 | 109 | |
2e0ee64a | 110 | TClonesArray* digitsArray = NULL; |
111 | TBranch* digitBranch = digitsTree->GetBranch("VZERODigit"); | |
112 | digitBranch->SetAddress(&digitsArray); | |
35b120ff | 113 | |
a055ee24 | 114 | const Float_t mip0=110.0; |
115 | Short_t Multiplicity[64]; | |
116 | Float_t mult[64]; | |
28fdf12c | 117 | Short_t adc[64]; |
118 | Short_t time[64]; | |
ef314913 | 119 | Float_t mip[64]; |
35b120ff | 120 | for (Int_t i=0; i<64; i++){ |
ef314913 | 121 | adc[i] = 0; |
a055ee24 | 122 | mip[i] = mip0; |
123 | mult[i]= 0.0; | |
124 | } | |
35b120ff | 125 | |
a055ee24 | 126 | // loop over VZERO entries to get multiplicity |
2e0ee64a | 127 | Int_t nEntries = (Int_t)digitsTree->GetEntries(); |
35b120ff | 128 | for (Int_t e=0; e<nEntries; e++) { |
2e0ee64a | 129 | digitsTree->GetEvent(e); |
35b120ff | 130 | |
2e0ee64a | 131 | Int_t nDigits = digitsArray->GetEntriesFast(); |
35b120ff | 132 | |
133 | for (Int_t d=0; d<nDigits; d++) { | |
2e0ee64a | 134 | AliVZEROdigit* digit = (AliVZEROdigit*)digitsArray->At(d); |
ef314913 | 135 | Int_t pmNumber = digit->PMNumber(); |
28fdf12c | 136 | adc[pmNumber] = (Short_t) digit->ADC(); |
137 | time[pmNumber] = (Short_t) digit->Time(); | |
59063a18 | 138 | // cut of ADC at MIP/2 |
a055ee24 | 139 | if (adc[pmNumber] > (mip[pmNumber]/2)) |
140 | mult[pmNumber] += float(adc[pmNumber])/mip[pmNumber]; | |
35b120ff | 141 | } // end of loop over digits |
35b120ff | 142 | } // end of loop over events in digits tree |
143 | ||
a055ee24 | 144 | for (Int_t j=0; j<64; j++) Multiplicity[j] = short(mult[j]+0.5); |
145 | fESDVZERO->SetMultiplicity(Multiplicity); | |
28fdf12c | 146 | fESDVZERO->SetADC(adc); |
147 | fESDVZERO->SetTime(time); | |
a055ee24 | 148 | |
149 | // now get the trigger mask | |
150 | ||
151 | AliVZEROTriggerMask *TriggerMask = new AliVZEROTriggerMask(); | |
152 | TriggerMask->SetAdcThreshold(mip0/2.0); | |
153 | TriggerMask->SetTimeWindowWidthBBA(50); | |
154 | TriggerMask->SetTimeWindowWidthBGA(20); | |
155 | TriggerMask->SetTimeWindowWidthBBC(50); | |
156 | TriggerMask->SetTimeWindowWidthBGC(20); | |
157 | TriggerMask->FillMasks(digitsTree,digitsArray); | |
158 | ||
159 | fESDVZERO->SetBBtriggerV0A(TriggerMask->GetBBtriggerV0A()); | |
160 | fESDVZERO->SetBGtriggerV0A(TriggerMask->GetBGtriggerV0A()); | |
161 | fESDVZERO->SetBBtriggerV0C(TriggerMask->GetBBtriggerV0C()); | |
162 | fESDVZERO->SetBGtriggerV0C(TriggerMask->GetBGtriggerV0C()); | |
35b120ff | 163 | |
2e0ee64a | 164 | if (esd) { |
a055ee24 | 165 | AliDebug(1, Form("Writing VZERO data to ESD tree")); |
166 | esd->SetVZEROData(fESDVZERO); | |
2e0ee64a | 167 | } |
35b120ff | 168 | } |
169 | ||
ce7090f5 | 170 | //_____________________________________________________________________________ |
171 | AliCDBStorage* AliVZEROReconstructor::SetStorage(const char *uri) | |
172 | { | |
ef314913 | 173 | // Sets the storage |
174 | ||
ce7090f5 | 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 | { | |
ef314913 | 199 | // Gets calibration object for VZERO set |
ce7090f5 | 200 | |
c0b82b5a | 201 | AliCDBManager *man = AliCDBManager::Instance(); |
ce7090f5 | 202 | |
c0b82b5a | 203 | AliCDBEntry *entry=0; |
204 | ||
205 | entry = man->Get("VZERO/Calib/Data"); | |
206 | ||
94a600a1 | 207 | // if(!entry){ |
208 | // AliWarning("Load of calibration data from default storage failed!"); | |
209 | // AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)"); | |
210 | // Int_t runNumber = man->GetRun(); | |
211 | // entry = man->GetStorage("local://$ALICE_ROOT") | |
212 | // ->Get("VZERO/Calib/Data",runNumber); | |
213 | // | |
214 | // } | |
c0b82b5a | 215 | |
216 | // Retrieval of data in directory VZERO/Calib/Data: | |
217 | ||
c0b82b5a | 218 | AliVZEROCalibData *calibdata = 0; |
219 | ||
220 | if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject(); | |
94a600a1 | 221 | if (!calibdata) AliFatal("No calibration data from calibration database !"); |
ce7090f5 | 222 | |
223 | return calibdata; | |
224 | } |