]>
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 | #include <Riostream.h> | |
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" | |
32 | ||
33 | ///////////////////////////////////////////////////////// | |
34 | // // | |
35 | // // | |
36 | // // | |
37 | ///////////////////////////////////////////////////////// | |
38 | ClassImp(AliITSsDigitize) | |
39 | //______________________________________________________________________ | |
40 | AliITSsDigitize::AliITSsDigitize(): | |
41 | fInit(kFALSE), | |
42 | fEnt(0), | |
43 | fEnt0(0), | |
44 | fITS(0), | |
45 | fRunLoader(0x0){ | |
46 | // Default constructor. | |
47 | // Inputs: | |
48 | // none. | |
49 | // Outputs: | |
50 | // none. | |
51 | // Return: | |
52 | // A zero-ed constructed AliITSsDigitize class. | |
53 | ||
54 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
55 | } | |
56 | //______________________________________________________________________ | |
57 | AliITSsDigitize::AliITSsDigitize(const char* filename): | |
58 | fInit(), | |
59 | fEnt(0), | |
60 | fEnt0(0), | |
61 | fITS(0), | |
62 | fRunLoader(0x0){ | |
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 | ||
75 | if(gAlice) | |
76 | { | |
77 | delete gAlice; | |
78 | gAlice = 0; | |
79 | } | |
80 | fRunLoader = AliRunLoader::Open(filename); | |
81 | fRunLoader->LoadgAlice(); | |
82 | fRunLoader->LoadHeader(); | |
83 | ||
84 | ||
85 | Init(); | |
86 | } | |
87 | //______________________________________________________________________ | |
88 | AliITSsDigitize::~AliITSsDigitize(){ | |
89 | // Default constructor. | |
90 | // Inputs: | |
91 | // none. | |
92 | // Outputs: | |
93 | // none. | |
94 | // Return: | |
95 | // A destroyed AliITSsDigitize class. | |
96 | ||
97 | if(fRunLoader) delete fRunLoader; | |
98 | fITS = 0; | |
99 | ||
100 | } | |
101 | //______________________________________________________________________ | |
102 | Bool_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 | |
110 | //Int_t nparticles; | |
111 | ||
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; | |
127 | fEnt = gAlice->GetEventsPerRun(); | |
128 | ||
129 | AliLoader* loader = fRunLoader->GetLoader("ITSLoader"); | |
130 | ||
131 | if(!loader->TreeS()){ | |
132 | cout << "Having to create the SDigits Tree." << endl; | |
133 | loader->MakeTree("S"); | |
134 | } // end if !gAlice->TreeS() | |
135 | //make branch | |
136 | fITS->MakeBranch("S"); | |
137 | fITS->SetTreeAddress(); | |
138 | ||
139 | fRunLoader->GetEvent(fEnt0); | |
140 | // finished init. | |
141 | fInit = InitSDig(); | |
142 | return fInit; | |
143 | } | |
144 | //______________________________________________________________________ | |
145 | Bool_t AliITSsDigitize::InitSDig() const { | |
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 | //______________________________________________________________________ | |
158 | void 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 | ||
186 | fITS->HitsToSDigits(fRunLoader->GetHeader()->GetEvent(),0,-1," ",lopt," "); | |
187 | } |