ATLAS Offline Software
Loading...
Searching...
No Matches
LArDSPThresholds2Ntuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
7
10
11#include "CoralBase/Blob.h"
13
14LArDSPThresholds2Ntuple::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 std::unique_ptr<LArDSPThresholdsFlat> df{};
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=std::make_unique< 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
99
100 sc=ntupleSvc()->writeRecord(m_nt);
101 if (sc!=StatusCode::SUCCESS) {
102 ATH_MSG_ERROR( "writeRecord failed" );
103 return StatusCode::FAILURE;
104 }
105 }
106
107
108 ATH_MSG_INFO( "LArDSPThresholds2Ntuple has finished." );
109 return StatusCode::SUCCESS;
110
111}// end finalize-method.
112
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
A LArRawConditionsContainer holding thresholds used by the DSP.
static Double_t sc
INTupleSvc * ntupleSvc()
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
An AttributeList represents a logical row of attributes in a metadata table.
StoreGateSvc * m_detStore
const LArOnlineID_Base * m_onlineId
bool fillFromIdentifier(const HWIdentifier &id)
Gaudi::Property< bool > m_addFEBTemp
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
NTuple::Item< float > m_trigThr
NTuple::Item< float > m_tQThr
NTuple::Item< float > m_samplesThr
LArDSPThresholds2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
float samplesThr(const HWIdentifier chid) const
float tQThr(const HWIdentifier chid) const
float trigSumThr(const HWIdentifier chid) const