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