]>
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$ | |
4c475d27 | 18 | Revision 1.21 2002/02/20 14:01:40 hristov |
19 | Compare a TString with a string, otherwise the conversion cannot be done on Sun | |
20 | ||
e6674585 | 21 | Revision 1.20 2002/02/13 16:58:37 cblume |
22 | Bug fix reported by Jiri. Make atoi input zero terminated in StepManager() | |
23 | ||
593a9fc3 | 24 | Revision 1.19 2002/02/11 14:25:27 cblume |
25 | Geometry update, compressed hit structure | |
26 | ||
332e9569 | 27 | Revision 1.18 2000/11/30 17:38:08 cblume |
28 | Changes to get in line with new STEER and EVGEN | |
29 | ||
1819f4bb | 30 | Revision 1.17 2000/11/01 14:53:21 cblume |
31 | Merge with TRD-develop | |
32 | ||
793ff80c | 33 | Revision 1.14.2.3 2000/10/06 16:49:46 cblume |
34 | Made Getters const | |
35 | ||
36 | Revision 1.14.2.2 2000/10/04 16:34:58 cblume | |
37 | Replace include files by forward declarations | |
38 | ||
39 | Revision 1.14.2.1 2000/09/18 13:48:18 cblume | |
40 | Adapt to new AliTRDhit | |
41 | ||
42 | Revision 1.16 2000/06/08 18:32:58 cblume | |
43 | Make code compliant to coding conventions | |
44 | ||
8230f242 | 45 | Revision 1.15 2000/06/07 16:25:37 cblume |
46 | Try to remove compiler warnings on Sun and HP | |
47 | ||
9d0b222b | 48 | Revision 1.14 2000/02/28 19:10:26 cblume |
49 | Include the new TRD classes | |
50 | ||
851d3db9 | 51 | Revision 1.13.4.1 2000/02/28 18:01:53 cblume |
52 | Change to new hit version and introduce geometry class | |
53 | ||
54 | Revision 1.13 1999/11/05 22:50:28 fca | |
55 | Do not use Atan, removed from ROOT too | |
56 | ||
90f8d287 | 57 | Revision 1.12 1999/11/02 16:35:56 fca |
58 | New version of TRD introduced | |
59 | ||
5c7f4665 | 60 | Revision 1.11 1999/11/01 20:41:51 fca |
61 | Added protections against using the wrong version of FRAME | |
62 | ||
ab76897d | 63 | Revision 1.10 1999/09/29 09:24:35 fca |
64 | Introduction of the Copyright and cvs Log | |
65 | ||
4c039060 | 66 | */ |
67 | ||
fe4da5cc | 68 | /////////////////////////////////////////////////////////////////////////////// |
69 | // // | |
5c7f4665 | 70 | // Transition Radiation Detector version 0 -- fast simulator // |
fe4da5cc | 71 | // // |
72 | //Begin_Html | |
73 | /* | |
5c7f4665 | 74 | <img src="picts/AliTRDfullClass.gif"> |
fe4da5cc | 75 | */ |
76 | //End_Html | |
77 | // // | |
78 | // // | |
79 | /////////////////////////////////////////////////////////////////////////////// | |
80 | ||
332e9569 | 81 | #include <stdlib.h> |
82 | ||
fe4da5cc | 83 | #include <TMath.h> |
84 | #include <TRandom.h> | |
1819f4bb | 85 | #include <TVector.h> |
86 | #include <TLorentzVector.h> | |
fe4da5cc | 87 | |
fe4da5cc | 88 | #include "AliRun.h" |
fe4da5cc | 89 | #include "AliConst.h" |
90 | ||
851d3db9 | 91 | #include "AliTRDv0.h" |
793ff80c | 92 | #include "AliTRDhit.h" |
851d3db9 | 93 | #include "AliTRDgeometry.h" |
fe4da5cc | 94 | |
851d3db9 | 95 | ClassImp(AliTRDv0) |
8230f242 | 96 | |
97 | //_____________________________________________________________________________ | |
98 | AliTRDv0::AliTRDv0():AliTRD() | |
99 | { | |
100 | // | |
101 | // AliTRDv0 default constructor | |
102 | // | |
103 | ||
8230f242 | 104 | fHitsOn = 0; |
105 | ||
8230f242 | 106 | } |
107 | ||
fe4da5cc | 108 | //_____________________________________________________________________________ |
109 | AliTRDv0::AliTRDv0(const char *name, const char *title) | |
110 | :AliTRD(name, title) | |
111 | { | |
112 | // | |
113 | // Standard constructor for Transition Radiation Detector version 0 | |
114 | // | |
82bbf98a | 115 | |
82bbf98a | 116 | fHitsOn = 0; |
117 | ||
fe4da5cc | 118 | } |
851d3db9 | 119 | |
8230f242 | 120 | //_____________________________________________________________________________ |
121 | AliTRDv0::~AliTRDv0() | |
122 | { | |
123 | // | |
124 | // AliTRDv0 destructor | |
125 | // | |
126 | ||
127 | } | |
128 | ||
fe4da5cc | 129 | //_____________________________________________________________________________ |
130 | void AliTRDv0::CreateGeometry() | |
131 | { | |
132 | // | |
82bbf98a | 133 | // Create the GEANT geometry for the Transition Radiation Detector - Version 0 |
134 | // This version covers the full azimuth. | |
d3f347ff | 135 | // |
d3f347ff | 136 | |
82bbf98a | 137 | // Check that FRAME is there otherwise we have no place where to put the TRD |
8230f242 | 138 | AliModule* frame = gAlice->GetModule("FRAME"); |
139 | if (!frame) return; | |
fe4da5cc | 140 | |
82bbf98a | 141 | // Define the chambers |
142 | AliTRD::CreateGeometry(); | |
fe4da5cc | 143 | |
fe4da5cc | 144 | } |
145 | ||
146 | //_____________________________________________________________________________ | |
147 | void AliTRDv0::CreateMaterials() | |
148 | { | |
149 | // | |
150 | // Create materials for the Transition Radiation Detector | |
151 | // | |
82bbf98a | 152 | |
fe4da5cc | 153 | AliTRD::CreateMaterials(); |
82bbf98a | 154 | |
fe4da5cc | 155 | } |
156 | ||
157 | //_____________________________________________________________________________ | |
158 | void AliTRDv0::Init() | |
159 | { | |
160 | // | |
851d3db9 | 161 | // Initialize Transition Radiation Detector after geometry is built |
fe4da5cc | 162 | // |
82bbf98a | 163 | |
fe4da5cc | 164 | AliTRD::Init(); |
82bbf98a | 165 | |
851d3db9 | 166 | printf(" Fast simulator\n\n"); |
5c7f4665 | 167 | for (Int_t i = 0; i < 80; i++) printf("*"); |
168 | printf("\n"); | |
169 | ||
fe4da5cc | 170 | } |
171 | ||
172 | //_____________________________________________________________________________ | |
173 | void AliTRDv0::StepManager() | |
174 | { | |
175 | // | |
176 | // Procedure called at every step in the TRD | |
82bbf98a | 177 | // Fast simulator. If switched on, a hit is produced when a track |
178 | // crosses the border between amplification region and pad plane. | |
fe4da5cc | 179 | // |
180 | ||
851d3db9 | 181 | Int_t pla = 0; |
182 | Int_t cha = 0; | |
183 | Int_t sec = 0; | |
82bbf98a | 184 | |
793ff80c | 185 | Float_t hits[3]; |
186 | Int_t det; | |
fe4da5cc | 187 | |
0a6d8768 | 188 | TLorentzVector p; |
332e9569 | 189 | |
190 | // Use pad plane as sensitive volume | |
191 | TString cIdSens = "L"; | |
192 | TString cIdCurrent; | |
593a9fc3 | 193 | Char_t cIdChamber[3]; |
194 | cIdChamber[2] = 0; | |
332e9569 | 195 | |
196 | const Int_t kNplan = AliTRDgeometry::Nplan(); | |
fe4da5cc | 197 | |
82bbf98a | 198 | // Writing out hits enabled? |
199 | if (!(fHitsOn)) return; | |
fe4da5cc | 200 | |
fe4da5cc | 201 | // Use only charged tracks and count them only once per volume |
82bbf98a | 202 | if (gMC->TrackCharge() && |
332e9569 | 203 | gMC->IsTrackEntering()) { |
fe4da5cc | 204 | |
205 | // Check on sensitive volume | |
332e9569 | 206 | cIdCurrent = gMC->CurrentVolName(); |
e6674585 | 207 | if (cIdSens == cIdCurrent[1]) { |
82bbf98a | 208 | |
209 | gMC->TrackPosition(p); | |
210 | for (Int_t i = 0; i < 3; i++) hits[i] = p[i]; | |
82bbf98a | 211 | |
851d3db9 | 212 | // The sector number (0 - 17) |
213 | // The numbering goes clockwise and starts at y = 0 | |
214 | Float_t phi = kRaddeg*TMath::ATan2(hits[0],hits[1]); | |
215 | if (phi < 90.) | |
216 | phi = phi + 270.; | |
217 | else | |
218 | phi = phi - 90.; | |
219 | sec = ((Int_t) (phi / 20)); | |
82bbf98a | 220 | |
332e9569 | 221 | // The plane and chamber number |
222 | cIdChamber[0] = cIdCurrent[2]; | |
223 | cIdChamber[1] = cIdCurrent[3]; | |
224 | Int_t idChamber = atoi(cIdChamber); | |
225 | cha = ((Int_t) idChamber / kNplan); | |
226 | pla = ((Int_t) idChamber % kNplan); | |
793ff80c | 227 | det = fGeometry->GetDetector(pla,cha,sec); |
82bbf98a | 228 | |
332e9569 | 229 | AddHit(gAlice->CurrentTrack(),det,hits,0,kTRUE); |
d3f347ff | 230 | |
fe4da5cc | 231 | } |
d3f347ff | 232 | |
fe4da5cc | 233 | } |
d3f347ff | 234 | |
fe4da5cc | 235 | } |