er  dev
ERBeamDetTOFPoint.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERBeamDetTOFPoint source file -----
3 // -------------------------------------------------------------------------
4 
5 #include "ERBeamDetTOFPoint.h"
6 #include <iostream>
7 using namespace std;
8 // ----- Default constructor -------------------------------------------
10  : FairMCPoint(),
11  fX_out(0.), fY_out(0.), fZ_out(0.),
12  fPx_out(0.), fPy_out(0.), fPz_out(0.)
13 {
14 }
15 // -------------------------------------------------------------------------
16 ERBeamDetTOFPoint::ERBeamDetTOFPoint(Int_t eventID, Int_t trackID,
17  Int_t mot0trackID,
18  Int_t pid,
19  TVector3 posIn,
20  TVector3 posOut, TVector3 momIn, TVector3 momOut,
21  Double_t ToF, Double_t length, Double_t eLoss, Double_t lightYield, Int_t tofNb)
22  : FairMCPoint(trackID, -1., posIn, momIn, ToF, length, eLoss),
23  fEventID(eventID),
24  fPid(pid),
25  fX_out(posOut.X()), fY_out(posOut.Y()), fZ_out(posOut.Z()),
26  fPx_out(momOut.X()), fPy_out(momOut.Y()), fPz_out(momOut.Z()),
27  fLightYield(lightYield),
28  fToFNb(tofNb)
29 {
30 }
31 // -------------------------------------------------------------------------
33  : FairMCPoint(right),
34  fPid(right.fPid),
35  fX_out(right.fX_out), fY_out(right.fY_out), fZ_out(right.fZ_out),
36  fPx_out(right.fPx_out), fPy_out(right.fPy_out), fPz_out(right.fPz_out)
37 {
38 }
39 // -------------------------------------------------------------------------
41 {
42 }
43 // -------------------------------------------------------------------------
44 void ERBeamDetTOFPoint::Print(const Option_t* opt /* = 0*/) const
45 {
46  cout << "-I- ERBeamDetTOFPoint: track " << fTrackID << " mother track = " << fMot0TrackID << endl;
47  cout << " particle ID " << fPid << endl;
48  cout << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << endl;
49  cout << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") MeV" << endl;
50  cout << " Time " << fTime << " ns, Length " << fLength << " cm" << endl;
51  cout << " Energy loss " << fELoss << " MeV "<< endl;
52 }
53 // -------------------------------------------------------------------------
54 // ----- Point x coordinate from linear extrapolation ------------------
55 Double_t ERBeamDetTOFPoint::GetX(Double_t z) const
56 {
57  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
58  Double_t dz = fZ_out - fZ;
59  return ( fX + (z-fZ) / dz * (fX_out-fX) );
60 }
61 // -------------------------------------------------------------------------
62 
63 // ----- Point y coordinate from linear extrapolation ------------------
64 Double_t ERBeamDetTOFPoint::GetY(Double_t z) const
65 {
66  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
67  Double_t dz = fZ_out - fZ;
68  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
69  return ( fY + (z-fZ) / dz * (fY_out-fY) );
70 }
71 // -------------------------------------------------------------------------
72 // ----- Public method IsUsable ----------------------------------------
74 {
75  Double_t dz = fZ_out - fZ;
76  if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
77  return kTRUE;
78 }
79 // -------------------------------------------------------------------------
80 ClassImp(ERBeamDetTOFPoint)
virtual void Print(const Option_t *opt=0) const
Bool_t IsUsable() const
Double_t GetX(Double_t z) const