FairShip
Loading...
Searching...
No Matches
splitcalHit Class Reference

#include <splitcalHit.h>

Inheritance diagram for splitcalHit:
Collaboration diagram for splitcalHit:

Public Member Functions

 splitcalHit ()
 
 splitcalHit (Int_t detID, Float_t tdc)
 
 splitcalHit (const std::vector< splitcalPoint > &points, Double_t t0)
 
 ~splitcalHit () override=default
 
void Print () const
 
Float_t GetTDC () const
 
void setInvalid ()
 
bool isValid () const
 
std::string GetPaddedString (int id)
 
std::string GetDetectorElementName (int id)
 
void Decoder (int id, int &isPrecision, int &nLayer, int &nModuleX, int &nMdouleY, int &nStrip)
 
void Decoder (const std::string &encodedID, int &isPrecision, int &nLayer, int &nModuleX, int &nMdouleY, int &nStrip)
 
void SetXYZ (double x, double y, double z)
 
void SetIDs (int isPrecision, int nLayer, int nModuleX, int nModuleY, int nStrip)
 
void SetEnergy (double e)
 
void UpdateEnergy (double e)
 
void SetIsX (bool x)
 
void SetIsY (bool y)
 
void SetIsUsed (int u)
 
void SetXYZErrors (double xError, double yError, double zError)
 
double GetX () const
 
double GetY () const
 
double GetZ () const
 
double GetEnergy () const
 
int GetIsPrecisionLayer () const
 
int GetLayerNumber () const
 
int GetModuleXNumber () const
 
int GetModuleYNumber () const
 
int GetStripNumber () const
 
bool IsX () const
 
bool IsY () const
 
int IsUsed () const
 
double GetXError () const
 
double GetYError () const
 
double GetZError () const
 
 splitcalHit (const splitcalHit &point)=default
 
splitcalHitoperator= (const splitcalHit &point)=default
 
- Public Member Functions inherited from SHiP::DetectorHit
 DetectorHit ()
 
 DetectorHit (Int_t detID, Float_t digi)
 
 ~DetectorHit () override=default
 
Double_t GetDigi () const
 
Int_t GetDetectorID () const
 
void SetDigi (Float_t d)
 
void SetDetectorID (Int_t detID)
 
void Print (const Option_t *opt="") const override
 

Private Member Functions

 ClassDef (splitcalHit, 6)
 

Private Attributes

Bool_t flag {true}
 
double _x
 
double _y
 
double _z
 
double _xError
 
double _yError
 
double _zError
 
double _energy
 
int _isPrecisionLayer
 
int _nLayer
 
int _nModuleX
 
int _nModuleY
 
int _nStrip
 
int _isUsed
 
bool _isX
 
bool _isY
 

Additional Inherited Members

- Protected Member Functions inherited from SHiP::DetectorHit
 ClassDefOverride (SHiP::DetectorHit, 1)
 
- Protected Attributes inherited from SHiP::DetectorHit
Float_t fdigi
 digitized detector hit
 
Int_t fDetectorID
 Detector unique identifier.
 

Detailed Description

Definition at line 14 of file splitcalHit.h.

Constructor & Destructor Documentation

◆ splitcalHit() [1/4]

splitcalHit::splitcalHit ( )

Default constructor

Definition at line 33 of file splitcalHit.cxx.

◆ splitcalHit() [2/4]

splitcalHit::splitcalHit ( Int_t  detID,
Float_t  tdc 
)

Constructor with arguments

Parameters
detIDDetector ID
digidigitized/measured TDC
flagTrue/False, false if there is another hit with smaller tdc

Definition at line 35 of file splitcalHit.cxx.

36 : SHiP::DetectorHit(detID, tdc) {}

◆ splitcalHit() [3/4]

splitcalHit::splitcalHit ( const std::vector< splitcalPoint > &  points,
Double_t  t0 
)

Definition at line 39 of file splitcalHit.cxx.

