10#include "FairLogger.h"
12#include "FairRunSim.h"
14#include "TGeoManager.h"
15#include "TGeoMatrix.h"
16#include "TGeoNavigator.h"
19#include "TGeoVolume.h"
36 :
SHiP::DetectorHit(detID, tdc) {}
40 :
SHiP::DetectorHit() {
44 <<
"splitcalHit constructor called with empty splitcalPoint vector";
49 const auto& firstPoint = points[0];
50 double pointX = firstPoint.GetX();
51 double pointY = firstPoint.GetY();
52 int detID = firstPoint.GetDetectorID();
56 for (
const auto& point : points) {
57 pointE += point.GetEnergyLoss();
60 fdigi = t0 + firstPoint.GetTime();
63 TGeoNavigator* navigator = gGeoManager->GetCurrentNavigator();
64 navigator->cd(
"cave/SplitCalDetector_1");
65 TGeoVolume* caloVolume = navigator->GetCurrentVolume();
71 int isPrec, nL, nMx, nMy, nS;
72 Decoder(detID, isPrec, nL, nMx, nMy, nS);
74 SetIDs(isPrec, nL, nMx, nMy, nS);
76 TGeoNode* strip = caloVolume->GetNode(stripName.c_str());
78 const Double_t* stripCoordinatesLocal = strip->GetMatrix()->GetTranslation();
79 Double_t stripCoordinatesMaster[3] = {0., 0., 0.};
80 navigator->LocalToMaster(stripCoordinatesLocal, stripCoordinatesMaster);
82 TGeoBBox* box =
dynamic_cast<TGeoBBox*
>(strip->GetVolume()->GetShape());
83 double xHalfLength = box->GetDX();
84 double yHalfLength = box->GetDY();
85 double zHalfLength = box->GetDZ();
87 double zPassiveHalfLength = box->GetDZ();
91 SetXYZ(pointX, pointY, stripCoordinatesMaster[2]);
93 SetXYZ(stripCoordinatesMaster[0], stripCoordinatesMaster[1],
94 stripCoordinatesMaster[2]);
96 2 * (zHalfLength + zPassiveHalfLength));
102 std::string stringID = std::to_string(
id);
103 std::string encodedID =
104 std::string(totalLength - stringID.length(),
'0') + stringID;
111 int isPrec, nL, nMx, nMy, nS;
112 Decoder(encodedID, isPrec, nL, nMx, nMy, nS);
116 name =
"ECALdet_gas_";
119 }
else if (nL % 2 == 0) {
120 name =
"stripGivingY_";
124 name =
"stripGivingX_";
128 name = name + std::to_string(
id);
134 int& nLayer,
int& nModuleX,
int& nModuleY,
136 std::string substring;
138 substring = encodedID.substr(0, 1);
139 isPrecision = atoi(substring.c_str());
141 substring = encodedID.substr(1, 3);
142 nLayer = atoi(substring.c_str());
144 substring = encodedID.substr(4, 1);
145 nModuleX = atoi(substring.c_str());
147 substring = encodedID.substr(5, 1);
148 nModuleY = atoi(substring.c_str());
150 substring = encodedID.substr(6, 3);
151 nStrip = atoi(substring.c_str());
155 int& nModuleY,
int& nStrip) {
157 Decoder(encodedID, isPrecision, nLayer, nModuleX, nModuleY, nStrip);
167 std::cout <<
"------- " << std::endl;
168 std::cout <<
" (x,y,z) = " <<
_x <<
" +- " <<
_xError <<
" , " <<
_y
174 std::cout <<
"------- " << std::endl;
void SetDetectorID(Int_t detID)
Float_t fdigi
digitized detector hit
std::string GetPaddedString(int id)
void SetXYZ(double x, double y, double z)
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)
void SetIDs(int isPrecision, int nLayer, int nModuleX, int nModuleY, int nStrip)