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