SND@LHC Software
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 (splitcalPoint *p, Double_t t0)
 
virtual ~splitcalHit ()
 
virtual 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 (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)
 
void AddClusterIndex (int i)
 
void AddEnergyWeight (double w)
 
double GetX ()
 
double GetY ()
 
double GetZ ()
 
double GetEnergy ()
 
double GetEnergyForCluster (int i)
 
int GetIsPrecisionLayer ()
 
int GetLayerNumber ()
 
int GetModuleXNumber ()
 
int GetModuleYNumber ()
 
int GetStripNumber ()
 
bool IsX ()
 
bool IsY ()
 
int IsUsed ()
 
double GetXError ()
 
double GetYError ()
 
double GetZError ()
 
std::vector< int > GetClusterIndices ()
 
std::vector< double > GetEnergyWeights ()
 
bool IsShared ()
 
double GetEnergyWeightForIndex (int index)
 
 splitcalHit (const splitcalHit &point)
 
splitcalHit operator= (const splitcalHit &point)
 
- Public Member Functions inherited from ShipHit
 ShipHit ()
 
 ShipHit (Int_t detID, Float_t digi)
 
virtual ~ShipHit ()
 
Double_t GetDigi () const
 
Int_t GetDetectorID () const
 
void SetDigi (Float_t d)
 
void SetDetectorID (Int_t detID)
 
virtual void Print (const Option_t *opt="") const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Member Functions

 ClassDef (splitcalHit, 3)
 

Private Attributes

Float_t flag
 
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
 
std::vector< double > _vecEnergyWeights
 
std::vector< int > _vecClusterIndices
 

Additional Inherited Members

- Protected Member Functions inherited from ShipHit
 ClassDef (ShipHit, 1)
 
- Protected Attributes inherited from ShipHit
Float_t fdigi
 digitized detector hit
 
Int_t fDetectorID
 Detector unique identifier.
 

Detailed Description

Definition at line 10 of file splitcalHit.h.

Constructor & Destructor Documentation

◆ splitcalHit() [1/4]

splitcalHit::splitcalHit ( )

Default constructor

Definition at line 24 of file splitcalHit.cxx.

25 : ShipHit()
26{
27 flag = true;
28}
ShipHit()
Definition ShipHit.cxx:5
Float_t flag
Definition splitcalHit.h:80

◆ 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 30 of file splitcalHit.cxx.

31 : ShipHit(detID,tdc)
32{
33 flag = true;
34}

◆ splitcalHit() [3/4]

splitcalHit::splitcalHit ( splitcalPoint p,
Double_t  t0 
)

Definition at line 36 of file splitcalHit.cxx.

