Skip to content
Snippets Groups Projects
Commit 65c55e6b authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'master-ATLASRECTS-4575' into 'master'

SCT algorithm code cleanups for ATLASRECTS-4575

See merge request atlas/athena!16601
parents fde8632d 105933f6
No related branches found
No related tags found
No related merge requests found
Showing
with 72 additions and 113 deletions
......@@ -52,7 +52,7 @@ StatusCode SCT_ConditionsParameterTestAlg::execute() {
// so the INFO level messages have no impact on performance of these services when used by clients
ATH_MSG_DEBUG("in execute()");
//
StatusCode sc{StatusCode::SUCCESS};
StatusCode sc{StatusCode::SUCCESS, true};
// Get the current event
SG::ReadHandle<xAOD::EventInfo> currentEvent{m_currentEventKey};
......
......@@ -19,9 +19,6 @@
// Include Gaudi stuff
#include "GaudiKernel/ToolHandle.h"
// Include STL stuff
#include <string>
/** This class acts as a test/sample client the ConditionsParameter class.
*/
class SCT_ConditionsParameterTestAlg : public AthAlgorithm {
......
......@@ -271,8 +271,8 @@ StatusCode SCT_ConfigurationCondAlg::fillChannelData(SCT_ConfigurationCondData*
} else { // Good chip
if (not isBadModule) nDisabledStripsExclusive += thisChip->numberOfMaskedChannels(); // Bad strips in a good chip of a good module
}
}
// Store chip status if not all good (==0)
if (chipStatusWord!=0) {
writeCdo->setBadChips(moduleId, chipStatusWord);
......
......@@ -13,9 +13,6 @@
#include "Identifier/Identifier.h"
#include "InDetIdentifier/SCT_ID.h"
// C++ includes
#include <string>
SCT_ConfigurationConditionsTestAlg::SCT_ConfigurationConditionsTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator),
m_sctId{nullptr}
......@@ -36,14 +33,13 @@ StatusCode SCT_ConfigurationConditionsTestAlg::execute() {
ATH_MSG_INFO("in execute()");
// Bad modules
unsigned int nBadMods = m_configConditions->badModules()->size();
unsigned int nBadMods{static_cast<unsigned int>(m_configConditions->badModules()->size())};
// Bad links
unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0};
const std::map<IdentifierHash, std::pair<bool, bool>>* badLinks{m_configConditions->badLinks()};
std::map<IdentifierHash, std::pair<bool, bool>>::const_iterator linkItr{badLinks->begin()};
std::map<IdentifierHash, std::pair<bool, bool>>::const_iterator linkEnd{badLinks->end()};
unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0};
while (linkItr != linkEnd) {
std::pair<bool, bool> status{(*linkItr).second};
if (status.first == false and status.second == true ) ++nBadLink0;
......@@ -53,11 +49,10 @@ StatusCode SCT_ConfigurationConditionsTestAlg::execute() {
}
// Bad chips
unsigned int nBadChips{0};
const std::map<Identifier, unsigned int>* badChips{m_configConditions->badChips()};
std::map<Identifier, unsigned int>::const_iterator chipItr{badChips->begin()};
std::map<Identifier, unsigned int>::const_iterator chipEnd{badChips->end()};
unsigned int nBadChips{0};
while (chipItr != chipEnd) {
unsigned int status{(*chipItr).second};
for (unsigned int i{0}; i<12; i++) nBadChips += ((status & (1<<i)) == 0 ? 0 : 1);
......@@ -67,13 +62,13 @@ StatusCode SCT_ConfigurationConditionsTestAlg::execute() {
// Bad strips
std::set<Identifier> badStripsAll;
m_configConditions->badStrips(badStripsAll);
unsigned int nBadStrips = badStripsAll.size();
unsigned int nBadStrips{static_cast<unsigned int>(badStripsAll.size())};
// Bad strips (w/o bad modules and chips)
std::set<Identifier> badStripsExclusive;
m_configConditions->badStrips(badStripsExclusive, true, true);
int nBadStripsExclusive = badStripsExclusive.size();
int nBadStripsExclusiveBEC[]{0,0,0};
unsigned int nBadStripsExclusive{static_cast<unsigned int>(badStripsExclusive.size())};
unsigned int nBadStripsExclusiveBEC[]{0,0,0};
std::set<Identifier>::const_iterator stripItr{badStripsExclusive.begin()};
std::set<Identifier>::const_iterator stripEnd{badStripsExclusive.end()};
......
......@@ -14,21 +14,7 @@ SCT_DCSConditionsStatCondAlg::SCT_DCSConditionsStatCondAlg(const std::string& na
: ::AthAlgorithm(name, pSvcLocator)
, m_condSvc{"CondSvc", name}
, m_doState{true}
, m_chanstatCut{"NORM"}
, m_hvLowLimit{0.0}
, m_hvUpLimit{1000000.0}
, m_useHV{false}
, m_useHVLowLimit{19.}
, m_useHVUpLimit{1000000.0}
, m_useHVChanCut{"LOOSE"}
{
declareProperty("HVCutLow", m_hvLowLimit);
declareProperty("HVCutUp", m_hvUpLimit);
declareProperty("StateCut", m_chanstatCut);
declareProperty("UseDefaultHV", m_useHV);
declareProperty("useHVLow", m_useHVLowLimit);
declareProperty("useHVUp", m_useHVUpLimit);
declareProperty("useHVChan", m_useHVChanCut);
}
StatusCode SCT_DCSConditionsStatCondAlg::initialize() {
......@@ -55,7 +41,7 @@ StatusCode SCT_DCSConditionsStatCondAlg::initialize() {
}
}
if (m_useHV) {
if (m_useHV.value()) {
m_hvLowLimit = m_useHVLowLimit;
m_hvUpLimit = m_useHVUpLimit;
m_chanstatCut = m_useHVChanCut;
......
......@@ -32,16 +32,16 @@ class SCT_DCSConditionsStatCondAlg : public AthAlgorithm
ServiceHandle<ICondSvc> m_condSvc;
bool m_doState;
BooleanProperty m_readAllDBFolders{this, "ReadAllDBFolders", true};
BooleanProperty m_returnHVTemp{this, "ReturnHVTemp", true};
bool m_doState;
std::string m_chanstatCut;
float m_hvLowLimit;
float m_hvUpLimit;
bool m_useHV;
float m_useHVLowLimit;
float m_useHVUpLimit;
std::string m_useHVChanCut;
StringProperty m_chanstatCut{this, "StateCut", "NORM"};
FloatProperty m_hvLowLimit{this, "HVCutLow", 0.0};
FloatProperty m_hvUpLimit{this, "HVCutUp", 1000000.0};
BooleanProperty m_useHV{this, "UseDefaultHV", false};
FloatProperty m_useHVLowLimit{this, "useHVLow", 19.};
FloatProperty m_useHVUpLimit{this, "useHVUp", 1000000.0};
StringProperty m_useHVChanCut{this, "useHVChan", "LOOSE"};
};
#endif // SCT_DCSCONDITIONSSTATCONDALG
......@@ -12,10 +12,6 @@
// Include Athena stuff
#include "Identifier/Identifier.h"
// Include STL stuff
#include <string>
using namespace std;
SCT_DCSConditionsTestAlg::SCT_DCSConditionsTestAlg(const std::string& name,
ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator)
......@@ -82,7 +78,7 @@ StatusCode SCT_DCSConditionsTestAlg::execute() {
} // SCT_DCSConditionsTestAlg::execute()
//----------------------------------------------------------------------
StatusCode SCT_DCSConditionsTestAlg::finalize(){
StatusCode SCT_DCSConditionsTestAlg::finalize() {
// Get the messaging service, print where you are
ATH_MSG_INFO("in finalize()");
return StatusCode::SUCCESS;
......
......@@ -4,14 +4,12 @@
#include "SCT_DetectorElementCondAlg.h"
#include <memory>
#include <map>
#include "InDetReadoutGeometry/SCT_DetectorManager.h"
#include "InDetReadoutGeometry/SiCommonItems.h"
#include "InDetReadoutGeometry/SiDetectorElement.h"
#include "TrkSurfaces/Surface.h"
#include "TrkGeometry/Layer.h"
#include "TrkSurfaces/Surface.h"
#include <map>
SCT_DetectorElementCondAlg::SCT_DetectorElementCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthAlgorithm(name, pSvcLocator)
......@@ -88,16 +86,16 @@ StatusCode SCT_DetectorElementCondAlg::execute()
InDetDD::SiDetectorElementCollection::iterator newEl{writeCdo->begin()};
for (const InDetDD::SiDetectorElement* oldEl: *oldColl) {
// At the first time access, SiCommonItems are prepared using the first old element
if (m_commonItems==nullptr) {
if (m_commonItems.get()==nullptr) {
const InDetDD::SiCommonItems* oldCommonItems{oldEl->getCommonItems()};
m_commonItems = new InDetDD::SiCommonItems(oldCommonItems->getIdHelper());
m_commonItems = std::make_unique<InDetDD::SiCommonItems>(oldCommonItems->getIdHelper());
m_commonItems->setSolenoidFrame(oldCommonItems->solenoidFrame());
}
*newEl = new InDetDD::SiDetectorElement(oldEl->identify(),
&(oldEl->design()),
oldEl->GeoVDetectorElement::getMaterialGeom(),
m_commonItems,
m_commonItems.get(),
readCdo);
oldToNewMap[oldEl] = *newEl;
newEl++;
......@@ -145,7 +143,5 @@ StatusCode SCT_DetectorElementCondAlg::finalize()
{
ATH_MSG_DEBUG("finalize " << name());
delete m_commonItems;
return StatusCode::SUCCESS;
}
......@@ -8,15 +8,17 @@
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GeoModelUtilities/GeoAlignmentStore.h"
#include "InDetReadoutGeometry/SiCommonItems.h"
#include "InDetReadoutGeometry/SiDetectorElementCollection.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
#include <memory>
namespace InDetDD {
class SCT_DetectorManager;
class SiCommonItems;
}
class SCT_DetectorElementCondAlg : public AthAlgorithm
......@@ -35,7 +37,7 @@ class SCT_DetectorElementCondAlg : public AthAlgorithm
ServiceHandle<ICondSvc> m_condSvc;
const InDetDD::SCT_DetectorManager* m_detManager;
InDetDD::SiCommonItems* m_commonItems;
std::unique_ptr<InDetDD::SiCommonItems> m_commonItems;
};
#endif // SCT_CONDITIONSALGORITHMS_SCT_DETECTORELEMENTCONDALG_H
......@@ -4,10 +4,10 @@
#include "SCT_LinkMaskingCondAlg.h"
#include <memory>
#include "GaudiKernel/EventIDRange.h"
#include <memory>
SCT_LinkMaskingCondAlg::SCT_LinkMaskingCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthAlgorithm(name, pSvcLocator)
, m_condSvc{"CondSvc", name}
......@@ -75,7 +75,7 @@ StatusCode SCT_LinkMaskingCondAlg::execute() {
if (not lastProbedState) writeCdo->setBadWaferId(waferId);
ATH_MSG_INFO("LINK " << waferId << " (" << waferId.get_identifier32().get_compact() << " in 32 bit): " << lastProbedState);
}
if (writeCdo->size()!=0) writeCdo->setFilled();
if (writeCdo->size()>0) writeCdo->setFilled();
// Record the output cond object
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
......
......@@ -6,10 +6,12 @@
#define SCT_MAJORITYCONDALG
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "SCT_ConditionsData/SCT_MajorityCondData.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
class SCT_MajorityCondAlg : public AthAlgorithm
......@@ -24,7 +26,7 @@ class SCT_MajorityCondAlg : public AthAlgorithm
private:
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey{this, "ReadKey", "/SCT/DCS/MAJ", "Key of input (raw) conditions folder"};
SG::WriteCondHandleKey<SCT_MajorityCondData> m_writeKey{this, "WriteKey", "SCT_MajorityCondData", "Key of output (derived) conditions data"};
ServiceHandle<ICondSvc> m_condSvc;
ServiceHandle<ICondSvc> m_condSvc;
};
#endif // SCT_MAJORITYCONDALG
......@@ -80,8 +80,8 @@ StatusCode SCT_ModuleVetoCondAlg::execute() {
std::vector<int> v{string2Vector<int>(badModuleString)};
int numberInDb{static_cast<int>(v.size())};
ATH_MSG_INFO(numberInDb << " elements were declared bad in the database.");
for (std::vector<int>::const_iterator i{v.begin()}; i!=v.end(); ++i) {
writeCdo->setBadWaferId(Identifier{*i});
for (const int badWaferId: v) {
writeCdo->setBadWaferId(Identifier{badWaferId});
}
// Record the output cond object
......
......@@ -65,7 +65,6 @@ SCT_ModuleVetoTestAlg::execute() {
return StatusCode::SUCCESS;
}
//Finalize
StatusCode
SCT_ModuleVetoTestAlg::finalize() {
......
......@@ -18,15 +18,10 @@
#include "InDetIdentifier/SCT_ID.h"
#include "StoreGate/ReadHandle.h"
//Gaudi includes
#include "GaudiKernel/StatusCode.h"
SCT_MonitorConditionsTestAlg::SCT_MonitorConditionsTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator),
m_sctId{nullptr},
m_evtKey{std::string{"EventInfo"}}
m_sctId{nullptr}
{
declareProperty("EventInfoKey", m_evtKey);
}
// -------------------------------------------------------------------------
......
......@@ -45,7 +45,7 @@ class SCT_MonitorConditionsTestAlg : public AthAlgorithm {
const SCT_ID* m_sctId;
// Parameters to control the db access
SG::ReadHandleKey<xAOD::EventInfo> m_evtKey;
SG::ReadHandleKey<xAOD::EventInfo> m_evtKey{this, "EventInfoKey", "EventInfo"};
}; // end of class
......
......@@ -14,6 +14,7 @@
#include "SCT_RODVetoCondAlg.h"
#include "InDetIdentifier/SCT_ID.h"
#include "StoreGate/WriteHandle.h"
#include <algorithm>
#include <ios>
......@@ -21,12 +22,8 @@
SCT_RODVetoCondAlg::SCT_RODVetoCondAlg(const std::string& name,
ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator),
m_pHelper{nullptr},
m_badIds{"BadSCTModuleIds_RODVeto"},
m_badRODElementsInput{}
m_pHelper{nullptr}
{
declareProperty("BadModuleIds", m_badIds, "Write key for bad module identifiers");
declareProperty("BadRODIds", m_badRODElementsInput, "Input list of RODs to be vetoed");
}
StatusCode SCT_RODVetoCondAlg::initialize() {
......@@ -38,7 +35,7 @@ StatusCode SCT_RODVetoCondAlg::initialize() {
}
StatusCode SCT_RODVetoCondAlg::execute() {
ATH_MSG_INFO(m_badRODElementsInput.size() <<" RODs were declared bad");
ATH_MSG_INFO(m_badRODElementsInput.value().size() <<" RODs were declared bad");
std::vector<unsigned int> allRods;
m_cabling->getAllRods(allRods);
......@@ -46,7 +43,7 @@ StatusCode SCT_RODVetoCondAlg::execute() {
SG::WriteHandle<IdentifierSet> badIds{m_badIds};
ATH_CHECK(badIds.record(std::make_unique<IdentifierSet>()));
for (unsigned int thisRod: m_badRODElementsInput) {
for (unsigned int thisRod: m_badRODElementsInput.value()) {
ATH_MSG_DEBUG("This rod is " << std::hex << "0x" << thisRod << std::dec);
//check whether rod exists
......
......@@ -19,7 +19,7 @@
#include "SCT_Cabling/ISCT_CablingTool.h"
#include "SCT_ConditionsData/IdentifierSet.h"
#include "StoreGate/WriteHandle.h"
#include "StoreGate/WriteHandleKey.h"
// STL
#include <string>
......@@ -41,8 +41,8 @@ class SCT_RODVetoCondAlg : public AthAlgorithm {
private:
ToolHandle<ISCT_CablingTool> m_cabling{this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"};
const SCT_ID* m_pHelper;
SG::WriteHandle<IdentifierSet> m_badIds;
std::vector<unsigned int> m_badRODElementsInput;
SG::WriteHandleKey<IdentifierSet> m_badIds{this, "BadModuleIds", "BadSCTModuleIds_RODVeto", "Write key for bad module identifiers"};
UnsignedIntegerArrayProperty m_badRODElementsInput{this, "BadRODIds", {}, "Input list of RODs to be vetoed"};
}; //end of class
#endif // SCT_RODVetoCondAlg_H
......@@ -15,7 +15,6 @@
// Athena include
#include "Identifier/IdentifierHash.h"
#include "Identifier/Identifier.h"
SCT_RODVetoTestAlg::SCT_RODVetoTestAlg(const std::string& name,
ISvcLocator* pSvcLocator) :
......@@ -25,7 +24,7 @@ SCT_RODVetoTestAlg::SCT_RODVetoTestAlg(const std::string& name,
//Initialize
StatusCode
SCT_RODVetoTestAlg::initialize(){
SCT_RODVetoTestAlg::initialize() {
ATH_MSG_INFO("Calling initialize");
ATH_CHECK(m_pRODVetoTool.retrieve());
return StatusCode::SUCCESS;
......@@ -37,18 +36,18 @@ SCT_RODVetoTestAlg::execute() {
//This method is only used to test the summary service, and only used within this package,
// so the INFO level messages have no impact on performance of these services when used by clients
ATH_MSG_INFO("Calling execute");
for (unsigned int hash=0; hash<8176; hash+=2) {
bool result=m_pRODVetoTool->isGood(IdentifierHash(hash));//invented, no idea what this is
for (unsigned int hash{0}; hash<8176; hash+=2) {
bool result{m_pRODVetoTool->isGood(IdentifierHash(hash))};//invented, no idea what this is
ATH_MSG_INFO("Call to module in ROD : Module (hash=" << hash << ") is " << (result?"good":"bad"));
}
return StatusCode::SUCCESS;
}
//Finalize
StatusCode
SCT_RODVetoTestAlg::finalize(){
SCT_RODVetoTestAlg::finalize() {
ATH_MSG_INFO("Calling finalize");
return StatusCode::SUCCESS;
}
......@@ -13,15 +13,16 @@
#ifndef SCT_RODVetoTestAlg_H
#define SCT_RODVetoTestAlg_H
//STL
#include <string>
//Athena
#include "SCT_ConditionsTools/ISCT_ConditionsTool.h"
//Gaudi
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
//Athena
#include "SCT_ConditionsTools/ISCT_ConditionsTool.h"
//STL
#include <string>
///Example algorithm to show calling the SCT_RODVeto to exclude bad components
class SCT_RODVetoTestAlg : public AthAlgorithm {
......
......@@ -23,17 +23,11 @@
SCT_ReadCalibChipDataTestAlg::SCT_ReadCalibChipDataTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator),
m_id_sct{nullptr},
m_currentEventKey{std::string("EventInfo")},
m_moduleId{0},
m_waferId{0},
m_stripId{0},
m_doTestmyConditionsSummary{false},
m_doTestmyDataSummary{false},
m_moduleOfflinePosition{} {
declareProperty("DoTestmyConditionsSummary", m_doTestmyConditionsSummary = false, "Test return bool conditions summary?");
declareProperty("DoTestmyDataSummary", m_doTestmyDataSummary = false, "Test return data summary?");
declareProperty("ModuleOfflinePosition", m_moduleOfflinePosition , "Offline pos. as: B-EC,layer-disk,phi,eta");
}
m_stripId{0}
{
}
//----------------------------------------------------------------------
StatusCode SCT_ReadCalibChipDataTestAlg::initialize() {
......@@ -98,10 +92,10 @@ StatusCode SCT_ReadCalibChipDataTestAlg::processProperties()
StatusCode SCT_ReadCalibChipDataTestAlg::execute() {
//This method is only used to test the summary service, and only used within this package,
// so the INFO level messages have no impact on performance of these services when used by clients
// Print where you are
ATH_MSG_DEBUG("in execute()");
// Get the current event
SG::ReadHandle<xAOD::EventInfo> currentEvent{m_currentEventKey};
if (not currentEvent.isValid()) {
......@@ -113,22 +107,22 @@ StatusCode SCT_ReadCalibChipDataTestAlg::execute() {
<< "." << currentEvent->eventNumber()
<< "," << currentEvent->timeStamp()
<< "]");
//Test Chip Data ConditionsSummary
if (m_doTestmyConditionsSummary) {
if (m_doTestmyConditionsSummary.value()) {
// Test summmary, ask status of strip in module
Identifier IdM{m_moduleId};
Identifier IdS{m_waferId};
bool Sok{m_ReadCalibChipDataTool->isGood(IdS, InDetConditions::SCT_SIDE)};
ATH_MSG_INFO("Side " << IdS << " on module " << IdM << " is " << (Sok ? "good" : "bad"));
}
//Test data summary
if (m_doTestmyDataSummary) {
if (m_doTestmyDataSummary.value()) {
// Test to get some data from the NPtGain or NoiseOccupancy
Identifier Id{m_moduleId};
const int side{1};
Identifier Id{m_moduleId};
const int side{1};
// Try to get some NPtGain data
// GainByChip, GainRMSByChip, NoiseByChip, NoiseRMSByChip, OffsetByChip, OffsetRMSByChip
std::string whatNPdata{"GainByChip"};
......@@ -136,7 +130,7 @@ StatusCode SCT_ReadCalibChipDataTestAlg::execute() {
for (unsigned int i{0}; i<NPdata.size(); i++) {
ATH_MSG_INFO("The " << whatNPdata << " for chip number " << i << " on side " << side << " is: " << NPdata[i]);
}
// Try to get some NO data
// occupancy, occupancyRMS, noise, offset
std::string whatNOdata{"OccupancyRMSByChip"};
......@@ -145,7 +139,7 @@ StatusCode SCT_ReadCalibChipDataTestAlg::execute() {
for (unsigned int i{0}; i<NOdata.size(); i++) {
ATH_MSG_INFO("The " << whatNOdata << " for chip number " << i << " on side " << side << " is: " << NOdata[i]);
}
// Try to get some INVALID NPtGain data
// GainByChip, GainRMSByChip, NoiseByChip, NoiseRMSByChip, OffsetByChip, OffsetRMSByChip
Identifier invalidId;//constructor forms invalid Id
......@@ -164,7 +158,7 @@ StatusCode SCT_ReadCalibChipDataTestAlg::execute() {
StatusCode SCT_ReadCalibChipDataTestAlg::finalize() {
// Print where you are
ATH_MSG_DEBUG("in finalize()");
return StatusCode::SUCCESS;
} // SCT_ReadCalibChipDataTestAlg::finalize()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment