]>
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 | |
e4da63c2 | 52 | #include "AliLog.h" |
53 | #include "AliMC.h" | |
88cb7938 | 54 | #include "AliLoader.h" |
971579f6 | 55 | #include "AliRun.h" |
db173afc | 56 | #include "TClonesArray.h" |
971579f6 | 57 | #include "AliSTART.h" |
6fc133d2 | 58 | #include "AliSTARTLoader.h" |
971579f6 | 59 | #include "AliSTARTdigit.h" |
971579f6 | 60 | #include "AliSTARThit.h" |
85a5290f | 61 | #include "AliSTARTDigitizer.h" |
e4da63c2 | 62 | #include "AliSTARTRawData.h" |
db173afc | 63 | #include "AliSTARTRecPoint.h" |
4951e003 | 64 | #include "AliLog.h" |
971579f6 | 65 | |
6ca40650 | 66 | ClassImp(AliSTART) |
ef51244a | 67 | |
e4da63c2 | 68 | //static AliSTARTdigit *digits; |
ef51244a | 69 | |
6ca40650 | 70 | //_____________________________________________________________________________ |
99560b47 | 71 | AliSTART::AliSTART() |
51f1bdcf | 72 | : AliDetector(), fIdSens(0), fDigits(NULL), fRecPoints(NULL) |
6ca40650 | 73 | { |
74 | // | |
75 | // Default constructor for class AliSTART | |
76 | // | |
f3ed336b | 77 | fIshunt = 1; |
971579f6 | 78 | fHits = 0; |
79 | fDigits = 0; | |
db173afc | 80 | fRecPoints = 0; |
6ca40650 | 81 | } |
82 | ||
83 | //_____________________________________________________________________________ | |
84 | AliSTART::AliSTART(const char *name, const char *title) | |
51f1bdcf | 85 | : AliDetector(name,title), fIdSens(0), fDigits(new AliSTARTdigit()), fRecPoints(new AliSTARTRecPoint()) |
6ca40650 | 86 | { |
87 | // | |
88 | // Standard constructor for START Detector | |
89 | // | |
971579f6 | 90 | |
c345bb4f | 91 | |
6ca40650 | 92 | // |
93 | // Initialise Hit array | |
971579f6 | 94 | fHits = new TClonesArray("AliSTARThit", 405); |
f1538e33 | 95 | gAlice->GetMCApp()->AddHitList(fHits); |
51f1bdcf | 96 | // fDigits = new AliSTARTdigit(); |
97 | // fRecPoints = new AliSTARTRecPoint(); | |
f3ed336b | 98 | fIshunt = 1; |
51f1bdcf | 99 | // fIdSens = 0; |
6ca40650 | 100 | SetMarkerColor(kRed); |
101 | } | |
bff160c8 | 102 | |
103 | //_____________________________________________________________________________ | |
104 | AliSTART::~AliSTART() { | |
db173afc | 105 | |
bff160c8 | 106 | if (fHits) { |
107 | fHits->Delete(); | |
108 | delete fHits; | |
db173afc | 109 | } |
110 | /* | |
111 | if (fDigits) { | |
112 | fDigits->Delete(); | |
113 | delete fDigits; | |
114 | cout<<" delete fDigits; "<<endl; | |
bff160c8 | 115 | } |
db173afc | 116 | if (fRecPoints) { |
117 | fRecPoints ->Delete(); | |
118 | delete fRecPoints; | |
119 | cout<<" delete fRecPoints; "<<endl; | |
120 | } | |
121 | */ | |
bff160c8 | 122 | } |
70d2c4a2 | 123 | |
124 | //______________________________________________________________________________ | |
125 | AliSTART::AliSTART(const AliSTART &source): | |
126 | AliDetector(source) | |
127 | { | |
128 | // Copy constructor | |
129 | // not implemented | |
130 | AliWarning("Copy constructor not implemented!"); | |
131 | } | |
132 | ||
133 | //______________________________________________________________________________ | |
134 | AliSTART& AliSTART::operator= (const AliSTART& source) | |
135 | { | |
136 | // Asignment operator | |
137 | // not implemented | |
138 | if(this==&source) return *this; | |
139 | ||
140 | AliWarning("Asignment operator not implemented!"); | |
141 | ||
142 | ((TObject *)this)->operator=(source); | |
143 | ||
144 | return *this; | |
145 | } | |
6ca40650 | 146 | |
147 | //_____________________________________________________________________________ | |
148 | void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
149 | { | |
150 | // | |
151 | // Add a START hit | |
152 | // | |
153 | TClonesArray &lhits = *fHits; | |
154 | new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits); | |
155 | } | |
971579f6 | 156 | |
e73d68f2 | 157 | |
971579f6 | 158 | //_____________________________________________________________________________ |
c345bb4f | 159 | |
db173afc | 160 | void AliSTART::AddDigit(Int_t besttimeright, Int_t besttimeleft, Int_t meantime, |
e3f84715 | 161 | Int_t timediff, Int_t sumMult, |
db173afc | 162 | TArrayI *time, TArrayI *adc, TArrayI *timeAmp, TArrayI *adcAmp) |
971579f6 | 163 | { |
c345bb4f | 164 | |
db173afc | 165 | // Add a START digit to the list. |
166 | // | |
c345bb4f | 167 | |
db173afc | 168 | if (!fDigits) { |
169 | fDigits = new AliSTARTdigit(); | |
170 | } | |
171 | fDigits-> SetTimeBestRight(besttimeright); | |
172 | fDigits->SetTimeBestLeft(besttimeleft); | |
173 | fDigits-> SetMeanTime(meantime); | |
174 | fDigits-> SetDiffTime(timediff); | |
e3f84715 | 175 | fDigits-> SetSumMult(sumMult); |
db173afc | 176 | fDigits->SetTime(*time); |
177 | fDigits->SetTimeAmp(*timeAmp); | |
178 | fDigits->SetADC(*adc); | |
179 | fDigits->SetADCAmp(*adcAmp); | |
971579f6 | 180 | } |
c345bb4f | 181 | |
db173afc | 182 | |
6ca40650 | 183 | //_____________________________________________________________________________ |
184 | void AliSTART::BuildGeometry() | |
185 | { | |
186 | // | |
187 | // Build simple ROOT TNode geometry for event display | |
188 | // | |
ef51244a | 189 | TNode *node, *top; |
6ca40650 | 190 | const int kColorSTART = 19; |
f3ed336b | 191 | |
ef51244a | 192 | top=gAlice->GetGeometry()->GetNode("alice"); |
6ca40650 | 193 | |
194 | // START define the different volumes | |
44b06417 | 195 | new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0); |
6ca40650 | 196 | |
2ca99a7f | 197 | new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3); |
ef51244a | 198 | top->cd(); |
1663993c | 199 | node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,""); |
ef51244a | 200 | node->SetLineColor(kColorSTART); |
201 | fNodes->Add(node); | |
6ca40650 | 202 | |
2ca99a7f | 203 | new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3); |
ef51244a | 204 | top->cd(); |
1663993c | 205 | node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999"); |
ef51244a | 206 | node->SetLineColor(kColorSTART); |
207 | fNodes->Add(node); | |
6ca40650 | 208 | } |
209 | ||
210 | //_____________________________________________________________________________ | |
7fe81cad | 211 | Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/) |
6ca40650 | 212 | { |
213 | // | |
214 | // Calculate the distance from the mouse to the START on the screen | |
215 | // Dummy routine | |
216 | // | |
217 | return 9999; | |
218 | } | |
219 | ||
6ca40650 | 220 | //------------------------------------------------------------------------- |
221 | void AliSTART::Init() | |
222 | { | |
223 | // | |
224 | // Initialis the START after it has been built | |
225 | Int_t i; | |
6ca40650 | 226 | // |
4951e003 | 227 | if(AliLog::GetGlobalDebugLevel()>0) { |
9e1a0ddb | 228 | printf("\n%s: ",ClassName()); |
229 | for(i=0;i<35;i++) printf("*"); | |
230 | printf(" START_INIT "); | |
231 | for(i=0;i<35;i++) printf("*"); | |
232 | printf("\n%s: ",ClassName()); | |
233 | // | |
234 | // Here the START initialisation code (if any!) | |
235 | for(i=0;i<80;i++) printf("*"); | |
236 | printf("\n"); | |
237 | } | |
6ca40650 | 238 | } |
239 | ||
240 | //--------------------------------------------------------------------------- | |
88cb7938 | 241 | void AliSTART::MakeBranch(Option_t* option) |
6ca40650 | 242 | { |
ef51244a | 243 | // |
db173afc | 244 | // Create Tree branches for the START. |
245 | ||
246 | // Options: | |
247 | // | |
248 | // H Make a branch of TClonesArray of AliSTARTHit's | |
249 | // D Make a branch of TClonesArray of AliSTARTDigit's | |
250 | // | |
251 | // R Make a branch of AliSTARTRecPoints | |
ef51244a | 252 | // |
e73d68f2 | 253 | char branchname[20]; |
6ca40650 | 254 | sprintf(branchname,"%s",GetName()); |
255 | ||
e73d68f2 | 256 | const char *cH = strstr(option,"H"); |
db173afc | 257 | const char *cD = strstr(option,"D"); |
258 | const char *cR = strstr(option,"R"); | |
259 | ||
260 | if (cH && fLoader->TreeH()) | |
e73d68f2 | 261 | { |
88cb7938 | 262 | if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); |
db173afc | 263 | AliDetector::MakeBranch(option); |
e73d68f2 | 264 | } |
db173afc | 265 | |
266 | ||
267 | if (cD && fLoader->TreeD()) | |
268 | { | |
269 | if (fDigits == 0x0) fDigits = new AliSTARTdigit(); | |
270 | // MakeBranchInTree(fLoader->TreeD(), branchname, | |
271 | // &fDigits, 405, 0); | |
272 | fLoader->TreeD()->Branch(branchname,"AliSTARTdigit",&fDigits,405,1); | |
e3f84715 | 273 | // fLoader->TreeD()->Print(); |
db173afc | 274 | } |
275 | if (cR && fLoader->TreeR()) | |
276 | { | |
277 | if (fRecPoints == 0x0) fRecPoints = new AliSTARTRecPoint(); | |
278 | MakeBranchInTree(fLoader->TreeR(), branchname, | |
279 | &fRecPoints, 405, 0); | |
280 | } | |
2ab0c725 | 281 | |
6ca40650 | 282 | } |
971579f6 | 283 | |
e73d68f2 | 284 | //_____________________________________________________________________________ |
285 | void AliSTART::ResetHits() | |
286 | { | |
287 | AliDetector::ResetHits(); | |
288 | ||
e73d68f2 | 289 | } |
db173afc | 290 | //____________________________________________________________________ |
291 | void AliSTART::ResetDigits() | |
292 | { | |
293 | // | |
294 | // Reset number of digits and the digits array for this detector | |
295 | // | |
296 | if (fDigits) fDigits->Clear(); | |
297 | } | |
e73d68f2 | 298 | |
299 | //_____________________________________________________________________________ | |
300 | void AliSTART::SetTreeAddress() | |
301 | { | |
e4da63c2 | 302 | |
88cb7938 | 303 | TTree *treeH; |
88cb7938 | 304 | treeH = TreeH(); |
e73d68f2 | 305 | |
306 | if (treeH) | |
e73d68f2 | 307 | { |
88cb7938 | 308 | if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405); |
e73d68f2 | 309 | } |
88cb7938 | 310 | |
311 | AliDetector::SetTreeAddress(); | |
db173afc | 312 | TTree *treeD = fLoader->TreeD(); |
313 | if (treeD) { | |
314 | if (fDigits == 0x0) fDigits = new AliSTARTdigit(); | |
315 | TBranch* branch = treeD->GetBranch ("START"); | |
316 | if (branch) branch->SetAddress(&fDigits); | |
317 | } | |
318 | ||
319 | TTree *treeR = fLoader->TreeR(); | |
320 | if (treeR) { | |
321 | if (fRecPoints == 0x0) fRecPoints = new AliSTARTRecPoint() ; | |
322 | TBranch* branch = treeR->GetBranch ("START"); | |
323 | if (branch) branch->SetAddress(&fRecPoints); | |
324 | } | |
325 | ||
e73d68f2 | 326 | } |
327 | ||
e4da63c2 | 328 | |
db173afc | 329 | //_____________________________________________________________________________ |
330 | void AliSTART::MakeBranchInTreeD(TTree *treeD, const char *file) | |
331 | { | |
332 | // | |
333 | // Create TreeD branches for the FMD | |
334 | // | |
335 | const Int_t kBufferSize = 4000; | |
336 | char branchname[20]; | |
337 | sprintf(branchname,"%s",GetName()); | |
338 | if(treeD) | |
339 | { | |
340 | MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file); | |
341 | } | |
6fc133d2 | 342 | } |
343 | ||
85a5290f | 344 | //_____________________________________________________________________________ |
c92eb8ad | 345 | AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f | 346 | { |
347 | return new AliSTARTDigitizer(manager); | |
348 | } | |
e4da63c2 | 349 | //____________________________________________________________________________ |
350 | void AliSTART::Digits2Raw() | |
351 | { | |
352 | // | |
353 | // Starting from the START digits, writes the Raw Data objects | |
354 | // | |
db173afc | 355 | // AliSTARTLoader* pStartLoader = (AliSTARTLoader*)fLoader; |
356 | fLoader ->LoadDigits("read"); | |
357 | TTree* treeD = fLoader->TreeD(); | |
358 | if (!treeD) { | |
359 | AliError("no digits tree"); | |
360 | return; | |
361 | } | |
362 | if (fDigits == 0x0) fDigits = new AliSTARTdigit(); | |
363 | ||
364 | TBranch *branch = treeD->GetBranch("START"); | |
365 | if (branch) { | |
366 | branch->SetAddress(&fDigits); | |
367 | }else{ | |
368 | AliError("Branch START DIGIT not found"); | |
369 | exit(111); | |
370 | } | |
e4da63c2 | 371 | AliSTARTRawData rawWriter; |
372 | rawWriter.SetVerbose(0); | |
db173afc | 373 | |
e4da63c2 | 374 | AliDebug(2,Form(" Formatting raw data for START ")); |
db173afc | 375 | branch->GetEntry(0); |
376 | // rawWriter.RawDataSTART(treeD->GetBranch("START")); | |
377 | rawWriter.RawDataSTART(fDigits); | |
378 | ||
379 | ||
380 | fLoader->UnloadDigits(); | |
e4da63c2 | 381 | |
e4da63c2 | 382 | } |