37 : ShipHit()
38{
39
40 flag = true;
41
42 double pointX = p->GetX();
43 double pointY = p->GetY();
44 double pointZ = p->GetZ();
45 double pointT = p->GetTime();
46 double pointE = p->GetEnergyLoss();
47 int detID = p->GetDetectorID();
48
49 //fdigi = t0 + t;
50 fdigi = t0 ;
51 // SetDigi(SetTimeRes(fdigi));
52 SetDetectorID(detID);
53
54 TGeoNavigator* navigator = gGeoManager->GetCurrentNavigator();
55 navigator->cd("cave/SplitCalDetector_1");
56 TGeoVolume* caloVolume = navigator->GetCurrentVolume();
57 // caloVolume->PrintNodes();
58
59 std::string stripName = GetDetectorElementName(detID); // it also sets if strip gives x or y coordinate
60
61 int isPrec, nL, nMx, nMy, nS;
62 Decoder(detID, isPrec, nL, nMx, nMy, nS);
63
64 SetIDs(isPrec, nL, nMx, nMy, nS);
65
66 TGeoNode* strip = caloVolume->GetNode(stripName.c_str());
67
68 const Double_t* stripCoordinatesLocal = strip->GetMatrix()->GetTranslation();
69 Double_t stripCoordinatesMaster[3] = {0.,0.,0.};
70 navigator->LocalToMaster(stripCoordinatesLocal, stripCoordinatesMaster);
71
72 TGeoBBox* box = (TGeoBBox*)strip->GetVolume()->GetShape();
73 double xHalfLength = box->GetDX();
74 double yHalfLength = box->GetDY();
75 double zHalfLength = box->GetDZ();
76
77 TGeoNode* passiveLayer = caloVolume->GetNode("ECALfilter_200000"); // they are all the same
78 TGeoBBox* boxPassive = (TGeoBBox*)passiveLayer->GetVolume()->GetShape();
79 double zPassiveHalfLength = box->GetDZ();
80
81 // std::cout<< "----------------------"<<std::endl;
82 // std::cout<< "-- pointX = " << pointX << std::endl;
83 // std::cout<< "-- pointY = " << pointY << std::endl;
84 // std::cout<< "-- pointZ = " << pointZ << std::endl;
85 // std::cout<< "-- detID = " << detID << std::endl;
86 // std::cout<< "-- stripName = " << stripName << std::endl;
87 // std::cout<< "-- isPrec = " << isPrec << std::endl;
88 // std::cout<< "-- nL = " << nL << std::endl;
89 // std::cout<< "-- nMx = " << nMx << std::endl;
90 // std::cout<< "-- nMy = " << nMy << std::endl;
91 // std::cout<< "-- nS = " << nS << std::endl;
92 // std::cout<< "-- stripCoordinatesLocal[0] = " << stripCoordinatesLocal[0] << std::endl;
93 // std::cout<< "-- stripCoordinatesLocal[1] = " << stripCoordinatesLocal[1] << std::endl;
94 // std::cout<< "-- stripCoordinatesLocal[2] = " << stripCoordinatesLocal[2] << std::endl;
95 // std::cout<< "-- stripCoordinatesMaster[0] = " << stripCoordinatesMaster[0] << std::endl;
96 // std::cout<< "-- stripCoordinatesMaster[1] = " << stripCoordinatesMaster[1] << std::endl;
97 // std::cout<< "-- stripCoordinatesMaster[2] = " << stripCoordinatesMaster[2] << std::endl;
98
99
100 // TGeoNode* check = navigator->FindNode(pointX,pointY,pointZ);
101
102 SetEnergy(pointE);
103 if (isPrec==1) SetXYZ(pointX,pointY,stripCoordinatesMaster[2]);
104 else SetXYZ(stripCoordinatesMaster[0], stripCoordinatesMaster[1], stripCoordinatesMaster[2]);
105 SetXYZErrors(xHalfLength,yHalfLength,2*(zHalfLength+zPassiveHalfLength));
106
107
108}
Float_t fdigi
digitized detector hit
Definition ShipHit.h:57
void SetDetectorID(Int_t detID)
Definition ShipHit.h:39
std::string GetDetectorElementName(int &id)
void SetXYZ(double &x, double &y, double &z)
Definition splitcalHit.h:38
void SetEnergy(double &e)
Definition splitcalHit.h:40
void SetIDs(int &isPrecision, int &nLayer, int &nModuleX, int &nModuleY, int &nStrip)
Definition splitcalHit.h:39
void Decoder(int &id, int &isPrecision, int &nLayer, int &nModuleX, int &nMdouleY, int &nStrip)
void SetXYZErrors(double xError, double yError, double zError)
Definition splitcalHit.h:45

◆ ~splitcalHit()

splitcalHit::~splitcalHit ( )
virtual

Destructor

Definition at line 205 of file splitcalHit.cxx.

205{ }

◆ splitcalHit() [4/4]

splitcalHit::splitcalHit ( const splitcalHit point)

Copy constructor

Member Function Documentation

◆ AddClusterIndex()

void splitcalHit::AddClusterIndex ( int  i)
inline

Definition at line 48 of file splitcalHit.h.

