10#ifndef ALGO_TrackingSetupIfs_h
11#define ALGO_TrackingSetupIfs_h 1
16#include <boost/serialization/access.hpp>
17#include <boost/serialization/array.hpp>
18#include <boost/serialization/vector.hpp>
27#include <fmt/format.h>
46 constexpr HitRange(
double x_,
double y_,
double t_) :
x(x_),
y(y_),
t(t_) {}
51 template<
class Archive>
64 template<
class ConcreteDetector>
85 template<
class HitType>
88 return static_cast<const ConcreteDetector*
>(
this)->
ImplGetHitRange(hit);
98 return static_cast<const ConcreteDetector*
>(
this)->ImplGetTrackingStationId(address);
109 return static_cast<const ConcreteDetector*
>(
this)->ImplIsTimeInfoProvided(stationId);
134 template<
class HitType>
137 return HitRange{3.5 * hit.GetDx(), 3.5 * hit.GetDy(), 3.5 * hit.GetTimeError()};
143 template<
class Archive>
159 template<
class ConcreteDetector>
162 std::stringstream msg;
163 msg <<
"Errors in the detector interface initialization for " << ConcreteDetector::GetDetectorName() <<
':';
169 LOG(error) << msg.str();
179 if (!activeVolume.IsValid()) {
180 msg <<
"\n\t - invalid active volume for station " << iSt <<
": " << activeVolume.ToString();
184 if (!fullVolume.IsValid()) {
185 msg <<
"\n\t - invalid active volume for station " << iSt <<
": " << fullVolume.ToString();
191 LOG(error) << msg.str();
200 if (prevVol.GetCenterZ() > thisVol.GetCenterZ()) {
201 msg <<
"\n\t - stations " << iSt - 1 <<
" and " << iSt <<
" are not properly ordered in z-direction:";
202 msg <<
"\n\t\t previous station: " << prevVol.ToString();
203 msg <<
"\n\t\t this station: " << thisVol.ToString();
207 if (thisVol.HasOverlapWith(prevVol)) {
208 msg <<
"\n\t - stations " << iSt - 1 <<
" and " << iSt <<
" have intersections:";
209 msg <<
"\n\t\t previous station: " << prevVol.ToString();
210 msg <<
"\n\t\t this station: " << thisVol.ToString();
216 LOG(error) << msg.str();
220 res =
static_cast<const ConcreteDetector*
>(
this)->IsInitialized();
227 template<
class ConcreteDetector>
232 std::stringstream table;
233 table <<
"* Tracking stations for " << ConcreteDetector::GetDetectorName() <<
" *";
235 "\n|{:>5}|{:>8}|{:>14}|{:>14}|{:>14}|{:>14}|{:>14}|{:>14}|{:>8}|{:>8}|{:>8}|{:>8}|{:>8}|{:>8}|{:>9}|\n",
"st.No",
236 "zRef[cm]",
"xMin(act.)[cm]",
"xMax(act.)[cm]",
"yMin(act.)[cm]",
"yMax(act.)[cm]",
"zMin(act.)[cm]",
237 "zMax(act.)[cm]",
"xMin[cm]",
"xMax[cm]",
"yMin[cm]",
"yMax[cm]",
"zMin[cm]",
"zMax[cm]",
"time info");
238 table << format(
"|{0:->5}|{0:->8}|{0:->14}|{0:->14}|{0:->14}|{0:->14}|{0:->14}|{0:->14}|{0:->8}|{0:->8}"
239 "|{0:->8}|{0:->8}|{0:->8}|{0:->8}|{0:->9}|\n",
245 "|{:>5d}|{:>8.2f}|{:>14.2f}|{:>14.2f}|{:>14.2f}|{:>14.2f}|{:>14.2f}|{:>14.2f}|{:>8.2f}|{:>8.2f}|{:>"
246 "8.2f}|{:>8.2f}|{:>8.2f}|"
248 iSt, volA.GetCenterZ(), volA.GetMinX(), volA.GetMaxX(), volA.GetMinY(), volA.GetMaxY(), volA.GetMinZ(),
249 volA.GetMaxZ(), volF.GetMinX(), volF.GetMaxX(), volF.GetMinY(), volF.GetMaxY(), volF.GetMinZ(), volF.GetMaxZ(),
A class for a geometrical volume representation in the reconstruction setup.
A representation of a geometrical volume of different tracking stations.
virtual ~TrackingSetupIfs()=default
Destructor.
TrackingSetupIfs(TrackingSetupIfs &&)=default
const GeoVolume & GetActiveVolume(int stationId) const
Gets active volume for a tracking station.
std::vector< GeoVolume > fvStationFullVolumes
Geometric properties of each station passive volume.
int GetTrackingStationId(uint32_t address) const
Gets a local index of a tracking station by a hardware address.
int GetNofTrackingStations() const
Gets number of tracking stations.
std::string TableOfTrackingStations() const
Dumps table of tracking stations to string.
TrackingSetupIfs()=default
const GeoVolume & GetFullVolume(int stationId) const
Gets full volume for a tracking station.
HitRange ImplGetHitRange(const HitType &hit) const
Returns default hit range factor.
bool IsTimeInfoProvided(int stationId) const
Checks, if station provides time measurements.
TrackingSetupIfs(const TrackingSetupIfs &)=default
TrackingSetupIfs & operator=(TrackingSetupIfs &&)=default
void serialize(Archive &ar, const unsigned int)
HitRange GetHitRange(const HitType &hit) const
Returns default hit range for x, y and time measurements.
TrackingSetupIfs & operator=(const TrackingSetupIfs &)=default
TrackingSetupIfs(std::pair< std::vector< GeoVolume >, std::vector< GeoVolume > > &&volumes)
Constructor from parameters.
friend class boost::serialization::access
Serialization method.
std::vector< GeoVolume > fvStationActiveVolumes
Geometric properties of each station active volume.
bool IsValid() const
Validates the interface.
A structure to keep the ranges of the hit x, y and time measurements.
double t
range for a time measurement [ns]
double y
range for an y-measurement [cm]
constexpr HitRange(double x_, double y_, double t_)
Constructor from parameters.
void serialize(Archive &ar, const unsigned int)
double x
range for an x-measurement [cm]
friend class boost::serialization::access
serialization method
constexpr HitRange()=default
Default constructor.