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