48{_vecClusterIndices.push_back(i);}
std::vector< int > _vecClusterIndices
Definition splitcalHit.h:87

◆ AddEnergyWeight()

void splitcalHit::AddEnergyWeight ( double  w)
inline

Definition at line 49 of file splitcalHit.h.

49{_vecEnergyWeights.push_back(w);}
std::vector< double > _vecEnergyWeights
Definition splitcalHit.h:86

◆ ClassDef()

splitcalHit::ClassDef ( splitcalHit  ,
 
)
private

◆ Decoder() [1/2]

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

Definition at line 172 of file splitcalHit.cxx.

172 {
173
174 std::string encodedID = GetPaddedString(id);
175 Decoder(encodedID, isPrecision, nLayer, nModuleX, nModuleY, nStrip);
176
177}
std::string GetPaddedString(int &id)

◆ Decoder() [2/2]

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

Definition at line 151 of file splitcalHit.cxx.

151 {
152
153 std::string subtring;
154
155 subtring = encodedID.substr(0, 1);
156 isPrecision = atoi(subtring.c_str());
157
158 subtring = encodedID.substr(1,3);
159 nLayer = atoi(subtring.c_str());
160
161 subtring = encodedID.substr(4,1);
162 nModuleX = atoi(subtring.c_str());
163
164 subtring = encodedID.substr(5,1);
165 nModuleY = atoi(subtring.c_str());
166
167 subtring = encodedID.substr(6,3);
168 nStrip = atoi(subtring.c_str());
169
170}

◆ GetClusterIndices()

std::vector< int > splitcalHit::GetClusterIndices ( )
inline

Definition at line 69 of file splitcalHit.h.

69{return _vecClusterIndices;}

◆ GetDetectorElementName()

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

Definition at line 123 of file splitcalHit.cxx.

123 {
124
125 std::string encodedID = GetPaddedString(id);
126 //std::cout << "-- encodedID = " << encodedID <<std::endl;
127 int isPrec, nL, nMx, nMy, nS;
128 Decoder(encodedID, isPrec, nL, nMx, nMy, nS);
129
130 std::string name;
131 if (isPrec==1) {
132 name = "ECALdet_gas_";
133 SetIsX(true);
134 SetIsY(true);
135 } else if (nL%2==0) {
136 name = "stripGivingY_";
137 SetIsX(false);
138 SetIsY(true);
139 } else {
140 name = "stripGivingX_";
141 SetIsX(true);
142 SetIsY(false);
143 }
144 name = name + std::to_string(id);
145 // std::cout << "--GetDetectorElementName - name = " << name <<std::endl;
146
147 return name;
148
149}
void SetIsX(bool x)
Definition splitcalHit.h:42
void SetIsY(bool y)
Definition splitcalHit.h:43

◆ GetEnergy()

double splitcalHit::GetEnergy ( )
inline

Definition at line 54 of file splitcalHit.h.

54{return _energy;}
double _energy
Definition splitcalHit.h:82

◆ GetEnergyForCluster()

double splitcalHit::GetEnergyForCluster ( int  i)

Definition at line 193 of file splitcalHit.cxx.

193 {
194
195 double unweightedEnergy = GetEnergy();
196 double weight = GetEnergyWeightForIndex(i);
197 double energy = unweightedEnergy*weight;
198 return energy;
199
200}
double GetEnergyWeightForIndex(int index)
double GetEnergy()
Definition splitcalHit.h:54

◆ GetEnergyWeightForIndex()

double splitcalHit::GetEnergyWeightForIndex ( int  index)

Definition at line 180 of file splitcalHit.cxx.

180 {
181
182 int iw = 0;
183 for(size_t i=0; i<_vecClusterIndices.size(); i++) {
184 if (_vecClusterIndices.at(i) == index) {
185 iw = i;
186 break;
187 }
188 }
189 return _vecEnergyWeights.at(iw);
190}
int i
Definition ShipAna.py:86

◆ GetEnergyWeights()

