ATLAS Offline Software
Loading...
Searching...
No Matches
LArWFParams2Ntuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6
14
15LArWFParams2Ntuple::LArWFParams2Ntuple(const std::string& name, ISvcLocator* pSvcLocator)
16 : LArCond2NtupleBase(name, pSvcLocator)
17{
18 //declareProperty("UseContainers",m_useContainers=false) ;
19 //declareProperty("UseComplete",m_useComplete=false) ;
20 declareProperty("DumpCaliPulseParams",m_dumpCaliPulseParams=false);
21 declareProperty("DumpDetCellParams" ,m_dumpDetCellParams=false);
22 declareProperty("DumpPhysCaliTdiff" ,m_dumpPhysCaliTdiff=false);
23 declareProperty("DumpTdrift" ,m_dumpTdrift=false);
24 declareProperty("DumpOFCBin" ,m_dumpOFCBin=false);
25
26 declareProperty("CaliPulseParamsKey",m_caliPulseParamsKey="LArCaliPulseParams");
27 declareProperty("DetCellParamsKey" ,m_detCellParamsKey="LArDetCellParams");
28 declareProperty("PhysCaliTDiffKey" ,m_physCaliTDiffKey="LArPhysCaliTDiff");
29 declareProperty("TdriftKey" ,m_tdriftKey="LArTdrift");
30 declareProperty("OFCBinKey" ,m_ofcBinKey="LArOFCBin");
31
32 m_addFEBTemp=false;
33}
34
36= default;
37
38
40
41 m_ntTitle="Parameters";
42 m_ntpath="/NTUPLES/FILE1/PARAMS";
44}
45
47
48 //Retrieve objects from DetStore
49 const LArCaliPulseParamsComplete* completeCaliPulseParams=nullptr ;
50 const LArDetCellParamsComplete* completeDetCellParams=nullptr ;
51 const LArPhysCaliTdiffComplete* completePhysCaliTdiff=nullptr ;
52 const LArTdriftComplete* completeTdrift=nullptr;
53 const LArOFCBinComplete* completeOFCBin=nullptr;
54
55
56 if ( m_dumpCaliPulseParams ) { //try retrieving from det store
57 ATH_MSG_DEBUG("Retrieving LArCaliPulseParamsComplete from detector store...");
58 StatusCode sc = detStore()->retrieve(completeCaliPulseParams,m_caliPulseParamsKey) ;
59 if ( sc.isFailure() ) {
60 ATH_MSG_ERROR( "Could not retrieve LArCaliPulseParamsComplete from detector store!" ) ;
61 m_dumpCaliPulseParams = false ;
62 }
63 }
64
65 if ( m_dumpDetCellParams ) { //try retrieving from det store
66 ATH_MSG_DEBUG("Retrieving LArDetCellParamsComplete from detector store...");
67 StatusCode sc = detStore()->retrieve(completeDetCellParams,m_detCellParamsKey);
68 if ( sc.isFailure() ) {
69 ATH_MSG_ERROR( "Could not retrieve LArDetCellParamsComplete from detector store!" ) ;
70 m_dumpDetCellParams = false;
71 }
72 }
73
74
75 if ( m_dumpPhysCaliTdiff ) { //try retrieving from det store
76 ATH_MSG_DEBUG("Retrieving LArPhysCaliTdiffComplete from detector store...");
77 StatusCode sc = detStore()->retrieve(completePhysCaliTdiff,m_physCaliTDiffKey);
78 if ( sc.isFailure()) {
79 ATH_MSG_ERROR( "Could not retrieve LArPhysCaliTdiffComplete from detector store!" ) ;
80 m_dumpPhysCaliTdiff = false ;
81 }
82 }
83
84
85 if ( m_dumpTdrift ) { //try retrieving from det store
86 ATH_MSG_DEBUG("Retrieving LArTdriftComplete from detector store...");
87 StatusCode sc = detStore()->retrieve(completeTdrift,m_tdriftKey) ;
88 if ( sc.isFailure()) {
89 ATH_MSG_ERROR( "Could not retrieve LArTdriftComplete from detector store!" );
90 m_dumpTdrift = false ;
91 }
92 }
93
94 if ( m_dumpOFCBin ) { //try retrieving from det store
95 ATH_MSG_DEBUG("Retrieving LArOFCBinComplete from detector store...");
96 StatusCode sc = detStore()->retrieve(completeOFCBin,m_ofcBinKey) ;
97 if ( sc.isFailure()) {
98 ATH_MSG_ERROR( "Could not retrieve LArOFCBinComplete from detector store!" );
99 m_dumpOFCBin= false ;
100 }
101 }
102
103
104 //Book ntuple item
105 NTuple::Item<long> gain;
106 NTuple::Item<double> Tcal, Fstep, Tdrift, Omega0, Taur, Tdiff,ofcbin;// Tshaper, Amplitude;
107
108 StatusCode sc=m_nt->addItem("gain",gain,-1,2);
109 if (sc!=StatusCode::SUCCESS) {
110 ATH_MSG_ERROR( "addItem 'Gain' failed" );
111 return StatusCode::FAILURE;
112 }
113
114
115 if ( m_dumpCaliPulseParams ) {
116 sc=m_nt->addItem("Tcal",Tcal);
117 if (sc!=StatusCode::SUCCESS) {
118 ATH_MSG_ERROR( "addItem 'Tcal' failed" );
119 return StatusCode::FAILURE;
120 }
121 sc=m_nt->addItem("Fstep",Fstep);
122 if (sc!=StatusCode::SUCCESS) {
123 ATH_MSG_ERROR( "addItem 'Fstep' failed" );
124 return StatusCode::FAILURE;
125 }
126 }
127 if ( m_dumpTdrift ) {
128 sc=m_nt->addItem("Tdrift",Tdrift);
129 if (sc!=StatusCode::SUCCESS) {
130 ATH_MSG_ERROR( "addItem 'Tdrift' failed" );
131 return StatusCode::FAILURE;
132 }
133 }
134 if ( m_dumpPhysCaliTdiff ) {
135 sc=m_nt->addItem("Tdiff",Tdiff);
136 if (sc!=StatusCode::SUCCESS) {
137 ATH_MSG_ERROR( "addItem 'Tdiff' failed" );
138 return StatusCode::FAILURE;
139 }
140 }
141 if ( m_dumpDetCellParams ) {
142 sc=m_nt->addItem("Omega0",Omega0);
143 if (sc!=StatusCode::SUCCESS) {
144 ATH_MSG_ERROR( "addItem 'Omega0' failed" );
145 return StatusCode::FAILURE;
146 }
147 sc=m_nt->addItem("Taur",Taur);
148 if (sc!=StatusCode::SUCCESS) {
149 ATH_MSG_ERROR( "addItem 'Taur' failed" );
150 return StatusCode::FAILURE;
151 }
152 }
153 if (m_dumpOFCBin) {
154 sc=m_nt->addItem("Bin",ofcbin);
155 if (sc!=StatusCode::SUCCESS) {
156 ATH_MSG_ERROR( "addIdetm 'Bin' failed!" );
157 }
158 }
159
160// sc=m_nt->addItem("Tshaper",m_Tshaper);
161// if (sc!=StatusCode::SUCCESS) {
162// ATH_MSG_ERROR( "addItem 'Tshaper' failed" );
163// return StatusCode::FAILURE;
164// }
165// sc=m_nt->addItem("Amplitude",m_Amplitude);
166// if (sc!=StatusCode::SUCCESS) {
167// ATH_MSG_ERROR( "addItem 'Amplitude' failed" );
168// return StatusCode::FAILURE;
169// }
170
171 //=======================================================================================================
172 // dump WFparams from smaller complete structures
173 // LArCaliPulseParamsComplete , LArDetCellParamsComplete , LArPhysCaliTdiffComplete , LArTdriftComplete
174 //=======================================================================================================
175
176
177
178
179 for(long igain=CaloGain::LARHIGHGAIN; igain<CaloGain::LARNGAIN; igain++) {
180 for (const HWIdentifier hwid: m_onlineId->channel_range()) {
181
182 //Initialize variables to 'errorcode'
185 float vTdrift=ILArCaliPulseParams::ERRORCODE;
186 float vOmega0=ILArCaliPulseParams::ERRORCODE;
190 //Tshaper=ILArCaliPulseParams::ERRORCODE;
191 //Amplitude=ILArCaliPulseParams::ERRORCODE;
192
193
194 bool haveData=false;
195 if ( m_dumpCaliPulseParams ) {
196 const LArCaliPulseParamsP& params=completeCaliPulseParams->get(hwid,igain);
197 vTcal=params.m_Tcal;
198 vFstep=params.m_Fstep;
199 if (!haveData && (vTcal>1+ILArCaliPulseParams::ERRORCODE || vFstep>1+ILArCaliPulseParams::ERRORCODE)) haveData=true;
200 }
201
202 if (m_dumpDetCellParams ) {
203 const LArDetCellParamsP& params=completeDetCellParams->get(hwid,igain);
204 vOmega0=params.m_Omega0;
205 vTaur=params.m_Taur;
206 if (!haveData && (vOmega0>1+ILArCaliPulseParams::ERRORCODE || vTaur>1+ILArCaliPulseParams::ERRORCODE)) haveData=true;
207 }
208
209 if (m_dumpTdrift ) {
210 const LArTdriftP& params=completeTdrift->get(hwid,gain);
211 if (!params.isEmpty()) {
212 vTdrift=params.m_Tdrift;
213 haveData=true;
214 }
215 }
216
217 if ( m_dumpPhysCaliTdiff ) {
218 const LArPhysCaliTdiffP& params= completePhysCaliTdiff->get(hwid,igain);
219 if (!params.isEmpty()) {
220 vTdiff=params.m_Tdiff;
221 if (!m_dumpTdrift && !m_dumpDetCellParams && !m_dumpCaliPulseParams) haveData=true;
222 }
223 }
224
225 if ( m_dumpOFCBin ) {
226 const LArOFCBinP & bin = completeOFCBin->bin(hwid,igain);
227 if (!bin.isEmpty()) {
228 vBin=bin.m_bin;
229 haveData=true;
230 }
231 }
232
233 if (haveData) {
234 bool connected=fillFromIdentifier(hwid);
235 if (!connected) {
236 //std::cout << "Disconnected: Tdrift:" << vTdrift << " Tdiff:" << vTdiff << " Taur" << vTaur << " Omega0" << vOmega0 << " Fstep" << vFstep << " Tcal" << vTcal << std::endl;
237 continue;
238 }
239 if ( m_dumpCaliPulseParams ) {
240 Tcal=vTcal;
241 Fstep=vFstep;
242 }
243 if (m_dumpDetCellParams ) {
244 Taur=vTaur;
245 Omega0=vOmega0;
246 }
247
248 if (m_dumpPhysCaliTdiff) Tdiff=vTdiff;
249
250 if (m_dumpTdrift ) Tdrift=vTdrift;
251
252 if (m_dumpOFCBin) ofcbin=vBin;
253
254 gain=igain;
255
256
257 sc=ntupleSvc()->writeRecord(m_nt);
258 if (sc!=StatusCode::SUCCESS) {
259 ATH_MSG_ERROR( "writeRecord failed" );
260 return StatusCode::FAILURE;
261 }
262 }//end if have data
263
264 }//end loop over identifiers
265
266 }//end loop over gains
267 return StatusCode::SUCCESS;
268}// end stop-method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
INTupleSvc * ntupleSvc()
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
This class implements the ILArCaliPulseParams interface.
const LArOnlineID_Base * m_onlineId
bool fillFromIdentifier(const HWIdentifier &id)
Gaudi::Property< bool > m_addFEBTemp
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
This class implements the ILArDetCellParams interface.
virtual const int & bin(const HWIdentifier &chid, const int &gain) const
This class implements the ILArPhysCaliTdiff interface ` *.
This class implements the ILArTdrift interface.
std::string m_detCellParamsKey
std::string m_caliPulseParamsKey
virtual StatusCode stop()
LArWFParams2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
std::string m_physCaliTDiffKey
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18