예제 #1
0
/** 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
0
파일: LoadMask.cpp 프로젝트: mcvine/mantid
/** 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;
}