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$ |
ab76897d |
18 | Revision 1.10 1999/09/29 09:24:35 fca |
19 | Introduction of the Copyright and cvs Log |
20 | |
4c039060 |
21 | */ |
22 | |
fe4da5cc |
23 | /////////////////////////////////////////////////////////////////////////////// |
24 | // // |
d3f347ff |
25 | // Transition Radiation Detector version 1 -- coarse simulation // |
26 | // This version has two detector arms, leaving the space in front of the // |
27 | // HMPID and PHOS empty // |
fe4da5cc |
28 | // // |
29 | //Begin_Html |
30 | /* |
1439f98e |
31 | <img src="picts/AliTRDv1Class.gif"> |
fe4da5cc |
32 | */ |
33 | //End_Html |
34 | // // |
35 | // // |
36 | /////////////////////////////////////////////////////////////////////////////// |
37 | |
ab76897d |
38 | #include <stdlib.h> |
39 | |
fe4da5cc |
40 | #include <TMath.h> |
41 | #include <TRandom.h> |
42 | #include <TVector.h> |
fe4da5cc |
43 | |
fe4da5cc |
44 | #include "AliTRDv1.h" |
45 | #include "AliRun.h" |
fe4da5cc |
46 | #include "AliMC.h" |
d3f347ff |
47 | #include "AliConst.h" |
fe4da5cc |
48 | |
49 | ClassImp(AliTRDv1) |
50 | |
51 | //_____________________________________________________________________________ |
52 | AliTRDv1::AliTRDv1(const char *name, const char *title) |
53 | :AliTRD(name, title) |
54 | { |
55 | // |
56 | // Standard constructor for the Transition Radiation Detector version 1 |
57 | // |
82bbf98a |
58 | |
59 | fIdSens = 0; |
60 | fHitsOn = 0; |
61 | |
62 | fIdSpace1 = 0; |
63 | fIdSpace2 = 0; |
64 | fIdSpace3 = 0; |
65 | |
66 | fIdChamber1 = 0; |
67 | fIdChamber2 = 0; |
68 | fIdChamber3 = 0; |
69 | |
fe4da5cc |
70 | } |
71 | |
72 | //_____________________________________________________________________________ |
73 | void AliTRDv1::CreateGeometry() |
74 | { |
75 | // |
82bbf98a |
76 | // Create the GEANT geometry for the Transition Radiation Detector - Version 1 |
77 | // This version covers only part of the azimuth. |
d3f347ff |
78 | // |
82bbf98a |
79 | // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99 |
d3f347ff |
80 | // |
81 | |
82bbf98a |
82 | Float_t xpos, ypos, zpos; |
d3f347ff |
83 | |
82bbf98a |
84 | // Check that FRAME is there otherwise we have no place where to put the TRD |
85 | AliModule* FRAME = gAlice->GetModule("FRAME"); |
86 | if (!FRAME) return; |
d3f347ff |
87 | |
82bbf98a |
88 | // Define the chambers |
89 | AliTRD::CreateGeometry(); |
d3f347ff |
90 | |
82bbf98a |
91 | // Position the the TRD-sectors only in one TRD-volume in the spaceframe |
92 | xpos = 0.; |
93 | ypos = 0.; |
94 | zpos = 0.; |
95 | gMC->Gspos("TRD ",1,"BTR1",xpos,ypos,zpos,0,"ONLY"); |
fe4da5cc |
96 | |
fe4da5cc |
97 | } |
98 | |
99 | //_____________________________________________________________________________ |
100 | void AliTRDv1::CreateMaterials() |
101 | { |
102 | // |
103 | // Create materials for the Transition Radiation Detector version 1 |
104 | // |
82bbf98a |
105 | |
d3f347ff |
106 | AliTRD::CreateMaterials(); |
82bbf98a |
107 | |
fe4da5cc |
108 | } |
109 | |
110 | //_____________________________________________________________________________ |
111 | void AliTRDv1::Init() |
112 | { |
113 | // |
114 | // Initialise the Transition Radiation Detector after the geometry is built |
115 | // |
82bbf98a |
116 | |
ab76897d |
117 | printf("**************************************" |
118 | " TRD " |
119 | "**************************************\n"); |
120 | printf("\n Version 1 of TRD initialing, " |
121 | "with openings for PHOS and RICH\n\n"); |
122 | |
fe4da5cc |
123 | AliTRD::Init(); |
82bbf98a |
124 | |
ab76897d |
125 | // |
126 | // Check that FRAME is there otherwise we have no place where to |
127 | // put TRD |
128 | AliModule* FRAME=gAlice->GetModule("FRAME"); |
129 | if(!FRAME) { |
130 | Error("Ctor","TRD needs FRAME to be present\n"); |
131 | exit(1); |
132 | } else |
133 | if(FRAME->IsVersion()!=0) { |
134 | Error("Ctor","FRAME version 0 needed with this version of TRD\n"); |
135 | exit(1); |
136 | } |
137 | |
82bbf98a |
138 | for (Int_t i = 0; i < 80; i++) printf("*"); |
139 | printf("\n"); |
140 | |
141 | // Identifier of the sensitive volume (amplification region) |
142 | fIdSens = gMC->VolId("UL06"); |
143 | |
144 | // Identifier of the TRD-spaceframe volumina |
145 | fIdSpace1 = gMC->VolId("B028"); |
146 | fIdSpace2 = gMC->VolId("B029"); |
147 | fIdSpace3 = gMC->VolId("B030"); |
148 | |
149 | // Identifier of the TRD-driftchambers |
150 | fIdChamber1 = gMC->VolId("UCIO"); |
151 | fIdChamber2 = gMC->VolId("UCIM"); |
152 | fIdChamber3 = gMC->VolId("UCII"); |
153 | |
ab76897d |
154 | printf("**************************************" |
155 | " TRD " |
156 | "**************************************\n"); |
fe4da5cc |
157 | } |
158 | |
159 | //_____________________________________________________________________________ |
160 | void AliTRDv1::StepManager() |
161 | { |
162 | // |
d3f347ff |
163 | // Procedure called at every step in the TRD |
82bbf98a |
164 | // Fast simulator. If switched on, a hit is produced when a track |
165 | // crosses the border between amplification region and pad plane. |
fe4da5cc |
166 | // |
d3f347ff |
167 | |
82bbf98a |
168 | Int_t vol[3]; |
169 | Int_t iIdSens, icSens; |
170 | Int_t iIdSpace, icSpace; |
171 | Int_t iIdChamber, icChamber; |
172 | |
173 | Int_t secMap1[10] = { 3, 7, 8, 9, 10, 11, 2, 1, 18, 17 }; |
174 | Int_t secMap2[ 5] = { 16, 15, 14, 13, 12 }; |
175 | Int_t secMap3[ 3] = { 5, 6, 4 }; |
176 | |
177 | Float_t hits[4]; |
178 | |
179 | TLorentzVector p; |
180 | TClonesArray &lhits = *fHits; |
181 | |
182 | // Writing out hits enabled? |
183 | if (!(fHitsOn)) return; |
fe4da5cc |
184 | |
fe4da5cc |
185 | // Use only charged tracks and count them only once per volume |
82bbf98a |
186 | if (gMC->TrackCharge() && |
187 | gMC->IsTrackExiting()) { |
fe4da5cc |
188 | |
189 | // Check on sensitive volume |
82bbf98a |
190 | iIdSens = gMC->CurrentVolID(icSens); |
191 | if (iIdSens == fIdSens) { |
192 | |
193 | gMC->TrackPosition(p); |
194 | for (Int_t i = 0; i < 3; i++) hits[i] = p[i]; |
195 | // No charge created |
196 | hits[3] = 0; |
197 | |
198 | iIdSpace = gMC->CurrentVolOffID(4,icSpace ); |
199 | iIdChamber = gMC->CurrentVolOffID(1,icChamber); |
fe4da5cc |
200 | |
fe4da5cc |
201 | // The sector number |
82bbf98a |
202 | if (iIdSpace == fIdSpace1) |
203 | vol[0] = secMap1[icSpace-1]; |
204 | else if (iIdSpace == fIdSpace2) |
205 | vol[0] = secMap2[icSpace-1]; |
206 | else if (iIdSpace == fIdSpace3) |
207 | vol[0] = secMap3[icSpace-1]; |
208 | |
d3f347ff |
209 | // The chamber number |
210 | // 1: outer left |
82bbf98a |
211 | // 2: middle left |
d3f347ff |
212 | // 3: inner |
82bbf98a |
213 | // 4: middle right |
d3f347ff |
214 | // 5: outer right |
82bbf98a |
215 | if (iIdChamber == fIdChamber1) |
216 | vol[1] = (hits[2] < 0 ? 1 : 5); |
217 | else if (iIdChamber == fIdChamber2) |
218 | vol[1] = (hits[2] < 0 ? 2 : 4); |
219 | else if (iIdChamber == fIdChamber3) |
d3f347ff |
220 | vol[1] = 3; |
82bbf98a |
221 | |
fe4da5cc |
222 | // The plane number |
82bbf98a |
223 | vol[2] = icChamber - TMath::Nint((Float_t) (icChamber / 7)) * 6; |
224 | |
225 | new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
d3f347ff |
226 | |
227 | } |
228 | |
82bbf98a |
229 | } |
d3f347ff |
230 | |
fe4da5cc |
231 | } |