22#include "TDirectory.h"
29RegionSelectionSvc ::RegionSelectionSvc(
const std::string &name, ISvcLocator *svc_locator) :
AthService(name, svc_locator) {}
31StatusCode RegionSelectionSvc ::initialize() {
37 SmartIF<StoreGateSvc> detStore{service(
"DetectorStore")};
48 return StatusCode::SUCCESS;
53const std::string& RegionSelectionSvc ::GetRegionSelection()
const {
return m_region_string; }
54const std::vector<MuonCalib ::NtupleStationId> &RegionSelectionSvc ::GetStationsInRegions()
const {
return m_stations_in_region; }
55int RegionSelectionSvc ::AddRegionNtuples(
const std::string &infile, TChain *chain) {
56 std::list<std::string> dirnames;
59int RegionSelectionSvc ::AddRegionNtuples(
const std::string &infile, TChain *chain, std::list<std::string> &dirnames) {
61 if (dirnames.empty()) {
63 std::unique_ptr<TFile>
inf{TFile::Open(infile.c_str(),
"READ")};
64 TIter nextkey(
inf->GetListOfKeys());
67 while ((key = (TKey *)nextkey())) { dirnames.push_back(key->GetName()); }
71 for (std::list<std::string>::iterator nt_it = dirnames.begin(); nt_it != dirnames.end(); ++nt_it) {
73 std::string regname(it->regionId(), 0, nt_it->size());
74 if (regname == (*nt_it)) {
75 chain->AddFile(infile.c_str(), TChain::kBigNumber, ((*nt_it) +
"/" +
"Segments").c_str());
76 std::list<std::string>::iterator new_it = nt_it;
78 dirnames.erase(nt_it);
86void RegionSelectionSvc ::Print(std::ostream &os)
const {
94void RegionSelectionSvc ::search_chambers_in_region() {
97 for (; it != it_end; ++it) {
101 int n_mls =
m_idHelperSvc->mdtIdHelper().numberOfMultilayers(*it);
104 std::vector<MuonCalib::NtupleStationId> the_ids;
105 for (
int i = 1; i <= n_mls; i++) {
109 the_ids.push_back(the_id);
113 if (
static_cast<int>(the_ids.size()) == n_mls) {
118 for (std::vector<MuonCalib::NtupleStationId>::iterator it2 = the_ids.begin(); it2 != the_ids.end(); ++it2) {
124 std::vector<int> tower(3);
132bool RegionSelectionSvc ::ProcessString(
const std::string &input) {
137void RegionSelectionSvc ::print_list_of_selected_chambers()
const {
139 msg(MSG::INFO) <<
"Selected regions: ";
142 msg(MSG::INFO) <<
" " << it->regionId();
#define ATH_CHECK
Evaluate an expression and check for errors.
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
bool setMdtMultilayer(int num)
Mdt specific: set multilayer to num.
Station Identifier for sorting calibration data.
void SetMultilayer(const int &ml)
static std::unique_ptr< RegionSelectorBase > GetRegion(const std::string &input)
create a region from a string
std::vector< Identifier >::const_iterator const_id_iterator
Gaudi::Property< std::string > m_region_string
region string - job option
void print_list_of_selected_chambers() const
print a list of selected chambers - debug function
bool isInRegion(const MuonCalib::MuonFixedId &id) const
return true if id is in selected region
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idToFixedIdTool
Gaudi::Property< bool > m_print_list_of_selected_chambers
print list of selected chambers if set to true - job option
void search_chambers_in_region()
int AddRegionNtuples(const std::string &infile, TChain *chain)
add region ntuples which are relevant for this region to TChain
const MuonGM::MuonDetectorManager * m_detMgr
std::set< MuonCalib::NtupleStationId > m_unique_chambers
bool ProcessString(const std::string &input)
process string
std::vector< MuonCalib::NtupleStationId > m_stations_in_region
chambers/mutlilayers in calibraition region
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
search for chambers and multilayers in selected region towers in selected region
virtual ~RegionSelectionSvc()
destructor
std::unique_ptr< MuonCalib ::RegionSelectorBase > m_master_region
master region
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.