ATLAS Offline Software
LArDSPThresholds2Ntuple.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
10 
11 #include "CoralBase/Blob.h"
13 
14 LArDSPThresholds2Ntuple::LArDSPThresholds2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
15  LArCond2NtupleBase(name, pSvcLocator){
16 
17  declareProperty("NtupleTitle",m_ntTitle="Gain Thresholds");
18  declareProperty("NtupleName",m_ntname="DSPTHR");
19  declareProperty("DumpFlat",m_doFlat=false);
20  declareProperty("FlatFolder",m_folder="");
21  m_ntpath="/NTUPLES/FILE1/"+m_ntname;
22  m_addFEBTemp=false;
23 }
24 
25 
27 
29  if (sc!=StatusCode::SUCCESS) {
30  ATH_MSG_ERROR( "Base init failed" );
31  return StatusCode::FAILURE;
32  }
33 
34  sc=m_nt->addItem("tQThr",m_tQThr);
35  if (sc!=StatusCode::SUCCESS) {
36  ATH_MSG_ERROR( "addItem tQThr failed" );
37  return StatusCode::FAILURE;
38  }
39 
40  sc=m_nt->addItem("samplesThr",m_samplesThr);
41  if (sc!=StatusCode::SUCCESS) {
42  ATH_MSG_ERROR( "addItem samplesThr failed" );
43  return StatusCode::FAILURE;
44  }
45 
46  sc=m_nt->addItem("trigThr",m_trigThr);
47  if (sc!=StatusCode::SUCCESS) {
48  ATH_MSG_ERROR( "addItem trigThr failed" );
49  return StatusCode::FAILURE;
50  }
51 
52  return StatusCode::SUCCESS;
53 }
54 
56 = default;
57 
59  StatusCode sc;
60 
61  const LArDSPThresholdsComplete *dc = nullptr;
62  const LArDSPThresholdsFlat *df = nullptr;
63  const AthenaAttributeList* attrList=nullptr;
64  if(m_doFlat) {
65  sc=detStore()->retrieve(attrList,m_folder);
66  if (sc.isFailure()) {
67  ATH_MSG_ERROR( "Failed to retrieve AthenaAttributeList with key " << m_folder );
68  return sc;
69  }
70 
71  const coral::Blob& blob = (attrList->coralList())["tQThr"].data<coral::Blob>();
72  if (blob.size()<3) {
73  ATH_MSG_INFO( "Found empty blob, nothing to do");
74  return StatusCode::SUCCESS;
75  }
76 
77  df=new LArDSPThresholdsFlat(attrList);
78 
79  } else {
80  sc=m_detStore->retrieve(dc);
81  if(sc!=StatusCode::SUCCESS) {
82  ATH_MSG_ERROR("Could not retrieve LArDSPThresholdsComplete....");
83  return StatusCode::FAILURE;
84  }
85  }
86 
87  for (const HWIdentifier hwid: m_onlineId->channel_range()) {
88  if(m_doFlat) {
89  m_tQThr=df->tQThr(hwid);
90  m_samplesThr=df->samplesThr(hwid);
91  m_trigThr=df->trigSumThr(hwid);
92  } else {
93  m_tQThr=dc->tQThr(hwid);
94  m_samplesThr=dc->samplesThr(hwid);
95  m_trigThr=dc->trigSumThr(hwid);
96  }
97 
98  fillFromIdentifier(hwid);
99  //ATH_MSG_INFO("hwid: "<<hwid.getString()<<" "<<tQThr<<" : "<<samplesThr<<" : "<<trigThr);
100 
101  sc=ntupleSvc()->writeRecord(m_nt);
102  if (sc!=StatusCode::SUCCESS) {
103  ATH_MSG_ERROR( "writeRecord failed" );
104  return StatusCode::FAILURE;
105  }
106  }
107 
108 
109  ATH_MSG_INFO( "LArDSPThresholds2Ntuple has finished." );
110  return StatusCode::SUCCESS;
111 
112 }// end finalize-method.
113 
LArDSPThresholds2Ntuple.h
LArCond2NtupleBase::m_addFEBTemp
Gaudi::Property< bool > m_addFEBTemp
Definition: LArCond2NtupleBase.h:54
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArDSPThresholdsComplete
Definition: LArDSPThresholdsComplete.h:21
LArDSPThresholds2Ntuple::m_trigThr
NTuple::Item< float > m_trigThr
Definition: LArDSPThresholds2Ntuple.h:29
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
AthenaAttributeList::coralList
const coral::AttributeList & coralList() const
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:65
LArDSPThresholds2Ntuple::m_tQThr
NTuple::Item< float > m_tQThr
Definition: LArDSPThresholds2Ntuple.h:27
LArDSPThresholdsFlat
Definition: LArDSPThresholdsFlat.h:17
HWIdentifier
Definition: HWIdentifier.h:13
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition: LArCond2NtupleBase.cxx:33
AthenaAttributeList.h
LArDSPThresholdsComplete::samplesThr
float samplesThr(const HWIdentifier chid) const
Definition: LArDSPThresholdsComplete.h:27
LArCond2NtupleBase
Definition: LArCond2NtupleBase.h:32
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
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArOnlineID_Base::channel_range
id_range channel_range() const
Definition: LArOnlineID_Base.cxx:1936
LArDSPThresholds2Ntuple::LArDSPThresholds2Ntuple
LArDSPThresholds2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArDSPThresholds2Ntuple.cxx:14
LArDSPThresholds2Ntuple::m_samplesThr
NTuple::Item< float > m_samplesThr
Definition: LArDSPThresholds2Ntuple.h:28
LArDSPThresholds2Ntuple::stop
StatusCode stop()
Definition: LArDSPThresholds2Ntuple.cxx:58
LArDSPThresholdsComplete.h
A LArRawConditionsContainer holding thresholds used by the DSP.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArCond2NtupleBase::m_ntpath
std::string m_ntpath
Definition: LArCond2NtupleBase.h:65
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition: LArCond2NtupleBase.h:68
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
LArDSPThresholdsComplete::trigSumThr
float trigSumThr(const HWIdentifier chid) const
Definition: LArDSPThresholdsComplete.h:28
LArDSPThresholds2Ntuple::m_folder
std::string m_folder
Definition: LArDSPThresholds2Ntuple.h:24
LArDSPThresholdsComplete::tQThr
float tQThr(const HWIdentifier chid) const
Definition: LArDSPThresholdsComplete.h:26
LArDSPThresholdsFlat.h
LArDSPThresholds2Ntuple::~LArDSPThresholds2Ntuple
~LArDSPThresholds2Ntuple()
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition: LArCond2NtupleBase.h:65
LArCond2NtupleBase::m_onlineId
const LArOnlineID_Base * m_onlineId
Definition: LArCond2NtupleBase.h:85
LArCond2NtupleBase::fillFromIdentifier
bool fillFromIdentifier(const HWIdentifier &id)
Definition: LArCond2NtupleBase.cxx:288
LArDSPThresholds2Ntuple::initialize
StatusCode initialize()
Definition: LArDSPThresholds2Ntuple.cxx:26
LArDSPThresholds2Ntuple::m_doFlat
bool m_doFlat
Definition: LArDSPThresholds2Ntuple.h:25
LArCond2NtupleBase::m_detStore
StoreGateSvc * m_detStore
Definition: LArCond2NtupleBase.h:81
LArDSPThresholds2Ntuple::m_ntname
std::string m_ntname
Definition: LArDSPThresholds2Ntuple.h:23
ntupleSvc
INTupleSvc * ntupleSvc()
Definition: ServiceAccessor.h:14
python.TriggerAPI.TriggerAPISession.df
df
Definition: TriggerAPISession.py:359
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
LArOnlineID.h