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