ATLAS Offline Software
SCT_ConfigurationConditionsTestAlg.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 // Local includes
11 
12 // Athena includes
13 #include "Identifier/Identifier.h"
14 #include "InDetIdentifier/SCT_ID.h"
15 
16 SCT_ConfigurationConditionsTestAlg::SCT_ConfigurationConditionsTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
17  AthReentrantAlgorithm(name, pSvcLocator)
18 {
19 }
20 
22  ATH_MSG_INFO("in initialize()");
23 
24  ATH_CHECK(m_configConditions.retrieve());
25 
26  ATH_CHECK(detStore()->retrieve(m_sctId, "SCT_ID"));
27 
28  return StatusCode::SUCCESS;
29 }
30 
32  ATH_MSG_INFO("in execute()");
33 
34  // Bad modules
35  unsigned int nBadMods{static_cast<unsigned int>(m_configConditions->badModules(ctx)->size())};
36 
37  // Bad links
38  unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0};
39  const std::map<IdentifierHash, std::pair<bool, bool>>* badLinks{m_configConditions->badLinks(ctx)};
40  std::map<IdentifierHash, std::pair<bool, bool>>::const_iterator linkItr{badLinks->begin()};
41  std::map<IdentifierHash, std::pair<bool, bool>>::const_iterator linkEnd{badLinks->end()};
42  while (linkItr != linkEnd) {
43  std::pair<bool, bool> status{(*linkItr).second};
44  if (!status.first and status.second ) ++nBadLink0;
45  if (status.first and !status.second) ++nBadLink1;
46  if (!status.first and !status.second) ++nBadLinkBoth;
47  ++linkItr;
48  }
49 
50  // Bad chips
51  unsigned int nBadChips{0};
52  const std::map<Identifier, unsigned int>* badChips{m_configConditions->badChips(ctx)};
53  std::map<Identifier, unsigned int>::const_iterator chipItr{badChips->begin()};
54  std::map<Identifier, unsigned int>::const_iterator chipEnd{badChips->end()};
55  while (chipItr != chipEnd) {
56  unsigned int status{(*chipItr).second};
57  for (unsigned int i{0}; i<12; i++) nBadChips += ((status & (1<<i)) == 0 ? 0 : 1);
58  ++chipItr;
59  }
60 
61  // Bad strips
62  std::set<Identifier> badStripsAll;
63  m_configConditions->badStrips(badStripsAll, ctx);
64  unsigned int nBadStrips{static_cast<unsigned int>(badStripsAll.size())};
65 
66  // Bad strips (w/o bad modules and chips)
67  std::set<Identifier> badStripsExclusive;
68  m_configConditions->badStrips(badStripsExclusive, ctx, true, true);
69  unsigned int nBadStripsExclusive{static_cast<unsigned int>(badStripsExclusive.size())};
70  unsigned int nBadStripsExclusiveBEC[]{0,0,0};
71 
72  std::set<Identifier>::const_iterator stripItr{badStripsExclusive.begin()};
73  std::set<Identifier>::const_iterator stripEnd{badStripsExclusive.end()};
74 
75  while (stripItr != stripEnd) {
76  int bec{m_sctId->barrel_ec(*stripItr)};
77  nBadStripsExclusiveBEC[(bec/2)+1] += 1;
78  ++stripItr;
79  }
80 
81  ATH_MSG_INFO("-----------------------------------------------------------------------");
82  ATH_MSG_INFO("Number of bad modules = " << nBadMods );
83  ATH_MSG_INFO("Number of bad link 0 = " << nBadLink0 );
84  ATH_MSG_INFO("Number of bad link 1 = " << nBadLink1 );
85  ATH_MSG_INFO("Number of bad link both = " << nBadLinkBoth );
86  ATH_MSG_INFO("Number of bad chips = " << nBadChips );
87  ATH_MSG_INFO("Number of bad strips = " << nBadStrips );
88  ATH_MSG_INFO("Number of bad strips exclusive = " << nBadStripsExclusive);
89  ATH_MSG_INFO("Number of bad strips exclusive (ECC, B, ECA) = "
90  << nBadStripsExclusiveBEC[0] << ", "
91  << nBadStripsExclusiveBEC[1] << ", "
92  << nBadStripsExclusiveBEC[2] << ", ");
93  ATH_MSG_INFO("-----------------------------------------------------------------------");
94 
95  return StatusCode::SUCCESS;
96 }
97 
98 
100  ATH_MSG_INFO("in finalize()");
101  return StatusCode::SUCCESS;
102 }
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
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ConfigurationConditionsTestAlg::SCT_ConfigurationConditionsTestAlg
SCT_ConfigurationConditionsTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SCT_ConfigurationConditionsTestAlg.cxx:16
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
SCT_ConfigurationConditionsTestAlg::m_configConditions
ToolHandle< ISCT_ConfigurationConditionsTool > m_configConditions
Definition: SCT_ConfigurationConditionsTestAlg.h:46
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_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ConfigurationConditionsTestAlg::finalize
virtual StatusCode finalize() override
Definition: SCT_ConfigurationConditionsTestAlg.cxx:99
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ConfigurationConditionsTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: SCT_ConfigurationConditionsTestAlg.cxx:31
SCT_ConfigurationConditionsTestAlg::m_sctId
const SCT_ID * m_sctId
Definition: SCT_ConfigurationConditionsTestAlg.h:47
merge.status
status
Definition: merge.py:17
SCT_ConfigurationConditionsTestAlg::initialize
virtual StatusCode initialize() override
Definition: SCT_ConfigurationConditionsTestAlg.cxx:21
SCT_ConfigurationConditionsTestAlg.h