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