ATLAS Offline Software
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:
12 MuonChamberIDSelector::MuonChamberIDSelector(const std::string &name, ISvcLocator *pSvcLocator) :
13  AthAlgorithm(name, pSvcLocator), m_mdtchambersId(nullptr), m_rpcchambersId(nullptr) {}
14 
15 // Initialize method:
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 
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 }
MuonChamberIDSelector::selectCSC
StatusCode selectCSC()
selects the CSCcollections
Definition: MuonChamberIDSelector.h:28
MuonChamberIDSelector::selectRPC
StatusCode selectRPC()
selects the RPCcollections
Definition: MuonChamberIDSelector.cxx:68
MuonChamberIDSelector::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonChamberIDSelector.h:31
initialize
void initialize()
Definition: run_EoverP.cxx:894
MuonChamberIDSelector::ChamberperformSelection
StatusCode ChamberperformSelection()
Definition: MuonChamberIDSelector.cxx:32
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MuonChamberNameConverter.h
MuonChamberIDSelector::MuonChamberIDSelector
MuonChamberIDSelector(const std::string &name, ISvcLocator *pSvcLocator)
Athena algorithm constructor.
Definition: MuonChamberIDSelector.cxx:12
MuonChamberIDSelector.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
MuonChamberIDSelector::m_rpcchambersId
std::vector< Identifier > * m_rpcchambersId
Definition: MuonChamberIDSelector.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonChamberIDSelector::m_mdtchambersId
std::vector< Identifier > * m_mdtchambersId
Definition: MuonChamberIDSelector.h:32
MuonChamberIDSelector::initialize
virtual StatusCode initialize()
Algorithm initialization: retrieves StoreGate/DetectorStore/MuonIdHelpers/MuonPrepDataContainers.
Definition: MuonChamberIDSelector.cxx:16
IdentifierHash
Definition: IdentifierHash.h:38
MuonChamberIDSelector::selectMDT
StatusCode selectMDT()
Definition: MuonChamberIDSelector.cxx:41
IdContext
class IdContext
Definition: IdContext.h:34
MuonChamberIDSelector::execute
virtual StatusCode execute()
Retrieves and records containers, performs selection.
Definition: MuonChamberIDSelector.cxx:23
MuonChamberIDSelector::selectTGC
StatusCode selectTGC()
selects the TGCcollections
Definition: MuonChamberIDSelector.h:27