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