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