]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
4c039060 | 17 | |
fe4da5cc | 18 | /////////////////////////////////////////////////////////////////////////////// |
19 | // // | |
5c7f4665 | 20 | // Transition Radiation Detector version 0 -- fast simulator // |
fe4da5cc | 21 | // // |
22 | //Begin_Html | |
23 | /* | |
5c7f4665 | 24 | <img src="picts/AliTRDfullClass.gif"> |
fe4da5cc | 25 | */ |
26 | //End_Html | |
27 | // // | |
28 | // // | |
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | ||
332e9569 | 31 | #include <stdlib.h> |
32 | ||
88cb7938 | 33 | #include <TLorentzVector.h> |
fe4da5cc | 34 | #include <TMath.h> |
35 | #include <TRandom.h> | |
1819f4bb | 36 | #include <TVector.h> |
88cb7938 | 37 | #include <TVirtualMC.h> |
fe4da5cc | 38 | |
fe4da5cc | 39 | #include "AliConst.h" |
88cb7938 | 40 | #include "AliRun.h" |
851d3db9 | 41 | #include "AliTRDgeometry.h" |
88cb7938 | 42 | #include "AliTRDhit.h" |
43 | #include "AliTRDv0.h" | |
5d12ce38 | 44 | #include "AliMC.h" |
fe4da5cc | 45 | |
851d3db9 | 46 | ClassImp(AliTRDv0) |
8230f242 | 47 | |
48 | //_____________________________________________________________________________ | |
49 | AliTRDv0::AliTRDv0():AliTRD() | |
50 | { | |
51 | // | |
52 | // AliTRDv0 default constructor | |
53 | // | |
54 | ||
8230f242 | 55 | fHitsOn = 0; |
56 | ||
8230f242 | 57 | } |
58 | ||
fe4da5cc | 59 | //_____________________________________________________________________________ |
60 | AliTRDv0::AliTRDv0(const char *name, const char *title) | |
61 | :AliTRD(name, title) | |
62 | { | |
63 | // | |
64 | // Standard constructor for Transition Radiation Detector version 0 | |
65 | // | |
82bbf98a | 66 | |
82bbf98a | 67 | fHitsOn = 0; |
68 | ||
fe4da5cc | 69 | } |
851d3db9 | 70 | |
8230f242 | 71 | //_____________________________________________________________________________ |
72 | AliTRDv0::~AliTRDv0() | |
73 | { | |
74 | // | |
75 | // AliTRDv0 destructor | |
76 | // | |
77 | ||
78 | } | |
79 | ||
fe4da5cc | 80 | //_____________________________________________________________________________ |
81 | void AliTRDv0::CreateGeometry() | |
82 | { | |
83 | // | |
82bbf98a | 84 | // Create the GEANT geometry for the Transition Radiation Detector - Version 0 |
85 | // This version covers the full azimuth. | |
d3f347ff | 86 | // |
d3f347ff | 87 | |
82bbf98a | 88 | // Check that FRAME is there otherwise we have no place where to put the TRD |
8230f242 | 89 | AliModule* frame = gAlice->GetModule("FRAME"); |
90 | if (!frame) return; | |
fe4da5cc | 91 | |
82bbf98a | 92 | // Define the chambers |
93 | AliTRD::CreateGeometry(); | |
fe4da5cc | 94 | |
fe4da5cc | 95 | } |
96 | ||
97 | //_____________________________________________________________________________ | |
98 | void AliTRDv0::CreateMaterials() | |
99 | { | |
100 | // | |
101 | // Create materials for the Transition Radiation Detector | |
102 | // | |
82bbf98a | 103 | |
fe4da5cc | 104 | AliTRD::CreateMaterials(); |
82bbf98a | 105 | |
fe4da5cc | 106 | } |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | void AliTRDv0::Init() | |
110 | { | |
111 | // | |
851d3db9 | 112 | // Initialize Transition Radiation Detector after geometry is built |
fe4da5cc | 113 | // |
82bbf98a | 114 | |
fe4da5cc | 115 | AliTRD::Init(); |
82bbf98a | 116 | |
851d3db9 | 117 | printf(" Fast simulator\n\n"); |
5c7f4665 | 118 | for (Int_t i = 0; i < 80; i++) printf("*"); |
119 | printf("\n"); | |
120 | ||
fe4da5cc | 121 | } |
122 | ||
123 | //_____________________________________________________________________________ | |
124 | void AliTRDv0::StepManager() | |
125 | { | |
126 | // | |
127 | // Procedure called at every step in the TRD | |
82bbf98a | 128 | // Fast simulator. If switched on, a hit is produced when a track |
129 | // crosses the border between amplification region and pad plane. | |
fe4da5cc | 130 | // |
131 | ||
851d3db9 | 132 | Int_t pla = 0; |
133 | Int_t cha = 0; | |
134 | Int_t sec = 0; | |
82bbf98a | 135 | |
793ff80c | 136 | Float_t hits[3]; |
137 | Int_t det; | |
fe4da5cc | 138 | |
0a6d8768 | 139 | TLorentzVector p; |
332e9569 | 140 | |
141 | // Use pad plane as sensitive volume | |
142 | TString cIdSens = "L"; | |
143 | TString cIdCurrent; | |
593a9fc3 | 144 | Char_t cIdChamber[3]; |
145 | cIdChamber[2] = 0; | |
332e9569 | 146 | |
147 | const Int_t kNplan = AliTRDgeometry::Nplan(); | |
fe4da5cc | 148 | |
82bbf98a | 149 | // Writing out hits enabled? |
150 | if (!(fHitsOn)) return; | |
fe4da5cc | 151 | |
fe4da5cc | 152 | // Use only charged tracks and count them only once per volume |
82bbf98a | 153 | if (gMC->TrackCharge() && |
332e9569 | 154 | gMC->IsTrackEntering()) { |
fe4da5cc | 155 | |
156 | // Check on sensitive volume | |
332e9569 | 157 | cIdCurrent = gMC->CurrentVolName(); |
e6674585 | 158 | if (cIdSens == cIdCurrent[1]) { |
82bbf98a | 159 | |
160 | gMC->TrackPosition(p); | |
161 | for (Int_t i = 0; i < 3; i++) hits[i] = p[i]; | |
82bbf98a | 162 | |
851d3db9 | 163 | // The sector number (0 - 17) |
164 | // The numbering goes clockwise and starts at y = 0 | |
165 | Float_t phi = kRaddeg*TMath::ATan2(hits[0],hits[1]); | |
166 | if (phi < 90.) | |
167 | phi = phi + 270.; | |
168 | else | |
169 | phi = phi - 90.; | |
170 | sec = ((Int_t) (phi / 20)); | |
82bbf98a | 171 | |
332e9569 | 172 | // The plane and chamber number |
173 | cIdChamber[0] = cIdCurrent[2]; | |
174 | cIdChamber[1] = cIdCurrent[3]; | |
175 | Int_t idChamber = atoi(cIdChamber); | |
176 | cha = ((Int_t) idChamber / kNplan); | |
177 | pla = ((Int_t) idChamber % kNplan); | |
793ff80c | 178 | det = fGeometry->GetDetector(pla,cha,sec); |
82bbf98a | 179 | |
5d12ce38 | 180 | AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,0,kTRUE); |
d3f347ff | 181 | |
fe4da5cc | 182 | } |
d3f347ff | 183 | |
fe4da5cc | 184 | } |
d3f347ff | 185 | |
fe4da5cc | 186 | } |