ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ReadCalibChipDataTestAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10// Include SCT_ReadCalibDataTestAlg
12
13// Include Athena stuff
15
16// Include Gaudi stuff
17
18// Include STL stuff
19#include <vector>
20
21//----------------------------------------------------------------------
22SCT_ReadCalibChipDataTestAlg::SCT_ReadCalibChipDataTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
23 AthReentrantAlgorithm(name, pSvcLocator)
24{
25}
26
27//----------------------------------------------------------------------
29 // Print where you are
30 ATH_MSG_DEBUG("in initialize()");
31
32 // Get SCT ID helper
33 ATH_CHECK( detStore()->retrieve(m_id_sct, "SCT_ID"));
34
35 // Process jobOption properties
37
38 // Get the SCT_ReadCaliChipDataSvc
40
41 return StatusCode::SUCCESS;
42} // SCT_ReadCalibChipDataTestAlg::initialize()
43
44//----------------------------------------------------------------------
46{
47 // Print where you are
48 ATH_MSG_DEBUG("in processProperties()");
49
50 // Get module position from jobOpt property
51 std::vector<int>::const_iterator itLoop{m_moduleOfflinePosition.value().begin()};
52 int offlineBarrelEC{*itLoop}; ++itLoop;
53 int offlineLayerDisk{*itLoop}; ++itLoop;
54 int offlineEta{*itLoop}; ++itLoop;
55 int offlinePhi{*itLoop}; ++itLoop;
56 int offlineSide{*itLoop}; ++itLoop;
57 int offlineStrip{*itLoop}; ++itLoop;
58
59 ATH_MSG_DEBUG("Module positions from jobOpt property:");
60 ATH_MSG_DEBUG("B-EC/layer-disk/eta/phi: "
61 << offlineBarrelEC << "/"
62 << offlineLayerDisk << "/"
63 << offlineEta << "/"
64 << offlinePhi << "/"
65 << offlineSide << "/"
66 << offlineStrip);
67
68 // Create offline Identifier for this module position, wafer,chip and strip
69 m_moduleId = m_id_sct->module_id(offlineBarrelEC, offlineLayerDisk, offlinePhi, offlineEta);
70 m_waferId = m_id_sct->wafer_id(offlineBarrelEC, offlineLayerDisk, offlinePhi, offlineEta, offlineSide);
71 m_stripId = m_id_sct->strip_id(offlineBarrelEC, offlineLayerDisk, offlinePhi, offlineEta, offlineSide, offlineStrip);
72
73 // Debug output
74 ATH_MSG_DEBUG("id-getString : " << m_moduleId.getString()); // hex format
75 ATH_MSG_DEBUG("id-getCompact: " << m_moduleId.get_compact()); // dec format
76 ATH_MSG_DEBUG("id-getCompact2: " << m_stripId.get_compact()); // dec format
77 ATH_MSG_DEBUG("Module Id: " << m_id_sct->print_to_string(m_moduleId));
78 ATH_MSG_DEBUG("Strip Id: " << m_id_sct->print_to_string(m_stripId));
79
80 return StatusCode::SUCCESS;
81} // SCT_ReadCalibChipDataTestAlg::processProperties()
82
83//----------------------------------------------------------------------
84StatusCode SCT_ReadCalibChipDataTestAlg::execute(const EventContext& ctx) const {
85 //This method is only used to test the summary service, and only used within this package,
86 // so the INFO level messages have no impact on performance of these services when used by clients
87
88 // Print where you are
89 ATH_MSG_DEBUG("in execute()");
90
91 ATH_MSG_DEBUG("Current Run.Event,Time: "
92 << "[" << ctx.eventID().run_number()
93 << "." << ctx.eventID().event_number()
94 << "," << ctx.eventID().time_stamp()
95 << "]");
96
97 //Test Chip Data ConditionsSummary
99 // Test summmary, ask status of strip in module
102 bool Sok{m_ReadCalibChipDataTool->isGood(IdS, ctx, InDetConditions::SCT_SIDE)};
103 ATH_MSG_INFO("Side " << IdS << " on module " << IdM << " is " << (Sok ? "good" : "bad"));
104 }
105
106 //Test data summary
108 // Test to get some data from the NPtGain or NoiseOccupancy
110 const int side{1};
111
112 // Try to get some NPtGain data
113 // GainByChip, GainRMSByChip, NoiseByChip, NoiseRMSByChip, OffsetByChip, OffsetRMSByChip
114 std::string whatNPdata{"GainByChip"};
115 std::vector<float> NPdata{m_ReadCalibChipDataTool->getNPtGainData(Id, side, whatNPdata, ctx)};
116 for (unsigned int i{0}; i<NPdata.size(); i++) {
117 ATH_MSG_INFO("The " << whatNPdata << " for chip number " << i << " on side " << side << " is: " << NPdata[i]);
118 }
119
120 // Try to get some NO data
121 // occupancy, occupancyRMS, noise, offset
122 std::string whatNOdata{"OccupancyRMSByChip"};
123 std::vector<float> NOdata{m_ReadCalibChipDataTool->getNoiseOccupancyData(Id, side, whatNOdata, ctx)};
124 ATH_MSG_INFO("Size of returned data: "<<NOdata.size());
125 for (unsigned int i{0}; i<NOdata.size(); i++) {
126 ATH_MSG_INFO("The " << whatNOdata << " for chip number " << i << " on side " << side << " is: " << NOdata[i]);
127 }
128
129 // Try to get some INVALID NPtGain data
130 // GainByChip, GainRMSByChip, NoiseByChip, NoiseRMSByChip, OffsetByChip, OffsetRMSByChip
131 Identifier invalidId;//constructor forms invalid Id
132 ATH_MSG_INFO("Trying to retrieve invalid data");
133 std::vector<float> nvNPdata{m_ReadCalibChipDataTool->getNPtGainData(invalidId, 0, whatNPdata, ctx)};
134 const long unsigned int sizeOfInvalidNPData{nvNPdata.size()};
135 ATH_MSG_INFO("Size of returned data: " << sizeOfInvalidNPData);
136 for (long unsigned int i{0}; i!=sizeOfInvalidNPData; ++i) {
137 ATH_MSG_INFO("The " << whatNPdata << " for chip number " << i << " on side " << side << " is: " << nvNPdata[i]);
138 }
139 }
140 return StatusCode::SUCCESS;
141} // SCT_ReadCalibChipDataTestAlg::execute()
142
143//----------------------------------------------------------------------
145 // Print where you are
146 ATH_MSG_DEBUG("in finalize()");
147
148 return StatusCode::SUCCESS;
149} // SCT_ReadCalibChipDataTestAlg::finalize()
150
151//----------------------------------------------------------------------
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
static const ITkStripOnlineId invalidId
This is an Identifier helper class for the SCT subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode finalize() override
Gaudi finaliser.
Identifier m_stripId
Strip identifier.
virtual StatusCode initialize() override
Gaudi initialiser.
SCT_ReadCalibChipDataTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Identifier m_moduleId
Module identifier.
StatusCode processProperties()
Process jobOpt properties.
const SCT_ID * m_id_sct
ID helper for SCT.
Identifier m_waferId
Wafer identifier.
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi executer.
ToolHandle< ISCT_ReadCalibChipDataTool > m_ReadCalibChipDataTool