ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ReadCalibDataTestAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10// Include SCT_ReadCalibDataTestAlg
12
13// Include Athena stuff
16
17// Include STL stuff
18#include <cstdint>
19#include <string>
20#include <vector>
21
22//----------------------------------------------------------------------
23SCT_ReadCalibDataTestAlg::SCT_ReadCalibDataTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
24 AthReentrantAlgorithm(name, pSvcLocator)
25{
26}
27
28//----------------------------------------------------------------------
30{
31 // Print where you are
32 ATH_MSG_DEBUG("in initialize()");
33
34 // Get SCT ID helper
35 ATH_CHECK(detStore()->retrieve(m_id_sct, "SCT_ID"));
36
37 // Process jobOption properties
39
40 // Get the SCT_ReadCaliDataTool
42
43 // Retrieve SCT Cabling service
44 ATH_CHECK(m_cabling.retrieve());
45
46 return StatusCode::SUCCESS;
47} // SCT_ReadCalibDataTestAlg::initialize()
48
49//----------------------------------------------------------------------
51{
52 // Print where you are
53 ATH_MSG_DEBUG("in processProperties()");
54
55 // Get module position from jobOpt property
56 std::vector<int>::const_iterator itLoop{m_moduleOfflinePosition.value().begin()};
57 int offlineBarrelEC{*itLoop}; ++itLoop;
58 int offlineLayerDisk{*itLoop}; ++itLoop;
59 int offlineEta{*itLoop}; ++itLoop;
60 int offlinePhi{*itLoop}; ++itLoop;
61 int offlineSide{*itLoop}; ++itLoop;
62 int offlineStrip{*itLoop}; ++itLoop;
63
64 ATH_MSG_DEBUG("Module positions from jobOpt property:");
65 ATH_MSG_DEBUG("B-EC/layer-disk/eta/phi: "
66 << offlineBarrelEC << "/"
67 << offlineLayerDisk << "/"
68 << offlineEta << "/"
69 << offlinePhi << "/"
70 << offlineSide << "/"
71 << offlineStrip);
72
73 // Create offline Identifier for this module position, wafer,chip and strip
74 m_moduleId = m_id_sct->module_id(offlineBarrelEC, offlineLayerDisk, offlinePhi, offlineEta);
75 m_waferId = m_id_sct->wafer_id(offlineBarrelEC, offlineLayerDisk, offlinePhi, offlineEta, offlineSide);
76 m_stripId = m_id_sct->strip_id(offlineBarrelEC, offlineLayerDisk, offlinePhi, offlineEta, offlineSide, offlineStrip);
77
78 // Debug output
79 ATH_MSG_DEBUG("id-getString : " << m_moduleId.getString()); // hex format
80 ATH_MSG_DEBUG("id-getCompact: " << m_moduleId.get_compact()); // dec format
81 ATH_MSG_DEBUG("id-getCompact2: " << m_stripId.get_compact()); // dec format
82 ATH_MSG_DEBUG("Module Id: " << m_id_sct->print_to_string(m_moduleId));
83 ATH_MSG_DEBUG("Strip Id: " << m_id_sct->print_to_string(m_stripId));
84
85 return StatusCode::SUCCESS;
86} // SCT_ReadCalibDataTestAlg::processProperties()
87
88//----------------------------------------------------------------------
89StatusCode SCT_ReadCalibDataTestAlg::execute(const EventContext& ctx) const
90{
91 //This method is only used to test the summary service, and only used within this package,
92 // so the INFO level messages have no impact on performance of these services when used by clients
93
94 // Print where you are
95 ATH_MSG_DEBUG("in execute()");
96
97 //Test ConditionsSummary
99 // Test summmary, ask status of strip in module
102 bool Sok{m_ReadCalibDataTool->isGood(IdS, ctx, InDetConditions::SCT_STRIP)};
103 ATH_MSG_INFO("Strip " << IdS << " on module " << IdM << " is " << (Sok?"good":"bad"));
104 }
105
106 // Loop over all strips and check if good or not using isGood, and print the bad ones
108 int ngood{0};
109 int nbad{0};
110 //Loop over all wafers using hashIds from the cabling service
111 std::vector<std::uint32_t> listOfRODs;
112 m_cabling->getAllRods(listOfRODs, ctx);
113 std::vector<std::uint32_t>::iterator rodIter{listOfRODs.begin()};
114 std::vector<std::uint32_t>::iterator rodEnd{listOfRODs.end()};
115 for (; rodIter != rodEnd; ++rodIter) {
116 std::vector<IdentifierHash> listOfHashes;
117 m_cabling->getHashesForRod(listOfHashes, *rodIter, ctx);
118 std::vector<IdentifierHash>::iterator hashIt{listOfHashes.begin()};
119 std::vector<IdentifierHash>::iterator hashEnd{listOfHashes.end()};
120 for (; hashIt != hashEnd; ++hashIt) {
121 Identifier waferId{m_id_sct->wafer_id(*hashIt)};
122 //loop over all strips and check if good or not
123 for (unsigned int stripIndex{0}; stripIndex<768; ++stripIndex) {
124 Identifier IdS{m_id_sct->strip_id(waferId,stripIndex)};
125 const int stripId{m_id_sct->strip(IdS)};
126 const int side{m_id_sct->side(IdS)};
127 const bool stripOk{m_ReadCalibDataTool->isGood(IdS, ctx, InDetConditions::SCT_STRIP)};
128 if (stripOk) ++ngood;
129 else ++nbad;
130 if (not stripOk) { // Print info on all bad strips
131 ATH_MSG_INFO("ModuleId/side/strip: " << m_id_sct->module_id(waferId) << "/" << side << "/" << stripId << " is bad");
132 }
133 }
134 }
135 }
136 ATH_MSG_INFO("Number of good strips: " << ngood << " number of bad strips: " << nbad);
137 }
138
139 return StatusCode::SUCCESS;
140} // SCT_ReadCalibDataTestAlg::execute()
141
142//----------------------------------------------------------------------
144{
145 // Print where you are
146 ATH_MSG_DEBUG("in finalize()");
147
148 return StatusCode::SUCCESS;
149} // SCT_ReadCalibDataTestAlg::finalize()
150
151//----------------------------------------------------------------------
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the SCT subdetector.
Header file for SCT_ReadCalibDataTestAlg.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
ToolHandle< ISCT_ReadCalibDataTool > m_ReadCalibDataTool
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi executer.
Identifier m_waferId
Wafer identifier.
const SCT_ID * m_id_sct
ID helper for SCT.
SCT_ReadCalibDataTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Identifier m_stripId
Strip identifier.
StatusCode processProperties()
Process jobOpt properties.
virtual StatusCode initialize() override
Gaudi initialiser.
ToolHandle< ISCT_CablingTool > m_cabling
IntegerArrayProperty m_moduleOfflinePosition
Offline pos.
virtual StatusCode finalize() override
Gaudi finaliser.
Identifier m_moduleId
Module identifier.