]>
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$ | |
b9d0a01d | 18 | Revision 1.20.6.2 2002/07/24 10:07:21 alibrary |
19 | Updating VirtualMC | |
20 | ||
21 | Revision 1.21 2002/07/23 10:02:46 morsch | |
22 | All volume names start with "S". | |
23 | ||
b74f1c6a | 24 | Revision 1.20 2001/10/30 12:18:45 morsch |
25 | Place station 3 into DDIP only if DDIP is present. | |
26 | ||
82e22b99 | 27 | Revision 1.19 2001/07/17 09:51:38 morsch |
28 | Place station 3 inside Dipole. | |
29 | ||
afa281f0 | 30 | Revision 1.18 2001/04/06 11:24:43 morsch |
31 | Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUONFactory class. | |
32 | Static method Build() builds the MUON system out of chambers, segmentation and response. | |
33 | ||
be3bb6c1 | 34 | Revision 1.17 2001/03/17 10:07:20 morsch |
35 | Correct inconsistent variable name / method name / comments. | |
36 | ||
2eb55fab | 37 | Revision 1.16 2001/01/27 08:50:50 morsch |
38 | Call non default constructors of segmentation classes. | |
39 | ||
c687f06a | 40 | Revision 1.15 2001/01/17 20:57:45 hristov |
41 | Unused variable removed | |
42 | ||
a7e8b51a | 43 | Revision 1.14 2000/12/21 22:42:55 morsch |
44 | Constructor contains default set-up for segmentation. | |
45 | Record charged particles only. | |
46 | ||
9fde056a | 47 | Revision 1.13 2000/10/06 10:03:38 morsch |
48 | Call to gMC->VolId() moved to Init() | |
49 | ||
b9046b8f | 50 | Revision 1.12 2000/10/02 21:28:09 fca |
51 | Removal of useless dependecies via forward declarations | |
52 | ||
94de3818 | 53 | Revision 1.11 2000/06/27 07:31:07 morsch |
54 | fChambers = 0; deleted from constructor. | |
55 | ||
c20a5a2a | 56 | Revision 1.10 2000/06/26 14:02:38 morsch |
57 | Add class AliMUONConstants with MUON specific constants using static memeber data and access methods. | |
58 | ||
f665c1ea | 59 | Revision 1.9 2000/06/15 07:58:49 morsch |
60 | Code from MUON-dev joined | |
61 | ||
a9e2aefa | 62 | Revision 1.8.4.9 2000/06/12 19:20:49 morsch |
63 | Constructor sets default geometry, segmentation and response parameters. | |
64 | ||
65 | Revision 1.8.4.8 2000/06/09 21:55:28 morsch | |
66 | Most coding rule violations corrected. | |
67 | ||
68 | Revision 1.8.4.7 2000/05/02 13:15:18 morsch | |
69 | Coding rule violations RS3, RN13 corected | |
70 | ||
71 | Revision 1.8.4.6 2000/05/02 10:24:26 morsch | |
72 | Public access to fdGas and fdAlu of AliMUONChamber replaced by getters. | |
73 | ||
74 | Revision 1.8.4.5 2000/04/26 19:58:47 morsch | |
75 | Obsolete reference to trig_ removed. | |
76 | ||
77 | Revision 1.8.4.4 2000/04/19 19:42:47 morsch | |
78 | change NCH to kNCH | |
79 | ||
80 | Revision 1.8.4.3 2000/02/17 08:17:43 morsch | |
81 | Gammas and neutrons are also scored in the stepmanager | |
4c039060 | 82 | */ |
83 | ||
fe4da5cc | 84 | ///////////////////////////////////////////////////////// |
85 | // Manager and hits classes for set:MUON version 0 // | |
86 | ///////////////////////////////////////////////////////// | |
87 | ||
88 | #include <TTUBE.h> | |
89 | #include <TNode.h> | |
90 | #include <TRandom.h> | |
a897a37a | 91 | #include <TLorentzVector.h> |
a9e2aefa | 92 | #include <iostream.h> |
fe4da5cc | 93 | |
94 | #include "AliMUONv0.h" | |
a9e2aefa | 95 | #include "AliMUONChamber.h" |
fe4da5cc | 96 | #include "AliRun.h" |
97 | #include "AliMC.h" | |
94de3818 | 98 | #include "AliMagF.h" |
a9e2aefa | 99 | #include "AliMUONHit.h" |
100 | #include "AliMUONPadHit.h" | |
fe4da5cc | 101 | #include "AliCallf77.h" |
102 | #include "AliConst.h" | |
f665c1ea | 103 | #include "AliMUONConstants.h" |
be3bb6c1 | 104 | #include "AliMUONFactory.h" |
fe4da5cc | 105 | ClassImp(AliMUONv0) |
106 | ||
107 | //___________________________________________ | |
108 | AliMUONv0::AliMUONv0() : AliMUON() | |
109 | { | |
a9e2aefa | 110 | // Constructor |
fe4da5cc | 111 | fChambers = 0; |
112 | } | |
113 | ||
114 | //___________________________________________ | |
115 | AliMUONv0::AliMUONv0(const char *name, const char *title) | |
116 | : AliMUON(name,title) | |
117 | { | |
a9e2aefa | 118 | // Constructor |
be3bb6c1 | 119 | AliMUONFactory::Build(this, "default"); |
a897a37a | 120 | } |
121 | ||
a9e2aefa | 122 | void AliMUONv0::CreateGeometry() |
123 | { | |
124 | // Creates coarse geometry for hit density simulations | |
125 | Int_t *idtmed = fIdtmed->GetArray()-1099; | |
fe4da5cc | 126 | // |
a9e2aefa | 127 | Float_t zpos, dAlu, tpar[3]; |
128 | Int_t idAir=idtmed[1100]; | |
129 | Int_t idAlu=idtmed[1103]; | |
130 | ||
131 | AliMUONChamber *iChamber; | |
132 | // Loop over all chambers (tracking and trigger) | |
f665c1ea | 133 | for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) { |
a9e2aefa | 134 | char alu[8]; |
135 | char gas[8]; | |
136 | ||
137 | iChamber=(AliMUONChamber*) (*fChambers)[ch]; | |
138 | // Z of the chamber | |
139 | zpos=iChamber->Z(); | |
140 | dAlu=iChamber->DAlu(); | |
f665c1ea | 141 | if (ch < AliMUONConstants::NTrackingCh()) { |
a9e2aefa | 142 | // tracking chambers |
b74f1c6a | 143 | sprintf(alu,"SA0%1d",ch); |
144 | sprintf(gas,"SG0%1d",ch); | |
a9e2aefa | 145 | } else { |
146 | // trigger chambers | |
b74f1c6a | 147 | sprintf(alu,"SA%2d",ch); |
148 | sprintf(gas,"SG%2d",ch); | |
a9e2aefa | 149 | } |
150 | // | |
a9e2aefa | 151 | tpar[0] = iChamber->RInner(); |
152 | tpar[1] = iChamber->ROuter(); | |
153 | tpar[2] = (dAlu+0.2)/2.; | |
154 | if (ch !=4 && ch !=5) { | |
155 | gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3); | |
156 | tpar[2] = 0.1; | |
157 | gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3); | |
158 | } else { | |
159 | gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3); | |
160 | tpar[2] = 0.1; | |
161 | gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3); | |
162 | } | |
163 | gMC->Gspos(gas, 1, alu, 0., 0., 0., 0, "ONLY"); | |
afa281f0 | 164 | if (ch == 4 || ch ==5) { |
82e22b99 | 165 | if (gMC->VolId("DDIP")) { |
166 | gMC->Gspos(alu, 1, "DDIP", 0., 0., zpos, 0, "ONLY"); | |
167 | } else { | |
168 | gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY"); | |
169 | } | |
afa281f0 | 170 | } else { |
171 | gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY"); | |
172 | } | |
a897a37a | 173 | } |
fe4da5cc | 174 | } |
175 | ||
fe4da5cc | 176 | //___________________________________________ |
177 | void AliMUONv0::CreateMaterials() | |
178 | { | |
a9e2aefa | 179 | // Creates materials for coarse geometry |
82e22b99 | 180 | AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500); |
181 | AliMaterial( 9, "ALUMINIUM$", 26.98, 13. , 2.7, 8.9, 37.2); | |
fe4da5cc | 182 | |
a9e2aefa | 183 | Float_t epsil = .001; // Tracking precision, |
184 | Float_t stemax = -1.; // Maximum displacement for multiple scat | |
185 | Float_t tmaxfd = -20.; // Maximum angle due to field deflection | |
186 | Float_t deemax = -.3; // Maximum fractional energy loss, DLS | |
187 | Float_t stmin = -.8; | |
188 | Int_t isxfld = gAlice->Field()->Integ(); | |
189 | Float_t sxmgmx = gAlice->Field()->Max(); | |
fe4da5cc | 190 | |
fe4da5cc | 191 | // |
a9e2aefa | 192 | // Air |
193 | AliMedium(1, "AIR_CH_US ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
82e22b99 | 194 | AliMedium(4, "ALU_CH_US ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu, |
a897a37a | 195 | fMaxDestepAlu, epsil, stmin); |
196 | ||
fe4da5cc | 197 | } |
198 | ||
fe4da5cc | 199 | void AliMUONv0::Init() |
200 | { | |
fe4da5cc | 201 | // |
202 | // Initialize Tracking Chambers | |
203 | // | |
b9046b8f | 204 | char vName[8]; |
205 | printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n"); | |
206 | for (Int_t i=0; i<AliMUONConstants::NCh(); i++) { | |
207 | // Initialise chamber | |
208 | ((AliMUONChamber*) (*fChambers)[i])->Init(); | |
209 | // Set sensitive volume Id | |
210 | if (i < AliMUONConstants::NTrackingCh()) { | |
211 | // tracking chambers | |
b74f1c6a | 212 | sprintf(vName,"SG0%1d",i); |
b9046b8f | 213 | } else { |
214 | // trigger chambers | |
b74f1c6a | 215 | sprintf(vName,"SG%2d",i); |
b9046b8f | 216 | } |
217 | ((AliMUONChamber*) (*fChambers)[i])->SetGid(gMC->VolId(vName)); | |
218 | } | |
fe4da5cc | 219 | } |
220 | ||
fe4da5cc | 221 | void AliMUONv0::StepManager() |
222 | { | |
a9e2aefa | 223 | // |
224 | // Step manager for hit density simulations | |
fe4da5cc | 225 | Int_t copy, id; |
226 | static Int_t idvol; | |
227 | static Int_t vol[2]; | |
228 | Int_t ipart; | |
a897a37a | 229 | TLorentzVector pos; |
230 | TLorentzVector mom; | |
231 | Float_t theta,phi; | |
fe4da5cc | 232 | |
a897a37a | 233 | // modifs perso |
a9e2aefa | 234 | static Float_t hits[15]; |
a897a37a | 235 | |
fe4da5cc | 236 | TClonesArray &lhits = *fHits; |
fe4da5cc | 237 | // |
238 | // Only gas gap inside chamber | |
239 | // Tag chambers and record hits when track enters | |
240 | idvol=-1; | |
0a6d8768 | 241 | id=gMC->CurrentVolID(copy); |
fe4da5cc | 242 | |
f665c1ea | 243 | for (Int_t i=1; i<=AliMUONConstants::NCh(); i++) { |
a9e2aefa | 244 | if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){ |
fe4da5cc | 245 | vol[0]=i; |
246 | idvol=i-1; | |
247 | } | |
248 | } | |
249 | if (idvol == -1) return; | |
250 | // | |
251 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
cfce8870 | 252 | gMC->TrackPosition(pos); |
253 | gMC->TrackMomentum(mom); | |
fe4da5cc | 254 | |
cfce8870 | 255 | ipart = gMC->TrackPid(); |
fe4da5cc | 256 | // |
257 | // record hits when track enters ... | |
9fde056a | 258 | if( !(gMC->TrackCharge()) ) return; |
0a6d8768 | 259 | if( gMC->IsTrackEntering()) { |
82e22b99 | 260 | // printf("\n Particle entering %f %f %f", pos[0], pos[1], pos[2] ); |
261 | ||
a897a37a | 262 | Double_t tc = mom[0]*mom[0]+mom[1]*mom[1]; |
263 | Double_t rt = TMath::Sqrt(tc); | |
a897a37a | 264 | theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg; |
265 | phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg; | |
a9e2aefa | 266 | hits[0] = Float_t(ipart); // Geant3 particle type |
267 | hits[1] = pos[0]; // X-position for hit | |
268 | hits[2] = pos[1]; // Y-position for hit | |
269 | hits[3] = pos[2]; // Z-position for hit | |
270 | hits[4] = theta; // theta angle of incidence | |
271 | hits[5] = phi; // phi angle of incidence | |
272 | hits[8] = -1; // first padhit | |
273 | hits[9] = -1; // last pad hit | |
2eb55fab | 274 | hits[10] = mom[3]; // hit Energy |
275 | hits[11] = mom[0]; // Px | |
276 | hits[12] = mom[1]; // Py | |
277 | hits[13] = mom[2]; // Pz | |
278 | hits[14] = gMC->TrackTime(); // time of flight | |
fe4da5cc | 279 | new(lhits[fNhits++]) |
a9e2aefa | 280 | AliMUONHit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
281 | ||
fe4da5cc | 282 | } |
82e22b99 | 283 | // if( gMC->IsTrackExiting()) gMC->StopTrack(); |
fe4da5cc | 284 | } |
a9e2aefa | 285 | |
286 | ||
287 | ||
288 | ||
289 | ||
290 | ||
291 | ||
292 | ||
293 |