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