Correct formula for phi, in case of current local X <0, in GetLocalXat and GetPhiZat
[u/mrichter/AliRoot.git] / ITS / AliITSsDigitize.cxx
CommitLineData
d8b00ff7 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$ */
94831058 17
4ae5bbc4 18#include <Riostream.h>
d8b00ff7 19
20#include <TROOT.h>
21#include <TFile.h>
22#include <TSeqCollection.h>
23#include <TString.h>
24#include <TClonesArray.h>
25
26#include "AliHeader.h"
27#include "AliRun.h"
28
29#include "AliITS.h"
30#include "AliITSsDigitize.h"
31#include "AliITSgeom.h"
7537d03c 32
33/////////////////////////////////////////////////////////
34// //
35// //
36// //
37/////////////////////////////////////////////////////////
d8b00ff7 38ClassImp(AliITSsDigitize)
39//______________________________________________________________________
7537d03c 40AliITSsDigitize::AliITSsDigitize():
41fInit(kFALSE),
42fEnt(0),
43fEnt0(0),
44fITS(0),
45fRunLoader(0x0){
d8b00ff7 46 // Default constructor.
47 // Inputs:
48 // none.
49 // Outputs:
50 // none.
51 // Return:
52 // A zero-ed constructed AliITSsDigitize class.
53
d8b00ff7 54 fDet[0] = fDet[1] = fDet[2] = kTRUE;
d8b00ff7 55}
56//______________________________________________________________________
7537d03c 57AliITSsDigitize::AliITSsDigitize(const char* filename):
58fInit(),
59fEnt(0),
60fEnt0(0),
61fITS(0),
62fRunLoader(0x0){
d8b00ff7 63 // Standard constructor.
64 // Inputs:
65 // const char* filename filename containing the digits to be
66 // reconstructed. If filename = 0 (nil)
67 // then no file is opened but a file is
68 // assumed to already be opened. This
69 // already opened file will be used.
70 // Outputs:
71 // none.
72 // Return:
73 // A standardly constructed AliITSsDigitize class.
74
88cb7938 75 if(gAlice)
76 {
77 delete gAlice;
78 gAlice = 0;
79 }
80 fRunLoader = AliRunLoader::Open(filename);
81 fRunLoader->LoadgAlice();
82 fRunLoader->LoadHeader();
83
d8b00ff7 84
85 Init();
86}
87//______________________________________________________________________
88AliITSsDigitize::~AliITSsDigitize(){
89 // Default constructor.
90 // Inputs:
91 // none.
92 // Outputs:
93 // none.
94 // Return:
95 // A destroyed AliITSsDigitize class.
96
88cb7938 97 if(fRunLoader) delete fRunLoader;
d8b00ff7 98 fITS = 0;
99
100}
101//______________________________________________________________________
102Bool_t AliITSsDigitize::Init(){
103 // Class Initilizer.
104 // Inputs:
105 // none.
106 // Outputs:
107 // none.
108 // Return:
109 // kTRUE if no errors initilizing this class occurse else kFALSE
88cb7938 110 //Int_t nparticles;
111
d8b00ff7 112 fITS = (AliITS*) gAlice->GetDetector("ITS");
113 if(!fITS){
114 cout << "ITS not found aborting. fITS=" << fITS << endl;
115 fInit = kFALSE;
116 return fInit;
117 } // end if !fITS
118 if(!(fITS->GetITSgeom())){
119 cout << "ITSgeom not found aborting."<< endl;
120 fInit = kFALSE;
121 return fInit;
122 } // end if !GetITSgeom()
123 // Now ready to init.
124
125 fDet[0] = fDet[1] = fDet[2] = kTRUE;
126 fEnt0 = 0;
33c3c91a 127 fEnt = AliRunLoader::Instance()->GetNumberOfEvents();
d8b00ff7 128
88cb7938 129 AliLoader* loader = fRunLoader->GetLoader("ITSLoader");
130
131 if(!loader->TreeS()){
d8b00ff7 132 cout << "Having to create the SDigits Tree." << endl;
88cb7938 133 loader->MakeTree("S");
d8b00ff7 134 } // end if !gAlice->TreeS()
135 //make branch
136 fITS->MakeBranch("S");
137 fITS->SetTreeAddress();
88cb7938 138
139 fRunLoader->GetEvent(fEnt0);
d8b00ff7 140 // finished init.
141 fInit = InitSDig();
142 return fInit;
143}
144//______________________________________________________________________
7537d03c 145Bool_t AliITSsDigitize::InitSDig() const {
d8b00ff7 146 // Sets up SDigitization part of AliITSDetType..
147 // Inputs:
148 // none.
149 // Outputs:
150 // none.
151 // Return:
152 // none.
153
154 return kTRUE;
155}
156
157//______________________________________________________________________
158void AliITSsDigitize::Exec(const Option_t *opt){
159 // Main SDigitization function.
160 // Inputs:
161 // Option_t * opt list of subdetector to digitize. =0 all.
162 // Outputs:
163 // none.
164 // Return:
165 // none.
166 Option_t *lopt;
167// Int_t nparticles,evnt;
168
169 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
170 fDet[0] = fDet[1] = fDet[2] = kTRUE;
171 lopt = "All";
172 }else{
173 fDet[0] = fDet[1] = fDet[2] = kFALSE;
174 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
175 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
176 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
177 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
178 else lopt = opt;
179 } // end if strstr(opt,...)
180
181 if(!fInit){
182 cout << "Initilization Failed, Can't run Exec." << endl;
183 return;
184 } // end if !fInit
185
88cb7938 186 fITS->HitsToSDigits(fRunLoader->GetHeader()->GetEvent(),0,-1," ",lopt," ");
d8b00ff7 187}