]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDv0.cxx
Introduce parameter class
[u/mrichter/AliRoot.git] / TRD / AliTRDv0.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$
e6674585 18Revision 1.20 2002/02/13 16:58:37 cblume
19Bug fix reported by Jiri. Make atoi input zero terminated in StepManager()
20
593a9fc3 21Revision 1.19 2002/02/11 14:25:27 cblume
22Geometry update, compressed hit structure
23
332e9569 24Revision 1.18 2000/11/30 17:38:08 cblume
25Changes to get in line with new STEER and EVGEN
26
1819f4bb 27Revision 1.17 2000/11/01 14:53:21 cblume
28Merge with TRD-develop
29
793ff80c 30Revision 1.14.2.3 2000/10/06 16:49:46 cblume
31Made Getters const
32
33Revision 1.14.2.2 2000/10/04 16:34:58 cblume
34Replace include files by forward declarations
35
36Revision 1.14.2.1 2000/09/18 13:48:18 cblume
37Adapt to new AliTRDhit
38
39Revision 1.16 2000/06/08 18:32:58 cblume
40Make code compliant to coding conventions
41
8230f242 42Revision 1.15 2000/06/07 16:25:37 cblume
43Try to remove compiler warnings on Sun and HP
44
9d0b222b 45Revision 1.14 2000/02/28 19:10:26 cblume
46Include the new TRD classes
47
851d3db9 48Revision 1.13.4.1 2000/02/28 18:01:53 cblume
49Change to new hit version and introduce geometry class
50
51Revision 1.13 1999/11/05 22:50:28 fca
52Do not use Atan, removed from ROOT too
53
90f8d287 54Revision 1.12 1999/11/02 16:35:56 fca
55New version of TRD introduced
56
5c7f4665 57Revision 1.11 1999/11/01 20:41:51 fca
58Added protections against using the wrong version of FRAME
59
ab76897d 60Revision 1.10 1999/09/29 09:24:35 fca
61Introduction of the Copyright and cvs Log
62
4c039060 63*/
64
fe4da5cc 65///////////////////////////////////////////////////////////////////////////////
66// //
5c7f4665 67// Transition Radiation Detector version 0 -- fast simulator //
fe4da5cc 68// //
69//Begin_Html
70/*
5c7f4665 71<img src="picts/AliTRDfullClass.gif">
fe4da5cc 72*/
73//End_Html
74// //
75// //
76///////////////////////////////////////////////////////////////////////////////
77
332e9569 78#include <stdlib.h>
79
fe4da5cc 80#include <TMath.h>
81#include <TRandom.h>
1819f4bb 82#include <TVector.h>
83#include <TLorentzVector.h>
fe4da5cc 84
fe4da5cc 85#include "AliRun.h"
86#include "AliMC.h"
87#include "AliConst.h"
88
851d3db9 89#include "AliTRDv0.h"
793ff80c 90#include "AliTRDhit.h"
851d3db9 91#include "AliTRDgeometry.h"
fe4da5cc 92
851d3db9 93ClassImp(AliTRDv0)
8230f242 94
95//_____________________________________________________________________________
96AliTRDv0::AliTRDv0():AliTRD()
97{
98 //
99 // AliTRDv0 default constructor
100 //
101
8230f242 102 fHitsOn = 0;
103
8230f242 104}
105
fe4da5cc 106//_____________________________________________________________________________
107AliTRDv0::AliTRDv0(const char *name, const char *title)
108 :AliTRD(name, title)
109{
110 //
111 // Standard constructor for Transition Radiation Detector version 0
112 //
82bbf98a 113
82bbf98a 114 fHitsOn = 0;
115
fe4da5cc 116}
851d3db9 117
8230f242 118//_____________________________________________________________________________
119AliTRDv0::~AliTRDv0()
120{
121 //
122 // AliTRDv0 destructor
123 //
124
125}
126
fe4da5cc 127//_____________________________________________________________________________
128void AliTRDv0::CreateGeometry()
129{
130 //
82bbf98a 131 // Create the GEANT geometry for the Transition Radiation Detector - Version 0
132 // This version covers the full azimuth.
d3f347ff 133 //
d3f347ff 134
82bbf98a 135 // Check that FRAME is there otherwise we have no place where to put the TRD
8230f242 136 AliModule* frame = gAlice->GetModule("FRAME");
137 if (!frame) return;
fe4da5cc 138
82bbf98a 139 // Define the chambers
140 AliTRD::CreateGeometry();
fe4da5cc 141
fe4da5cc 142}
143
144//_____________________________________________________________________________
145void AliTRDv0::CreateMaterials()
146{
147 //
148 // Create materials for the Transition Radiation Detector
149 //
82bbf98a 150
fe4da5cc 151 AliTRD::CreateMaterials();
82bbf98a 152
fe4da5cc 153}
154
155//_____________________________________________________________________________
156void AliTRDv0::Init()
157{
158 //
851d3db9 159 // Initialize Transition Radiation Detector after geometry is built
fe4da5cc 160 //
82bbf98a 161
fe4da5cc 162 AliTRD::Init();
82bbf98a 163
851d3db9 164 printf(" Fast simulator\n\n");
5c7f4665 165 for (Int_t i = 0; i < 80; i++) printf("*");
166 printf("\n");
167
fe4da5cc 168}
169
170//_____________________________________________________________________________
171void AliTRDv0::StepManager()
172{
173 //
174 // Procedure called at every step in the TRD
82bbf98a 175 // Fast simulator. If switched on, a hit is produced when a track
176 // crosses the border between amplification region and pad plane.
fe4da5cc 177 //
178
851d3db9 179 Int_t pla = 0;
180 Int_t cha = 0;
181 Int_t sec = 0;
82bbf98a 182
793ff80c 183 Float_t hits[3];
184 Int_t det;
fe4da5cc 185
0a6d8768 186 TLorentzVector p;
332e9569 187
188 // Use pad plane as sensitive volume
189 TString cIdSens = "L";
190 TString cIdCurrent;
593a9fc3 191 Char_t cIdChamber[3];
192 cIdChamber[2] = 0;
332e9569 193
194 const Int_t kNplan = AliTRDgeometry::Nplan();
fe4da5cc 195
82bbf98a 196 // Writing out hits enabled?
197 if (!(fHitsOn)) return;
fe4da5cc 198
fe4da5cc 199 // Use only charged tracks and count them only once per volume
82bbf98a 200 if (gMC->TrackCharge() &&
332e9569 201 gMC->IsTrackEntering()) {
fe4da5cc 202
203 // Check on sensitive volume
332e9569 204 cIdCurrent = gMC->CurrentVolName();
e6674585 205 if (cIdSens == cIdCurrent[1]) {
82bbf98a 206
207 gMC->TrackPosition(p);
208 for (Int_t i = 0; i < 3; i++) hits[i] = p[i];
82bbf98a 209
851d3db9 210 // The sector number (0 - 17)
211 // The numbering goes clockwise and starts at y = 0
212 Float_t phi = kRaddeg*TMath::ATan2(hits[0],hits[1]);
213 if (phi < 90.)
214 phi = phi + 270.;
215 else
216 phi = phi - 90.;
217 sec = ((Int_t) (phi / 20));
82bbf98a 218
332e9569 219 // The plane and chamber number
220 cIdChamber[0] = cIdCurrent[2];
221 cIdChamber[1] = cIdCurrent[3];
222 Int_t idChamber = atoi(cIdChamber);
223 cha = ((Int_t) idChamber / kNplan);
224 pla = ((Int_t) idChamber % kNplan);
793ff80c 225 det = fGeometry->GetDetector(pla,cha,sec);
82bbf98a 226
332e9569 227 AddHit(gAlice->CurrentTrack(),det,hits,0,kTRUE);
d3f347ff 228
fe4da5cc 229 }
d3f347ff 230
fe4da5cc 231 }
d3f347ff 232
fe4da5cc 233}