]>
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 | // START (T-Zero) Detector // | |
21 | // This class contains the base procedures for the START // | |
22 | // detector // | |
23 | // // | |
24 | //Begin_Html | |
25 | /* | |
26 | <img src="gif/AliSTARTClass.gif"> | |
27 | </pre> | |
28 | <br clear=left> | |
29 | <font size=+2 color=red> | |
30 | <p>The responsible person for this module is | |
31 | <a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>. | |
32 | </font> | |
33 | <pre> | |
34 | */ | |
35 | //End_Html | |
36 | // // | |
37 | // // | |
38 | /////////////////////////////////////////////////////////////////////////////// | |
39 | ||
40 | #include <Riostream.h> | |
41 | ||
42 | #include <TFile.h> | |
43 | #include <TGeometry.h> | |
44 | #include <TMath.h> | |
45 | #include <TNode.h> | |
46 | #include <TParticle.h> | |
47 | #include <TRandom.h> | |
48 | #include <TTUBE.h> | |
49 | #include <TVirtualMC.h> | |
50 | ||
51 | #include "AliLoader.h" | |
52 | #include "AliRun.h" | |
53 | #include "AliSTART.h" | |
54 | #include "AliSTARTdigit.h" | |
55 | #include "AliSTARThit.h" | |
56 | #include "AliSTARThitPhoton.h" | |
57 | #include "AliSTARTvertex.h" | |
58 | ||
59 | ClassImp(AliSTART) | |
60 | ||
61 | static AliSTARTdigit *digits; | |
62 | ||
63 | //_____________________________________________________________________________ | |
64 | AliSTART::AliSTART() | |
65 | { | |
66 | // | |
67 | // Default constructor for class AliSTART | |
68 | // | |
69 | fIshunt = 1; | |
70 | fHits = 0; | |
71 | fDigits = 0; | |
72 | fPhotons = 0; | |
73 | } | |
74 | ||
75 | //_____________________________________________________________________________ | |
76 | AliSTART::AliSTART(const char *name, const char *title) | |
77 | : AliDetector(name,title) | |
78 | { | |
79 | // | |
80 | // Standard constructor for START Detector | |
81 | // | |
82 | ||
83 | ||
84 | // | |
85 | // Initialise Hit array | |
86 | fHits = new TClonesArray("AliSTARThit", 405); | |
87 | gAlice->AddHitList(fHits); | |
88 | ||
89 | fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); | |
90 | gAlice->AddHitList (fPhotons); | |
91 | ||
92 | fIshunt = 1; | |
93 | fIdSens = 0; | |
94 | fNPhotons = 0; | |
95 | SetMarkerColor(kRed); | |
96 | } | |
97 | ||
98 | //_____________________________________________________________________________ | |
99 | AliSTART::~AliSTART() { | |
100 | if (fHits) { | |
101 | fHits->Delete(); | |
102 | delete fHits; | |
103 | } | |
104 | if (fPhotons) { | |
105 | fPhotons->Delete(); | |
106 | delete fPhotons; | |
107 | } | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
112 | { | |
113 | // | |
114 | // Add a START hit | |
115 | // | |
116 | TClonesArray &lhits = *fHits; | |
117 | new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits); | |
118 | } | |
119 | ||
120 | //_____________________________________________________________________________ | |
121 | void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits) | |
122 | { | |
123 | // Add a START hit of photons | |
124 | ||
125 | TClonesArray &lhits = *fPhotons; | |
126 | new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits); | |
127 | } | |
128 | ||
129 | //_____________________________________________________________________________ | |
130 | ||
131 | void AliSTART::AddDigit(Int_t *tracks,Int_t *digits) | |
132 | { | |
133 | ||
134 | // Add a START digit to the list. Dummy function. | |
135 | ||
136 | } | |
137 | ||
138 | //_____________________________________________________________________________ | |
139 | void AliSTART::BuildGeometry() | |
140 | { | |
141 | // | |
142 | // Build simple ROOT TNode geometry for event display | |
143 | // | |
144 | TNode *node, *top; | |
145 | const int kColorSTART = 19; | |
146 | ||
147 | top=gAlice->GetGeometry()->GetNode("alice"); | |
148 | ||
149 | // START define the different volumes | |
150 | new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0); | |
151 | ||
152 | new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3); | |
153 | top->cd(); | |
154 | node = new TNode("0ST1","0ST01","S_0ST1",0,0,69.7,""); | |
155 | node->SetLineColor(kColorSTART); | |
156 | fNodes->Add(node); | |
157 | ||
158 | new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3); | |
159 | top->cd(); | |
160 | node = new TNode("0ST2","0ST2","S_0ST2",0,0,-350,"rotx999"); | |
161 | node->SetLineColor(kColorSTART); | |
162 | fNodes->Add(node); | |
163 | } | |
164 | ||
165 | //_____________________________________________________________________________ | |
166 | Int_t AliSTART::DistanceToPrimitive(Int_t px, Int_t py) | |
167 | { | |
168 | // | |
169 | // Calculate the distance from the mouse to the START on the screen | |
170 | // Dummy routine | |
171 | // | |
172 | return 9999; | |
173 | } | |
174 | ||
175 | //------------------------------------------------------------------------- | |
176 | void AliSTART::Init() | |
177 | { | |
178 | // | |
179 | // Initialis the START after it has been built | |
180 | Int_t i; | |
181 | // | |
182 | if(fDebug) { | |
183 | printf("\n%s: ",ClassName()); | |
184 | for(i=0;i<35;i++) printf("*"); | |
185 | printf(" START_INIT "); | |
186 | for(i=0;i<35;i++) printf("*"); | |
187 | printf("\n%s: ",ClassName()); | |
188 | // | |
189 | // Here the START initialisation code (if any!) | |
190 | for(i=0;i<80;i++) printf("*"); | |
191 | printf("\n"); | |
192 | } | |
193 | } | |
194 | ||
195 | //--------------------------------------------------------------------------- | |
196 | void AliSTART::MakeBranch(Option_t* option) | |
197 | { | |
198 | // | |
199 | // Specific START branches | |
200 | // | |
201 | // Create Tree branches for the START. | |
202 | Int_t buffersize = 4000; | |
203 | char branchname[20]; | |
204 | sprintf(branchname,"%s",GetName()); | |
205 | ||
206 | ||
207 | const char *cD = strstr(option,"D"); | |
208 | const char *cH = strstr(option,"H"); | |
209 | ||
210 | if (cH && fLoader->TreeH()) | |
211 | { | |
212 | if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); | |
213 | sprintf (branchname, "%shitPhoton", GetName()); | |
214 | MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0); | |
215 | if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); | |
216 | } | |
217 | ||
218 | AliDetector::MakeBranch(option); | |
219 | ||
220 | if (cD) { | |
221 | digits = new AliSTARTdigit(); | |
222 | MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0); | |
223 | } | |
224 | } | |
225 | ||
226 | //_____________________________________________________________________________ | |
227 | void AliSTART::ResetHits() | |
228 | { | |
229 | AliDetector::ResetHits(); | |
230 | ||
231 | fNPhotons = 0; | |
232 | if (fPhotons) fPhotons->Clear(); | |
233 | } | |
234 | ||
235 | //_____________________________________________________________________________ | |
236 | void AliSTART::SetTreeAddress() | |
237 | { | |
238 | TBranch *branch; | |
239 | TTree *treeH; | |
240 | ||
241 | ||
242 | treeH = TreeH(); | |
243 | ||
244 | if (treeH) | |
245 | { | |
246 | if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); | |
247 | branch = treeH->GetBranch("STARThitPhoton"); | |
248 | if (branch) branch->SetAddress(&fPhotons); | |
249 | if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); | |
250 | } | |
251 | ||
252 | AliDetector::SetTreeAddress(); | |
253 | ||
254 | } | |
255 | ||
256 | ||
257 | //_____________________________________________________________________________ | |
258 | ||
259 | void AliSTART::Hit2digit(Int_t evnum) | |
260 | { | |
261 | } | |
262 |