41 // Empty vector check
42 if (points.empty()) {
43 LOG(error)
44 << "splitcalHit constructor called with empty splitcalPoint vector";
45 return;
46 }
47
48 // Use first point for geometry lookup and detector ID
49 const auto& firstPoint = points[0];
50 double pointX = firstPoint.GetX();
51 double pointY = firstPoint.GetY();
52 int detID = firstPoint.GetDetectorID();
53
54 // Sum energy from all points
55 double pointE = 0.0;
56 for (const auto& point : points) {
57 pointE += point.GetEnergyLoss();
58 }
59
60 fdigi = t0 + firstPoint.GetTime();
61 SetDetectorID(detID);
62
63 TGeoNavigator* navigator = gGeoManager->GetCurrentNavigator();
64 navigator->cd("cave/SplitCalDetector_1");
65 TGeoVolume* caloVolume = navigator->GetCurrentVolume();
66 // caloVolume->PrintNodes();
67
68 std::string stripName = GetDetectorElementName(
69 detID); // it also sets if strip gives x or y coordinate
70
71 int isPrec, nL, nMx, nMy, nS;
72 Decoder(detID, isPrec, nL, nMx, nMy, nS);
73
74 SetIDs(isPrec, nL, nMx, nMy, nS);
75
76 TGeoNode* strip = caloVolume->GetNode(stripName.c_str());
77
78 const Double_t* stripCoordinatesLocal = strip->GetMatrix()->GetTranslation();
79 Double_t stripCoordinatesMaster[3] = {0., 0., 0.};
80 navigator->LocalToMaster(stripCoordinatesLocal, stripCoordinatesMaster);
81
82 TGeoBBox* box = dynamic_cast<TGeoBBox*>(strip->GetVolume()->GetShape());
83 double xHalfLength = box->GetDX();
84 double yHalfLength = box->GetDY();
85 double zHalfLength = box->GetDZ();
86
87 double zPassiveHalfLength = box->GetDZ();
88
89 SetEnergy(pointE);
90 if (isPrec == 1)
91 SetXYZ(pointX, pointY, stripCoordinatesMaster[2]);
92 else
93 SetXYZ(stripCoordinatesMaster[0], stripCoordinatesMaster[1],
94 stripCoordinatesMaster[2]);
95 SetXYZErrors(xHalfLength, yHalfLength,
96 2 * (zHalfLength + zPassiveHalfLength));
97}
void SetDetectorID(Int_t detID)
Definition: DetectorHit.h:33
Float_t fdigi
digitized detector hit
Definition: DetectorHit.h:39
void SetEnergy(double e)
Definition: splitcalHit.h:56
void SetXYZ(double x, double y, double z)
Definition: splitcalHit.h:43
void Decoder(int id, int &isPrecision, int &nLayer, int &nModuleX, int &nMdouleY, int &nStrip)
std::string GetDetectorElementName(int id)
void SetXYZErrors(double xError, double yError, double zError)
Definition: splitcalHit.h:61
void SetIDs(int isPrecision, int nLayer, int nModuleX, int nModuleY, int nStrip)
Definition: splitcalHit.h:48

◆ ~splitcalHit()

splitcalHit::~splitcalHit ( )
overridedefault

Destructor

◆ splitcalHit() [4/4]

splitcalHit::splitcalHit ( const splitcalHit point)
default

Copy constructor

Member Function Documentation

◆ ClassDef()

splitcalHit::ClassDef ( splitcalHit  ,
 
)
private

◆ Decoder() [1/2]

void splitcalHit::Decoder ( const std::string &  encodedID,
int &  isPrecision,
int &  nLayer,
int &  nModuleX,
int &  nMdouleY,
int &  nStrip 
)

Definition at line 133 of file splitcalHit.cxx.

135 {
136 std::string substring;
137
138 substring = encodedID.substr(0, 1);
139 isPrecision = atoi(substring.c_str());
140
141 substring = encodedID.substr(1, 3);
142 nLayer = atoi(substring.c_str());
143
144 substring = encodedID.substr(4, 1);
145 nModuleX = atoi(substring.c_str());
146
147 substring = encodedID.substr(5, 1);
148 nModuleY = atoi(substring.c_str());
149
150 substring = encodedID.substr(6, 3);
151 nStrip = atoi(substring.c_str());
152}

◆ Decoder() [2/2]

void splitcalHit::Decoder ( int  id,
int &  isPrecision,
int &  nLayer,
int &  nModuleX,
int &  nMdouleY,
int &  nStrip 
)

Definition at line 154 of file splitcalHit.cxx.

155 {
156 std::string encodedID = GetPaddedString(id);
157 Decoder(encodedID, isPrecision, nLayer, nModuleX, nModuleY, nStrip);
158}
std::string GetPaddedString(int id)
Definition: splitcalHit.cxx:99

◆ GetDetectorElementName()

std::string splitcalHit::GetDetectorElementName ( int  id)

Definition at line 109 of file splitcalHit.cxx.