std::vector< double > splitcalHit::GetEnergyWeights ( )
inline

Definition at line 70 of file splitcalHit.h.

70{return _vecEnergyWeights;}

◆ GetIsPrecisionLayer()

int splitcalHit::GetIsPrecisionLayer ( )
inline

Definition at line 56 of file splitcalHit.h.

56{return _isPrecisionLayer;}
int _isPrecisionLayer
Definition splitcalHit.h:84

◆ GetLayerNumber()

int splitcalHit::GetLayerNumber ( )
inline

Definition at line 57 of file splitcalHit.h.

57{return _nLayer;}

◆ GetModuleXNumber()

int splitcalHit::GetModuleXNumber ( )
inline

Definition at line 58 of file splitcalHit.h.

58{return _nModuleX;}

◆ GetModuleYNumber()

int splitcalHit::GetModuleYNumber ( )
inline

Definition at line 59 of file splitcalHit.h.

59{return _nModuleY;}

◆ GetPaddedString()

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

Definition at line 112 of file splitcalHit.cxx.

112 {
113
114 //zero padded string
115 int totalLength = 9;
116 std::string stringID = std::to_string(id);
117 std::string encodedID = std::string(totalLength - stringID.length(), '0') + stringID;
118
119 return encodedID;
120
121}

◆ GetStripNumber()

int splitcalHit::GetStripNumber ( )
inline

Definition at line 60 of file splitcalHit.h.

60{return _nStrip;}

◆ GetTDC()

Float_t splitcalHit::GetTDC ( ) const
inline

Definition at line 29 of file splitcalHit.h.

29{return fdigi;}

◆ GetX()

double splitcalHit::GetX ( )
inline

Definition at line 51 of file splitcalHit.h.

51{return _x;}

◆ GetXError()

double splitcalHit::GetXError ( )
inline

Definition at line 64 of file splitcalHit.h.

64{return _xError;}
double _xError
Definition splitcalHit.h:81

◆ GetY()

double splitcalHit::GetY ( )
inline

Definition at line 52 of file splitcalHit.h.

52{return _y;}

◆ GetYError()

double splitcalHit::GetYError ( )
inline

Definition at line 65 of file splitcalHit.h.

65{return _yError;}
double _yError
Definition splitcalHit.h:81

◆ GetZ()

double splitcalHit::GetZ ( )
inline

Definition at line 53 of file splitcalHit.h.

53{return _z;}

◆ GetZError()

double splitcalHit::GetZError ( )
inline

Definition at line 66 of file splitcalHit.h.

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

◆ IsShared()

bool splitcalHit::IsShared ( )
inline

Definition at line 71 of file splitcalHit.h.

71{return GetClusterIndices().size()>1; }
std::vector< int > GetClusterIndices()
Definition splitcalHit.h:69

◆ IsUsed()

int splitcalHit::IsUsed ( )
inline

Definition at line 63 of file splitcalHit.h.

63{return _isUsed;}

◆ isValid()

bool splitcalHit::isValid ( ) const
inline

Definition at line 31 of file splitcalHit.h.

31{return flag;}

◆ IsX()

bool splitcalHit::IsX ( )
inline

Definition at line 61 of file splitcalHit.h.

61{return _isX;}

◆ IsY()

bool splitcalHit::IsY ( )
inline

Definition at line 62 of file splitcalHit.h.

62{return _isY;}

◆ operator=()

splitcalHit splitcalHit::operator= ( const splitcalHit point)

◆ Print()

void splitcalHit::Print ( ) const
virtual

Output to screen

Definition at line 209 of file splitcalHit.cxx.

