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