ATLAS Offline Software
Loading...
Searching...
No Matches
MuonChamberIDSelector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <iomanip>
8
10
11// Constructor with parameters:
12MuonChamberIDSelector::MuonChamberIDSelector(const std::string &name, ISvcLocator *pSvcLocator) :
13 AthAlgorithm(name, pSvcLocator), m_mdtchambersId(nullptr), m_rpcchambersId(nullptr) {}
14
15// Initialize method:
17 ATH_CHECK(AthAlgorithm::initialize());
18 ATH_MSG_DEBUG("initialize() called");
19 ATH_CHECK(m_idHelperSvc.retrieve());
20 return StatusCode::SUCCESS;
21}
22
24 ATH_MSG_DEBUG("execute() called");
25
26 StatusCode sc = ChamberperformSelection();
27 if (sc.isFailure()) ATH_MSG_DEBUG("unable to perform selection");
28
29 return StatusCode::SUCCESS;
30}
31
33 StatusCode sc = StatusCode::SUCCESS;
34 sc = selectMDT();
35 sc = selectRPC();
36 sc = selectTGC();
37 sc = selectCSC();
38 return sc;
39}
40
42 StatusCode sc = StatusCode::SUCCESS;
43 ATH_MSG_DEBUG("in MDT ChambersSelectorID vector");
44
45 std::vector<Identifier>::const_iterator idfirst = m_idHelperSvc->mdtIdHelper().module_begin();
46 std::vector<Identifier>::const_iterator idlast = m_idHelperSvc->mdtIdHelper().module_end();
47
48 IdContext mdtModuleContext = m_idHelperSvc->mdtIdHelper().module_context();
49 Identifier Id;
50 IdentifierHash Idhash;
51
52 for (std::vector<Identifier>::const_iterator i = idfirst; i != idlast; ++i) {
53 Id = *i;
54 int gethash_code = m_idHelperSvc->mdtIdHelper().get_hash(Id, Idhash, &mdtModuleContext);
55
56 m_mdtchambersId->push_back(Id);
57 std::string extid = m_idHelperSvc->mdtIdHelper().show_to_string(Id);
58 ATH_MSG_DEBUG("Adding the chamber Identifier: " << extid);
59 if (gethash_code == 0)
60 ATH_MSG_DEBUG(" its hash Id is " << Idhash);
61 else
62 ATH_MSG_DEBUG(" hash Id NOT computed " << Idhash);
63 }
64
65 return sc;
66}
67
69 StatusCode sc = StatusCode::SUCCESS;
70 ATH_MSG_DEBUG("in RPC ChambersSelectorID vector");
71
72 std::vector<Identifier>::const_iterator idfirst = m_idHelperSvc->rpcIdHelper().module_begin();
73 std::vector<Identifier>::const_iterator idlast = m_idHelperSvc->rpcIdHelper().module_end();
74
75 IdContext rpcModuleContext = m_idHelperSvc->rpcIdHelper().module_context();
76 Identifier Id;
77 IdentifierHash Idhash;
78 m_rpcchambersId = new std::vector<Identifier>;
79
80 for (std::vector<Identifier>::const_iterator i = idfirst; i != idlast; ++i) {
81 Id = *i;
82 int gethash_code = m_idHelperSvc->rpcIdHelper().get_hash(Id, Idhash, &rpcModuleContext);
83 m_rpcchambersId->push_back(Id);
84 std::string extid = m_idHelperSvc->rpcIdHelper().show_to_string(Id);
85 ATH_MSG_DEBUG("Adding the chamber Identifier: " << extid);
86 if (gethash_code == 0)
87 ATH_MSG_DEBUG(" its hash Id is " << Idhash);
88 else
89 ATH_MSG_DEBUG(" hash Id NOT computed " << Idhash);
90 }
91
92 return sc;
93}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
static Double_t sc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
This is a "hash" representation of an Identifier.
std::vector< Identifier > * m_mdtchambersId
virtual StatusCode execute()
Retrieves and records containers, performs selection.
virtual StatusCode initialize()
Algorithm initialization: retrieves StoreGate/DetectorStore/MuonIdHelpers/MuonPrepDataContainers.
std::vector< Identifier > * m_rpcchambersId
MuonChamberIDSelector(const std::string &name, ISvcLocator *pSvcLocator)
Athena algorithm constructor.
StatusCode selectCSC()
selects the CSCcollections
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode selectRPC()
selects the RPCcollections
StatusCode selectTGC()
selects the TGCcollections