]>
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 | // Manager and hits classes for set:MUON version 0 // | |
20 | ///////////////////////////////////////////////////////// | |
21 | ||
116cbefd | 22 | #include <Riostream.h> |
88cb7938 | 23 | |
116cbefd | 24 | #include <TLorentzVector.h> |
fe4da5cc | 25 | #include <TNode.h> |
26 | #include <TRandom.h> | |
116cbefd | 27 | #include <TTUBE.h> |
88cb7938 | 28 | #include <TVirtualMC.h> |
fe4da5cc | 29 | |
fe4da5cc | 30 | #include "AliCallf77.h" |
31 | #include "AliConst.h" | |
88cb7938 | 32 | #include "AliMUONChamber.h" |
f665c1ea | 33 | #include "AliMUONConstants.h" |
be3bb6c1 | 34 | #include "AliMUONFactory.h" |
88cb7938 | 35 | #include "AliMUONHit.h" |
36 | #include "AliMUONPadHit.h" | |
37 | #include "AliMUONv0.h" | |
38 | #include "AliMagF.h" | |
39 | #include "AliRun.h" | |
40 | ||
fe4da5cc | 41 | ClassImp(AliMUONv0) |
42 | ||
43 | //___________________________________________ | |
44 | AliMUONv0::AliMUONv0() : AliMUON() | |
45 | { | |
a9e2aefa | 46 | // Constructor |
fe4da5cc | 47 | fChambers = 0; |
48 | } | |
49 | ||
50 | //___________________________________________ | |
51 | AliMUONv0::AliMUONv0(const char *name, const char *title) | |
52 | : AliMUON(name,title) | |
53 | { | |
a9e2aefa | 54 | // Constructor |
ba030c0e | 55 | AliMUONFactory factory; |
56 | factory.Build(this, title); | |
a897a37a | 57 | } |
58 | ||
a9e2aefa | 59 | void AliMUONv0::CreateGeometry() |
60 | { | |
61 | // Creates coarse geometry for hit density simulations | |
62 | Int_t *idtmed = fIdtmed->GetArray()-1099; | |
fe4da5cc | 63 | // |
a9e2aefa | 64 | Float_t zpos, dAlu, tpar[3]; |
65 | Int_t idAir=idtmed[1100]; | |
66 | Int_t idAlu=idtmed[1103]; | |
67 | ||
68 | AliMUONChamber *iChamber; | |
69 | // Loop over all chambers (tracking and trigger) | |
f665c1ea | 70 | for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) { |
a9e2aefa | 71 | char alu[8]; |
72 | char gas[8]; | |
73 | ||
74 | iChamber=(AliMUONChamber*) (*fChambers)[ch]; | |
75 | // Z of the chamber | |
76 | zpos=iChamber->Z(); | |
77 | dAlu=iChamber->DAlu(); | |
f665c1ea | 78 | if (ch < AliMUONConstants::NTrackingCh()) { |
a9e2aefa | 79 | // tracking chambers |
b74f1c6a | 80 | sprintf(alu,"SA0%1d",ch); |
81 | sprintf(gas,"SG0%1d",ch); | |
a9e2aefa | 82 | } else { |
83 | // trigger chambers | |
b74f1c6a | 84 | sprintf(alu,"SA%2d",ch); |
85 | sprintf(gas,"SG%2d",ch); | |
a9e2aefa | 86 | } |
87 | // | |
a9e2aefa | 88 | tpar[0] = iChamber->RInner(); |
89 | tpar[1] = iChamber->ROuter(); | |
90 | tpar[2] = (dAlu+0.2)/2.; | |
91 | if (ch !=4 && ch !=5) { | |
92 | gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3); | |
93 | tpar[2] = 0.1; | |
94 | gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3); | |
95 | } else { | |
96 | gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3); | |
97 | tpar[2] = 0.1; | |
98 | gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3); | |
99 | } | |
100 | gMC->Gspos(gas, 1, alu, 0., 0., 0., 0, "ONLY"); | |
afa281f0 | 101 | if (ch == 4 || ch ==5) { |
82e22b99 | 102 | if (gMC->VolId("DDIP")) { |
103 | gMC->Gspos(alu, 1, "DDIP", 0., 0., zpos, 0, "ONLY"); | |
104 | } else { | |
105 | gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY"); | |
106 | } | |
afa281f0 | 107 | } else { |
108 | gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY"); | |
109 | } | |
a897a37a | 110 | } |
fe4da5cc | 111 | } |
112 | ||
fe4da5cc | 113 | //___________________________________________ |
114 | void AliMUONv0::CreateMaterials() | |
115 | { | |
a9e2aefa | 116 | // Creates materials for coarse geometry |
82e22b99 | 117 | AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500); |
118 | AliMaterial( 9, "ALUMINIUM$", 26.98, 13. , 2.7, 8.9, 37.2); | |
fe4da5cc | 119 | |
a9e2aefa | 120 | Float_t epsil = .001; // Tracking precision, |
121 | Float_t stemax = -1.; // Maximum displacement for multiple scat | |
122 | Float_t tmaxfd = -20.; // Maximum angle due to field deflection | |
123 | Float_t deemax = -.3; // Maximum fractional energy loss, DLS | |
124 | Float_t stmin = -.8; | |
125 | Int_t isxfld = gAlice->Field()->Integ(); | |
126 | Float_t sxmgmx = gAlice->Field()->Max(); | |
fe4da5cc | 127 | |
fe4da5cc | 128 | // |
a9e2aefa | 129 | // Air |
130 | AliMedium(1, "AIR_CH_US ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
82e22b99 | 131 | AliMedium(4, "ALU_CH_US ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu, |
a897a37a | 132 | fMaxDestepAlu, epsil, stmin); |
133 | ||
fe4da5cc | 134 | } |
135 | ||
fe4da5cc | 136 | void AliMUONv0::Init() |
137 | { | |
fe4da5cc | 138 | // |
139 | // Initialize Tracking Chambers | |
140 | // | |
b9046b8f | 141 | char vName[8]; |
142 | printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n"); | |
143 | for (Int_t i=0; i<AliMUONConstants::NCh(); i++) { | |
144 | // Initialise chamber | |
145 | ((AliMUONChamber*) (*fChambers)[i])->Init(); | |
146 | // Set sensitive volume Id | |
147 | if (i < AliMUONConstants::NTrackingCh()) { | |
148 | // tracking chambers | |
b74f1c6a | 149 | sprintf(vName,"SG0%1d",i); |
b9046b8f | 150 | } else { |
151 | // trigger chambers | |
b74f1c6a | 152 | sprintf(vName,"SG%2d",i); |
b9046b8f | 153 | } |
154 | ((AliMUONChamber*) (*fChambers)[i])->SetGid(gMC->VolId(vName)); | |
155 | } | |
fe4da5cc | 156 | } |
157 | ||
fe4da5cc | 158 | void AliMUONv0::StepManager() |
159 | { | |
a9e2aefa | 160 | // |
161 | // Step manager for hit density simulations | |
fe4da5cc | 162 | Int_t copy, id; |
163 | static Int_t idvol; | |
164 | static Int_t vol[2]; | |
165 | Int_t ipart; | |
a897a37a | 166 | TLorentzVector pos; |
167 | TLorentzVector mom; | |
168 | Float_t theta,phi; | |
fe4da5cc | 169 | |
a897a37a | 170 | // modifs perso |
a9e2aefa | 171 | static Float_t hits[15]; |
a897a37a | 172 | |
fe4da5cc | 173 | TClonesArray &lhits = *fHits; |
fe4da5cc | 174 | // |
175 | // Only gas gap inside chamber | |
176 | // Tag chambers and record hits when track enters | |
177 | idvol=-1; | |
0a6d8768 | 178 | id=gMC->CurrentVolID(copy); |
fe4da5cc | 179 | |
f665c1ea | 180 | for (Int_t i=1; i<=AliMUONConstants::NCh(); i++) { |
a9e2aefa | 181 | if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){ |
fe4da5cc | 182 | vol[0]=i; |
183 | idvol=i-1; | |
184 | } | |
185 | } | |
186 | if (idvol == -1) return; | |
187 | // | |
188 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
cfce8870 | 189 | gMC->TrackPosition(pos); |
190 | gMC->TrackMomentum(mom); | |
fe4da5cc | 191 | |
cfce8870 | 192 | ipart = gMC->TrackPid(); |
fe4da5cc | 193 | // |
194 | // record hits when track enters ... | |
9fde056a | 195 | if( !(gMC->TrackCharge()) ) return; |
0a6d8768 | 196 | if( gMC->IsTrackEntering()) { |
82e22b99 | 197 | // printf("\n Particle entering %f %f %f", pos[0], pos[1], pos[2] ); |
198 | ||
a897a37a | 199 | Double_t tc = mom[0]*mom[0]+mom[1]*mom[1]; |
200 | Double_t rt = TMath::Sqrt(tc); | |
a897a37a | 201 | theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg; |
202 | phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg; | |
a9e2aefa | 203 | hits[0] = Float_t(ipart); // Geant3 particle type |
204 | hits[1] = pos[0]; // X-position for hit | |
205 | hits[2] = pos[1]; // Y-position for hit | |
206 | hits[3] = pos[2]; // Z-position for hit | |
207 | hits[4] = theta; // theta angle of incidence | |
208 | hits[5] = phi; // phi angle of incidence | |
209 | hits[8] = -1; // first padhit | |
210 | hits[9] = -1; // last pad hit | |
2eb55fab | 211 | hits[10] = mom[3]; // hit Energy |
212 | hits[11] = mom[0]; // Px | |
213 | hits[12] = mom[1]; // Py | |
214 | hits[13] = mom[2]; // Pz | |
215 | hits[14] = gMC->TrackTime(); // time of flight | |
fe4da5cc | 216 | new(lhits[fNhits++]) |
642f15cf | 217 | AliMUONHit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); |
a9e2aefa | 218 | |
fe4da5cc | 219 | } |
82e22b99 | 220 | // if( gMC->IsTrackExiting()) gMC->StopTrack(); |
fe4da5cc | 221 | } |
a9e2aefa | 222 | |
223 | ||
224 | ||
225 | ||
226 | ||
227 | ||
228 | ||
229 | ||
230 |