]>
Commit | Line | Data |
---|---|---|
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 | ||
88cb7938 | 16 | /* $Id$ */ |
4c039060 | 17 | |
fe4da5cc | 18 | /////////////////////////////////////////////////////////////////////////////// |
19 | // // | |
5c7f4665 | 20 | // Transition Radiation Detector version 0 -- fast simulator // |
fe4da5cc | 21 | // // |
22 | //Begin_Html | |
23 | /* | |
5c7f4665 | 24 | <img src="picts/AliTRDfullClass.gif"> |
fe4da5cc | 25 | */ |
26 | //End_Html | |
27 | // // | |
28 | // // | |
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | ||
332e9569 | 31 | #include <stdlib.h> |
32 | ||
88cb7938 | 33 | #include <TLorentzVector.h> |
fe4da5cc | 34 | #include <TMath.h> |
35 | #include <TRandom.h> | |
1819f4bb | 36 | #include <TVector.h> |
88cb7938 | 37 | #include <TVirtualMC.h> |
fe4da5cc | 38 | |
fe4da5cc | 39 | #include "AliConst.h" |
88cb7938 | 40 | #include "AliRun.h" |
851d3db9 | 41 | #include "AliTRDgeometry.h" |
88cb7938 | 42 | #include "AliTRDhit.h" |
43 | #include "AliTRDv0.h" | |
fe4da5cc | 44 | |
851d3db9 | 45 | ClassImp(AliTRDv0) |
8230f242 | 46 | |
47 | //_____________________________________________________________________________ | |
48 | AliTRDv0::AliTRDv0():AliTRD() | |
49 | { | |
50 | // | |
51 | // AliTRDv0 default constructor | |
52 | // | |
53 | ||
8230f242 | 54 | fHitsOn = 0; |
55 | ||
8230f242 | 56 | } |
57 | ||
fe4da5cc | 58 | //_____________________________________________________________________________ |
59 | AliTRDv0::AliTRDv0(const char *name, const char *title) | |
60 | :AliTRD(name, title) | |
61 | { | |
62 | // | |
63 | // Standard constructor for Transition Radiation Detector version 0 | |
64 | // | |
82bbf98a | 65 | |
82bbf98a | 66 | fHitsOn = 0; |
67 | ||
fe4da5cc | 68 | } |
851d3db9 | 69 | |
8230f242 | 70 | //_____________________________________________________________________________ |
71 | AliTRDv0::~AliTRDv0() | |
72 | { | |
73 | // | |
74 | // AliTRDv0 destructor | |
75 | // | |
76 | ||
77 | } | |
78 | ||
fe4da5cc | 79 | //_____________________________________________________________________________ |
80 | void AliTRDv0::CreateGeometry() | |
81 | { | |
82 | // | |
82bbf98a | 83 | // Create the GEANT geometry for the Transition Radiation Detector - Version 0 |
84 | // This version covers the full azimuth. | |
d3f347ff | 85 | // |
d3f347ff | 86 | |
82bbf98a | 87 | // Check that FRAME is there otherwise we have no place where to put the TRD |
8230f242 | 88 | AliModule* frame = gAlice->GetModule("FRAME"); |
89 | if (!frame) return; | |
fe4da5cc | 90 | |
82bbf98a | 91 | // Define the chambers |
92 | AliTRD::CreateGeometry(); | |
fe4da5cc | 93 | |
fe4da5cc | 94 | } |
95 | ||
96 | //_____________________________________________________________________________ | |
97 | void AliTRDv0::CreateMaterials() | |
98 | { | |
99 | // | |
100 | // Create materials for the Transition Radiation Detector | |
101 | // | |
82bbf98a | 102 | |
fe4da5cc | 103 | AliTRD::CreateMaterials(); |
82bbf98a | 104 | |
fe4da5cc | 105 | } |
106 | ||
107 | //_____________________________________________________________________________ | |
108 | void AliTRDv0::Init() | |
109 | { | |
110 | // | |
851d3db9 | 111 | // Initialize Transition Radiation Detector after geometry is built |
fe4da5cc | 112 | // |
82bbf98a | 113 | |
fe4da5cc | 114 | AliTRD::Init(); |
82bbf98a | 115 | |
851d3db9 | 116 | printf(" Fast simulator\n\n"); |
5c7f4665 | 117 | for (Int_t i = 0; i < 80; i++) printf("*"); |
118 | printf("\n"); | |
119 | ||
fe4da5cc | 120 | } |
121 | ||
122 | //_____________________________________________________________________________ | |
123 | void AliTRDv0::StepManager() | |
124 | { | |
125 | // | |
126 | // Procedure called at every step in the TRD | |
82bbf98a | 127 | // Fast simulator. If switched on, a hit is produced when a track |
128 | // crosses the border between amplification region and pad plane. | |
fe4da5cc | 129 | // |
130 | ||
851d3db9 | 131 | Int_t pla = 0; |
132 | Int_t cha = 0; | |
133 | Int_t sec = 0; | |
82bbf98a | 134 | |
793ff80c | 135 | Float_t hits[3]; |
136 | Int_t det; | |
fe4da5cc | 137 | |
0a6d8768 | 138 | TLorentzVector p; |
332e9569 | 139 | |
140 | // Use pad plane as sensitive volume | |
141 | TString cIdSens = "L"; | |
142 | TString cIdCurrent; | |
593a9fc3 | 143 | Char_t cIdChamber[3]; |
144 | cIdChamber[2] = 0; | |
332e9569 | 145 | |
146 | const Int_t kNplan = AliTRDgeometry::Nplan(); | |
fe4da5cc | 147 | |
82bbf98a | 148 | // Writing out hits enabled? |
149 | if (!(fHitsOn)) return; | |
fe4da5cc | 150 | |
fe4da5cc | 151 | // Use only charged tracks and count them only once per volume |
82bbf98a | 152 | if (gMC->TrackCharge() && |
332e9569 | 153 | gMC->IsTrackEntering()) { |
fe4da5cc | 154 | |
155 | // Check on sensitive volume | |
332e9569 | 156 | cIdCurrent = gMC->CurrentVolName(); |
e6674585 | 157 | if (cIdSens == cIdCurrent[1]) { |
82bbf98a | 158 | |
159 | gMC->TrackPosition(p); | |
160 | for (Int_t i = 0; i < 3; i++) hits[i] = p[i]; | |
82bbf98a | 161 | |
851d3db9 | 162 | // The sector number (0 - 17) |
163 | // The numbering goes clockwise and starts at y = 0 | |
164 | Float_t phi = kRaddeg*TMath::ATan2(hits[0],hits[1]); | |
165 | if (phi < 90.) | |
166 | phi = phi + 270.; | |
167 | else | |
168 | phi = phi - 90.; | |
169 | sec = ((Int_t) (phi / 20)); | |
82bbf98a | 170 | |
332e9569 | 171 | // The plane and chamber number |
172 | cIdChamber[0] = cIdCurrent[2]; | |
173 | cIdChamber[1] = cIdCurrent[3]; | |
174 | Int_t idChamber = atoi(cIdChamber); | |
175 | cha = ((Int_t) idChamber / kNplan); | |
176 | pla = ((Int_t) idChamber % kNplan); | |
793ff80c | 177 | det = fGeometry->GetDetector(pla,cha,sec); |
82bbf98a | 178 | |
642f15cf | 179 | AddHit(gAlice->GetCurrentTrackNumber(),det,hits,0,kTRUE); |
d3f347ff | 180 | |
fe4da5cc | 181 | } |
d3f347ff | 182 | |
fe4da5cc | 183 | } |
d3f347ff | 184 | |
fe4da5cc | 185 | } |