109 {
110 std::string encodedID = GetPaddedString(id);
111 int isPrec, nL, nMx, nMy, nS;
112 Decoder(encodedID, isPrec, nL, nMx, nMy, nS);
113
114 std::string name;
115 if (isPrec == 1) {
116 name = "ECALdet_gas_";
117 SetIsX(true);
118 SetIsY(true);
119 } else if (nL % 2 == 0) {
120 name = "stripGivingY_";
121 SetIsX(false);
122 SetIsY(true);
123 } else {
124 name = "stripGivingX_";
125 SetIsX(true);
126 SetIsY(false);
127 }
128 name = name + std::to_string(id);
129
130 return name;
131}
void SetIsX(bool x)
Definition: splitcalHit.h:58
void SetIsY(bool y)
Definition: splitcalHit.h:59

◆ GetEnergy()

double splitcalHit::GetEnergy ( ) const
inline

Definition at line 70 of file splitcalHit.h.

70{ return _energy; }
double _energy
Definition: splitcalHit.h:90

◆ GetIsPrecisionLayer()

int splitcalHit::GetIsPrecisionLayer ( ) const
inline

Definition at line 71 of file splitcalHit.h.

71{ return _isPrecisionLayer; }
int _isPrecisionLayer
Definition: splitcalHit.h:91

◆ GetLayerNumber()

int splitcalHit::GetLayerNumber ( ) const
inline

Definition at line 72 of file splitcalHit.h.

72{ return _nLayer; }

◆ GetModuleXNumber()

int splitcalHit::GetModuleXNumber ( ) const
inline

Definition at line 73 of file splitcalHit.h.

73{ return _nModuleX; }

◆ GetModuleYNumber()

int splitcalHit::GetModuleYNumber ( ) const
inline

Definition at line 74 of file splitcalHit.h.

74{ return _nModuleY; }

◆ GetPaddedString()

std::string splitcalHit::GetPaddedString ( int  id)

Definition at line 99 of file splitcalHit.cxx.

99 {
100 // zero padded string
101 int totalLength = 9;
102 std::string stringID = std::to_string(id);
103 std::string encodedID =
104 std::string(totalLength - stringID.length(), '0') + stringID;
105
106 return encodedID;
107}

◆ GetStripNumber()

int splitcalHit::GetStripNumber ( ) const
inline

Definition at line 75 of file splitcalHit.h.

75{ return _nStrip; }

◆ GetTDC()

Float_t splitcalHit::GetTDC ( ) const
inline

Definition at line 32 of file splitcalHit.h.

32{ return fdigi; }

◆ GetX()

double splitcalHit::GetX ( ) const
inline

Definition at line 67 of file splitcalHit.h.

67{ return _x; }
double _x
Definition: splitcalHit.h:89

◆ GetXError()

double splitcalHit::GetXError ( ) const
inline

Definition at line 79 of file splitcalHit.h.

79{ return _xError; }
double _xError
Definition: splitcalHit.h:89

◆ GetY()

double splitcalHit::GetY ( ) const
inline

Definition at line 68 of file splitcalHit.h.

68{ return _y; }
double _y
Definition: splitcalHit.h:89

◆ GetYError()

double splitcalHit::GetYError ( ) const
inline

Definition at line 80 of file splitcalHit.h.

80{ return _yError; }
double _yError
Definition: splitcalHit.h:89

◆ GetZ()

double splitcalHit::GetZ ( ) const
inline

Definition at line 69 of file splitcalHit.h.

69{ return _z; }
double _z
Definition: splitcalHit.h:89

◆ GetZError()

double splitcalHit::GetZError ( ) const
inline

Definition at line 81 of file splitcalHit.h.

81{ return _zError; }
double _zError
Definition: splitcalHit.h:89

◆ IsUsed()

int splitcalHit::IsUsed ( ) const
inline

Definition at line 78 of file splitcalHit.h.

78{ return _isUsed; }

◆ isValid()

bool splitcalHit::isValid ( ) const
inline

Definition at line 34 of file splitcalHit.h.

34{ return flag; }
Bool_t flag
Definition: splitcalHit.h:88

◆ IsX()

bool splitcalHit::IsX ( ) const
inline

Definition at line 76 of file splitcalHit.h.

76{ return _isX; }

◆ IsY()

bool splitcalHit::IsY ( ) const
inline

Definition at line 77 of file splitcalHit.h.

77{ return _isY; }

◆ operator=()

splitcalHit & splitcalHit::operator= ( const splitcalHit point)
default

◆ Print()

void splitcalHit::Print ( ) const

Definition at line 163 of file splitcalHit.cxx.

