er  dev
ERGadastCsIPoint.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 #include "ERGadastCsIPoint.h"
10 
11 #include "FairLogger.h"
12 
13 //--------------------------------------------------------------------------------------------------
15  FairMCPoint(),
16  fX_out(0.), fY_out(0.), fZ_out(0.),
17  fPx_out(0.), fPy_out(0.), fPz_out(0.)
18 {
19 }
20 
21 //--------------------------------------------------------------------------------------------------
22 ERGadastCsIPoint::ERGadastCsIPoint(Int_t eventID, Int_t trackID,
23  Int_t mot0trackID,
24  Double_t mass,
25  TVector3 posIn,
26  TVector3 posOut, TVector3 momIn, TVector3 momOut,
27  Double_t tof, Double_t length, Double_t eLoss, Int_t pdg,
28  Int_t wall, Int_t block, Int_t cell):
29  FairMCPoint(trackID, -1., posIn, momIn, tof, length, eLoss),
30  fEventID(eventID),
31  fX_out(posOut.X()), fY_out(posOut.Y()), fZ_out(posOut.Z()),
32  fPx_out(momOut.X()), fPy_out(momOut.Y()), fPz_out(momOut.Z()),
33  fPDG(pdg), fWall(wall), fBlock(block), fCell(cell)
34 {
35 }
36 
37 //--------------------------------------------------------------------------------------------------
39  FairMCPoint(right),
40  fX_out(right.fX_out), fY_out(right.fY_out), fZ_out(right.fZ_out),
41  fPx_out(right.fPx_out), fPy_out(right.fPy_out), fPz_out(right.fPz_out),
42  fPDG(right.fPDG), fWall(right.fWall), fBlock(right.fBlock), fCell(right.fCell)
43 {
44 }
45 
46 //--------------------------------------------------------------------------------------------------
48 }
49 
50 //--------------------------------------------------------------------------------------------------
51 void ERGadastCsIPoint::Print(const Option_t* opt /* = 0*/) const {
52  LOG(INFO) << "ERGadastCsIPoint: track " << fTrackID;
53  LOG(INFO) << " mother track = " << fMot0TrackID << FairLogger::endl;
54  LOG(INFO) << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << FairLogger::endl;
55  LOG(INFO) << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << FairLogger::endl;
56  LOG(INFO) << " Time " << fTime << " ns, Length " << fLength << " cm" << FairLogger::endl;
57  LOG(INFO) << " Energy loss " << fELoss << " keV "<< FairLogger::endl;
58 }
59 
60 //--------------------------------------------------------------------------------------------------
61 Double_t ERGadastCsIPoint::GetX(Double_t z) const {
62  // cout << fZ << " " << z << " " << fZ_out << endl;
63  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
64  Double_t dz = fZ_out - fZ;
65  return ( fX + (z-fZ) / dz * (fX_out-fX) );
66 }
67 
68 //--------------------------------------------------------------------------------------------------
69 Double_t ERGadastCsIPoint::GetY(Double_t z) const {
70  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
71  Double_t dz = fZ_out - fZ;
72  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
73  return ( fY + (z-fZ) / dz * (fY_out-fY) );
74 }
75 
76 //--------------------------------------------------------------------------------------------------
78  Double_t dz = fZ_out - fZ;
79  if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
80  return kTRUE;
81 }
82 
83 //--------------------------------------------------------------------------------------------------
84 ClassImp(ERGadastCsIPoint)
Int_t fBlock
CsI Block number.
Double32_t fZ_out
point out coordinate
virtual void Print(const Option_t *opt=0) const
Print point information to screen.
Bool_t IsUsable() const
Check for distance between in and out.
Int_t fEventID
event index
Int_t fMot0TrackID
0th mother track index
Int_t fPDG
particle PDG
Int_t fWall
CsI Wall number.
The data class for storing pieces of charged tracks in sensitive volumes in CsI crystall.
virtual ~ERGadastCsIPoint()
Destructor.
ERGadastCsIPoint()
Default constructor.
Double_t GetX(Double_t z) const
Point X coordinate at given z from linear extrapolation.
Double_t GetY(Double_t z) const
Point Y coordinate at given z from linear extrapolation.
Int_t fCell
CsI Cell number.
Double32_t fPz_out
point out momentum