er  dev
ERBeamDetMWPCPoint.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERBeamDetMWPCPoint source file -----
3 // -------------------------------------------------------------------------
4 
5 #include "ERBeamDetMWPCPoint.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 ERBeamDetMWPCPoint::ERBeamDetMWPCPoint(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,
22  Int_t mwpcNb, Int_t planeNb, Int_t wireNb)
23  : FairMCPoint(trackID, -1., posIn, momIn, tof, length, eLoss),
24  fEventID(eventID),
25  fPid(pid),
26  fX_out(posOut.X()), fY_out(posOut.Y()), fZ_out(posOut.Z()),
27  fPx_out(momOut.X()), fPy_out(momOut.Y()), fPz_out(momOut.Z()),
28  fLightYield(lightYield),
29  fMWPCNb(mwpcNb),
30  fPlaneNb(planeNb),
31  fWireNb(wireNb)
32 {
33 }
34 // -------------------------------------------------------------------------
36  : FairMCPoint(right),
37  fPid(right.fPid),
38  fX_out(right.fX_out), fY_out(right.fY_out), fZ_out(right.fZ_out),
39  fPx_out(right.fPx_out), fPy_out(right.fPy_out), fPz_out(right.fPz_out)
40 {
41 }
42 // -------------------------------------------------------------------------
44 {
45 }
46 // -------------------------------------------------------------------------
47 void ERBeamDetMWPCPoint::Print(const Option_t* opt /* = 0*/) const
48 {
49  cout << "-I- ERBeamDetMWPCPoint: track " << fTrackID << " mother track = " << fMot0TrackID << endl;
50  cout << " particle ID " << fPid << endl;
51  cout << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << endl;
52  cout << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") MeV" << endl;
53  cout << " Time " << fTime << " ns, Length " << fLength << " cm" << endl;
54  cout << " Energy loss " << fELoss << " MeV "<< endl;
55 }
56 // -------------------------------------------------------------------------
57 // ----- Point x coordinate from linear extrapolation ------------------
58 Double_t ERBeamDetMWPCPoint::GetX(Double_t z) const
59 {
60  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
61  Double_t dz = fZ_out - fZ;
62  return ( fX + (z-fZ) / dz * (fX_out-fX) );
63 }
64 // -------------------------------------------------------------------------
65 
66 // ----- Point y coordinate from linear extrapolation ------------------
67 Double_t ERBeamDetMWPCPoint::GetY(Double_t z) const
68 {
69  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
70  Double_t dz = fZ_out - fZ;
71  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
72  return ( fY + (z-fZ) / dz * (fY_out-fY) );
73 }
74 // -------------------------------------------------------------------------
75 // ----- Public method IsUsable ----------------------------------------
77 {
78  Double_t dz = fZ_out - fZ;
79  if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
80  return kTRUE;
81 }
82 // -------------------------------------------------------------------------
83 ClassImp(ERBeamDetMWPCPoint)
Bool_t IsUsable() const
Double_t GetX(Double_t z) const
virtual void Print(const Option_t *opt=0) const