163 {
164 // cout << "-I- splitcalHit: splitcal hit " << " in detector " << fDetectorID
165 // << endl; cout << " TDC " << fdigi << " ns" << endl;
166 // std::cout<< "-I- splitcalHit: " <<std::endl;
167 std::cout << "------- " << std::endl;
168 std::cout << " (x,y,z) = " << _x << " +- " << _xError << " , " << _y
169 << " +- " << _yError << " , " << _z << " +- " << _zError
170 << std::endl;
171 std::cout << " isP, nL, nMx, nMy, nS = " << _isPrecisionLayer << " , "
172 << _nLayer << " , " << _nModuleX << " , " << _nModuleY << " , "
173 << _nStrip << std::endl;
174 std::cout << "------- " << std::endl;
175}

◆ SetEnergy()

void splitcalHit::SetEnergy ( double  e)
inline

Definition at line 56 of file splitcalHit.h.

56{ _energy = e; }

◆ SetIDs()

void splitcalHit::SetIDs ( int  isPrecision,
int  nLayer,
int  nModuleX,
int  nModuleY,
int  nStrip 
)
inline

Definition at line 48 of file splitcalHit.h.

49 {
50 _isPrecisionLayer = isPrecision;
51 _nLayer = nLayer;
52 _nModuleX = nModuleX;
53 _nModuleY = nModuleY;
54 _nStrip = nStrip;
55 }

◆ setInvalid()

void splitcalHit::setInvalid ( )
inline

Definition at line 33 of file splitcalHit.h.

33{ flag = false; }

◆ SetIsUsed()

void splitcalHit::SetIsUsed ( int  u)
inline

Definition at line 60 of file splitcalHit.h.

60{ _isUsed = u; }

◆ SetIsX()

void splitcalHit::SetIsX ( bool  x)
inline

Definition at line 58 of file splitcalHit.h.

58{ _isX = x; }

◆ SetIsY()

void splitcalHit::SetIsY ( bool  y)
inline

Definition at line 59 of file splitcalHit.h.

◆ SetXYZ()

void splitcalHit::SetXYZ ( double  x,
double  y,
double  z 
)
inline

Definition at line 43 of file splitcalHit.h.

43 {
44 _x = x;
45 _y = y;
46 _z = z;
47 }

◆ SetXYZErrors()

void splitcalHit::SetXYZErrors ( double  xError,
double  yError,
double  zError 
)
inline

Definition at line 61 of file splitcalHit.h.

61 {
62 _xError = xError;
63 _yError = yError;
64 _zError = zError;
65 }

◆ UpdateEnergy()

void splitcalHit::UpdateEnergy ( double  e)
inline

Definition at line 57 of file splitcalHit.h.

57{ _energy = _energy + e; }

Member Data Documentation

◆ _energy

double splitcalHit::_energy
private

Definition at line 90 of file splitcalHit.h.

◆ _isPrecisionLayer

int splitcalHit::_isPrecisionLayer
private

Definition at line 91 of file splitcalHit.h.

◆ _isUsed

int splitcalHit::_isUsed
private

Definition at line 91 of file splitcalHit.h.

◆ _isX

bool splitcalHit::_isX
private

Definition at line 92 of file splitcalHit.h.

◆ _isY

bool splitcalHit::_isY
private

Definition at line 92 of file splitcalHit.h.

◆ _nLayer

int splitcalHit::_nLayer
private

Definition at line 91 of file splitcalHit.h.

◆ _nModuleX

int splitcalHit::_nModuleX
private

Definition at line 91 of file splitcalHit.h.

◆ _nModuleY

int splitcalHit::_nModuleY
private

Definition at line 91 of file splitcalHit.h.

◆ _nStrip

int splitcalHit::_nStrip
private

Definition at line 91 of file splitcalHit.h.

◆ _x

double splitcalHit::_x
private

Definition at line 89 of file splitcalHit.h.

◆ _xError

double splitcalHit::_xError
private

Definition at line 89 of file splitcalHit.h.

◆ _y

double splitcalHit::_y
private

Definition at line 89 of file splitcalHit.h.

◆ _yError

double splitcalHit::_yError
private

Definition at line 89 of file splitcalHit.h.

◆ _z

double splitcalHit::_z
private

Definition at line 89 of file splitcalHit.h.

◆ _zError

double splitcalHit::_zError
private

Definition at line 89 of file splitcalHit.h.

◆ flag

Bool_t splitcalHit::flag {true}
private

Definition at line 88 of file splitcalHit.h.


The documentation for this class was generated from the following files: