er  dev
ERGadastLaBrPoint.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERGadastLaBrPoint source file -----
3 // -------------------------------------------------------------------------
4 
5 #include "ERGadastLaBrPoint.h"
6 #include<iostream>
7 // ----- Default constructor -------------------------------------------
9  : FairMCPoint(),
10  fX_out(0.), fY_out(0.), fZ_out(0.),
11  fPx_out(0.), fPy_out(0.), fPz_out(0.)
12 {
13 }
14 // -------------------------------------------------------------------------
15 
16 
17 
18 // ----- Standard constructor ------------------------------------------
19 ERGadastLaBrPoint::ERGadastLaBrPoint(Int_t eventID, Int_t trackID,
20  Int_t mot0trackID,
21  Double_t mass,
22  TVector3 posIn,
23  TVector3 posOut, TVector3 momIn, TVector3 momOut,
24  Double_t tof, Double_t length, Double_t eLoss, Int_t pdg, Int_t cell)
25  : FairMCPoint(trackID, -1., posIn, momIn, tof, length, eLoss),
26  fEventID(eventID),
27  fX_out(posOut.X()), fY_out(posOut.Y()), fZ_out(posOut.Z()),
28  fPx_out(momOut.X()), fPy_out(momOut.Y()), fPz_out(momOut.Z()),
29  fPDG(pdg), fCell(cell)
30 {
31 }
32 // -------------------------------------------------------------------------
33 
34 
35 
36 // -------------------------------------------------------------------------
38  : FairMCPoint(right),
39  fX_out(right.fX_out), fY_out(right.fY_out), fZ_out(right.fZ_out),
40  fPx_out(right.fPx_out), fPy_out(right.fPy_out), fPz_out(right.fPz_out),
41  fPDG(right.fPDG), fCell(right.fCell)
42 {
43 }
44 // -------------------------------------------------------------------------
45 
46 
47 
48 // ----- Destructor ----------------------------------------------------
50 {
51 }
52 // -------------------------------------------------------------------------
53 
54 
55 
56 // ----- Public method Print -------------------------------------------
57 void ERGadastLaBrPoint::Print(const Option_t* opt /* = 0*/) const
58 {
59  std::cout << "-I- ERGadastLaBrPoint: track " << fTrackID << " mother track = " << fMot0TrackID << std::endl;
60  std::cout << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << std::endl;
61  std::cout << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << std::endl;
62  std::cout << " Time " << fTime << " ns, Length " << fLength << " cm" << std::endl;
63  std::cout << " Energy loss " << fELoss << " keV "<< std::endl;
64 }
65 // -------------------------------------------------------------------------
66 
67 
68 
69 // ----- Point x coordinate from linear extrapolation ------------------
70 Double_t ERGadastLaBrPoint::GetX(Double_t z) const
71 {
72  // cout << fZ << " " << z << " " << fZ_out << endl;
73  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
74  Double_t dz = fZ_out - fZ;
75  return ( fX + (z-fZ) / dz * (fX_out-fX) );
76 }
77 // -------------------------------------------------------------------------
78 
79 
80 
81 // ----- Point y coordinate from linear extrapolation ------------------
82 Double_t ERGadastLaBrPoint::GetY(Double_t z) const
83 {
84  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
85  Double_t dz = fZ_out - fZ;
86  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
87  return ( fY + (z-fZ) / dz * (fY_out-fY) );
88 }
89 // -------------------------------------------------------------------------
90 
91 
92 
93 // ----- Public method IsUsable ----------------------------------------
95 {
96  Double_t dz = fZ_out - fZ;
97  if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
98  return kTRUE;
99 }
100 // -------------------------------------------------------------------------
101 
102 
103 
104 ClassImp(ERGadastLaBrPoint)
virtual void Print(const Option_t *opt=0) const
Bool_t IsUsable() const
Double_t GetX(Double_t z) const