本文整理汇总了C++中geometry::Instrument_const_sptr::getDetectorsInBank方法的典型用法代码示例。如果您正苦于以下问题:C++ Instrument_const_sptr::getDetectorsInBank方法的具体用法?C++ Instrument_const_sptr::getDetectorsInBank怎么用?C++ Instrument_const_sptr::getDetectorsInBank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry::Instrument_const_sptr
的用法示例。
在下文中一共展示了Instrument_const_sptr::getDetectorsInBank方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bankToDetectors
/** Convert bank to detectors
* This routine has never been used. Dead code.
* @param singlebanks -- vector of string containing bank names
* @param detectors -- vector of detector-id-s belonging to these banks
*/
void LoadMask::bankToDetectors(const std::vector<std::string> &singlebanks,
std::vector<detid_t> &detectors) {
std::stringstream infoss;
infoss << "Bank IDs to be converted to detectors: \n";
for (auto &singlebank : singlebanks) {
infoss << "Bank: " << singlebank << '\n';
}
g_log.debug(infoss.str());
Geometry::Instrument_const_sptr minstrument = m_maskWS->getInstrument();
for (auto &singlebank : singlebanks) {
std::vector<Geometry::IDetector_const_sptr> idetectors;
minstrument->getDetectorsInBank(idetectors, singlebank);
g_log.debug() << "Bank: " << singlebank << " has " << idetectors.size()
<< " detectors\n";
// a) get information
size_t numdets = idetectors.size();
detid_t detid_first = idetectors.front()->getID();
detid_t detid_last = idetectors.back()->getID();
// b) set detectors
for (const auto &det : idetectors) {
detid_t detid = det->getID();
detectors.push_back(detid);
}
g_log.debug() << "Number of Detectors in Bank " << singlebank
<< " is: " << numdets << "\nRange From: " << detid_first
<< " To: " << detid_last << '\n';
} // ENDFOR
}
示例2: bankToDetectors
/** Convert bank to detectors
*/
void LoadMask::bankToDetectors(std::vector<std::string> singlebanks,
std::vector<int32_t> &detectors,
std::vector<int32_t> &detectorpairslow,
std::vector<int32_t> &detectorpairsup) {
std::stringstream infoss;
infoss << "Bank IDs to be converted to detectors: " << endl;
for (auto &singlebank : singlebanks) {
infoss << "Bank: " << singlebank << std::endl;
}
g_log.debug(infoss.str());
Geometry::Instrument_const_sptr minstrument = m_maskWS->getInstrument();
for (auto &singlebank : singlebanks) {
std::vector<Geometry::IDetector_const_sptr> idetectors;
minstrument->getDetectorsInBank(idetectors, singlebank);
g_log.debug() << "Bank: " << singlebank << " has " << idetectors.size()
<< " detectors" << std::endl;
// a) get information
size_t numdets = idetectors.size();
detid_t detid_first = idetectors[0]->getID();
detid_t detid_last = idetectors[idetectors.size() - 1]->getID();
// b) set detectors
if (detid_first + int32_t(numdets) == detid_last + 1 && false) {
// TODO This save-time method is not used at this stage
g_log.information() << "Using Range of Detectors" << std::endl;
detectorpairslow.push_back(detid_first);
detectorpairsup.push_back(detid_last);
} else {
g_log.debug() << "Apply 1 by 1 "
<< "DetID: " << detid_first << ", " << detid_last
<< std::endl;
for (const auto &det : idetectors) {
int32_t detid = det->getID();
detectors.push_back(detid);
}
} // if-else
} // ENDFOR
return;
}