]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDv0.cxx
Only one initializer for a default argument
[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$
9d0b222b 18Revision 1.14 2000/02/28 19:10:26 cblume
19Include the new TRD classes
20
851d3db9 21Revision 1.13.4.1 2000/02/28 18:01:53 cblume
22Change to new hit version and introduce geometry class
23
24Revision 1.13 1999/11/05 22:50:28 fca
25Do not use Atan, removed from ROOT too
26
90f8d287 27Revision 1.12 1999/11/02 16:35:56 fca
28New version of TRD introduced
29
5c7f4665 30Revision 1.11 1999/11/01 20:41:51 fca
31Added protections against using the wrong version of FRAME
32
ab76897d 33Revision 1.10 1999/09/29 09:24:35 fca
34Introduction of the Copyright and cvs Log
35
4c039060 36*/
37
fe4da5cc 38///////////////////////////////////////////////////////////////////////////////
39// //
5c7f4665 40// Transition Radiation Detector version 0 -- fast simulator //
fe4da5cc 41// //
42//Begin_Html
43/*
5c7f4665 44<img src="picts/AliTRDfullClass.gif">
fe4da5cc 45*/
46//End_Html
47// //
48// //
49///////////////////////////////////////////////////////////////////////////////
50
51#include <TMath.h>
52#include <TRandom.h>
53#include <TVector.h>
fe4da5cc 54
fe4da5cc 55#include "AliRun.h"
56#include "AliMC.h"
57#include "AliConst.h"
58
851d3db9 59#include "AliTRDv0.h"
60#include "AliTRDgeometry.h"
fe4da5cc 61
851d3db9 62ClassImp(AliTRDv0)
63
fe4da5cc 64//_____________________________________________________________________________
65AliTRDv0::AliTRDv0(const char *name, const char *title)
66 :AliTRD(name, title)
67{
68 //
69 // Standard constructor for Transition Radiation Detector version 0
70 //
82bbf98a 71
72 fIdSens = 0;
73 fHitsOn = 0;
74
82bbf98a 75 fIdChamber1 = 0;
76 fIdChamber2 = 0;
77 fIdChamber3 = 0;
78
fe4da5cc 79}
851d3db9 80
fe4da5cc 81//_____________________________________________________________________________
82void AliTRDv0::CreateGeometry()
83{
84 //
82bbf98a 85 // Create the GEANT geometry for the Transition Radiation Detector - Version 0
86 // This version covers the full azimuth.
d3f347ff 87 //
d3f347ff 88
82bbf98a 89 // Check that FRAME is there otherwise we have no place where to put the TRD
90 AliModule* FRAME = gAlice->GetModule("FRAME");
91 if (!FRAME) return;
fe4da5cc 92
82bbf98a 93 // Define the chambers
94 AliTRD::CreateGeometry();
fe4da5cc 95
fe4da5cc 96}
97
98//_____________________________________________________________________________
99void AliTRDv0::CreateMaterials()
100{
101 //
102 // Create materials for the Transition Radiation Detector
103 //
82bbf98a 104
fe4da5cc 105 AliTRD::CreateMaterials();
82bbf98a 106
fe4da5cc 107}
108
109//_____________________________________________________________________________
110void AliTRDv0::Init()
111{
112 //
851d3db9 113 // Initialize Transition Radiation Detector after geometry is built
fe4da5cc 114 //
82bbf98a 115
fe4da5cc 116 AliTRD::Init();
82bbf98a 117
82bbf98a 118 // Identifier of the sensitive volume (amplification region)
119 fIdSens = gMC->VolId("UL06");
120
82bbf98a 121 // Identifier of the TRD-driftchambers
122 fIdChamber1 = gMC->VolId("UCIO");
123 fIdChamber2 = gMC->VolId("UCIM");
124 fIdChamber3 = gMC->VolId("UCII");
125
851d3db9 126 printf(" Fast simulator\n\n");
5c7f4665 127 for (Int_t i = 0; i < 80; i++) printf("*");
128 printf("\n");
129
fe4da5cc 130}
131
132//_____________________________________________________________________________
133void AliTRDv0::StepManager()
134{
135 //
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 //
140
851d3db9 141 Int_t pla = 0;
142 Int_t cha = 0;
143 Int_t sec = 0;
82bbf98a 144 Int_t iIdSens, icSens;
82bbf98a 145 Int_t iIdChamber, icChamber;
146
82bbf98a 147 Float_t hits[4];
9d0b222b 148 Int_t det[1];
fe4da5cc 149
0a6d8768 150 TLorentzVector p;
82bbf98a 151 TClonesArray &lhits = *fHits;
fe4da5cc 152
82bbf98a 153 // Writing out hits enabled?
154 if (!(fHitsOn)) return;
fe4da5cc 155
fe4da5cc 156 // Use only charged tracks and count them only once per volume
82bbf98a 157 if (gMC->TrackCharge() &&
158 gMC->IsTrackExiting()) {
fe4da5cc 159
160 // Check on sensitive volume
82bbf98a 161 iIdSens = gMC->CurrentVolID(icSens);
162 if (iIdSens == fIdSens) {
163
164 gMC->TrackPosition(p);
165 for (Int_t i = 0; i < 3; i++) hits[i] = p[i];
166 // No charge created
167 hits[3] = 0;
168
851d3db9 169 // The sector number (0 - 17)
170 // The numbering goes clockwise and starts at y = 0
171 Float_t phi = kRaddeg*TMath::ATan2(hits[0],hits[1]);
172 if (phi < 90.)
173 phi = phi + 270.;
174 else
175 phi = phi - 90.;
176 sec = ((Int_t) (phi / 20));
82bbf98a 177
d3f347ff 178 // The chamber number
851d3db9 179 // 0: outer left
180 // 1: middle left
181 // 2: inner
182 // 3: middle right
183 // 4: outer right
5c7f4665 184 iIdChamber = gMC->CurrentVolOffID(1,icChamber);
82bbf98a 185 if (iIdChamber == fIdChamber1)
851d3db9 186 cha = (hits[2] < 0 ? 0 : 4);
82bbf98a 187 else if (iIdChamber == fIdChamber2)
851d3db9 188 cha = (hits[2] < 0 ? 1 : 3);
82bbf98a 189 else if (iIdChamber == fIdChamber3)
851d3db9 190 cha = 2;
82bbf98a 191
851d3db9 192 // The plane number (0 - 5)
193 pla = icChamber - TMath::Nint((Float_t) (icChamber / 7)) * 6 - 1;
82bbf98a 194
9d0b222b 195 det[0] = fGeometry->GetDetector(pla,cha,sec);
851d3db9 196 new(lhits[fNhits++]) AliTRDhit(fIshunt
197 ,gAlice->CurrentTrack()
9d0b222b 198 ,det
851d3db9 199 ,hits);
d3f347ff 200
fe4da5cc 201 }
d3f347ff 202
fe4da5cc 203 }
d3f347ff 204
fe4da5cc 205}