10 #include "otsdaq-core/MonicelliInterface/Geometry.h"
11 #include "otsdaq-core/MonicelliInterface/MessageTools.h"
13 using namespace monicelli;
19 calibrationDone_(false)
25 Geometry::~Geometry(
void)
33 void Geometry::setGeometryFileName(std::string fileName)
35 geometryFileName_ = fileName;
39 bool Geometry::compare_zPosition(std::string first, std::string second)
41 if ( this->getDetector(first)->getZPositionTotal() < this->getDetector(second)->getZPositionTotal() )
48 Detector * Geometry::addDetector(std::string plaqID,
bool isDUT)
50 if( detectorsMap_.find( plaqID ) == detectorsMap_.end() )
52 detectorsMap_[ plaqID ] =
new Detector(plaqID, isDUT);
53 if( isDUT ) dutNumbers_++ ;
55 else STDLINE(
"Warning: Detector: " + plaqID +
" was already added!!",ACRed);
57 return detectorsMap_[ plaqID ];
61 Detector * Geometry::getDetector (std::string plaqID)
63 if( detectorsMap_.find( plaqID ) == detectorsMap_.end() )
68 else return detectorsMap_[plaqID];
72 Detector * Geometry::getDetector(
int station ,
int plaq)
74 std::stringstream ss_;
76 ss_ <<
"Station: " << station <<
" - " <<
"Plaq: " << plaq;
77 return this->getDetector(ss_.str());
81 std::string Geometry::getDetectorID(
int station ,
int plaq)
83 std::stringstream ss_;
85 ss_ <<
"Station: " << station <<
" - " <<
"Plaq: " << plaq;
90 unsigned int Geometry::getMaxRowsNum(
void)
92 unsigned int maxRowsNum=0;
93 for (detectorsMapDef::iterator it=detectorsMap_.begin(); it!=detectorsMap_.end(); ++it)
95 if ( (*it).second->getNumberOfRows() > maxRowsNum ) maxRowsNum = (*it).second->getNumberOfRows();
101 unsigned int Geometry::getMaxColsNum(
void)
103 unsigned int maxColsNum=0;
104 for (detectorsMapDef::iterator it=detectorsMap_.begin(); it!=detectorsMap_.end(); ++it)
106 if ( (*it).second->getNumberOfCols() > maxColsNum ) maxColsNum = (*it).second->getNumberOfCols();
112 double Geometry::getMaxDetectorsLength(
void)
114 double maxDetectorsLength=0;
115 for (detectorsMapDef::iterator it=detectorsMap_.begin(); it!=detectorsMap_.end(); ++it)
117 if ( (*it).second->getDetectorLengthX() > maxDetectorsLength ) maxDetectorsLength = (*it).second->getDetectorLengthX();
118 if ( (*it).second->getDetectorLengthY() > maxDetectorsLength ) maxDetectorsLength = (*it).second->getDetectorLengthY();
120 return maxDetectorsLength;
124 unsigned int Geometry::getDetectorsNumber(
bool excludeDUT)
126 if (!excludeDUT)
return detectorsMap_.size() ;
127 else return (detectorsMap_.size()-dutNumbers_ );
131 std::vector<Detector*> Geometry::getDUTs(
void )
133 std::vector<Detector*> DUTs;
134 for (detectorsMapDef::iterator it=detectorsMap_.begin(); it!=detectorsMap_.end(); ++it)
136 if( (*it).second->isDUT() ) DUTs.push_back( (*it).second );
142 void Geometry::dump(
void)
144 for (detectorsMapDef::iterator it=detectorsMap_.begin(); it!=detectorsMap_.end(); ++it)
146 STDLINE(it->first,ACRed);