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.8.1 2002/07/24 10:09:31 alibrary
21 Revision 1.2 2002/06/12 09:54:35 cblume
22 Update of tracking code provided by Sergei
24 Revision 1.1 2001/11/06 17:19:41 cblume
25 Add detailed geometry and simple simulator
29 ///////////////////////////////////////////////////////////////////////////////
31 // Simple TRD Monte Carlo class //
33 ///////////////////////////////////////////////////////////////////////////////
37 #include <TLorentzVector.h>
41 #include "AliTRDsimpleMC.h"
42 #include "AliTRDgeometry.h"
44 #include "AliTRDparameter.h"
46 ClassImp(AliTRDsimpleMC)
48 //_____________________________________________________________________________
49 AliTRDsimpleMC::AliTRDsimpleMC():AliMC()
52 // AliTRDsimpleMC default constructor
70 fTrackEntering = kFALSE;
77 //_____________________________________________________________________________
78 AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title)
82 // AliTRDsimpleMC default constructor
100 fTrackEntering = kFALSE;
107 //_____________________________________________________________________________
108 AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m)
111 // AliTRDsimpleMC copy constructor
114 ((AliTRDsimpleMC &) m).Copy(*this);
118 //_____________________________________________________________________________
119 AliTRDsimpleMC::~AliTRDsimpleMC()
122 // AliTRDsimpleMC destructor
127 //_____________________________________________________________________________
128 AliTRDsimpleMC &AliTRDsimpleMC::operator=(const AliTRDsimpleMC &m)
131 // Assignment operator
134 if (this != &m) ((AliTRDsimpleMC &) m).Copy(*this);
139 //_____________________________________________________________________________
140 void AliTRDsimpleMC::Copy(TObject &m)
146 ((AliTRDsimpleMC &) m).fMaxStep = fMaxStep;
147 ((AliTRDsimpleMC &) m).fNStep = fNStep;
148 ((AliTRDsimpleMC &) m).fTrack = fTrack;
149 ((AliTRDsimpleMC &) m).fTrackPx = fTrackPx;
150 ((AliTRDsimpleMC &) m).fTrackPy = fTrackPy;
151 ((AliTRDsimpleMC &) m).fTrackPz = fTrackPz;
152 ((AliTRDsimpleMC &) m).fTrackPtot = fTrackPtot;
153 ((AliTRDsimpleMC &) m).fTrackEtot = fTrackEtot;
154 ((AliTRDsimpleMC &) m).fTrackX = fTrackX;
155 ((AliTRDsimpleMC &) m).fTrackY = fTrackY;
156 ((AliTRDsimpleMC &) m).fTrackZ = fTrackZ;
157 ((AliTRDsimpleMC &) m).fTrackStep = fTrackStep;
158 ((AliTRDsimpleMC &) m).fTrackPid = fTrackPid;
159 ((AliTRDsimpleMC &) m).fTrackCharge = fTrackCharge;
160 ((AliTRDsimpleMC &) m).fTrackMass = fTrackMass;
161 ((AliTRDsimpleMC &) m).fTrackEntering = fTrackEntering;
165 //_____________________________________________________________________________
166 void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg
167 , Double_t px, Double_t py, Double_t pz)
170 // Starts a new track.
174 fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
178 fTRD = (AliTRDv1 *) gAlice->GetDetector("TRD");
179 fX0 = fPar->GetTime0(0) - AliTRDgeometry::DrThick();
189 fTrackEntering = kTRUE;
193 fTrackMass = 5.11e-4;
197 fTrackMass = 0.13957;
201 printf("<AliTRDsimpleMC::NewTrack> PDG code %d not implemented\n",pdg);
205 Double_t pTot2 = px*px + py*py + pz*pz;
206 fTrackPtot = TMath::Sqrt(pTot2);
207 fTrackEtot = TMath::Sqrt(pTot2 + fTrackMass*fTrackMass);
216 gAlice->SetCurrentTrack(-1);
220 //_____________________________________________________________________________
221 void AliTRDsimpleMC::ProcessEvent()
224 // Process one single track:
225 // - Determines the step size.
226 // - Calculates the track position
227 // - Calls TRD step manager.
230 // The stepsize from an exponential distribution
231 fTrackStep = gRandom->Exp(fMaxStep);
233 if ((fTrackEntering) && (fNStep > 0)) {
234 fTrackEntering = kFALSE;
238 // New track position
239 Double_t d = fTrackStep / fTrackPtot;
240 fTrackX += fTrackPx * d;
241 fTrackY += fTrackPy * d;
242 fTrackZ += fTrackPz * d;
244 // Call the TRD step manager
249 //_____________________________________________________________________________
250 void AliTRDsimpleMC::TrackPosition(TLorentzVector& position) const
256 position[0] = fTrackX;
257 position[1] = fTrackY;
258 position[2] = fTrackZ;
262 //_____________________________________________________________________________
263 void AliTRDsimpleMC::TrackMomentum(TLorentzVector& momentum) const
269 momentum[0] = fTrackPx;
270 momentum[1] = fTrackPy;
271 momentum[2] = fTrackPz;
272 momentum[3] = fTrackEtot;
276 //_____________________________________________________________________________
277 Int_t AliTRDsimpleMC::VolId(const Text_t* volName) const
280 // Returns the volume IDs:
282 // 2 = amplification region
283 // 3 = drift chambers
288 if (strcmp(volName,"UL05") == 0) {
291 else if (strcmp(volName,"UL06") == 0) {
294 else if (strcmp(volName,"UCII") == 0) {
302 //_____________________________________________________________________________
303 Int_t AliTRDsimpleMC::CurrentVolID(Int_t& copyNo) const
306 // Check for the current volume
314 if ((fTrackX-fX0) < AliTRDgeometry::DrThick()) {
317 else if ((fTrackX-fX0) < (AliTRDgeometry::DrThick() +
318 AliTRDgeometry::AmThick())) {
326 //_____________________________________________________________________________
327 Int_t AliTRDsimpleMC::CurrentVolOffID(Int_t off, Int_t ©No) const
330 // Check for the current volume