]>
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 | ||
16 | /* | |
17 | $Log$ | |
17b26de4 | 18 | Revision 1.36 2002/02/11 14:25:27 cblume |
19 | Geometry update, compressed hit structure | |
20 | ||
332e9569 | 21 | Revision 1.35 2001/11/14 12:08:44 cblume |
22 | Remove unneccessary header files | |
23 | ||
faea7205 | 24 | Revision 1.34 2001/11/14 10:50:45 cblume |
25 | Changes in digits IO. Add merging of summable digits | |
26 | ||
abaf1f1d | 27 | Revision 1.33 2001/11/06 17:19:41 cblume |
28 | Add detailed geometry and simple simulator | |
29 | ||
16bf9884 | 30 | Revision 1.32 2001/10/08 06:57:33 hristov |
31 | Branches for TRD digits are created only during the digitisation | |
32 | ||
aa9d00f0 | 33 | Revision 1.31 2001/08/30 09:30:30 hristov |
34 | The split level of branches is set to 99 | |
35 | ||
40c7ef21 | 36 | Revision 1.30 2001/05/28 17:07:58 hristov |
37 | Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh) | |
38 | ||
a819a5f7 | 39 | Revision 1.29 2001/05/21 16:45:47 hristov |
40 | Last minute changes (C.Blume) | |
41 | ||
db30bf0f | 42 | Revision 1.28 2001/05/16 14:57:27 alibrary |
43 | New files for folders and Stack | |
44 | ||
45 | Revision 1.27 2001/05/08 07:05:02 hristov | |
46 | Loop variable declared once (HP, Sun) | |
47 | ||
ea01d9e4 | 48 | Revision 1.26 2001/05/07 08:03:22 cblume |
49 | Generate also hits in the amplification region | |
50 | ||
f73816f5 | 51 | Revision 1.25 2001/03/13 09:30:35 cblume |
52 | Update of digitization. Moved digit branch definition to AliTRD | |
53 | ||
6244debe | 54 | Revision 1.24 2001/01/26 19:56:49 hristov |
55 | Major upgrade of AliRoot code | |
56 | ||
2ab0c725 | 57 | Revision 1.23 2000/11/01 14:53:20 cblume |
58 | Merge with TRD-develop | |
59 | ||
793ff80c | 60 | Revision 1.17.2.6 2000/10/15 23:29:08 cblume |
61 | Introduced more detailed geometry for the display | |
62 | ||
63 | Revision 1.17.2.5 2000/10/06 16:49:46 cblume | |
64 | Made Getters const | |
65 | ||
66 | Revision 1.17.2.4 2000/10/04 16:34:57 cblume | |
67 | Replace include files by forward declarations | |
68 | ||
69 | Revision 1.17.2.3 2000/09/22 14:45:17 cblume | |
70 | Included changes for the tracking | |
71 | ||
72 | Revision 1.17.2.2 2000/09/18 13:25:13 cblume | |
73 | Included LoadPoints() method to display the TR photons | |
74 | ||
75 | Revision 1.22 2000/10/02 21:28:19 fca | |
76 | Removal of useless dependecies via forward declarations | |
77 | ||
78 | Revision 1.21 2000/06/09 11:10:07 cblume | |
79 | Compiler warnings and coding conventions, next round | |
80 | ||
81 | Revision 1.20 2000/06/08 18:32:57 cblume | |
82 | Make code compliant to coding conventions | |
83 | ||
84 | Revision 1.19 2000/06/07 16:25:37 cblume | |
85 | Try to remove compiler warnings on Sun and HP | |
86 | ||
87 | Revision 1.18 2000/05/08 16:17:27 cblume | |
88 | Merge TRD-develop | |
89 | ||
94de3818 | 90 | Revision 1.21 2000/06/09 11:10:07 cblume |
91 | Compiler warnings and coding conventions, next round | |
92 | ||
dd9a6ee3 | 93 | Revision 1.20 2000/06/08 18:32:57 cblume |
94 | Make code compliant to coding conventions | |
95 | ||
8230f242 | 96 | Revision 1.19 2000/06/07 16:25:37 cblume |
97 | Try to remove compiler warnings on Sun and HP | |
98 | ||
9d0b222b | 99 | Revision 1.18 2000/05/08 16:17:27 cblume |
100 | Merge TRD-develop | |
101 | ||
6f1e466d | 102 | Revision 1.17.2.1 2000/05/08 14:28:59 cblume |
103 | Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray | |
104 | ||
105 | Revision 1.17 2000/02/28 19:10:26 cblume | |
106 | Include the new TRD classes | |
107 | ||
851d3db9 | 108 | Revision 1.16.2.2 2000/02/28 17:53:24 cblume |
109 | Introduce TRD geometry classes | |
110 | ||
111 | Revision 1.16.2.1 2000/02/28 17:04:19 cblume | |
112 | Include functions and data members for AliTRDrecPoint | |
113 | ||
114 | Revision 1.16 2000/01/19 17:17:35 fca | |
115 | Introducing a list of lists of hits -- more hits allowed for detector now | |
116 | ||
1cedd08a | 117 | Revision 1.15 1999/11/02 17:04:25 fca |
118 | Small syntax change for HP compiler | |
119 | ||
94c641ff | 120 | Revision 1.14 1999/11/02 16:57:02 fca |
121 | Avoid non ansi warnings on HP compilers | |
122 | ||
8459a454 | 123 | Revision 1.13 1999/11/02 16:35:56 fca |
124 | New version of TRD introduced | |
125 | ||
5c7f4665 | 126 | Revision 1.12 1999/11/01 20:41:51 fca |
127 | Added protections against using the wrong version of FRAME | |
128 | ||
ab76897d | 129 | Revision 1.11 1999/09/29 09:24:34 fca |
130 | Introduction of the Copyright and cvs Log | |
131 | ||
4c039060 | 132 | */ |
133 | ||
fe4da5cc | 134 | /////////////////////////////////////////////////////////////////////////////// |
135 | // // | |
136 | // Transition Radiation Detector // | |
137 | // This class contains the basic functions for the Transition Radiation // | |
6f1e466d | 138 | // Detector. // |
fe4da5cc | 139 | // // |
140 | /////////////////////////////////////////////////////////////////////////////// | |
141 | ||
5c7f4665 | 142 | #include <stdlib.h> |
2ab0c725 | 143 | #include <iostream.h> |
5c7f4665 | 144 | |
fe4da5cc | 145 | #include <TMath.h> |
fe4da5cc | 146 | #include <TNode.h> |
94de3818 | 147 | #include <TGeometry.h> |
793ff80c | 148 | #include <TTree.h> |
149 | #include <TPGON.h> | |
abaf1f1d | 150 | #include <TFile.h> |
151 | #include <TROOT.h> | |
332e9569 | 152 | #include <TParticle.h> |
fe4da5cc | 153 | |
fe4da5cc | 154 | #include "AliRun.h" |
d3f347ff | 155 | #include "AliConst.h" |
793ff80c | 156 | #include "AliDigit.h" |
157 | #include "AliMagF.h" | |
158 | #include "AliMC.h" | |
159 | ||
160 | #include "AliTRD.h" | |
161 | #include "AliTRDhit.h" | |
162 | #include "AliTRDpoints.h" | |
163 | #include "AliTRDdigit.h" | |
851d3db9 | 164 | #include "AliTRDdigitizer.h" |
165 | #include "AliTRDclusterizer.h" | |
166 | #include "AliTRDgeometryHole.h" | |
167 | #include "AliTRDgeometryFull.h" | |
168 | #include "AliTRDrecPoint.h" | |
f73816f5 | 169 | #include "AliTRDcluster.h" |
2ab0c725 | 170 | #include "AliTRDdigitsManager.h" |
332e9569 | 171 | #include "AliTRDtrackHits.h" |
793ff80c | 172 | |
fe4da5cc | 173 | ClassImp(AliTRD) |
174 | ||
175 | //_____________________________________________________________________________ | |
176 | AliTRD::AliTRD() | |
177 | { | |
178 | // | |
179 | // Default constructor | |
180 | // | |
82bbf98a | 181 | |
6244debe | 182 | fIshunt = 0; |
183 | fGasMix = 0; | |
184 | fHits = 0; | |
185 | fDigits = 0; | |
5c7f4665 | 186 | |
6244debe | 187 | fRecPoints = 0; |
188 | fNRecPoints = 0; | |
5c7f4665 | 189 | |
6244debe | 190 | fGeometry = 0; |
82bbf98a | 191 | |
6244debe | 192 | fGasDensity = 0; |
193 | fFoilDensity = 0; | |
793ff80c | 194 | |
6244debe | 195 | fDrawTR = 0; |
332e9569 | 196 | fDisplayType = 0; |
197 | ||
198 | fTrackHits = 0; | |
199 | fHitType = 0; | |
6244debe | 200 | |
fe4da5cc | 201 | } |
202 | ||
203 | //_____________________________________________________________________________ | |
204 | AliTRD::AliTRD(const char *name, const char *title) | |
205 | : AliDetector(name,title) | |
206 | { | |
207 | // | |
208 | // Standard constructor for the TRD | |
209 | // | |
210 | ||
5c7f4665 | 211 | // Check that FRAME is there otherwise we have no place where to |
212 | // put TRD | |
8230f242 | 213 | AliModule* frame = gAlice->GetModule("FRAME"); |
214 | if (!frame) { | |
5c7f4665 | 215 | Error("Ctor","TRD needs FRAME to be present\n"); |
216 | exit(1); | |
217 | } | |
218 | ||
219 | // Define the TRD geometry according to the FRAME geometry | |
8230f242 | 220 | if (frame->IsVersion() == 0) { |
851d3db9 | 221 | // Geometry with hole |
222 | fGeometry = new AliTRDgeometryHole(); | |
223 | } | |
8230f242 | 224 | else if (frame->IsVersion() == 1) { |
851d3db9 | 225 | // Geometry without hole |
226 | fGeometry = new AliTRDgeometryFull(); | |
227 | } | |
228 | else { | |
229 | Error("Ctor","Could not find valid FRAME version\n"); | |
230 | exit(1); | |
231 | } | |
5c7f4665 | 232 | |
fe4da5cc | 233 | // Allocate the hit array |
f73816f5 | 234 | fHits = new TClonesArray("AliTRDhit" ,405); |
1cedd08a | 235 | gAlice->AddHitList(fHits); |
99d5402e | 236 | |
237 | // Allocate the digits array | |
f73816f5 | 238 | fDigits = 0; |
5c7f4665 | 239 | |
851d3db9 | 240 | // Allocate the rec point array |
6244debe | 241 | fRecPoints = new TObjArray(400); |
242 | fNRecPoints = 0; | |
99d5402e | 243 | |
6244debe | 244 | fIshunt = 0; |
245 | fGasMix = 1; | |
793ff80c | 246 | |
6244debe | 247 | fGasDensity = 0; |
248 | fFoilDensity = 0; | |
793ff80c | 249 | |
6244debe | 250 | fDrawTR = 0; |
251 | fDisplayType = 0; | |
252 | ||
332e9569 | 253 | fTrackHits = 0; |
254 | fHitType = 2; | |
255 | ||
fe4da5cc | 256 | SetMarkerColor(kWhite); |
82bbf98a | 257 | |
fe4da5cc | 258 | } |
99d5402e | 259 | |
8230f242 | 260 | //_____________________________________________________________________________ |
dd9a6ee3 | 261 | AliTRD::AliTRD(const AliTRD &trd) |
8230f242 | 262 | { |
263 | // | |
264 | // Copy constructor | |
265 | // | |
266 | ||
dd9a6ee3 | 267 | ((AliTRD &) trd).Copy(*this); |
8230f242 | 268 | |
269 | } | |
270 | ||
99d5402e | 271 | //_____________________________________________________________________________ |
272 | AliTRD::~AliTRD() | |
273 | { | |
274 | // | |
275 | // TRD destructor | |
276 | // | |
277 | ||
278 | fIshunt = 0; | |
279 | ||
abaf1f1d | 280 | if (fGeometry) { |
281 | delete fGeometry; | |
332e9569 | 282 | fGeometry = 0; |
abaf1f1d | 283 | } |
284 | if (fHits) { | |
285 | delete fHits; | |
332e9569 | 286 | fHits = 0; |
abaf1f1d | 287 | } |
288 | if (fRecPoints) { | |
289 | delete fRecPoints; | |
332e9569 | 290 | fRecPoints = 0; |
291 | } | |
292 | if (fTrackHits) { | |
293 | delete fTrackHits; | |
294 | fTrackHits = 0; | |
6244debe | 295 | } |
5c7f4665 | 296 | |
297 | } | |
298 | ||
299 | //_____________________________________________________________________________ | |
f73816f5 | 300 | void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp |
a819a5f7 | 301 | , Int_t *tracks, Float_t sigmaY2, Int_t iType) |
5c7f4665 | 302 | { |
303 | // | |
f73816f5 | 304 | // Add a cluster for the TRD |
851d3db9 | 305 | // |
793ff80c | 306 | |
f73816f5 | 307 | Int_t pla = fGeometry->GetPlane(det); |
308 | Int_t cha = fGeometry->GetChamber(det); | |
309 | Int_t sec = fGeometry->GetSector(det); | |
310 | ||
311 | Float_t padRow = pos[0]; | |
312 | Float_t padCol = pos[1]; | |
313 | Float_t row0 = fGeometry->GetRow0(pla,cha,sec); | |
314 | Float_t col0 = fGeometry->GetCol0(pla); | |
315 | Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec); | |
316 | Float_t colSize = fGeometry->GetColPadSize(pla); | |
317 | ||
318 | AliTRDcluster *c = new AliTRDcluster(); | |
319 | ||
320 | c->SetDetector(det); | |
321 | c->AddTrackIndex(tracks); | |
99d5402e | 322 | |
f73816f5 | 323 | c->SetQ(amp); |
324 | ||
325 | c->SetLocalTimeBin(((Int_t) pos[2])); | |
17b26de4 | 326 | c->SetY(col0 + padCol * colSize); |
327 | c->SetZ(row0 + padRow * rowSize); | |
f73816f5 | 328 | |
a819a5f7 | 329 | c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize); |
f73816f5 | 330 | c->SetSigmaZ2(rowSize * rowSize / 12.); |
331 | ||
db30bf0f | 332 | switch (iType) { |
333 | case 0: | |
334 | c->Set2pad(); | |
335 | break; | |
336 | case 1: | |
337 | c->Set3pad(); | |
338 | break; | |
339 | case 2: | |
340 | c->Set4pad(); | |
341 | break; | |
342 | case 3: | |
343 | c->Set5pad(); | |
344 | break; | |
345 | case 4: | |
346 | c->SetLarge(); | |
347 | break; | |
348 | }; | |
793ff80c | 349 | |
f73816f5 | 350 | fRecPoints->Add(c); |
6f1e466d | 351 | |
99d5402e | 352 | } |
6244debe | 353 | |
354 | //_____________________________________________________________________________ | |
355 | void AliTRD::Hits2Digits() | |
2ab0c725 | 356 | { |
357 | // | |
358 | // Create digits | |
359 | // | |
6244debe | 360 | |
361 | AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer" | |
362 | ,"TRD digitizer class"); | |
332e9569 | 363 | digitizer->SetDebug(GetDebug()); |
9e1a0ddb | 364 | digitizer->SetEvent(gAlice->GetEvNumber()); |
abaf1f1d | 365 | |
6244debe | 366 | // Initialization |
db30bf0f | 367 | digitizer->InitDetector(); |
6244debe | 368 | |
369 | // Create the digits | |
370 | digitizer->MakeDigits(); | |
2ab0c725 | 371 | |
6244debe | 372 | // Write the digits into the input file |
abaf1f1d | 373 | if (digitizer->MakeBranch(fDigitsFile)) { |
6244debe | 374 | |
375 | digitizer->WriteDigits(); | |
376 | ||
377 | // Save the digitizer class in the AliROOT | |
378 | digitizer->Write(); | |
379 | ||
380 | } | |
381 | ||
382 | } | |
383 | ||
384 | //_____________________________________________________________________________ | |
385 | void AliTRD::Hits2SDigits() | |
386 | { | |
387 | // | |
388 | // Create summable digits | |
389 | // | |
390 | ||
391 | AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer" | |
392 | ,"TRD digitizer class"); | |
332e9569 | 393 | digitizer->SetDebug(GetDebug()); |
6244debe | 394 | |
395 | // For the summable digits | |
396 | digitizer->SetSDigits(kTRUE); | |
9e1a0ddb | 397 | digitizer->SetEvent(gAlice->GetEvNumber()); |
6244debe | 398 | |
399 | // Initialization | |
db30bf0f | 400 | digitizer->InitDetector(); |
2ab0c725 | 401 | |
abaf1f1d | 402 | // Create the TRD s-digits branch |
6244debe | 403 | digitizer->MakeDigits(); |
2ab0c725 | 404 | |
405 | // Write the digits into the input file | |
abaf1f1d | 406 | if (digitizer->MakeBranch(fDigitsFile)) { |
6244debe | 407 | |
408 | digitizer->WriteDigits(); | |
2ab0c725 | 409 | |
410 | // Save the digitizer class in the AliROOT | |
6244debe | 411 | digitizer->Write(); |
412 | ||
2ab0c725 | 413 | } |
6244debe | 414 | |
415 | } | |
416 | ||
417 | //_____________________________________________________________________________ | |
418 | void AliTRD::SDigits2Digits() | |
419 | { | |
420 | // | |
421 | // Create final digits from summable digits | |
422 | // | |
423 | ||
abaf1f1d | 424 | // Create the TRD digitizer |
425 | AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer" | |
426 | ,"TRD digitizer class"); | |
332e9569 | 427 | digitizer->SetDebug(GetDebug()); |
99d5402e | 428 | |
abaf1f1d | 429 | // Set the parameter |
430 | digitizer->SetEvent(gAlice->GetEvNumber()); | |
431 | ||
432 | // Initialization | |
433 | digitizer->InitDetector(); | |
434 | ||
435 | // Read the s-digits via digits manager | |
436 | AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager(); | |
332e9569 | 437 | sdigitsManager->SetDebug(GetDebug()); |
abaf1f1d | 438 | sdigitsManager->SetSDigits(kTRUE); |
439 | if (fDigitsFile) { | |
440 | sdigitsManager->Open(fDigitsFile); | |
441 | } | |
442 | sdigitsManager->CreateArrays(); | |
443 | sdigitsManager->ReadDigits(); | |
444 | ||
445 | // Add the s-digits to the input list | |
446 | digitizer->AddSDigitsManager(sdigitsManager); | |
99d5402e | 447 | |
abaf1f1d | 448 | // Convert the s-digits to normal digits |
449 | digitizer->SDigits2Digits(); | |
450 | ||
451 | // Store the digits | |
452 | if (digitizer->MakeBranch(fDigitsFile)) { | |
453 | ||
454 | digitizer->WriteDigits(); | |
455 | ||
456 | } | |
99d5402e | 457 | |
458 | } | |
459 | ||
fe4da5cc | 460 | //_____________________________________________________________________________ |
332e9569 | 461 | void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q |
462 | , Bool_t inDrift) | |
fe4da5cc | 463 | { |
464 | // | |
465 | // Add a hit for the TRD | |
332e9569 | 466 | // |
467 | // The data structure is set according to fHitType: | |
468 | // bit0: standard TClonesArray | |
469 | // bit1: compressed trackHits structure | |
fe4da5cc | 470 | // |
82bbf98a | 471 | |
332e9569 | 472 | if (fHitType & 1) { |
473 | TClonesArray &lhits = *fHits; | |
474 | new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q); | |
475 | } | |
476 | ||
477 | if (fHitType > 1) { | |
478 | AddHit2(track,det,hits,q,inDrift); | |
479 | } | |
82bbf98a | 480 | |
fe4da5cc | 481 | } |
482 | ||
483 | //_____________________________________________________________________________ | |
484 | void AliTRD::BuildGeometry() | |
485 | { | |
486 | // | |
487 | // Create the ROOT TNode geometry for the TRD | |
488 | // | |
82bbf98a | 489 | |
8230f242 | 490 | TNode *node, *top; |
fe4da5cc | 491 | TPGON *pgon; |
793ff80c | 492 | |
493 | Float_t rmin, rmax; | |
494 | Float_t zmax1, zmax2; | |
db30bf0f | 495 | |
496 | Int_t iPlan; | |
793ff80c | 497 | |
fe4da5cc | 498 | const Int_t kColorTRD = 46; |
d3f347ff | 499 | |
fe4da5cc | 500 | // Find the top node alice |
8230f242 | 501 | top = gAlice->GetGeometry()->GetNode("alice"); |
d3f347ff | 502 | |
db30bf0f | 503 | if (fDisplayType == 0) { |
793ff80c | 504 | |
505 | pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4); | |
506 | rmin = AliTRDgeometry::Rmin(); | |
507 | rmax = AliTRDgeometry::Rmax(); | |
508 | pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax); | |
509 | pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax); | |
510 | pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax); | |
511 | pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax); | |
512 | top->cd(); | |
513 | node = new TNode("TRD","TRD","S_TRD",0,0,0,""); | |
514 | node->SetLineColor(kColorTRD); | |
515 | fNodes->Add(node); | |
516 | ||
db30bf0f | 517 | } |
518 | else if (fDisplayType == 1) { | |
793ff80c | 519 | |
f73816f5 | 520 | Char_t name[7]; |
521 | ||
793ff80c | 522 | Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2()) |
523 | / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin()); | |
524 | ||
332e9569 | 525 | rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght(); |
526 | rmax = rmin + AliTRDgeometry::CdrHght(); | |
f73816f5 | 527 | |
528 | Float_t thickness = rmin - AliTRDgeometry::Rmin(); | |
529 | zmax2 = AliTRDgeometry::Zmax2() + slope * thickness; | |
793ff80c | 530 | zmax1 = zmax2 + slope * AliTRDgeometry::DrThick(); |
793ff80c | 531 | |
db30bf0f | 532 | for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { |
793ff80c | 533 | |
f73816f5 | 534 | sprintf(name,"S_TR1%d",iPlan); |
535 | pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4); | |
536 | pgon->DefineSection(0,-zmax1,rmax,rmax); | |
537 | pgon->DefineSection(1,-zmax2,rmin,rmax); | |
538 | pgon->DefineSection(2, zmax2,rmin,rmax); | |
539 | pgon->DefineSection(3, zmax1,rmax,rmax); | |
540 | top->cd(); | |
541 | node = new TNode("TRD","TRD",name,0,0,0,""); | |
542 | node->SetLineColor(kColorTRD); | |
543 | fNodes->Add(node); | |
544 | ||
545 | Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace(); | |
546 | rmin = rmin + height; | |
547 | rmax = rmax + height; | |
548 | zmax1 = zmax1 + slope * height; | |
549 | zmax2 = zmax2 + slope * height; | |
550 | ||
551 | } | |
552 | ||
553 | thickness += AliTRDgeometry::DrThick(); | |
554 | rmin = AliTRDgeometry::Rmin() + thickness; | |
555 | rmax = rmin + AliTRDgeometry::AmThick(); | |
556 | zmax2 = AliTRDgeometry::Zmax2() + slope * thickness; | |
557 | zmax1 = zmax2 + slope * AliTRDgeometry::AmThick(); | |
558 | ||
db30bf0f | 559 | for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { |
f73816f5 | 560 | |
561 | sprintf(name,"S_TR2%d",iPlan); | |
793ff80c | 562 | pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4); |
563 | pgon->DefineSection(0,-zmax1,rmax,rmax); | |
564 | pgon->DefineSection(1,-zmax2,rmin,rmax); | |
565 | pgon->DefineSection(2, zmax2,rmin,rmax); | |
566 | pgon->DefineSection(3, zmax1,rmax,rmax); | |
567 | top->cd(); | |
568 | node = new TNode("TRD","TRD",name,0,0,0,""); | |
569 | node->SetLineColor(kColorTRD); | |
570 | fNodes->Add(node); | |
571 | ||
572 | Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace(); | |
573 | rmin = rmin + height; | |
574 | rmax = rmax + height; | |
575 | zmax1 = zmax1 + slope * height; | |
576 | zmax2 = zmax2 + slope * height; | |
577 | ||
578 | } | |
579 | ||
db30bf0f | 580 | } |
d3f347ff | 581 | |
fe4da5cc | 582 | } |
583 | ||
8230f242 | 584 | //_____________________________________________________________________________ |
dd9a6ee3 | 585 | void AliTRD::Copy(TObject &trd) |
8230f242 | 586 | { |
587 | // | |
588 | // Copy function | |
589 | // | |
590 | ||
793ff80c | 591 | ((AliTRD &) trd).fGasMix = fGasMix; |
592 | ((AliTRD &) trd).fGeometry = fGeometry; | |
593 | ((AliTRD &) trd).fRecPoints = fRecPoints; | |
594 | ((AliTRD &) trd).fNRecPoints = fNRecPoints; | |
595 | ((AliTRD &) trd).fGasDensity = fGasDensity; | |
596 | ((AliTRD &) trd).fFoilDensity = fFoilDensity; | |
597 | ((AliTRD &) trd).fDrawTR = fDrawTR; | |
598 | ((AliTRD &) trd).fDisplayType = fDisplayType; | |
332e9569 | 599 | ((AliTRD &) trd).fHitType = fHitType; |
8230f242 | 600 | |
601 | //AliDetector::Copy(trd); | |
602 | ||
603 | } | |
604 | ||
fe4da5cc | 605 | //_____________________________________________________________________________ |
82bbf98a | 606 | void AliTRD::CreateGeometry() |
fe4da5cc | 607 | { |
82bbf98a | 608 | // |
609 | // Creates the volumes for the TRD chambers | |
610 | // | |
82bbf98a | 611 | |
612 | // Check that FRAME is there otherwise we have no place where to put the TRD | |
8230f242 | 613 | AliModule* frame = gAlice->GetModule("FRAME"); |
614 | if (!frame) { | |
851d3db9 | 615 | printf(" The TRD needs the FRAME to be defined first\n"); |
616 | return; | |
82bbf98a | 617 | } |
d3f347ff | 618 | |
851d3db9 | 619 | fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299); |
5c7f4665 | 620 | |
82bbf98a | 621 | } |
622 | ||
623 | //_____________________________________________________________________________ | |
624 | void AliTRD::CreateMaterials() | |
625 | { | |
fe4da5cc | 626 | // |
627 | // Create the materials for the TRD | |
628 | // Origin Y.Foka | |
629 | // | |
630 | ||
8230f242 | 631 | Int_t isxfld = gAlice->Field()->Integ(); |
632 | Float_t sxmgmx = gAlice->Field()->Max(); | |
fe4da5cc | 633 | |
d3f347ff | 634 | // For polyethilene (CH2) |
635 | Float_t ape[2] = { 12., 1. }; | |
636 | Float_t zpe[2] = { 6., 1. }; | |
637 | Float_t wpe[2] = { 1., 2. }; | |
638 | Float_t dpe = 0.95; | |
639 | ||
640 | // For mylar (C5H4O2) | |
641 | Float_t amy[3] = { 12., 1., 16. }; | |
642 | Float_t zmy[3] = { 6., 1., 8. }; | |
643 | Float_t wmy[3] = { 5., 4., 2. }; | |
fe4da5cc | 644 | Float_t dmy = 1.39; |
d3f347ff | 645 | |
646 | // For CO2 | |
647 | Float_t aco[2] = { 12., 16. }; | |
648 | Float_t zco[2] = { 6., 8. }; | |
649 | Float_t wco[2] = { 1., 2. }; | |
650 | Float_t dco = 0.001977; | |
651 | ||
652 | // For water | |
653 | Float_t awa[2] = { 1., 16. }; | |
654 | Float_t zwa[2] = { 1., 8. }; | |
655 | Float_t wwa[2] = { 2., 1. }; | |
656 | Float_t dwa = 1.0; | |
657 | ||
658 | // For isobutane (C4H10) | |
659 | Float_t ais[2] = { 12., 1. }; | |
660 | Float_t zis[2] = { 6., 1. }; | |
661 | Float_t wis[2] = { 4., 10. }; | |
662 | Float_t dis = 0.00267; | |
663 | ||
db30bf0f | 664 | // For plexiglas (C5H8O2) |
665 | Float_t apg[3] = { 12.011 , 1.0 , 15.9994 }; | |
666 | Float_t zpg[3] = { 6.0 , 1.0 , 8.0 }; | |
667 | Float_t wpg[3] = { 5.0 , 8.0 , 2.0 }; | |
668 | Float_t dpg = 1.18; | |
669 | ||
d3f347ff | 670 | // For Xe/CO2-gas-mixture |
db30bf0f | 671 | // Xe-content of the Xe/CO2-mixture (85% / 15%) |
672 | Float_t fxc = .85; | |
d3f347ff | 673 | // Xe-content of the Xe/Isobutane-mixture (97% / 3%) |
674 | Float_t fxi = .97; | |
fe4da5cc | 675 | Float_t dxe = .005858; |
676 | ||
d3f347ff | 677 | // General tracking parameter |
fe4da5cc | 678 | Float_t tmaxfd = -10.; |
679 | Float_t stemax = -1e10; | |
d3f347ff | 680 | Float_t deemax = -0.1; |
681 | Float_t epsil = 1e-4; | |
682 | Float_t stmin = -0.001; | |
fe4da5cc | 683 | |
684 | Float_t absl, radl, d, buf[1]; | |
793ff80c | 685 | Float_t agm[2], zgm[2], wgm[2]; |
686 | Float_t dgm1, dgm2; | |
d3f347ff | 687 | Int_t nbuf; |
fe4da5cc | 688 | |
d3f347ff | 689 | ////////////////////////////////////////////////////////////////////////// |
fe4da5cc | 690 | // Define Materials |
d3f347ff | 691 | ////////////////////////////////////////////////////////////////////////// |
692 | ||
16bf9884 | 693 | AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2); |
694 | AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0); | |
695 | AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0); | |
696 | AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8); | |
697 | AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4); | |
698 | AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0); | |
699 | AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8); | |
700 | AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2); | |
701 | AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0); | |
d3f347ff | 702 | |
703 | // Mixtures | |
db30bf0f | 704 | AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe); |
705 | AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy); | |
706 | AliMixture(8, "CO2", aco, zco, dco, -2, wco); | |
707 | AliMixture(9, "Isobutane", ais, zis, dis, -2, wis); | |
708 | AliMixture(13,"Water", awa, zwa, dwa, -2, wwa); | |
709 | AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg); | |
d3f347ff | 710 | |
711 | // Gas mixtures | |
82bbf98a | 712 | Char_t namate[21]; |
d3f347ff | 713 | // Xe/CO2-mixture |
714 | // Get properties of Xe | |
cfce8870 | 715 | gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf); |
d3f347ff | 716 | // Get properties of CO2 |
cfce8870 | 717 | gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf); |
d3f347ff | 718 | // Create gas mixture |
719 | wgm[0] = fxc; | |
720 | wgm[1] = 1. - fxc; | |
793ff80c | 721 | dgm1 = wgm[0] * dxe + wgm[1] * dco; |
db30bf0f | 722 | AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm); |
d3f347ff | 723 | // Xe/Isobutane-mixture |
724 | // Get properties of Xe | |
cfce8870 | 725 | gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf); |
d3f347ff | 726 | // Get properties of Isobutane |
cfce8870 | 727 | gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf); |
d3f347ff | 728 | // Create gas mixture |
729 | wgm[0] = fxi; | |
730 | wgm[1] = 1. - fxi; | |
793ff80c | 731 | dgm2 = wgm[0] * dxe + wgm[1] * dis; |
db30bf0f | 732 | AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm); |
d3f347ff | 733 | |
734 | ////////////////////////////////////////////////////////////////////////// | |
fe4da5cc | 735 | // Tracking Media Parameters |
d3f347ff | 736 | ////////////////////////////////////////////////////////////////////////// |
737 | ||
738 | // Al Frame | |
db30bf0f | 739 | AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx |
d3f347ff | 740 | , tmaxfd, stemax, deemax, epsil, stmin); |
741 | // Air | |
db30bf0f | 742 | AliMedium(2, "Air", 2, 0, isxfld, sxmgmx |
d3f347ff | 743 | , tmaxfd, stemax, deemax, epsil, stmin); |
744 | // Polyethilene | |
db30bf0f | 745 | AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx |
d3f347ff | 746 | , tmaxfd, stemax, deemax, epsil, stmin); |
747 | // Xe | |
db30bf0f | 748 | AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx |
d3f347ff | 749 | , tmaxfd, stemax, deemax, epsil, stmin); |
750 | // Cu pads | |
db30bf0f | 751 | AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx |
d3f347ff | 752 | , tmaxfd, stemax, deemax, epsil, stmin); |
753 | // Fee + cables | |
db30bf0f | 754 | AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx |
d3f347ff | 755 | , tmaxfd, stemax, deemax, epsil, stmin); |
756 | // C frame | |
db30bf0f | 757 | AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx |
d3f347ff | 758 | , tmaxfd, stemax, deemax, epsil, stmin); |
759 | // Mylar foils | |
db30bf0f | 760 | AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx |
d3f347ff | 761 | , tmaxfd, stemax, deemax, epsil, stmin); |
762 | if (fGasMix == 1) { | |
763 | // Gas-mixture (Xe/CO2) | |
db30bf0f | 764 | AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx |
d3f347ff | 765 | , tmaxfd, stemax, deemax, epsil, stmin); |
766 | } | |
767 | else { | |
768 | // Gas-mixture (Xe/Isobutane) | |
db30bf0f | 769 | AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx |
d3f347ff | 770 | , tmaxfd, stemax, deemax, epsil, stmin); |
771 | } | |
772 | // Nomex-honeycomb (use carbon for the time being) | |
db30bf0f | 773 | AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx |
d3f347ff | 774 | , tmaxfd, stemax, deemax, epsil, stmin); |
775 | // Kapton foils (use Mylar for the time being) | |
db30bf0f | 776 | AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx |
d3f347ff | 777 | , tmaxfd, stemax, deemax, epsil, stmin); |
778 | // Gas-filling of the radiator | |
db30bf0f | 779 | AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx |
d3f347ff | 780 | , tmaxfd, stemax, deemax, epsil, stmin); |
781 | // G10-plates | |
db30bf0f | 782 | AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx |
d3f347ff | 783 | , tmaxfd, stemax, deemax, epsil, stmin); |
784 | // Cooling water | |
db30bf0f | 785 | AliMedium(14, "Water", 13, 0, isxfld, sxmgmx |
786 | , tmaxfd, stemax, deemax, epsil, stmin); | |
787 | // Rohacell (plexiglas) for the radiator | |
788 | AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx | |
d3f347ff | 789 | , tmaxfd, stemax, deemax, epsil, stmin); |
16bf9884 | 790 | // Al layer in MCMs |
791 | AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx | |
792 | , tmaxfd, stemax, deemax, epsil, stmin); | |
793 | // Sn layer in MCMs | |
794 | AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx | |
795 | , tmaxfd, stemax, deemax, epsil, stmin); | |
796 | // Cu layer in MCMs | |
797 | AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx | |
798 | , tmaxfd, stemax, deemax, epsil, stmin); | |
799 | // G10 layer in MCMs | |
800 | AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx | |
801 | , tmaxfd, stemax, deemax, epsil, stmin); | |
802 | // Si in readout chips | |
803 | AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx | |
804 | , tmaxfd, stemax, deemax, epsil, stmin); | |
805 | // Epoxy in readout chips | |
806 | AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx | |
807 | , tmaxfd, stemax, deemax, epsil, stmin); | |
808 | // PE in connectors | |
809 | AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx | |
810 | , tmaxfd, stemax, deemax, epsil, stmin); | |
811 | // Cu in connectors | |
812 | AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx | |
813 | , tmaxfd, stemax, deemax, epsil, stmin); | |
814 | // Al of cooling pipes | |
815 | AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx | |
816 | , tmaxfd, stemax, deemax, epsil, stmin); | |
d3f347ff | 817 | |
793ff80c | 818 | // Save the density values for the TRD absorbtion |
819 | fFoilDensity = dmy; | |
820 | if (fGasMix == 1) | |
821 | fGasDensity = dgm1; | |
822 | else | |
823 | fGasDensity = dgm2; | |
824 | ||
fe4da5cc | 825 | } |
826 | ||
82bbf98a | 827 | //_____________________________________________________________________________ |
828 | void AliTRD::DrawModule() | |
829 | { | |
830 | // | |
831 | // Draw a shaded view of the Transition Radiation Detector version 0 | |
832 | // | |
833 | ||
834 | // Set everything unseen | |
835 | gMC->Gsatt("*" ,"SEEN",-1); | |
836 | ||
837 | // Set ALIC mother transparent | |
838 | gMC->Gsatt("ALIC","SEEN", 0); | |
839 | ||
840 | // Set the volumes visible | |
851d3db9 | 841 | if (fGeometry->IsVersion() == 0) { |
5c7f4665 | 842 | gMC->Gsatt("B071","SEEN", 0); |
843 | gMC->Gsatt("B074","SEEN", 0); | |
844 | gMC->Gsatt("B075","SEEN", 0); | |
845 | gMC->Gsatt("B077","SEEN", 0); | |
846 | gMC->Gsatt("BTR1","SEEN", 0); | |
847 | gMC->Gsatt("BTR2","SEEN", 0); | |
848 | gMC->Gsatt("BTR3","SEEN", 0); | |
332e9569 | 849 | gMC->Gsatt("UTR1","SEEN", 0); |
850 | gMC->Gsatt("UTR2","SEEN", 0); | |
851 | gMC->Gsatt("UTR3","SEEN", 0); | |
5c7f4665 | 852 | } |
853 | else { | |
854 | gMC->Gsatt("B071","SEEN", 0); | |
855 | gMC->Gsatt("B074","SEEN", 0); | |
856 | gMC->Gsatt("B075","SEEN", 0); | |
857 | gMC->Gsatt("B077","SEEN", 0); | |
858 | gMC->Gsatt("BTR1","SEEN", 0); | |
859 | gMC->Gsatt("BTR2","SEEN", 0); | |
860 | gMC->Gsatt("BTR3","SEEN", 0); | |
332e9569 | 861 | gMC->Gsatt("UTR1","SEEN", 0); |
6f1e466d | 862 | if (fGeometry->GetPHOShole()) |
332e9569 | 863 | gMC->Gsatt("UTR2","SEEN", 0); |
6f1e466d | 864 | if (fGeometry->GetRICHhole()) |
332e9569 | 865 | gMC->Gsatt("UTR3","SEEN", 0); |
5c7f4665 | 866 | } |
332e9569 | 867 | // gMC->Gsatt("UCII","SEEN", 0); |
868 | // gMC->Gsatt("UCIM","SEEN", 0); | |
869 | // gMC->Gsatt("UCIO","SEEN", 0); | |
870 | // gMC->Gsatt("UL02","SEEN", 1); | |
871 | // gMC->Gsatt("UL05","SEEN", 1); | |
872 | // gMC->Gsatt("UL06","SEEN", 1); | |
82bbf98a | 873 | |
874 | gMC->Gdopt("hide", "on"); | |
875 | gMC->Gdopt("shad", "on"); | |
876 | gMC->Gsatt("*", "fill", 7); | |
877 | gMC->SetClipBox("."); | |
878 | gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000); | |
879 | gMC->DefaultRange(); | |
880 | gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021); | |
881 | gMC->Gdhead(1111, "Transition Radiation Detector"); | |
882 | gMC->Gdman(18, 4, "MAN"); | |
883 | ||
884 | } | |
885 | ||
fe4da5cc | 886 | //_____________________________________________________________________________ |
887 | Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t ) | |
888 | { | |
889 | // | |
890 | // Distance between the mouse and the TRD detector on the screen | |
891 | // Dummy routine | |
82bbf98a | 892 | |
893 | return 9999; | |
894 | ||
fe4da5cc | 895 | } |
896 | ||
897 | //_____________________________________________________________________________ | |
898 | void AliTRD::Init() | |
899 | { | |
900 | // | |
851d3db9 | 901 | // Initialize the TRD detector after the geometry has been created |
fe4da5cc | 902 | // |
82bbf98a | 903 | |
5c7f4665 | 904 | Int_t i; |
851d3db9 | 905 | |
abaf1f1d | 906 | if (fDebug) { |
9e1a0ddb | 907 | printf("\n%s: ",ClassName()); |
908 | for (i = 0; i < 35; i++) printf("*"); | |
909 | printf(" TRD_INIT "); | |
910 | for (i = 0; i < 35; i++) printf("*"); | |
911 | printf("\n"); | |
912 | } | |
5c7f4665 | 913 | |
851d3db9 | 914 | if (fGeometry->IsVersion() == 0) { |
9e1a0ddb | 915 | printf("%s: Geometry for spaceframe with holes initialized\n",ClassName()); |
851d3db9 | 916 | } |
917 | else if (fGeometry->IsVersion() == 1) { | |
9e1a0ddb | 918 | printf("%s: Geometry for spaceframe without holes initialized\n",ClassName()); |
6f1e466d | 919 | if (fGeometry->GetPHOShole()) |
9e1a0ddb | 920 | printf("%s: Leave space in front of PHOS free\n",ClassName()); |
6f1e466d | 921 | if (fGeometry->GetRICHhole()) |
9e1a0ddb | 922 | printf("%s: Leave space in front of RICH free\n",ClassName()); |
5c7f4665 | 923 | } |
9e1a0ddb | 924 | |
abaf1f1d | 925 | if (fGasMix == 1) { |
db30bf0f | 926 | printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName()); |
abaf1f1d | 927 | } |
928 | else { | |
9e1a0ddb | 929 | printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName()); |
abaf1f1d | 930 | } |
5c7f4665 | 931 | |
932 | } | |
933 | ||
793ff80c | 934 | //_____________________________________________________________________________ |
935 | void AliTRD::LoadPoints(Int_t track) | |
936 | { | |
937 | // | |
938 | // Store x, y, z of all hits in memory. | |
939 | // Hit originating from TR photons are given a different color | |
940 | // | |
941 | ||
332e9569 | 942 | //if (!fDrawTR) { |
943 | // AliDetector::LoadPoints(track); | |
944 | // return; | |
945 | //} | |
793ff80c | 946 | |
332e9569 | 947 | if ((fHits == 0) && (fTrackHits == 0)) return; |
793ff80c | 948 | |
332e9569 | 949 | Int_t nhits; |
950 | if (fHitType < 2) { | |
951 | nhits = fHits->GetEntriesFast(); | |
952 | } | |
953 | else { | |
954 | nhits = fTrackHits->GetEntriesFast(); | |
955 | } | |
793ff80c | 956 | if (nhits == 0) return; |
957 | ||
958 | Int_t tracks = gAlice->GetNtrack(); | |
959 | if (fPoints == 0) fPoints = new TObjArray(tracks); | |
960 | ||
961 | AliTRDhit *ahit; | |
962 | ||
963 | Int_t *ntrkE = new Int_t[tracks]; | |
964 | Int_t *ntrkT = new Int_t[tracks]; | |
965 | Int_t *limiE = new Int_t[tracks]; | |
966 | Int_t *limiT = new Int_t[tracks]; | |
967 | Float_t **coorE = new Float_t*[tracks]; | |
968 | Float_t **coorT = new Float_t*[tracks]; | |
969 | for(Int_t i = 0; i < tracks; i++) { | |
970 | ntrkE[i] = 0; | |
971 | ntrkT[i] = 0; | |
972 | coorE[i] = 0; | |
973 | coorT[i] = 0; | |
974 | limiE[i] = 0; | |
975 | limiT[i] = 0; | |
976 | } | |
977 | ||
332e9569 | 978 | AliTRDpoints *points = 0; |
979 | Float_t *fp = 0; | |
980 | Int_t trk; | |
981 | Int_t chunk = nhits / 4 + 1; | |
793ff80c | 982 | |
983 | // Loop over all the hits and store their position | |
332e9569 | 984 | ahit = (AliTRDhit *) FirstHit(-1); |
985 | while (ahit) { | |
793ff80c | 986 | |
987 | // dEdx hits | |
332e9569 | 988 | if (ahit->GetCharge() >= 0) { |
793ff80c | 989 | |
990 | trk = ahit->GetTrack(); | |
991 | if (ntrkE[trk] == limiE[trk]) { | |
992 | // Initialise a new track | |
993 | fp = new Float_t[3*(limiE[trk]+chunk)]; | |
994 | if (coorE[trk]) { | |
995 | memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]); | |
996 | delete [] coorE[trk]; | |
997 | } | |
998 | limiE[trk] += chunk; | |
999 | coorE[trk] = fp; | |
1000 | } | |
1001 | else { | |
1002 | fp = coorE[trk]; | |
1003 | } | |
1004 | fp[3*ntrkE[trk] ] = ahit->X(); | |
1005 | fp[3*ntrkE[trk]+1] = ahit->Y(); | |
1006 | fp[3*ntrkE[trk]+2] = ahit->Z(); | |
1007 | ntrkE[trk]++; | |
1008 | ||
1009 | } | |
1010 | // TR photon hits | |
332e9569 | 1011 | else if ((ahit->GetCharge() < 0) && (fDrawTR)) { |
793ff80c | 1012 | |
1013 | trk = ahit->GetTrack(); | |
1014 | if (ntrkT[trk] == limiT[trk]) { | |
1015 | // Initialise a new track | |
1016 | fp = new Float_t[3*(limiT[trk]+chunk)]; | |
1017 | if (coorT[trk]) { | |
1018 | memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]); | |
1019 | delete [] coorT[trk]; | |
1020 | } | |
1021 | limiT[trk] += chunk; | |
1022 | coorT[trk] = fp; | |
1023 | } | |
1024 | else { | |
1025 | fp = coorT[trk]; | |
1026 | } | |
1027 | fp[3*ntrkT[trk] ] = ahit->X(); | |
1028 | fp[3*ntrkT[trk]+1] = ahit->Y(); | |
1029 | fp[3*ntrkT[trk]+2] = ahit->Z(); | |
1030 | ntrkT[trk]++; | |
1031 | ||
1032 | } | |
1033 | ||
332e9569 | 1034 | ahit = (AliTRDhit *) NextHit(); |
1035 | ||
793ff80c | 1036 | } |
1037 | ||
1038 | for (trk = 0; trk < tracks; ++trk) { | |
1039 | ||
1040 | if (ntrkE[trk] || ntrkT[trk]) { | |
1041 | ||
1042 | points = new AliTRDpoints(); | |
1043 | points->SetDetector(this); | |
1044 | points->SetParticle(trk); | |
1045 | ||
1046 | // Set the dEdx points | |
1047 | if (ntrkE[trk]) { | |
1048 | points->SetMarkerColor(GetMarkerColor()); | |
1049 | points->SetMarkerSize(GetMarkerSize()); | |
1050 | points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle()); | |
1051 | delete [] coorE[trk]; | |
1052 | coorE[trk] = 0; | |
1053 | } | |
1054 | ||
1055 | // Set the TR photon points | |
1056 | if (ntrkT[trk]) { | |
1057 | points->SetTRpoints(ntrkT[trk],coorT[trk]); | |
1058 | delete [] coorT[trk]; | |
1059 | coorT[trk] = 0; | |
1060 | } | |
1061 | ||
1062 | fPoints->AddAt(points,trk); | |
1063 | ||
1064 | } | |
1065 | ||
1066 | } | |
1067 | ||
1068 | delete [] coorE; | |
1069 | delete [] coorT; | |
1070 | delete [] ntrkE; | |
1071 | delete [] ntrkT; | |
1072 | delete [] limiE; | |
1073 | delete [] limiT; | |
1074 | ||
1075 | } | |
1076 | ||
5c7f4665 | 1077 | //_____________________________________________________________________________ |
9e1a0ddb | 1078 | void AliTRD::MakeBranch(Option_t* option, const char *file) |
5c7f4665 | 1079 | { |
1080 | // | |
abaf1f1d | 1081 | // Create Tree branches for the TRD digits. |
5c7f4665 | 1082 | // |
1083 | ||
abaf1f1d | 1084 | Int_t buffersize = 4000; |
1085 | Char_t branchname[15]; | |
1086 | sprintf(branchname,"%s",GetName()); | |
5c7f4665 | 1087 | |
aa9d00f0 | 1088 | const char *cD = strstr(option,"D"); |
1089 | ||
2ab0c725 | 1090 | AliDetector::MakeBranch(option,file); |
5c7f4665 | 1091 | |
abaf1f1d | 1092 | if (fDigits && gAlice->TreeD() && cD) { |
1093 | MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file); | |
1094 | } | |
1095 | ||
332e9569 | 1096 | if (fHitType > 1) { |
1097 | MakeBranch2(option,file); | |
1098 | } | |
1099 | ||
851d3db9 | 1100 | } |
1101 | ||
6244debe | 1102 | //_____________________________________________________________________________ |
1103 | void AliTRD::ResetDigits() | |
1104 | { | |
1105 | // | |
abaf1f1d | 1106 | // Reset number of digits and the digits array for this detector |
6244debe | 1107 | // |
1108 | ||
abaf1f1d | 1109 | fNdigits = 0; |
1110 | if (fDigits) fDigits->Clear(); | |
6244debe | 1111 | |
1112 | } | |
1113 | ||
851d3db9 | 1114 | //_____________________________________________________________________________ |
1115 | void AliTRD::ResetRecPoints() | |
1116 | { | |
1117 | // | |
1118 | // Reset number of reconstructed points and the point array | |
1119 | // | |
1120 | ||
f73816f5 | 1121 | if (fRecPoints) { |
793ff80c | 1122 | fNRecPoints = 0; |
1123 | Int_t nentr = fRecPoints->GetEntriesFast(); | |
f73816f5 | 1124 | for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i); |
793ff80c | 1125 | } |
5c7f4665 | 1126 | |
1127 | } | |
1128 | ||
1129 | //_____________________________________________________________________________ | |
1130 | void AliTRD::SetTreeAddress() | |
1131 | { | |
1132 | // | |
1133 | // Set the branch addresses for the trees. | |
1134 | // | |
1135 | ||
1136 | Char_t branchname[15]; | |
1137 | ||
1138 | AliDetector::SetTreeAddress(); | |
1139 | ||
1140 | TBranch *branch; | |
851d3db9 | 1141 | TTree *treeR = gAlice->TreeR(); |
1142 | ||
1143 | if (treeR) { | |
f73816f5 | 1144 | sprintf(branchname,"%scluster",GetName()); |
851d3db9 | 1145 | if (fRecPoints) { |
1146 | branch = treeR->GetBranch(branchname); | |
1147 | if (branch) { | |
1148 | branch->SetAddress(&fRecPoints); | |
1149 | } | |
5c7f4665 | 1150 | } |
1151 | } | |
1152 | ||
332e9569 | 1153 | if (fHitType > 0) { |
1154 | SetTreeAddress2(); | |
1155 | } | |
1156 | ||
fe4da5cc | 1157 | } |
1158 | ||
d3f347ff | 1159 | //_____________________________________________________________________________ |
b060c36f | 1160 | void AliTRD::SetGasMix(Int_t imix) |
d3f347ff | 1161 | { |
82bbf98a | 1162 | // |
1163 | // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2) | |
1164 | // | |
1165 | ||
d3f347ff | 1166 | if ((imix < 0) || (imix > 1)) { |
1167 | printf("Wrong input value: %d\n",imix); | |
1168 | printf("Use standard setting\n"); | |
6244debe | 1169 | fGasMix = 1; |
d3f347ff | 1170 | return; |
1171 | } | |
1172 | ||
1173 | fGasMix = imix; | |
1174 | ||
1175 | } | |
1176 | ||
793ff80c | 1177 | //_____________________________________________________________________________ |
1178 | void AliTRD::SetPHOShole() | |
1179 | { | |
1180 | // | |
1181 | // Selects a geometry with a hole in front of the PHOS | |
1182 | // | |
1183 | ||
1184 | fGeometry->SetPHOShole(); | |
1185 | ||
1186 | } | |
1187 | ||
1188 | //_____________________________________________________________________________ | |
1189 | void AliTRD::SetRICHhole() | |
1190 | { | |
1191 | // | |
1192 | // Selects a geometry with a hole in front of the RICH | |
1193 | // | |
1194 | ||
1195 | fGeometry->SetRICHhole(); | |
1196 | ||
1197 | } | |
1198 | ||
dd9a6ee3 | 1199 | //_____________________________________________________________________________ |
1200 | AliTRD &AliTRD::operator=(const AliTRD &trd) | |
1201 | { | |
1202 | // | |
1203 | // Assignment operator | |
1204 | // | |
1205 | ||
1206 | if (this != &trd) ((AliTRD &) trd).Copy(*this); | |
1207 | return *this; | |
1208 | ||
f73816f5 | 1209 | } |
abaf1f1d | 1210 | |
332e9569 | 1211 | //_____________________________________________________________________________ |
1212 | void AliTRD::FinishPrimary() | |
1213 | { | |
1214 | // | |
1215 | // Store the hits in the containers after all primaries are finished | |
1216 | // | |
1217 | ||
1218 | if (fTrackHits) { | |
1219 | fTrackHits->FlushHitStack(); | |
1220 | } | |
1221 | ||
1222 | } | |
1223 | ||
1224 | //_____________________________________________________________________________ | |
1225 | void AliTRD::RemapTrackHitIDs(Int_t *map) | |
1226 | { | |
1227 | // | |
1228 | // Remap the track IDs | |
1229 | // | |
1230 | ||
1231 | if (!fTrackHits) { | |
1232 | return; | |
1233 | } | |
1234 | ||
1235 | if (fTrackHits) { | |
1236 | TClonesArray *arr = fTrackHits->GetArray();; | |
1237 | for (Int_t i = 0; i < arr->GetEntriesFast(); i++){ | |
1238 | AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i)); | |
1239 | info->fTrackID = map[info->fTrackID]; | |
1240 | } | |
1241 | } | |
1242 | ||
1243 | } | |
1244 | ||
1245 | //_____________________________________________________________________________ | |
1246 | void AliTRD::ResetHits() | |
1247 | { | |
1248 | // | |
1249 | // Reset the hits | |
1250 | // | |
1251 | ||
1252 | AliDetector::ResetHits(); | |
1253 | if (fTrackHits) { | |
1254 | fTrackHits->Clear(); | |
1255 | } | |
1256 | ||
1257 | } | |
1258 | ||
1259 | //_____________________________________________________________________________ | |
1260 | AliHit* AliTRD::FirstHit(Int_t track) | |
1261 | { | |
1262 | // | |
1263 | // Return the first hit of a track | |
1264 | // | |
1265 | ||
1266 | if (fHitType > 1) { | |
1267 | return FirstHit2(track); | |
1268 | } | |
abaf1f1d | 1269 | |
332e9569 | 1270 | return AliDetector::FirstHit(track); |
abaf1f1d | 1271 | |
332e9569 | 1272 | } |
1273 | ||
1274 | //_____________________________________________________________________________ | |
1275 | AliHit* AliTRD::NextHit() | |
1276 | { | |
1277 | // | |
1278 | // Returns the next hit of a track | |
1279 | // | |
1280 | ||
1281 | if (fHitType > 1) { | |
1282 | return NextHit2(); | |
1283 | } | |
1284 | ||
1285 | return AliDetector::NextHit(); | |
1286 | ||
1287 | } | |
1288 | ||
1289 | //_____________________________________________________________________________ | |
1290 | AliHit* AliTRD::FirstHit2(Int_t track) | |
1291 | { | |
1292 | // | |
1293 | // Initializes the hit iterator. | |
1294 | // Returns the address of the first hit of a track. | |
1295 | // If <track> >= 0 the track is read from disk, | |
1296 | // while if <track> < 0 the first hit of the current | |
1297 | // track is returned. | |
1298 | // | |
1299 | ||
1300 | if (track >= 0) { | |
1301 | gAlice->ResetHits(); | |
1302 | gAlice->TreeH()->GetEvent(track); | |
1303 | } | |
1304 | ||
1305 | if (fTrackHits) { | |
1306 | fTrackHits->First(); | |
1307 | return (AliHit*) fTrackHits->GetHit(); | |
1308 | } | |
1309 | else { | |
1310 | return 0; | |
1311 | } | |
1312 | ||
1313 | } | |
1314 | ||
1315 | //_____________________________________________________________________________ | |
1316 | AliHit* AliTRD::NextHit2() | |
1317 | { | |
1318 | // | |
1319 | // Returns the next hit of the current track | |
1320 | // | |
1321 | ||
1322 | if (fTrackHits) { | |
1323 | fTrackHits->Next(); | |
1324 | return (AliHit *) fTrackHits->GetHit(); | |
1325 | } | |
1326 | else { | |
1327 | return 0; | |
1328 | } | |
1329 | ||
1330 | } | |
1331 | ||
1332 | //_____________________________________________________________________________ | |
1333 | void AliTRD::MakeBranch2(Option_t *option, const char *file) | |
1334 | { | |
1335 | // | |
1336 | // Create a new branch in the current Root tree. | |
1337 | // The branch of fHits is automatically split. | |
1338 | // | |
1339 | ||
1340 | if (fHitType < 2) { | |
1341 | return; | |
1342 | } | |
1343 | ||
1344 | char branchname[10]; | |
1345 | sprintf(branchname,"%s2",GetName()); | |
1346 | ||
1347 | // Get the pointer to the header | |
1348 | const char *cH = strstr(option,"H"); | |
1349 | ||
1350 | if (!fTrackHits) { | |
1351 | fTrackHits = new AliTRDtrackHits(); | |
1352 | } | |
1353 | ||
1354 | if (fTrackHits && gAlice->TreeH() && cH) { | |
1355 | ||
1356 | gAlice->TreeH()->Branch(branchname,"AliTRDtrackHits" | |
1357 | ,&fTrackHits | |
1358 | ,fBufferSize,99); | |
1359 | ||
1360 | if (GetDebug() > 1) { | |
1361 | printf("<AliTRD::MakeBranch2> Making Branch %s for trackhits\n" | |
1362 | ,branchname); | |
1363 | } | |
1364 | ||
1365 | const char folder[] = "RunMC/Event/Data"; | |
1366 | ||
1367 | if (GetDebug()) { | |
1368 | printf("<AliTRD::MakeBranch2> %15s: Publishing %s to %s\n" | |
1369 | ,ClassName(),branchname,folder); | |
1370 | } | |
1371 | ||
1372 | Publish(folder,&fTrackHits,branchname); | |
1373 | ||
1374 | if (file) { | |
1375 | TBranch *b = gAlice->TreeH()->GetBranch(branchname); | |
1376 | TDirectory *wd = gDirectory; | |
1377 | b->SetFile(file); | |
1378 | TIter next(b->GetListOfBranches()); | |
1379 | while ((b = (TBranch*) next())) { | |
1380 | b->SetFile(file); | |
1381 | } | |
1382 | wd->cd(); | |
1383 | if (GetDebug() > 1) { | |
1384 | printf("<AliTRD::MakeBranch2> Diverting branch %s to file %s\n" | |
1385 | ,branchname,file); | |
1386 | } | |
1387 | } | |
1388 | ||
1389 | } | |
1390 | ||
1391 | } | |
1392 | ||
1393 | //_____________________________________________________________________________ | |
1394 | void AliTRD::SetTreeAddress2() | |
1395 | { | |
1396 | // | |
1397 | // Set the branch address for the trackHits tree | |
1398 | // | |
1399 | ||
1400 | TBranch *branch; | |
1401 | ||
1402 | char branchname[20]; | |
1403 | ||
1404 | sprintf(branchname,"%s2",GetName()); | |
1405 | ||
1406 | // Branch address for hit tree | |
1407 | TTree *treeH = gAlice->TreeH(); | |
1408 | if ((treeH) && (fHitType > 0)) { | |
1409 | branch = treeH->GetBranch(branchname); | |
1410 | if (branch) { | |
1411 | branch->SetAddress(&fTrackHits); | |
1412 | } | |
1413 | } | |
1414 | ||
1415 | } | |
1416 | ||
1417 | //_____________________________________________________________________________ | |
1418 | void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q | |
1419 | , Bool_t inDrift) | |
1420 | { | |
1421 | // | |
1422 | // Add a hit to the list | |
1423 | // | |
1424 | ||
1425 | Int_t rtrack; | |
1426 | ||
1427 | if (fIshunt) { | |
1428 | Int_t primary = gAlice->GetPrimary(track); | |
1429 | gAlice->Particle(primary)->SetBit(kKeepBit); | |
1430 | rtrack = primary; | |
1431 | } | |
1432 | else { | |
1433 | rtrack = track; | |
1434 | gAlice->FlagTrack(track); | |
1435 | } | |
1436 | ||
1437 | if ((fTrackHits) && (fHitType > 0)) { | |
1438 | fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift); | |
1439 | } | |
1440 | ||
1441 | } | |
abaf1f1d | 1442 | |
1443 | ||
1444 | ||
1445 | ||
1446 | ||
1447 | ||
1448 | ||
1449 | ||
1450 | ||
1451 | ||
1452 | ||
1453 | ||
1454 | ||
1455 | ||
1456 | ||
1457 | ||
1458 | ||
1459 | ||
1460 | ||
1461 | ||
1462 | ||
1463 | ||
1464 | ||
1465 | ||
1466 | ||
1467 | ||
1468 | ||
1469 | ||
1470 | ||
1471 | ||
1472 | ||
1473 | ||
1474 | ||
1475 | ||
1476 | ||
1477 | ||
1478 | ||
1479 | ||
1480 | ||
1481 | ||
1482 | ||
1483 | ||
1484 | ||
1485 | ||
1486 | ||
1487 | ||
1488 | ||
1489 | ||
1490 | ||
1491 | ||
1492 | ||
1493 | ||
1494 | ||
1495 | ||
1496 | ||
1497 | ||
1498 | ||
1499 | ||
1500 | ||
1501 | ||
1502 | ||
1503 | ||
1504 | ||
1505 | ||
1506 | ||
1507 | ||
1508 | ||
1509 | ||
1510 | ||
1511 | ||
1512 | ||
1513 | ||
1514 | ||
1515 | ||
1516 | ||
1517 | ||
1518 | ||
1519 | ||
1520 | ||
1521 | ||
1522 | ||
1523 | ||
1524 | ||
1525 | ||
1526 | ||
1527 | ||
1528 | ||
1529 | ||
1530 | ||
1531 | ||
1532 | ||
1533 | ||
1534 | ||
1535 | ||
1536 | ||
1537 | ||
1538 | ||
1539 | ||
1540 | ||
1541 | ||
1542 | ||
1543 | ||
1544 | ||
1545 | ||
1546 | ||
1547 | ||
1548 | ||
1549 | ||
1550 | ||
1551 | ||
1552 | ||
1553 | ||
1554 | ||
1555 | ||
1556 | ||
1557 | ||
1558 | ||
1559 | ||
1560 | ||
1561 | ||
1562 | ||
1563 | ||
1564 | ||
1565 | ||
1566 | ||
1567 | ||
1568 | ||
1569 | ||
1570 | ||
1571 | ||
1572 | ||
1573 | ||
1574 | ||
1575 | ||
1576 | ||
1577 | ||
1578 | ||
1579 | ||
1580 | ||
1581 | ||
1582 | ||
1583 | ||
1584 | ||
1585 | ||
1586 | ||
1587 | ||
1588 | ||
1589 | ||
1590 | ||
1591 | ||
1592 | ||
1593 | ||
1594 | ||
1595 | ||
1596 | ||
1597 | ||
1598 | ||
1599 | ||
1600 | ||
1601 | ||
1602 | ||
1603 | ||
1604 | ||
1605 | ||
1606 | ||
1607 | ||
1608 | ||
1609 | ||
1610 | ||
1611 | ||
1612 | ||
1613 | ||
1614 | ||
1615 | ||
1616 | ||
1617 | ||
1618 | ||
1619 | ||
1620 | ||
1621 | ||
1622 | ||
1623 | ||
1624 | ||
1625 | ||
1626 | ||
1627 | ||
1628 | ||
1629 | ||
1630 | ||
1631 | ||
1632 | ||
1633 | ||
1634 | ||
1635 | ||
1636 | ||
1637 | ||
1638 | ||
1639 | ||
1640 | ||
1641 | ||
1642 | ||
1643 | ||
1644 | ||
1645 | ||
1646 | ||
1647 | ||
1648 | ||
1649 | ||
1650 | ||
1651 | ||
1652 | ||
1653 | ||
1654 | ||
1655 | ||
1656 | ||
1657 | ||
1658 | ||
1659 | ||
1660 | ||
1661 | ||
1662 | ||
1663 | ||
1664 | ||
1665 | ||
1666 | ||
1667 | ||
1668 | ||
1669 | ||
1670 | ||
1671 | ||
1672 | ||
1673 | ||
1674 | ||
1675 | ||
1676 | ||
1677 | ||
1678 | ||
1679 | ||
1680 | ||
1681 | ||
1682 | ||
1683 | ||
1684 | ||
1685 | ||
1686 | ||
1687 | ||
1688 | ||
1689 | ||
1690 | ||
1691 | ||
1692 | ||
1693 | ||
1694 | ||
1695 | ||
1696 | ||
1697 | ||
1698 | ||
1699 | ||
1700 | ||
1701 | ||
1702 | ||
1703 | ||
1704 | ||
1705 | ||
1706 | ||
1707 | ||
1708 | ||
1709 | ||
1710 | ||
1711 | ||
1712 | ||
1713 | ||
1714 | ||
1715 | ||
1716 | ||
1717 | ||
1718 | ||
1719 | ||
1720 | ||
1721 | ||
1722 | ||
1723 | ||
1724 | ||
1725 | ||
1726 | ||
1727 | ||
1728 | ||
1729 | ||
1730 | ||
1731 | ||
1732 | ||
1733 | ||
1734 | ||
1735 | ||
1736 | ||
1737 | ||
1738 | ||
1739 | ||
1740 | ||
1741 | ||
1742 | ||
1743 | ||
1744 | ||
1745 | ||
1746 | ||
1747 | ||
1748 | ||
1749 | ||
1750 | ||
1751 | ||
1752 | ||
1753 | ||
1754 | ||
1755 | ||
1756 | ||
1757 | ||
1758 | ||
1759 | ||
1760 | ||
1761 | ||
1762 | ||
1763 | ||
1764 | ||
1765 | ||
1766 | ||
1767 | ||
1768 | ||
1769 | ||
1770 | ||
1771 | ||
1772 | ||
1773 | ||
1774 | ||
1775 | ||
1776 | ||
1777 | ||
1778 | ||
1779 | ||
1780 |