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