1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.1 2001/11/06 17:19:41 cblume
19 Add detailed geometry and simple simulator
23 ///////////////////////////////////////////////////////////////////////////////
25 // Simple TRD Monte Carlo class //
27 ///////////////////////////////////////////////////////////////////////////////
31 #include <TLorentzVector.h>
35 #include "AliTRDsimpleMC.h"
36 #include "AliTRDgeometry.h"
38 #include "AliTRDparameter.h"
40 ClassImp(AliTRDsimpleMC)
42 //_____________________________________________________________________________
43 AliTRDsimpleMC::AliTRDsimpleMC():AliMC()
46 // AliTRDsimpleMC default constructor
64 fTrackEntering = kFALSE;
71 //_____________________________________________________________________________
72 AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title)
76 // AliTRDsimpleMC default constructor
94 fTrackEntering = kFALSE;
101 //_____________________________________________________________________________
102 AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m)
105 // AliTRDsimpleMC copy constructor
108 ((AliTRDsimpleMC &) m).Copy(*this);
112 //_____________________________________________________________________________
113 AliTRDsimpleMC::~AliTRDsimpleMC()
116 // AliTRDsimpleMC destructor
121 //_____________________________________________________________________________
122 AliTRDsimpleMC &AliTRDsimpleMC::operator=(const AliTRDsimpleMC &m)
125 // Assignment operator
128 if (this != &m) ((AliTRDsimpleMC &) m).Copy(*this);
133 //_____________________________________________________________________________
134 void AliTRDsimpleMC::Copy(TObject &m)
140 ((AliTRDsimpleMC &) m).fMaxStep = fMaxStep;
141 ((AliTRDsimpleMC &) m).fNStep = fNStep;
142 ((AliTRDsimpleMC &) m).fTrack = fTrack;
143 ((AliTRDsimpleMC &) m).fTrackPx = fTrackPx;
144 ((AliTRDsimpleMC &) m).fTrackPy = fTrackPy;
145 ((AliTRDsimpleMC &) m).fTrackPz = fTrackPz;
146 ((AliTRDsimpleMC &) m).fTrackPtot = fTrackPtot;
147 ((AliTRDsimpleMC &) m).fTrackEtot = fTrackEtot;
148 ((AliTRDsimpleMC &) m).fTrackX = fTrackX;
149 ((AliTRDsimpleMC &) m).fTrackY = fTrackY;
150 ((AliTRDsimpleMC &) m).fTrackZ = fTrackZ;
151 ((AliTRDsimpleMC &) m).fTrackStep = fTrackStep;
152 ((AliTRDsimpleMC &) m).fTrackPid = fTrackPid;
153 ((AliTRDsimpleMC &) m).fTrackCharge = fTrackCharge;
154 ((AliTRDsimpleMC &) m).fTrackMass = fTrackMass;
155 ((AliTRDsimpleMC &) m).fTrackEntering = fTrackEntering;
159 //_____________________________________________________________________________
160 void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg
161 , Double_t px, Double_t py, Double_t pz)
164 // Starts a new track.
168 fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
172 fTRD = (AliTRDv1 *) gAlice->GetDetector("TRD");
173 fX0 = fPar->GetTime0(0) - AliTRDgeometry::DrThick();
183 fTrackEntering = kTRUE;
187 fTrackMass = 5.11e-4;
191 fTrackMass = 0.13957;
195 printf("<AliTRDsimpleMC::NewTrack> PDG code %d not implemented\n",pdg);
199 Double_t pTot2 = px*px + py*py + pz*pz;
200 fTrackPtot = TMath::Sqrt(pTot2);
201 fTrackEtot = TMath::Sqrt(pTot2 + fTrackMass*fTrackMass);
210 gAlice->SetCurrentTrack(-1);
214 //_____________________________________________________________________________
215 void AliTRDsimpleMC::ProcessEvent()
218 // Process one single track:
219 // - Determines the step size.
220 // - Calculates the track position
221 // - Calls TRD step manager.
224 // The stepsize from an exponential distribution
225 fTrackStep = gRandom->Exp(fMaxStep);
227 if ((fTrackEntering) && (fNStep > 0)) {
228 fTrackEntering = kFALSE;
232 // New track position
233 Double_t d = fTrackStep / fTrackPtot;
234 fTrackX += fTrackPx * d;
235 fTrackY += fTrackPy * d;
236 fTrackZ += fTrackPz * d;
238 // Call the TRD step manager
243 //_____________________________________________________________________________
244 void AliTRDsimpleMC::TrackPosition(TLorentzVector& position) const
250 position[0] = fTrackX;
251 position[1] = fTrackY;
252 position[2] = fTrackZ;
256 //_____________________________________________________________________________
257 void AliTRDsimpleMC::TrackMomentum(TLorentzVector& momentum) const
263 momentum[0] = fTrackPx;
264 momentum[1] = fTrackPy;
265 momentum[2] = fTrackPz;
266 momentum[3] = fTrackEtot;
270 //_____________________________________________________________________________
271 Int_t AliTRDsimpleMC::VolId(const Text_t* volName) const
274 // Returns the volume IDs:
276 // 2 = amplification region
277 // 3 = drift chambers
282 if (strcmp(volName,"UL05") == 0) {
285 else if (strcmp(volName,"UL06") == 0) {
288 else if (strcmp(volName,"UCII") == 0) {
296 //_____________________________________________________________________________
297 Int_t AliTRDsimpleMC::CurrentVolID(Int_t& copyNo) const
300 // Check for the current volume
308 if ((fTrackX-fX0) < AliTRDgeometry::DrThick()) {
311 else if ((fTrackX-fX0) < (AliTRDgeometry::DrThick() +
312 AliTRDgeometry::AmThick())) {
320 //_____________________________________________________________________________
321 Int_t AliTRDsimpleMC::CurrentVolOffID(Int_t off, Int_t ©No) const
324 // Check for the current volume