]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsDigitize.cxx
New version and structure of ITS V11 geometry. Work still in progress.
[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
16/*
17$Log$
4ae5bbc4 18Revision 1.3 2002/10/14 14:57:03 hristov
19Merging the VirtualMC branch to the main development branch (HEAD)
20
b9d0a01d 21Revision 1.2.4.1 2002/06/10 17:51:15 hristov
22Merged with v3-08-02
23
24Revision 1.2 2002/05/19 18:17:03 hristov
25Changes needed by ICC/IFC compiler (Intel)
26
94831058 27Revision 1.1 2002/03/28 16:25:26 nilsen
28New TTask method for creating SDigits from Hits.
29
d8b00ff7 30*/
94831058 31
4ae5bbc4 32#include <Riostream.h>
d8b00ff7 33
34#include <TROOT.h>
35#include <TFile.h>
36#include <TSeqCollection.h>
37#include <TString.h>
38#include <TClonesArray.h>
39
40#include "AliHeader.h"
41#include "AliRun.h"
42
43#include "AliITS.h"
44#include "AliITSsDigitize.h"
45#include "AliITSgeom.h"
46
47ClassImp(AliITSsDigitize)
48//______________________________________________________________________
49AliITSsDigitize::AliITSsDigitize(){
50 // Default constructor.
51 // Inputs:
52 // none.
53 // Outputs:
54 // none.
55 // Return:
56 // A zero-ed constructed AliITSsDigitize class.
57
58 fFilename = "";
59 fFile = 0;
60 fITS = 0;
61 fDet[0] = fDet[1] = fDet[2] = kTRUE;
62 fInit = kFALSE;
63}
64//______________________________________________________________________
65AliITSsDigitize::AliITSsDigitize(const char* filename){
66 // Standard constructor.
67 // Inputs:
68 // const char* filename filename containing the digits to be
69 // reconstructed. If filename = 0 (nil)
70 // then no file is opened but a file is
71 // assumed to already be opened. This
72 // already opened file will be used.
73 // Outputs:
74 // none.
75 // Return:
76 // A standardly constructed AliITSsDigitize class.
77
78 fFilename = filename;
79
80 if(filename){
81 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
82 if(fFile) fFile->Close();
83 fFile = new TFile(fFilename.Data(),"UPDATE");
84 //
85 if(gAlice) {
86 delete gAlice;
87 gAlice = 0;
88 }
89 gAlice = (AliRun*)fFile->Get("gAlice");
90 if(!gAlice) {
91 cout << "gAlice not found on file. Aborting." << endl;
92 fInit = kFALSE;
93 return;
94 } // end if !gAlice
95 } // end if !filename.
96
97 Init();
98}
99//______________________________________________________________________
100AliITSsDigitize::~AliITSsDigitize(){
101 // Default constructor.
102 // Inputs:
103 // none.
104 // Outputs:
105 // none.
106 // Return:
107 // A destroyed AliITSsDigitize class.
108
109 if(fFile) fFile->Close();
110 fFile = 0;
111 fITS = 0;
112
113}
114//______________________________________________________________________
115Bool_t AliITSsDigitize::Init(){
116 // Class Initilizer.
117 // Inputs:
118 // none.
119 // Outputs:
120 // none.
121 // Return:
122 // kTRUE if no errors initilizing this class occurse else kFALSE
123 Int_t nparticles;
124
125 fITS = (AliITS*) gAlice->GetDetector("ITS");
126 if(!fITS){
127 cout << "ITS not found aborting. fITS=" << fITS << endl;
128 fInit = kFALSE;
129 return fInit;
130 } // end if !fITS
131 if(!(fITS->GetITSgeom())){
132 cout << "ITSgeom not found aborting."<< endl;
133 fInit = kFALSE;
134 return fInit;
135 } // end if !GetITSgeom()
136 // Now ready to init.
137
138 fDet[0] = fDet[1] = fDet[2] = kTRUE;
139 fEnt0 = 0;
140 fEnt = gAlice->GetEventsPerRun();
141
142 if(!gAlice->TreeS()){
143 cout << "Having to create the SDigits Tree." << endl;
144 gAlice->MakeTree("S");
145 } // end if !gAlice->TreeS()
146 //make branch
147 fITS->MakeBranch("S");
148 fITS->SetTreeAddress();
149 nparticles = gAlice->GetEvent(fEnt0);
150
151 // finished init.
152 fInit = InitSDig();
153 return fInit;
154}
155//______________________________________________________________________
156Bool_t AliITSsDigitize::InitSDig(){
157 // Sets up SDigitization part of AliITSDetType..
158 // Inputs:
159 // none.
160 // Outputs:
161 // none.
162 // Return:
163 // none.
164
165 return kTRUE;
166}
167
168//______________________________________________________________________
169void AliITSsDigitize::Exec(const Option_t *opt){
170 // Main SDigitization function.
171 // Inputs:
172 // Option_t * opt list of subdetector to digitize. =0 all.
173 // Outputs:
174 // none.
175 // Return:
176 // none.
177 Option_t *lopt;
178// Int_t nparticles,evnt;
179
180 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
181 fDet[0] = fDet[1] = fDet[2] = kTRUE;
182 lopt = "All";
183 }else{
184 fDet[0] = fDet[1] = fDet[2] = kFALSE;
185 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
186 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
187 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
188 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
189 else lopt = opt;
190 } // end if strstr(opt,...)
191
192 if(!fInit){
193 cout << "Initilization Failed, Can't run Exec." << endl;
194 return;
195 } // end if !fInit
196
197 fITS->HitsToSDigits(gAlice->GetHeader()->GetEvent(),0,-1," ",lopt," ");
198}