ATLAS Offline Software
SCT_ReadoutTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "SCT_ReadoutTool.h"
6 
9 
10 #include <algorithm>
11 
12 // Constructor
13 SCT_ReadoutTool::SCT_ReadoutTool(const std::string& type, const std::string& name, const IInterface* parent):
14  base_class(type, name, parent),
15  m_sctId{nullptr},
16  m_msgSvc{nullptr}
17 {
18 }
19 
20 // Initialize
22  ATH_MSG_DEBUG("Initialize SCT_ReadoutTool");
23  // Retrieve cabling
24  if (not m_cablingTool.empty()) {
25  ATH_CHECK(m_cablingTool.retrieve());
26  }
27  // Retrieve SCT helper
28  ATH_CHECK(detStore()->retrieve(m_sctId, "SCT_ID"));
29  // Get MessageSvc for SCT_ReadoutData
30  ISvcLocator* svcLocator{Gaudi::svcLocator()};
31  ATH_CHECK(svcLocator->service("MessageSvc", m_msgSvc));
32  return StatusCode::SUCCESS;
33 }
34 
35 // Finalize
37  ATH_MSG_DEBUG("Finalize SCT_ReadoutTool");
38  return StatusCode::SUCCESS;
39 }
40 
41 StatusCode SCT_ReadoutTool::determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const {
42  // Determine which chips are in the module readout from truncated serial number
43 
44  // Get moduleId
45  const IdentifierHash& hash{m_cablingTool->getHashFromSerialNumber(truncatedSerialNumber)};
46  if (not hash.is_valid()) return StatusCode::SUCCESS;
48 
49  // Call identifier version
50  return determineReadout(moduleId, chips, link0ok, link1ok);
51 }
52 
53 StatusCode SCT_ReadoutTool::determineReadout(const Identifier& moduleId, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const {
54  // This determineReadout(const Identifier is the main method of this class.
55  // Methods of SCT_ReadoutData are called in the following order in this method:
56  // setChips
57  // setLinkStatus
58  // setModuleType
59  // setChipMap
60  // clearChipReadout
61  // checkLink
62  // \_ followReadoutUpstream
63  // \_ setChipIn
64  // \_ setChipOut
65  // \_ hasConnectedInput
66  // \_ inputChip
67  // maskChipsNotInReadout
68  // \_ isChipReadOut
69  // printStatus
70  // \_ isLinkStandard
71  //
72  // The following two methods are not used.
73  // isEndBeingTalkedTo
74  // \_ outputChip
75 
76  // Determine which chips are in the module readout from Identifier
77  ATH_MSG_DEBUG("Determining Readout for module ID = " << moduleId);
78 
79  // Make sure there are 12 chips
80  if (chips.size()!=12) {
81  ATH_MSG_DEBUG("Readout must contain exactly 12 chips");
82  return StatusCode::SUCCESS;
83  }
84 
86 
87  // Set the chips and sort in order of ID
88  data.setChips(chips);
89 
90  // Set link status
91  data.setLinkStatus(link0ok, link1ok);
92 
93  // Determine module type (as per ModuleType enum) and set mapping
94  data.setModuleType(moduleId, m_sctId->barrel_ec(moduleId));
95  data.setChipMap();
96 
97  // Set all chips out of readout and clear both links to start
98  data.clearChipReadout();
99 
100  // Check the links
101  data.checkLink(0);
102  data.checkLink(1);
103 
104  // Mask chips not in readout
105  data.maskChipsNotInReadout();
106 
107  data.printStatus(moduleId);
108 
109  return StatusCode::SUCCESS;
110 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SCT_ReadoutTool::finalize
StatusCode finalize() override
Definition: SCT_ReadoutTool.cxx:36
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SCT_ReadoutTool::initialize
StatusCode initialize() override
Definition: SCT_ReadoutTool.cxx:21
SCT_ReadoutTool::m_sctId
const SCT_ID * m_sctId
Private data.
Definition: SCT_ReadoutTool.h:50
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::module_id
Identifier module_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: SCT_ID.h:416
SCT_ReadoutTool::SCT_ReadoutTool
SCT_ReadoutTool(const std::string &type, const std::string &name, const IInterface *parent)
Usual framework methods for an AlgTool.
Definition: SCT_ReadoutTool.cxx:13
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ReadoutTool.h
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SCT_ReadoutData
Definition: SCT_ReadoutData.h:42
SCT_ReadoutTool::m_cablingTool
ToolHandle< ISCT_CablingTool > m_cablingTool
Definition: SCT_ReadoutTool.h:52
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_ReadoutData.h
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
IdentifierHash
Definition: IdentifierHash.h:38
SCT_ReadoutTool::determineReadout
virtual StatusCode determineReadout(const Identifier &moduleId, std::vector< SCT_Chip > &chips, bool link0ok, bool link1ok) const override
Determine which chips are in the readout for a module of a particular type by Identifier.
Definition: SCT_ReadoutTool.cxx:53
SCT_ReadoutTool::m_msgSvc
IMessageSvc * m_msgSvc
Definition: SCT_ReadoutTool.h:51