]>
Commit | Line | Data |
---|---|---|
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 | // V-Zero Detector // | |
21 | // This class contains the base procedures for the VZERO detector // | |
22 | // Default geometry of November 2003 : V0R box is 4.4 cm thick // | |
23 | // scintillators are 2 cm thick // | |
24 | // All comments should be sent to Brigitte CHEYNIS : // | |
25 | // b.cheynis@ipnl.in2p3.fr // | |
26 | // // | |
27 | // // | |
28 | /////////////////////////////////////////////////////////////////////////// | |
29 | ||
30 | ||
31 | // --- Standard libraries --- | |
32 | #include <Riostream.h> | |
33 | #include <stdlib.h> | |
34 | ||
35 | // --- ROOT libraries --- | |
36 | #include <TNamed.h> | |
37 | #include "TROOT.h" | |
38 | #include "TFile.h" | |
39 | #include "TNetFile.h" | |
40 | #include "TRandom.h" | |
41 | #include "TTree.h" | |
42 | #include "TBranch.h" | |
43 | #include "TClonesArray.h" | |
44 | #include "TStopwatch.h" | |
45 | ||
46 | // --- AliRoot header files --- | |
47 | #include "AliRun.h" | |
48 | #include "AliMC.h" | |
49 | #include "AliVZERO.h" | |
50 | #include "AliVZEROLoader.h" | |
51 | #include "AliVZERODigitizer.h" | |
52 | #include "AliVZEROBuffer.h" | |
53 | #include "AliRunDigitizer.h" | |
54 | #include "AliVZEROdigit.h" | |
55 | ||
56 | ClassImp(AliVZERO) | |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliVZERO::AliVZERO(const char *name, const char *title) | |
60 | : AliDetector(name,title) | |
61 | { | |
62 | // | |
63 | // Standard constructor for VZERO Detector | |
64 | // | |
65 | ||
66 | // fIshunt = 1; // All hits are associated with primary particles | |
67 | ||
68 | fHits = new TClonesArray("AliVZEROhit", 400); | |
69 | fDigits = new TClonesArray("AliVZEROdigit",400); | |
70 | ||
71 | gAlice->GetMCApp()->AddHitList(fHits); | |
72 | ||
73 | fThickness = 4.4; // total thickness of the V0R box in cm | |
74 | fThickness1 = 2.0; // thickness of scintillating cells in cm | |
75 | ||
76 | fMaxStepQua = 0.05; | |
77 | fMaxStepAlu = 0.01; | |
78 | ||
79 | fMaxDestepQua = -1.0; | |
80 | fMaxDestepAlu = -1.0; | |
81 | ||
82 | SetMarkerColor(kRed); | |
83 | } | |
84 | ||
85 | //_____________________________________________________________________________ | |
86 | AliVZERO::~AliVZERO() | |
87 | { | |
88 | // | |
89 | // Default destructor for VZERO Detector | |
90 | // | |
91 | ||
92 | if (fHits) { | |
93 | fHits->Delete(); | |
94 | delete fHits; | |
95 | fHits=0; } | |
96 | ||
97 | if (fDigits) { | |
98 | fDigits->Delete(); | |
99 | delete fDigits; | |
100 | fDigits=0; } | |
101 | } | |
102 | ||
103 | //_____________________________________________________________________________ | |
104 | void AliVZERO::BuildGeometry() | |
105 | { | |
106 | // | |
107 | // Builds simple ROOT TNode geometry for event display | |
108 | // | |
109 | } | |
110 | ||
111 | //_____________________________________________________________________________ | |
112 | void AliVZERO::CreateGeometry() | |
113 | { | |
114 | // | |
115 | // Builds simple Geant3 geometry | |
116 | // | |
117 | } | |
118 | //_____________________________________________________________________________ | |
119 | void AliVZERO::CreateMaterials() | |
120 | { | |
121 | // | |
122 | // Creates materials used for Geant3 geometry | |
123 | // | |
124 | } | |
125 | ||
126 | //_____________________________________________________________________________ | |
127 | Int_t AliVZERO::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/) | |
128 | { | |
129 | // | |
130 | // Calculates the distance from the mouse to the VZERO on the screen | |
131 | // Dummy routine | |
132 | // | |
133 | ||
134 | return 9999; | |
135 | } | |
136 | ||
137 | //_____________________________________________________________________________ | |
138 | void AliVZERO::Init() | |
139 | { | |
140 | // | |
141 | // Initialises the VZERO class after it has been built | |
142 | // | |
143 | } | |
144 | ||
145 | ||
146 | //_____________________________________________________________________________ | |
147 | void AliVZERO::SetMaxStepQua(Float_t p1) | |
148 | { | |
149 | // | |
150 | // Possible parametrisation of steps in active materials | |
151 | // | |
152 | fMaxStepQua = p1; | |
153 | } | |
154 | ||
155 | //_____________________________________________________________________________ | |
156 | void AliVZERO::SetMaxStepAlu(Float_t p1) | |
157 | { | |
158 | // | |
159 | // Possible parametrisation of steps in Aluminum foils (not used in | |
160 | // version v2) | |
161 | // | |
162 | fMaxStepAlu = p1; | |
163 | } | |
164 | ||
165 | //_____________________________________________________________________________ | |
166 | void AliVZERO::SetMaxDestepQua(Float_t p1) | |
167 | { | |
168 | // | |
169 | // Possible parametrisation of steps in active materials (quartz) | |
170 | // | |
171 | fMaxDestepQua = p1; | |
172 | } | |
173 | ||
174 | //_____________________________________________________________________________ | |
175 | void AliVZERO::SetMaxDestepAlu(Float_t p1) | |
176 | { | |
177 | // | |
178 | // Possible parametrisation of steps in Aluminum (not used in | |
179 | // version v2) | |
180 | // | |
181 | fMaxDestepAlu = p1; | |
182 | } | |
183 | ||
184 | //_____________________________________________________________________________ | |
185 | AliLoader* AliVZERO::MakeLoader(const char* topfoldername) | |
186 | { | |
187 | // | |
188 | // Builds VZEROgetter (AliLoader type) | |
189 | // if detector wants to use customized getter, it must overload this method | |
190 | // | |
191 | ||
192 | Info("MakeLoader","Creating AliVZEROLoader. Top folder is %s.",topfoldername); | |
193 | fLoader = new AliVZEROLoader(GetName(),topfoldername); | |
194 | return fLoader; | |
195 | } | |
196 | ||
197 | //_____________________________________________________________________________ | |
198 | void AliVZERO::SetTreeAddress() | |
199 | { | |
200 | // | |
201 | // Sets tree address for hits. | |
202 | // | |
203 | if (fLoader->TreeH() && (fHits == 0x0)) | |
204 | fHits = new TClonesArray("AliVZEROhit", 400); | |
205 | ||
206 | AliDetector::SetTreeAddress(); | |
207 | } | |
208 | ||
209 | //_____________________________________________________________________________ | |
210 | AliDigitizer* AliVZERO::CreateDigitizer(AliRunDigitizer* manager) const | |
211 | { | |
212 | // | |
213 | // Creates a digitizer for VZERO | |
214 | // | |
215 | return new AliVZERODigitizer(manager); | |
216 | } | |
217 | ||
218 | //_____________________________________________________________________________ | |
219 | void AliVZERO::Hits2Digits(){ | |
220 | // | |
221 | // Converts hits to digits of the current event | |
222 | // | |
223 | // Inputs file name | |
224 | const char *alifile = "galice.root"; | |
225 | ||
226 | // Create the run digitizer | |
227 | AliRunDigitizer* manager = new AliRunDigitizer(1, 1); | |
228 | manager->SetInputStream(0, alifile); | |
229 | manager->SetOutputFile("H2Dfile"); | |
230 | ||
231 | // Creates the VZERO digitizer | |
232 | AliVZERODigitizer* dig = new AliVZERODigitizer(manager); | |
233 | ||
234 | // Creates the digits | |
235 | dig->Exec(""); | |
236 | ||
237 | } | |
238 | //_____________________________________________________________________________ | |
239 | void AliVZERO::Digits2Raw() | |
240 | { | |
241 | // | |
242 | // Converts digits of the current event to raw data | |
243 | // | |
244 | AliVZERO *fVZERO = (AliVZERO*)gAlice->GetDetector("VZERO"); | |
245 | fLoader->LoadDigits(); | |
246 | TTree* digits = fLoader->TreeD(); | |
247 | if (!digits) { | |
248 | Error("Digits2Raw", "no digits tree"); | |
249 | return; | |
250 | } | |
251 | TClonesArray * VZEROdigits = new TClonesArray("AliVZEROdigit",1000); | |
252 | fVZERO->SetTreeAddress(); | |
253 | digits->GetBranch("VZERODigit")->SetAddress(&VZEROdigits); | |
254 | ||
255 | const char *fileName = "VZERO_3584.ddl"; | |
256 | AliVZEROBuffer* buffer = new AliVZEROBuffer(fileName); | |
257 | ||
258 | // Verbose level | |
259 | // 0: Silent | |
260 | // 1: cout messages | |
261 | // 2: txt files with digits | |
262 | // BE CAREFUL, verbose level 2 MUST be used only for debugging and | |
263 | // it is highly suggested to use this mode only for debugging digits files | |
264 | // reasonably small, because otherwise the size of the txt files can reach | |
265 | // quickly several MB wasting time and disk space. | |
266 | ||
267 | ofstream ftxt; | |
268 | buffer->SetVerbose(0); | |
269 | Int_t fVerbose = buffer->GetVerbose(); | |
270 | ||
271 | Int_t nEntries = Int_t(digits->GetEntries()); | |
272 | ||
273 | for (Int_t i = 0; i < nEntries; i++) { | |
274 | ||
275 | fVZERO->ResetDigits(); | |
276 | digits->GetEvent(i); | |
277 | Int_t ndig = VZEROdigits->GetEntriesFast(); | |
278 | ||
279 | if(ndig == 0) continue; | |
280 | if(fVerbose == 2) {ftxt.open("VZEROdigits.txt",ios::app);} | |
281 | for(Int_t k=0; k<ndig; k++){ | |
282 | AliVZEROdigit* fVZERODigit = (AliVZEROdigit*) VZEROdigits->At(k); | |
283 | Int_t ADC = fVZERODigit->ADC(); | |
284 | Int_t cell = fVZERODigit->CellNumber(); | |
285 | Int_t Time = fVZERODigit->Time(); | |
286 | if(fVerbose == 1) { cout <<"DDL: "<<fileName<< "\tdigit number: "<< k<<"\tcell: " | |
287 | <<cell<<"\tADC: "<< ADC << "\tTime: "<< Time << endl;} | |
288 | if(fVerbose == 2) { | |
289 | ftxt<<"DDL: "<<fileName<< "\tdigit number: "<< k<<"\tcell: " | |
290 | <<cell<<"\tADC: "<< ADC << endl; | |
291 | } | |
292 | buffer->WriteBinary(cell, ADC, Time); | |
293 | } | |
294 | if(fVerbose==2) ftxt.close(); | |
295 | } | |
296 | ||
297 | delete buffer; | |
298 | fLoader->UnloadDigits(); | |
299 | } | |
300 | ||
301 |