er  dev
ERSensPlanePoint.cxx
1 /********************************************************************************
2  * Copyright (C) Joint Institute for Nuclear Research *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 // ------------------------------------------------------------------------------
10 // ----- ERSensPlanePoint source file -----
11 // ------------------------------------------------------------------------------
12 
13 #include "ERSensPlanePoint.h"
14 
15 #include "FairLogger.h"
16 
17 // ----- Default constructor ------------------------------------------------
19  : FairMCPoint(),
20  fX_out(0.),
21  fY_out(0.),
22  fZ_out(0.),
23  fPx_out(0.),
24  fPy_out(0.),
25  fPz_out(0.)
26 {
27 }
28 // ------------------------------------------------------------------------------
29 
30 // ----- Standard constructor -----------------------------------------------
32  Int_t trackID,
33  Int_t mot0trackID,
34  Double_t mass,
35  TVector3 posIn,
36  TVector3 posOut,
37  TVector3 momIn,
38  TVector3 momOut,
39  Double_t tof,
40  Double_t length,
41  Double_t eLoss)
42  : FairMCPoint(trackID, -1., posIn, momIn, tof, length, eLoss),
43  fEventID(eventID),
44  fX_out(posOut.X()),
45  fY_out(posOut.Y()),
46  fZ_out(posOut.Z()),
47  fPx_out(momOut.X()),
48  fPy_out(momOut.Y()),
49  fPz_out(momOut.Z())
50 {
51 }
52 // ------------------------------------------------------------------------------
53 
54 // ------------------------------------------------------------------------------
56  : FairMCPoint(right),
57  fX_out(right.fX_out),
58  fY_out(right.fY_out),
59  fZ_out(right.fZ_out),
60  fPx_out(right.fPx_out),
61  fPy_out(right.fPy_out),
62  fPz_out(right.fPz_out)
63 {
64 }
65 // ------------------------------------------------------------------------------
66 
67 // ----- Destructor ---------------------------------------------------------
69 {
70 }
71 // ------------------------------------------------------------------------------
72 
73 // ----- Public method Print ------------------------------------------------
74 void ERSensPlanePoint::Print(const Option_t* opt /* = 0*/) const
75 {
76  LOG(INFO) << "-I- ERSensPlanePoint: track " << fTrackID
77  << " mother track = " << fMot0TrackID << FairLogger::endl;
78  LOG(INFO) << " Position (" << fX << ", " << fY << ", "
79  << fZ << ") cm" << FairLogger::endl;
80  LOG(INFO) << " Momentum (" << fPx << ", " << fPy << ", "
81  << fPz << ") GeV" << FairLogger::endl;
82  LOG(INFO) << " Time " << fTime << " ns, Length "
83  << fLength << " cm" << FairLogger::endl;
84  LOG(INFO) << " Energy loss " << fELoss << " keV "<< FairLogger::endl;
85 }
86 // ------------------------------------------------------------------------------
87 
88 // ----- Point x coordinate from linear extrapolation -----------------------
89 Double_t ERSensPlanePoint::GetX(Double_t z) const
90 {
91  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
92  Double_t dz = fZ_out - fZ;
93  return ( fX + (z-fZ) / dz * (fX_out-fX) );
94 }
95 // ------------------------------------------------------------------------------
96 
97 // ----- Point y coordinate from linear extrapolation -----------------------
98 Double_t ERSensPlanePoint::GetY(Double_t z) const
99 {
100  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
101  Double_t dz = fZ_out - fZ;
102  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
103  return ( fY + (z-fZ) / dz * (fY_out-fY) );
104 }
105 // ------------------------------------------------------------------------------
106 
107 // ----- Public method IsUsable ---------------------------------------------
109 {
110  Double_t dz = fZ_out - fZ;
111  if (TMath::Abs(dz) < 1.e-4) return kFALSE;
112  return kTRUE;
113 }
114 // ------------------------------------------------------------------------------
115 
116 ClassImp(ERSensPlanePoint)
virtual void Print(const Option_t *opt=0) const
Double_t GetX(Double_t z) const
virtual ~ERSensPlanePoint()
Bool_t IsUsable() const