ATLAS Offline Software
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 
10 // Include SCT_ReadCalibDataTestAlg
12 
13 // Include Athena stuff
14 #include "InDetIdentifier/SCT_ID.h"
15 
16 // Include Gaudi stuff
17 
18 // Include STL stuff
19 #include <vector>
20 
21 //----------------------------------------------------------------------
22 SCT_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
79 
80  return StatusCode::SUCCESS;
81 } // SCT_ReadCalibChipDataTestAlg::processProperties()
82 
83 //----------------------------------------------------------------------
84 StatusCode 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
100  Identifier IdM{m_moduleId};
101  Identifier IdS{m_waferId};
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
107  if (m_doTestmyDataSummary) {
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 //----------------------------------------------------------------------
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SCT_ReadCalibChipDataTestAlg::m_id_sct
const SCT_ID * m_id_sct
ID helper for SCT.
Definition: SCT_ReadCalibChipDataTestAlg.h:51
SCT_ReadCalibChipDataTestAlg::initialize
virtual StatusCode initialize() override
Gaudi initialiser.
Definition: SCT_ReadCalibChipDataTestAlg.cxx:28
SCT_ReadCalibChipDataTestAlg::m_moduleId
Identifier m_moduleId
Module identifier.
Definition: SCT_ReadCalibChipDataTestAlg.h:52
Identifier::get_compact
value_type get_compact() const
Get the compact id.
SCT_ReadCalibChipDataTestAlg::m_doTestmyDataSummary
BooleanProperty m_doTestmyDataSummary
Definition: SCT_ReadCalibChipDataTestAlg.h:60
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_ReadCalibChipDataTestAlg::finalize
virtual StatusCode finalize() override
Gaudi finaliser.
Definition: SCT_ReadCalibChipDataTestAlg.cxx:144
SCT_ReadCalibChipDataTestAlg::m_stripId
Identifier m_stripId
Strip identifier.
Definition: SCT_ReadCalibChipDataTestAlg.h:54
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TRT::Hit::side
@ side
Definition: HitInfo.h:83
SCT_ReadCalibChipDataTestAlg::m_waferId
Identifier m_waferId
Wafer identifier.
Definition: SCT_ReadCalibChipDataTestAlg.h:53
SCT_ReadCalibChipDataTestAlg::SCT_ReadCalibChipDataTestAlg
SCT_ReadCalibChipDataTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: SCT_ReadCalibChipDataTestAlg.cxx:22
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
SCT_ReadCalibChipDataTestAlg::m_ReadCalibChipDataTool
ToolHandle< ISCT_ReadCalibChipDataTool > m_ReadCalibChipDataTool
Definition: SCT_ReadCalibChipDataTestAlg.h:57
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ReadCalibChipDataTestAlg::m_doTestmyConditionsSummary
BooleanProperty m_doTestmyConditionsSummary
Definition: SCT_ReadCalibChipDataTestAlg.h:59
AtlasDetectorID::print_to_string
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:655
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ReadCalibChipDataTestAlg::m_moduleOfflinePosition
IntegerArrayProperty m_moduleOfflinePosition
Definition: SCT_ReadCalibChipDataTestAlg.h:61
SCT_ReadCalibChipDataTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi executer.
Definition: SCT_ReadCalibChipDataTestAlg.cxx:84
SCT_ReadCalibChipDataTestAlg.h
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
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
InDetConditions::SCT_SIDE
@ SCT_SIDE
Definition: InDetHierarchy.h:14
SCT_ReadCalibChipDataTestAlg::processProperties
StatusCode processProperties()
Process jobOpt properties.
Definition: SCT_ReadCalibChipDataTestAlg.cxx:45
SCT_ID::strip_id
Identifier strip_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side, int strip) const
For an individual strip.
Definition: SCT_ID.h:535
Identifier
Definition: IdentifierFieldParser.cxx:14