Skip to content
Snippets Groups Projects
Commit 3459c5cf authored by Sergei Zharko's avatar Sergei Zharko Committed by Sergey Gorbunov
Browse files

L1: added NaN checkers to tracking detector interfaces

parent 4caaab79
No related branches found
No related tags found
1 merge request!983L1: validity checks for the tracking detector interfaces are introduced
...@@ -17,75 +17,110 @@ ...@@ -17,75 +17,110 @@
bool CbmTrackingDetectorInterfaceBase::Check() const bool CbmTrackingDetectorInterfaceBase::Check() const
{ {
bool res = true; bool res = true;
std::string prefix = std::string("Detector interface for ") + this->GetDetectorName() + ": "; std::stringstream msg;
msg << "Errors in the detector interface initialization for " << this->GetDetectorName() << ":\n";
// Number of stations // Number of stations
if (this->GetNtrackingStations() < 1) { if (this->GetNtrackingStations() < 1) {
LOG(error) << prefix << "Number of stations is less then 1(" << this->GetNtrackingStations() << ")"; msg << "\t- Number of stations is less then 1(" << this->GetNtrackingStations() << ")";
res = false && res; res = false && res;
} }
else { else {
// Position along beam axis
std::vector<double> zPositions(this->GetNtrackingStations()); // Station individual parameters check
for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) { for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) {
zPositions[iSt] = this->GetZ(iSt); std::string prefix = std::string("\t- Station ") + std::to_string(iSt) + " has ";
} // Position along Z-axis
std::set<double> zPositionSet(zPositions.begin(), zPositions.end()); if (std::isnan(this->GetZ(iSt))) {
if (zPositions.size() != zPositionSet.size()) { msg << prefix << " NaN component along Z-axis (" << this->GetZ(iSt) << " cm)\n";
LOG(error) << prefix << "Some of stations have the same z position component:"; res = false && res;
for (size_t iSt = 0; iSt < zPositions.size(); ++iSt) {
LOG(error) << "\tstation " << iSt << ", z = " << zPositions[iSt] << " cm";
} }
res = false && res;
}
// Station sizes check
for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) {
// Size along X-axis // Size along X-axis
if (this->GetXmax(iSt) < std::numeric_limits<double>::epsilon()) { auto xMax = this->GetXmax(iSt);
LOG(error) << prefix << "Station " << iSt << " has zero or negative X-size (" << this->GetXmax(iSt) << " cm)"; if (xMax < std::numeric_limits<double>::epsilon() || std::isnan(xMax)) {
msg << prefix << " zero, negative or NaN X-size (" << xMax << " cm)\n";
res = false && res; res = false && res;
} }
// Size along Y-axis // Size along Y-axis
if (this->GetYmax(iSt) < std::numeric_limits<double>::epsilon()) { auto yMax = this->GetYmax(iSt);
LOG(error) << prefix << "Station " << iSt << " has zero or negative Y-size (" << this->GetYmax(iSt) << " cm)"; if (yMax < std::numeric_limits<double>::epsilon() || std::isnan(yMax)) {
msg << prefix << " zero, negative or NaN Y-size (" << yMax << " cm)\n";
res = false && res; res = false && res;
} }
// Max station radius // Max station radius
if (this->GetRmax(iSt) < std::numeric_limits<double>::epsilon()) { auto rMax = this->GetRmax(iSt);
LOG(error) << prefix << "Station " << iSt << " has zero or negative outer radius (" << this->GetRmax(iSt) if (rMax < std::numeric_limits<double>::epsilon() || std::isnan(rMax)) {
<< " cm)"; msg << prefix << " zero, negative or NaN outer radius (" << rMax << " cm)\n";
res = false && res; res = false && res;
} }
// Min station radius // Min station radius
if (this->GetRmin(iSt) < 0) { auto rMin = this->GetRmin(iSt);
LOG(error) << prefix << "Station " << iSt << " has negative inner radius (" << this->GetRmin(iSt) << " cm)"; if (rMin < 0 || std::isnan(rMin)) {
msg << prefix << " negative or NaN inner radius (" << rMin << " cm)\n";
res = false && res;
}
// Front strips stereo angle
auto angleF = this->GetStripsStereoAngleFront(iSt);
if (std::isnan(angleF)) {
msg << prefix << " NaN front strips stereo angle (" << angleF << " rad)\n";
res = false && res;
}
// Back strips stereo angle
auto angleB = this->GetStripsStereoAngleBack(iSt);
if (std::isnan(angleF)) {
msg << prefix << " NaN back strips stereo angle (" << angleB << " rad)\n";
res = false && res; res = false && res;
} }
// Front strips spatial resolution // Front strips spatial resolution
if (this->GetStripsSpatialRmsFront(iSt) < std::numeric_limits<double>::epsilon()) { auto rmsF = this->GetStripsSpatialRmsFront(iSt);
LOG(error) << prefix << "Station " << iSt << " has zero or negative front strips spatial resolution (" if (rmsF < std::numeric_limits<double>::epsilon() || std::isnan(rmsF)) {
<< this->GetStripsSpatialRmsFront(iSt) << " cm)"; msg << prefix << " zero, negative or NaN front strips spatial resolution (" << rmsF << " cm)\n";
res = false && res; res = false && res;
} }
// Back strips spatial resolution // Back strips spatial resolution
if (this->GetStripsSpatialRmsBack(iSt) < std::numeric_limits<double>::epsilon()) { auto rmsB = this->GetStripsSpatialRmsBack(iSt);
LOG(error) << prefix << "Station " << iSt << " has zero or negative back strips spatial resolution (" if (rmsB < std::numeric_limits<double>::epsilon() || std::isnan(rmsB)) {
<< this->GetStripsSpatialRmsBack(iSt) << " cm)"; msg << prefix << " zero, negative or NaN back strips spatial resolution (" << rmsB << " cm)\n";
res = false && res; res = false && res;
} }
// Time resolution
auto timeRes = this->GetTimeResolution(iSt);
if (timeRes < std::numeric_limits<double>::epsilon() || std::isnan(timeRes)) {
msg << prefix << " zero, negative or NaN time resolution (" << timeRes << " cm)\n";
res = false && res;
}
}
// Position along beam axis
std::vector<double> zPositions(this->GetNtrackingStations());
for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) {
zPositions[iSt] = this->GetZ(iSt);
}
std::set<double> zPositionSet(zPositions.begin(), zPositions.end());
if (zPositions.size() != zPositionSet.size()) {
msg << "\t- Some of stations have the same z position component:\n";
for (size_t iSt = 0; iSt < zPositions.size(); ++iSt) {
msg << "\t\tstation " << iSt << ", z = " << zPositions[iSt] << " cm\n";
}
res = false && res;
} }
} }
if (!res) { if (!res) {
LOG(error) << "\033[4mErrors above mean that CA tracking cannot be used for the current version of " LOG(error) << msg.str() << "\033[4mErrors above mean that CA tracking cannot be used for the current version of "
<< this->GetDetectorName() << " setup. Please, check if the " << this->GetDetectorName() << this->GetDetectorName() << " setup. Please, check if the " << this->GetDetectorName()
<< " setup parameters and the corresponding tracking detector interface are initialized properly\033[0m"; << " setup parameters and the corresponding tracking detector interface are initialized properly\033[0m";
} }
return res; return res;
} }
...@@ -29,6 +29,10 @@ public: ...@@ -29,6 +29,10 @@ public:
/// Gets actual number of stations, provided by the current geometry setup /// Gets actual number of stations, provided by the current geometry setup
virtual int GetNtrackingStations() const = 0; virtual int GetNtrackingStations() const = 0;
// TODO: SZh 17.10.2022: At the moment the radiation length and the station thickness are not used for the tracking
// initialization as soon as the material budget maps are in use. Should we keep these
// accessors here, or just remove them from the interfaces?
/// Gets station radiation length /// Gets station radiation length
/// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1]) /// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1])
/// \return Radiation length [cm] /// \return Radiation length [cm]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment