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