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