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