]>
Commit | Line | Data |
---|---|---|
4c039060 | 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$ */ |
4c039060 | 17 | |
6ca40650 | 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 | ||
ef0750c2 | 40 | #include <Riostream.h> |
971579f6 | 41 | |
88cb7938 | 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> | |
affef71b | 50 | #include <AliESD.h> |
2ab0c725 | 51 | |
88cb7938 | 52 | #include "AliLoader.h" |
971579f6 | 53 | #include "AliRun.h" |
54 | #include "AliSTART.h" | |
55 | #include "AliSTARTdigit.h" | |
971579f6 | 56 | #include "AliSTARThit.h" |
e73d68f2 | 57 | #include "AliSTARThitPhoton.h" |
c345bb4f | 58 | #include "AliSTARTvertex.h" |
f1538e33 | 59 | #include "AliMC.h" |
85a5290f | 60 | #include "AliSTARTDigitizer.h" |
971579f6 | 61 | |
6ca40650 | 62 | ClassImp(AliSTART) |
ef51244a | 63 | |
f1538e33 | 64 | static AliSTARTdigit *digits; |
ef51244a | 65 | |
6ca40650 | 66 | //_____________________________________________________________________________ |
99560b47 | 67 | AliSTART::AliSTART() |
6ca40650 | 68 | { |
69 | // | |
70 | // Default constructor for class AliSTART | |
71 | // | |
f3ed336b | 72 | fIshunt = 1; |
971579f6 | 73 | fHits = 0; |
74 | fDigits = 0; | |
e73d68f2 | 75 | fPhotons = 0; |
6ca40650 | 76 | } |
77 | ||
78 | //_____________________________________________________________________________ | |
79 | AliSTART::AliSTART(const char *name, const char *title) | |
80 | : AliDetector(name,title) | |
81 | { | |
82 | // | |
83 | // Standard constructor for START Detector | |
84 | // | |
971579f6 | 85 | |
c345bb4f | 86 | |
6ca40650 | 87 | // |
88 | // Initialise Hit array | |
971579f6 | 89 | fHits = new TClonesArray("AliSTARThit", 405); |
f1538e33 | 90 | gAlice->GetMCApp()->AddHitList(fHits); |
e73d68f2 | 91 | |
92 | fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); | |
f1538e33 | 93 | gAlice->GetMCApp()->AddHitList (fPhotons); |
affef71b | 94 | if (GetDebug()>2) cout<<" Debug "<<endl; |
f3ed336b | 95 | fIshunt = 1; |
c345bb4f | 96 | fIdSens = 0; |
e73d68f2 | 97 | fNPhotons = 0; |
6ca40650 | 98 | SetMarkerColor(kRed); |
99 | } | |
bff160c8 | 100 | |
101 | //_____________________________________________________________________________ | |
102 | AliSTART::~AliSTART() { | |
103 | if (fHits) { | |
104 | fHits->Delete(); | |
105 | delete fHits; | |
106 | } | |
e73d68f2 | 107 | if (fPhotons) { |
108 | fPhotons->Delete(); | |
109 | delete fPhotons; | |
110 | } | |
bff160c8 | 111 | } |
6ca40650 | 112 | |
113 | //_____________________________________________________________________________ | |
114 | void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
115 | { | |
116 | // | |
117 | // Add a START hit | |
118 | // | |
119 | TClonesArray &lhits = *fHits; | |
120 | new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits); | |
121 | } | |
971579f6 | 122 | |
e73d68f2 | 123 | //_____________________________________________________________________________ |
124 | void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits) | |
125 | { | |
126 | // Add a START hit of photons | |
127 | ||
128 | TClonesArray &lhits = *fPhotons; | |
129 | new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits); | |
130 | } | |
131 | ||
971579f6 | 132 | //_____________________________________________________________________________ |
c345bb4f | 133 | |
f1538e33 | 134 | void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/) |
971579f6 | 135 | { |
c345bb4f | 136 | |
f3ed336b | 137 | // Add a START digit to the list. Dummy function. |
c345bb4f | 138 | |
971579f6 | 139 | } |
c345bb4f | 140 | |
6ca40650 | 141 | //_____________________________________________________________________________ |
142 | void AliSTART::BuildGeometry() | |
143 | { | |
144 | // | |
145 | // Build simple ROOT TNode geometry for event display | |
146 | // | |
ef51244a | 147 | TNode *node, *top; |
6ca40650 | 148 | const int kColorSTART = 19; |
f3ed336b | 149 | |
ef51244a | 150 | top=gAlice->GetGeometry()->GetNode("alice"); |
6ca40650 | 151 | |
152 | // START define the different volumes | |
44b06417 | 153 | new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0); |
6ca40650 | 154 | |
2ca99a7f | 155 | new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3); |
ef51244a | 156 | top->cd(); |
1663993c | 157 | node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,""); |
ef51244a | 158 | node->SetLineColor(kColorSTART); |
159 | fNodes->Add(node); | |
6ca40650 | 160 | |
2ca99a7f | 161 | new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3); |
ef51244a | 162 | top->cd(); |
1663993c | 163 | node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999"); |
ef51244a | 164 | node->SetLineColor(kColorSTART); |
165 | fNodes->Add(node); | |
6ca40650 | 166 | } |
167 | ||
168 | //_____________________________________________________________________________ | |
7fe81cad | 169 | Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/) |
6ca40650 | 170 | { |
171 | // | |
172 | // Calculate the distance from the mouse to the START on the screen | |
173 | // Dummy routine | |
174 | // | |
175 | return 9999; | |
176 | } | |
177 | ||
6ca40650 | 178 | //------------------------------------------------------------------------- |
179 | void AliSTART::Init() | |
180 | { | |
181 | // | |
182 | // Initialis the START after it has been built | |
183 | Int_t i; | |
6ca40650 | 184 | // |
9e1a0ddb | 185 | if(fDebug) { |
186 | printf("\n%s: ",ClassName()); | |
187 | for(i=0;i<35;i++) printf("*"); | |
188 | printf(" START_INIT "); | |
189 | for(i=0;i<35;i++) printf("*"); | |
190 | printf("\n%s: ",ClassName()); | |
191 | // | |
192 | // Here the START initialisation code (if any!) | |
193 | for(i=0;i<80;i++) printf("*"); | |
194 | printf("\n"); | |
195 | } | |
6ca40650 | 196 | } |
197 | ||
198 | //--------------------------------------------------------------------------- | |
88cb7938 | 199 | void AliSTART::MakeBranch(Option_t* option) |
6ca40650 | 200 | { |
ef51244a | 201 | // |
202 | // Specific START branches | |
203 | // | |
6ca40650 | 204 | // Create Tree branches for the START. |
f1538e33 | 205 | Int_t buffersize = 4000; |
e73d68f2 | 206 | char branchname[20]; |
6ca40650 | 207 | sprintf(branchname,"%s",GetName()); |
208 | ||
6ca40650 | 209 | |
f1538e33 | 210 | const char *cD = strstr(option,"D"); |
e73d68f2 | 211 | const char *cH = strstr(option,"H"); |
212 | ||
88cb7938 | 213 | if (cH && fLoader->TreeH()) |
e73d68f2 | 214 | { |
88cb7938 | 215 | if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); |
e73d68f2 | 216 | sprintf (branchname, "%shitPhoton", GetName()); |
88cb7938 | 217 | MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0); |
218 | if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); | |
e73d68f2 | 219 | } |
2ab0c725 | 220 | |
88cb7938 | 221 | AliDetector::MakeBranch(option); |
f1538e33 | 222 | |
2ab0c725 | 223 | if (cD) { |
224 | digits = new AliSTARTdigit(); | |
88cb7938 | 225 | MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0); |
2ab0c725 | 226 | } |
6ca40650 | 227 | } |
971579f6 | 228 | |
e73d68f2 | 229 | //_____________________________________________________________________________ |
230 | void AliSTART::ResetHits() | |
231 | { | |
232 | AliDetector::ResetHits(); | |
233 | ||
234 | fNPhotons = 0; | |
235 | if (fPhotons) fPhotons->Clear(); | |
236 | } | |
237 | ||
238 | //_____________________________________________________________________________ | |
239 | void AliSTART::SetTreeAddress() | |
240 | { | |
88cb7938 | 241 | TBranch *branch; |
242 | TTree *treeH; | |
243 | ||
244 | ||
245 | treeH = TreeH(); | |
e73d68f2 | 246 | |
247 | if (treeH) | |
e73d68f2 | 248 | { |
88cb7938 | 249 | if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); |
250 | branch = treeH->GetBranch("STARThitPhoton"); | |
251 | if (branch) branch->SetAddress(&fPhotons); | |
252 | if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); | |
e73d68f2 | 253 | } |
88cb7938 | 254 | |
255 | AliDetector::SetTreeAddress(); | |
256 | ||
e73d68f2 | 257 | } |
258 | ||
85a5290f | 259 | //_____________________________________________________________________________ |
c92eb8ad | 260 | AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f | 261 | { |
262 | return new AliSTARTDigitizer(manager); | |
263 | } | |
affef71b | 264 |