ATLAS Offline Software
LArFillDSPConfig.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 
12 // Public methods:
14 
15 // Constructors
18  ISvcLocator* pSvcLocator ) :
19  ::AthAlgorithm( name, pSvcLocator ),
20  m_onlineID(nullptr)
21 {
22  declareProperty("Foldername",m_folderName="/LAR/Configuraton/DSPConfiguration");
23  declareProperty("Dump",m_dump=true);
24  declareProperty("isLowMu",m_lowmu=false);
25 }
26 
27 // Destructor
30 
31 // Athena Algorithm's Hooks
34 {
35  return StatusCode::SUCCESS;
36 }
37 
39 
40 
41  StatusCode sc=detStore()->retrieve(m_onlineID);
42  if (sc.isFailure()) {
43  ATH_MSG_ERROR( "Failed to get LArOnlineID" );
44  return sc;
45  }
46 
47  const unsigned nFebs=m_onlineID->febHashMax();
48 
49 
50  LArDSPConfigWrite larDSPConfig;
51 
52  for (unsigned iFeb=0;iFeb<nFebs;++iFeb) {
53  const HWIdentifier febId=m_onlineID->feb_Id(iFeb);
54  //bool useMGRampIntercept=(m_onlineID->isEMBchannel(febId) || m_onlineID->isEMECchannel(febId));
55  bool useMGRampIntercept=(m_onlineID->isEMBchannel(febId) || m_onlineID->isEMECOW(febId) );
56  if(m_lowmu) {
57  if(m_onlineID->isFCALchannel(febId)) useMGRampIntercept=true;
58  }
59  uint8_t peakSample=2;
60  if (m_onlineID->isHECchannel(febId)) peakSample=1; //HEC: peak-sample=1
61  larDSPConfig.set(iFeb,peakSample,useMGRampIntercept);
62  }
63 
64 
65  std::unique_ptr<AthenaAttributeList> pAttrList(larDSPConfig.attributeList());
66  ATH_CHECK(detStore()->record(std::move(pAttrList),m_folderName));
67  ATH_MSG_INFO( "Successfully recorded AthenaAttributeList containing DSP configuration for " << nFebs << " Febs" );
68 
69  if (m_dump) {
70  //Crosscheck:
71  const AthenaAttributeList* attrList_read=nullptr;
72  ATH_CHECK(detStore()->retrieve(attrList_read,m_folderName));
73 
74  LArDSPConfig config(attrList_read);
75 
76  for (auto fit= m_onlineID->feb_begin();fit!=m_onlineID->feb_end();++fit) {
77  unsigned ps=config.peakSample(*fit);
78  bool ic=config.useMGRampIntercept(*fit);
79  std::cout << "FEB " << m_onlineID->channel_name(*fit) << ": peakSample=" << ps << " useMGIntercept=" << ic << std::endl;
80  }
81  }
82  return StatusCode::SUCCESS;
83 }
84 
85 
86 
87 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArOnlineID_Base::febHashMax
size_type febHashMax(void) const
define feb hash tables max size
Definition: LArOnlineID_Base.cxx:1896
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArOnlineID_Base::feb_begin
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Definition: LArOnlineID_Base.cxx:1910
HWIdentifier
Definition: HWIdentifier.h:13
AthenaAttributeList.h
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArFillDSPConfig::m_lowmu
bool m_lowmu
Definition: LArFillDSPConfig.h:43
LArFillDSPConfig::m_folderName
std::string m_folderName
Definition: LArFillDSPConfig.h:41
LArDSPConfigWrite
Definition: LArDSPConfig.h:69
LArOnlineID_Base::isFCALchannel
bool isFCALchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1657
LArDSPConfigWrite::attributeList
std::unique_ptr< AthenaAttributeList > attributeList()
Definition: LArDSPConfig.h:81
LArDSPConfig
Definition: LArDSPConfig.h:18
LArFillDSPConfig::initialize
StatusCode initialize()
Definition: LArFillDSPConfig.cxx:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArDSPConfig.h
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
LArFillDSPConfig::m_dump
bool m_dump
Definition: LArFillDSPConfig.h:42
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
AthAlgorithm
Definition: AthAlgorithm.h:47
LArFillDSPConfig::LArFillDSPConfig
LArFillDSPConfig()
Default constructor:
LArFillDSPConfig.h
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1483
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
LArFillDSPConfig::stop
virtual StatusCode stop()
Definition: LArFillDSPConfig.cxx:38
grepfile.ic
int ic
Definition: grepfile.py:33
LArOnlineID_Base::feb_end
id_iterator feb_end() const
Definition: LArOnlineID_Base.cxx:1915
LArFillDSPConfig::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArFillDSPConfig.h:39
LArOnlineID::isEMECOW
bool isEMECOW(const HWIdentifier id) const override final
Definition: LArOnlineID.cxx:755
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1652
config
std::vector< std::string > config
Definition: fbtTestBasics.cxx:72
LArDSPConfigWrite::set
void set(const IdentifierHash febId, const uint8_t peakSample, const bool useMGRampIntercept)
Definition: LArDSPConfig.cxx:72
LArFillDSPConfig::~LArFillDSPConfig
virtual ~LArFillDSPConfig()
Destructor:
LArOnlineID::isHECchannel
bool isHECchannel(const HWIdentifier id) const override final
Definition: LArOnlineID.cxx:734
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:218
LArOnlineID.h