13 #include <FairLogger.h>
16 #include <TGeoMatrix.h>
17 #include <TGeoPhysicalNode.h>
18 #include <TGeoShape.h>
19 #include <TGeoVolume.h>
20 #include <TMathBase.h>
29 using std::stringstream;
42 , fDiffSensorD(kFALSE)
43 , fFirstSensor(nullptr)
52 TGeoPhysicalNode* node)
62 , fDiffSensorD(kFALSE)
63 , fFirstSensor(nullptr)
91 Double_t zMin = 999999.;
92 Double_t zMax = -999999.;
95 for (UInt_t iLad = 0; iLad <
fLadders.size(); iLad++) {
115 TGeoPhysicalNode* sensorNode = sensor->
GetPnode();
117 Double_t local[3] = {0., 0., 0.};
119 sensorNode->GetMatrix()->LocalToMaster(local, global);
124 zMin = TMath::Min(zMin, global[2]);
125 zMax = TMath::Max(zMax, global[2]);
129 TGeoBBox* sBox =
dynamic_cast<TGeoBBox*
>(sensorNode->GetShape());
130 if (!sBox) LOG(fatal) << GetName() <<
": sensor shape is not a box!";
131 Double_t sD = 2. * sBox->GetDZ();
144 fZ = 0.5 * (zMin + zMax);
153 assert(side == 0 || side == 1);
160 return parSensor->
GetPar(side + 6);
168 assert(side == 0 || side == 1);
174 return parSensor->
GetPar(side + 8);
187 TGeoBBox* box =
dynamic_cast<TGeoBBox*
>(
fNode->GetShape());
188 if (!box) LOG(fatal) << GetName() <<
": shape is not box! ";
189 Double_t local[3] = {0., 0., 0.};
191 fNode->GetMatrix()->LocalToMaster(local, global);
192 fXmin = global[0] - box->GetDX();
193 fXmax = global[0] + box->GetDX();
194 fYmin = global[1] - box->GetDY();
195 fYmax = global[1] + box->GetDY();
203 TGeoVolumeAssembly* statVol =
new TGeoVolumeAssembly(
"myStation");
204 for (UInt_t iLadder = 0; iLadder <
fLadders.size(); iLadder++) {
205 TGeoVolume* ladVol =
fLadders.at(iLadder)->GetPnode()->GetVolume();
206 TGeoHMatrix* ladMat =
fLadders.at(iLadder)->GetPnode()->GetMatrix();
207 statVol->AddNode(ladVol, iLadder, ladMat);
209 statVol->GetShape()->ComputeBBox();
210 TGeoBBox* statShape =
dynamic_cast<TGeoBBox*
>(statVol->GetShape());
211 const Double_t* origin = statShape->GetOrigin();
212 fXmin = origin[0] - statShape->GetDX();
213 fXmax = origin[0] + statShape->GetDX();
214 fYmin = origin[1] - statShape->GetDY();
215 fYmax = origin[1] + statShape->GetDY();
225 LOG(warn) << GetName() <<
": Different values for sensor thickness!";
232 Double_t unitLocal[3] = {1., 0., 0.};
233 Double_t unitGlobal[3];
234 sensorNode->GetMatrix()->LocalToMaster(unitLocal, unitGlobal);
236 Double_t* translation = sensorNode->GetMatrix()->GetTranslation();
237 unitGlobal[0] -= translation[0];
238 unitGlobal[1] -= translation[1];
239 unitGlobal[2] -= translation[2];
249 ss << GetName() <<
": " <<
fNofSensors <<
" sensors, z = " <<
fZ
251 <<
" to " <<
fYmax <<
" cm "
253 <<
" rotation " <<
fSensorRot * 180. / 3.1415927 <<
" degrees,"
254 <<
" sensor thickness " <<
fSensorD <<
" cm";