210{
211 // cout << "-I- splitcalHit: splitcal hit " << " in detector " << fDetectorID << endl;
212 // cout << " TDC " << fdigi << " ns" << endl;
213 // std::cout<< "-I- splitcalHit: " <<std::endl;
214 std::cout<< "------- " <<std::endl;
215 std::cout<< " (x,y,z) = "
216 << _x << " +- " << _xError << " , "
217 << _y << " +- " << _yError << " , "
218 << _z << " +- " << _zError <<std::endl;
219 std::cout<< " isP, nL, nMx, nMy, nS = "
220 << _isPrecisionLayer << " , "
221 << _nLayer << " , "
222 << _nModuleX << " , "
223 << _nModuleY << " , "
224 << _nStrip << std::endl;
225 std::cout<< "------- " <<std::endl;
226}

◆ SetEnergy()

void splitcalHit::SetEnergy ( double &  e)
inline

Definition at line 40 of file splitcalHit.h.

40{_energy = e;}

◆ SetIDs()

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

Definition at line 39 of file splitcalHit.h.

39{_isPrecisionLayer = isPrecision; _nLayer = nLayer; _nModuleX = nModuleX; _nModuleY=nModuleY; _nStrip = nStrip;}

◆ setInvalid()

void splitcalHit::setInvalid ( )
inline

Definition at line 30 of file splitcalHit.h.

30{flag = false;}

◆ SetIsUsed()

void splitcalHit::SetIsUsed ( int  u)
inline

Definition at line 44 of file splitcalHit.h.

44{_isUsed = u;}

◆ SetIsX()

void splitcalHit::SetIsX ( bool  x)
inline

Definition at line 42 of file splitcalHit.h.

◆ SetIsY()

void splitcalHit::SetIsY ( bool  y)
inline

Definition at line 43 of file splitcalHit.h.

◆ SetXYZ()

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

Definition at line 38 of file splitcalHit.h.

◆ SetXYZErrors()

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

Definition at line 45 of file splitcalHit.h.

45{_xError = xError; _yError = yError; _zError = zError;}

◆ UpdateEnergy()

void splitcalHit::UpdateEnergy ( double  e)
inline

Definition at line 41 of file splitcalHit.h.

41{_energy = _energy+e;}

Member Data Documentation

◆ _energy

double splitcalHit::_energy
private

Definition at line 82 of file splitcalHit.h.

◆ _isPrecisionLayer

int splitcalHit::_isPrecisionLayer
private

Definition at line 84 of file splitcalHit.h.

◆ _isUsed

int splitcalHit::_isUsed
private

Definition at line 84 of file splitcalHit.h.

◆ _isX

bool splitcalHit::_isX
private

Definition at line 85 of file splitcalHit.h.

◆ _isY

bool splitcalHit::_isY
private

Definition at line 85 of file splitcalHit.h.

◆ _nLayer

int splitcalHit::_nLayer
private

Definition at line 84 of file splitcalHit.h.

◆ _nModuleX

int splitcalHit::_nModuleX
private

Definition at line 84 of file splitcalHit.h.

◆ _nModuleY

int splitcalHit::_nModuleY
private

Definition at line 84 of file splitcalHit.h.

◆ _nStrip

int splitcalHit::_nStrip
private

Definition at line 84 of file splitcalHit.h.

◆ _vecClusterIndices

std::vector<int > splitcalHit::_vecClusterIndices
private

Definition at line 87 of file splitcalHit.h.

◆ _vecEnergyWeights

std::vector<double > splitcalHit::_vecEnergyWeights
private

Definition at line 86 of file splitcalHit.h.

◆ _x

double splitcalHit::_x
private

Definition at line 81 of file splitcalHit.h.

◆ _xError

double splitcalHit::_xError
private

Definition at line 81 of file splitcalHit.h.

◆ _y

double splitcalHit::_y
private

Definition at line 81 of file splitcalHit.h.

◆ _yError

double splitcalHit::_yError
private

Definition at line 81 of file splitcalHit.h.

◆ _z

double splitcalHit::_z
private

Definition at line 81 of file splitcalHit.h.

◆ _zError

double splitcalHit::_zError
private

Definition at line 81 of file splitcalHit.h.

◆ flag

Float_t splitcalHit::flag
private

Definition at line 80 of file splitcalHit.h.


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