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