]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDv0.cxx
Introducing Copyright include file
[u/mrichter/AliRoot.git] / TRD / AliTRDv0.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Transition Radiation Detector version 0 -- coarse simulation //
4// //
5//Begin_Html
6/*
1439f98e 7<img src="picts/AliTRDv0Class.gif">
fe4da5cc 8*/
9//End_Html
10// //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include <TMath.h>
15#include <TRandom.h>
16#include <TVector.h>
fe4da5cc 17
fe4da5cc 18#include "AliTRDv0.h"
19#include "AliRun.h"
20#include "AliMC.h"
21#include "AliConst.h"
22
23ClassImp(AliTRDv0)
24
25//_____________________________________________________________________________
26AliTRDv0::AliTRDv0(const char *name, const char *title)
27 :AliTRD(name, title)
28{
29 //
30 // Standard constructor for Transition Radiation Detector version 0
31 //
82bbf98a 32
33 fIdSens = 0;
34 fHitsOn = 0;
35
36 fIdSpace1 = 0;
37 fIdSpace2 = 0;
38 fIdSpace3 = 0;
39
40 fIdChamber1 = 0;
41 fIdChamber2 = 0;
42 fIdChamber3 = 0;
43
fe4da5cc 44}
45
46//_____________________________________________________________________________
47void AliTRDv0::CreateGeometry()
48{
49 //
82bbf98a 50 // Create the GEANT geometry for the Transition Radiation Detector - Version 0
51 // This version covers the full azimuth.
d3f347ff 52 //
82bbf98a 53 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
d3f347ff 54 //
55
82bbf98a 56 Float_t xpos, ypos, zpos;
d3f347ff 57
82bbf98a 58 // Check that FRAME is there otherwise we have no place where to put the TRD
59 AliModule* FRAME = gAlice->GetModule("FRAME");
60 if (!FRAME) return;
fe4da5cc 61
82bbf98a 62 // Define the chambers
63 AliTRD::CreateGeometry();
fe4da5cc 64
82bbf98a 65 // Position the the TRD-sectors in all TRD-volumes in the spaceframe
66 xpos = 0.;
67 ypos = 0.;
68 zpos = 0.;
69 gMC->Gspos("TRD ",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
70 gMC->Gspos("TRD ",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
71 gMC->Gspos("TRD ",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
d3f347ff 72
fe4da5cc 73}
74
75//_____________________________________________________________________________
76void AliTRDv0::CreateMaterials()
77{
78 //
79 // Create materials for the Transition Radiation Detector
80 //
82bbf98a 81
fe4da5cc 82 AliTRD::CreateMaterials();
82bbf98a 83
fe4da5cc 84}
85
86//_____________________________________________________________________________
87void AliTRDv0::Init()
88{
89 //
90 // Initialise Transition Radiation Detector after geometry is built
91 //
82bbf98a 92
fe4da5cc 93 AliTRD::Init();
82bbf98a 94
95 for (Int_t i = 0; i < 80; i++) printf("*");
96 printf("\n");
97
98 // Identifier of the sensitive volume (amplification region)
99 fIdSens = gMC->VolId("UL06");
100
101 // Identifier of the TRD-spaceframe volumina
102 fIdSpace1 = gMC->VolId("B028");
103 fIdSpace2 = gMC->VolId("B029");
104 fIdSpace3 = gMC->VolId("B030");
105
106 // Identifier of the TRD-driftchambers
107 fIdChamber1 = gMC->VolId("UCIO");
108 fIdChamber2 = gMC->VolId("UCIM");
109 fIdChamber3 = gMC->VolId("UCII");
110
fe4da5cc 111}
112
113//_____________________________________________________________________________
114void AliTRDv0::StepManager()
115{
116 //
117 // Procedure called at every step in the TRD
82bbf98a 118 // Fast simulator. If switched on, a hit is produced when a track
119 // crosses the border between amplification region and pad plane.
fe4da5cc 120 //
121
82bbf98a 122 Int_t vol[3];
123 Int_t iIdSens, icSens;
124 Int_t iIdSpace, icSpace;
125 Int_t iIdChamber, icChamber;
126
127 Int_t secMap1[10] = { 3, 7, 8, 9, 10, 11, 2, 1, 18, 17 };
128 Int_t secMap2[ 5] = { 16, 15, 14, 13, 12 };
129 Int_t secMap3[ 3] = { 5, 6, 4 };
130
131 Float_t hits[4];
fe4da5cc 132
0a6d8768 133 TLorentzVector p;
82bbf98a 134 TClonesArray &lhits = *fHits;
fe4da5cc 135
82bbf98a 136 // Writing out hits enabled?
137 if (!(fHitsOn)) return;
fe4da5cc 138
fe4da5cc 139 // Use only charged tracks and count them only once per volume
82bbf98a 140 if (gMC->TrackCharge() &&
141 gMC->IsTrackExiting()) {
fe4da5cc 142
143 // Check on sensitive volume
82bbf98a 144 iIdSens = gMC->CurrentVolID(icSens);
145 if (iIdSens == fIdSens) {
146
147 gMC->TrackPosition(p);
148 for (Int_t i = 0; i < 3; i++) hits[i] = p[i];
149 // No charge created
150 hits[3] = 0;
151
152 iIdSpace = gMC->CurrentVolOffID(4,icSpace );
153 iIdChamber = gMC->CurrentVolOffID(1,icChamber);
154
fe4da5cc 155 // The sector number
82bbf98a 156 if (iIdSpace == fIdSpace1)
157 vol[0] = secMap1[icSpace-1];
158 else if (iIdSpace == fIdSpace2)
159 vol[0] = secMap2[icSpace-1];
160 else if (iIdSpace == fIdSpace3)
161 vol[0] = secMap3[icSpace-1];
162
d3f347ff 163 // The chamber number
164 // 1: outer left
82bbf98a 165 // 2: middle left
d3f347ff 166 // 3: inner
82bbf98a 167 // 4: middle right
d3f347ff 168 // 5: outer right
82bbf98a 169 if (iIdChamber == fIdChamber1)
170 vol[1] = (hits[2] < 0 ? 1 : 5);
171 else if (iIdChamber == fIdChamber2)
172 vol[1] = (hits[2] < 0 ? 2 : 4);
173 else if (iIdChamber == fIdChamber3)
d3f347ff 174 vol[1] = 3;
82bbf98a 175
fe4da5cc 176 // The plane number
82bbf98a 177 vol[2] = icChamber - TMath::Nint((Float_t) (icChamber / 7)) * 6;
178
179 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
d3f347ff 180
fe4da5cc 181 }
d3f347ff 182
fe4da5cc 183 }
d3f347ff 184
fe4da5cc 185}