ATLAS Offline Software
Loading...
Searching...
No Matches
ZDC::LISAnalysisTool Class Reference

#include <LISAnalysisTool.h>

Inheritance diagram for ZDC::LISAnalysisTool:
Collaboration diagram for ZDC::LISAnalysisTool:

Public Member Functions

 LISAnalysisTool (std::string const &name)
virtual ~LISAnalysisTool () override=default
StatusCode initialize () override
 Dummy implementation of the initialisation function.
StatusCode recoZdcModules (xAOD::ZdcModuleContainer const &moduleContainer, xAOD::ZdcModuleContainer const &moduleSumContainer) override
StatusCode reprocessZdc () override
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void initialize_default ()
LISModuleResults processLISModule (const xAOD::ZdcModule &module)
LISModuleResults processModuleData (int side, int channel, const std::vector< unsigned short > &data, unsigned int startSample, unsigned int endSample)
double getAmplitudeCorrection (int iside, int imod, bool highGain, float fitAmp)
void setFADCCorrections (unsigned int runNumber)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_init {false}
std::string m_name
Gaudi::Property< std::string > m_configuration {this, "Configuration", "default", "Which config to use"}
Gaudi::Property< bool > m_writeAux {this, "WriteAux", true, "Write auxiliary data"}
Gaudi::Property< std::string > m_auxSuffix {this, "AuxSuffix", "", "Suffix for aux data names"}
Gaudi::Property< unsigned int > m_nBaselineStart {this, "BaselineStart", 0, "Start index for baseline calculation"}
Gaudi::Property< unsigned int > m_nBaselineEnd {this, "BaselineEnd", 5, "End index for baseline calculation"}
std::vector< unsigned int > m_LEDCalreqIdx
std::vector< unsigned int > m_LEDBCID
const std::vector< std::string > m_LEDNames = {"Blue1", "Green", "Blue2"}
const std::vector< std::string > m_calreqNames = {"CalReq1", "CalReq2", "CalReq3"}
unsigned int m_numSamples {24}
unsigned int m_preSample {0}
float m_deltaTSample {3.125}
unsigned int m_sampleAnaStart {5}
unsigned int m_sampleAnaEnd {23}
unsigned int m_nBaselineSamples {5}
Gaudi::Property< std::string > m_zdcModuleContainerName {this, "ZdcModuleContainerName", "ZdcModules", "Location of ZDC processed data"}
Gaudi::Property< std::string > m_zdcSumContainerName {this, "ZdcSumContainerName", "ZdcSums", "Location of ZDC processed sums"}
const xAOD::ZdcModuleContainerm_zdcModules {nullptr}
const xAOD::ZdcModuleContainerm_zdcSums {nullptr}
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfoKey", "EventInfo", "Location of the event info"}
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainerm_eventTypeKey {this, "ZdcEventTypeKey", "", "ZDC Event type"}
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainerm_robBCIDKey {this, "ROBBCIDKey", "", "BCID from LUCROD ROB headers"}
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainerm_DAQModeKey {this, "ZdcDAQModeKey", "", "ZDC DAQ mode"}
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainerm_ZdcLEDType {this, "ZdcLEDType", "", "ZDC LED Type (0-Blue1, 1-Green, 2-Blue2}"}
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainerm_LISPresampleADC {this, "LISPresampleADC", "", "LIS presample ADC"}
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainerm_LISADCSum {this, "LISADCSum", "", "LIS pulse FADC sum"}
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainerm_LISMaxADC {this, "LISMaxADC", "", "LIS pulse max FADC value"}
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainerm_LISMaxSample {this, "LISMaxSample", "", "LIS max FADC sample"}
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainerm_LISAvgTime {this, "LISAvgTime", "", "LIS average time"}
bool m_doFADCCorr {}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 48 of file LISAnalysisTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LISAnalysisTool()

ZDC::LISAnalysisTool::LISAnalysisTool ( std::string const & name)
explicit

Definition at line 16 of file LISAnalysisTool.cxx.

16 :
17 asg::AsgTool(name),
18 m_name(name)
19{
20#ifndef XAOD_STANDALONE
21 declareInterface<IZdcAnalysisTool>(this);
22#endif
23}

◆ ~LISAnalysisTool()

virtual ZDC::LISAnalysisTool::~LISAnalysisTool ( )
overridevirtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getAmplitudeCorrection()

double ZDC::LISAnalysisTool::getAmplitudeCorrection ( int iside,
int imod,
bool highGain,
float fitAmp )
private

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode ZDC::LISAnalysisTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 25 of file LISAnalysisTool.cxx.

25 {
26 ATH_MSG_INFO("Initializing LISAnalysisTool with configuration: " << m_configuration);
27 ATH_MSG_INFO("Initializing LISAnalysisTool with BaselineStart: " << m_nBaselineStart << ", BaselineEnd: " << m_nBaselineEnd);
28
30
31 ATH_MSG_INFO("LIS Configuration:");
32 ATH_MSG_INFO(" NumSamples: " << m_numSamples);
33 ATH_MSG_INFO(" Presample: " << m_preSample);
34 ATH_MSG_INFO(" DeltaTSample: " << m_deltaTSample << " ns");
35 ATH_MSG_INFO(" SampleAnaStart: " << m_sampleAnaStart);
36 ATH_MSG_INFO(" SampleAnaEnd: " << m_sampleAnaEnd);
37
38 // If an aux suffix is provided, prepend it with "_"
39 std::string auxSuffix = m_auxSuffix;
40 if (auxSuffix != "") auxSuffix = "_" + auxSuffix;
41
42 // Initialize eventInfo access
43 ATH_CHECK(m_eventInfoKey.initialize());
44
45 // Initialize keys for reading ZDC event-level aux decor information
47 ATH_CHECK(m_eventTypeKey.initialize());
48
50 ATH_CHECK(m_DAQModeKey.initialize());
51
53 ATH_CHECK(m_robBCIDKey.initialize());
54
55 // Initialize WriteDecor handles
56 if (m_writeAux) {
57 m_ZdcLEDType = m_zdcSumContainerName + ".ZdcLEDType" + auxSuffix;
58 ATH_CHECK(m_ZdcLEDType.initialize());
59
60 m_LISPresampleADC = m_zdcModuleContainerName + ".LISPresample" + auxSuffix;
61 ATH_CHECK(m_LISPresampleADC.initialize());
62
63 m_LISADCSum = m_zdcModuleContainerName + ".LISADCSum" + auxSuffix;
64 ATH_CHECK(m_LISADCSum.initialize());
65
66 m_LISMaxADC = m_zdcModuleContainerName + ".LISMaxADC" + auxSuffix;
67 ATH_CHECK(m_LISMaxADC.initialize());
68
69 m_LISMaxSample = m_zdcModuleContainerName + ".LISMaxSample" + auxSuffix;
70 ATH_CHECK(m_LISMaxSample.initialize());
71
72 m_LISAvgTime = m_zdcModuleContainerName + ".LISAvgTime" + auxSuffix;
73 ATH_CHECK(m_LISAvgTime.initialize());
74
75 }
76
77 m_init = true;
78 ATH_MSG_INFO("LISAnalysisTool initialization complete");
79
80 return StatusCode::SUCCESS;
81}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISMaxADC
Gaudi::Property< bool > m_writeAux
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISMaxSample
Gaudi::Property< unsigned int > m_nBaselineEnd
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISADCSum
Gaudi::Property< std::string > m_auxSuffix
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_robBCIDKey
unsigned int m_sampleAnaStart
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISPresampleADC
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_eventTypeKey
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDType
Gaudi::Property< unsigned int > m_nBaselineStart
Gaudi::Property< std::string > m_configuration
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_DAQModeKey
Gaudi::Property< std::string > m_zdcModuleContainerName
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISAvgTime
unsigned int m_numSamples
Gaudi::Property< std::string > m_zdcSumContainerName
unsigned int m_sampleAnaEnd

◆ initialize_default()

void ZDC::LISAnalysisTool::initialize_default ( )
private

Definition at line 83 of file LISAnalysisTool.cxx.

83 {
84 // PbPb 2025 configuration
85 m_numSamples = 24;
86 m_preSample = 0;
87 m_deltaTSample = 3.125;
89 m_sampleAnaEnd = 23;
91
92 m_LEDBCID = {3476, 3479, 3482};
93 m_LEDCalreqIdx = {0 ,1 ,2};}
std::vector< unsigned int > m_LEDCalreqIdx
std::vector< unsigned int > m_LEDBCID
unsigned int m_nBaselineSamples

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ processLISModule()

LISModuleResults ZDC::LISAnalysisTool::processLISModule ( const xAOD::ZdcModule & module)
private

Definition at line 154 of file LISAnalysisTool.cxx.

154 {
155 ATH_MSG_DEBUG("Processing LIS module: side=" << module.zdcSide()
156 << ", module=" << module.zdcModule()
157 << ", channel=" << module.zdcChannel());
158
159 int LISModuleGain = 0;
160
161 if(module.zdcChannel() > 3){
162 LISModuleGain = 1; // gain 1 for channels 4-7
163 }
164 else{
165 LISModuleGain = 0; // gain 0 for channels 0-3
166 }
167
168 ATH_MSG_DEBUG("LIS module gain: " << LISModuleGain);
169
170 // Determine which gain data to use
171 static SG::ConstAccessor<std::vector<uint16_t>> g0dataAccessor("g0data");
172 static SG::ConstAccessor<std::vector<uint16_t>> g1dataAccessor("g1data");
173 const SG::ConstAccessor<std::vector<uint16_t>> &gainDataAccessor = (LISModuleGain == 0) ? g0dataAccessor : g1dataAccessor;
174
175 // Get waveform data
176 if (!gainDataAccessor.isAvailable(module)) {
177 ATH_MSG_DEBUG("No gain data available for this module");
178 return LISModuleResults();
179 }
180
181 const std::vector<uint16_t> &waveform = gainDataAccessor(module);
182 if (waveform.empty()) {
183 ATH_MSG_DEBUG("Empty waveform");
184 return LISModuleResults();
185 }
186
187 return processModuleData(module.zdcSide(), module.zdcChannel(),
189}
#define ATH_MSG_DEBUG(x)
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
LISModuleResults processModuleData(int side, int channel, const std::vector< unsigned short > &data, unsigned int startSample, unsigned int endSample)

◆ processModuleData()

LISModuleResults ZDC::LISAnalysisTool::processModuleData ( int side,
int channel,
const std::vector< unsigned short > & data,
unsigned int startSample,
unsigned int endSample )
private

Definition at line 95 of file LISAnalysisTool.cxx.

99{
100 ATH_MSG_DEBUG("Processing LIS data for side " << side << ", channel " << channel);
101
102 int ADCSum = 0;
103 int maxADCsub = -999;
104 unsigned int maxSample = 0;
105 float avgTime = 0.f;
106
107 if (data.empty()) {
108 ATH_MSG_DEBUG("Empty waveform data");
109 return LISModuleResults();
110 }
111
112 if (startSample >= data.size() || endSample >= data.size()) {
113 ATH_MSG_WARNING("Start or end sample number greater than number of samples");
114 return LISModuleResults();
115 }
116
117 // Calculate presample (baseline) from first few samples
118 float preFADC = 0;
119 unsigned int nBaseline = std::min(m_nBaselineSamples, static_cast<unsigned int>(data.size()));
120 for (unsigned int i = m_nBaselineStart; i < m_nBaselineEnd; ++i) {
121 preFADC += data[i];
122 }
123 preFADC /= nBaseline;
124
125 // Process samples in analysis window
126 for (unsigned int sample = startSample; sample <= endSample; sample++) {
127 int FADCsub = static_cast<int>(data[sample]) - static_cast<int>(std::round(preFADC));
128
129 float time = (sample + 0.5f) * m_deltaTSample;
130 ADCSum += FADCsub;
131
132 if (FADCsub > maxADCsub) {
133 maxADCsub = FADCsub;
134 maxSample = sample;
135 }
136
137 avgTime += time * FADCsub;
138 }
139
140 // Calculate average time
141 if (ADCSum != 0) {
142 avgTime /= ADCSum;
143 } else {
144 avgTime = 0.f;
145 }
146
147 ATH_MSG_DEBUG(" Presample: " << preFADC << ", ADCSum: " << ADCSum
148 << ", MaxADC: " << maxADCsub << ", MaxSample: " << maxSample
149 << ", AvgTime: " << avgTime);
150
151 return LISModuleResults(preFADC, ADCSum, maxADCsub, maxSample, avgTime);
152}
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
time(flags, cells_name, *args, **kw)

◆ recoZdcModules()

StatusCode ZDC::LISAnalysisTool::recoZdcModules ( xAOD::ZdcModuleContainer const & moduleContainer,
xAOD::ZdcModuleContainer const & moduleSumContainer )
overridevirtual

Implements ZDC::IZdcAnalysisTool.

Definition at line 191 of file LISAnalysisTool.cxx.

193 {
194
195 ATH_MSG_DEBUG("LISAnalysisTool::recoZdcModules processing event");
196
197 if (!m_init) {
198 ATH_MSG_WARNING("Tool not initialized!");
199 return StatusCode::FAILURE;
200 }
201
202 if (moduleContainer.empty()) {
203 return StatusCode::SUCCESS;
204 }
205 // Check for decoding errors
206 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
207 if (!eventInfo.isValid()) {
208 ATH_MSG_WARNING("EventInfo not valid");
209 return StatusCode::FAILURE;
210 }
211
212 bool lisErr = eventInfo->isEventFlagBitSet(xAOD::EventInfo::ForwardDet, ZdcEventInfo::LISDECODINGERROR);
213 if (lisErr) {
214 ATH_MSG_WARNING("LIS decoding error found - abandoning LISAnalysisTool!");
215 return StatusCode::SUCCESS;
216 }
217
218 SG::ReadDecorHandle<xAOD::ZdcModuleContainer, unsigned int> eventTypeHandle(m_eventTypeKey);
219 SG::ReadDecorHandle<xAOD::ZdcModuleContainer, std::vector<uint16_t>> rodBCIDHandle(m_robBCIDKey);
220
221 // Loop over the sum container to find event-level info (side == 0)
222 //
223 bool haveZdcEventInfo = false;
224 unsigned int eventType = ZdcEventInfo::ZdcEventUnknown;
225 unsigned int bcid = 0;
226
227 const xAOD::ZdcModule* moduleSumEventInfo_ptr = 0;
228
229 for (auto modSum : moduleSumContainer) {
230 //
231 // Module sum object with side == 0 contains event-level information
232 //
233 if (modSum->zdcSide() == 0) {
234 //
235 // Add the event type and bcid as aux decors
236 //
237 ATH_MSG_DEBUG("Found global sum");
238 eventType = eventTypeHandle(*modSum);
239 haveZdcEventInfo = true;
240 moduleSumEventInfo_ptr = modSum;
241 }
242 }
243
244 if (!haveZdcEventInfo) {
245 ATH_MSG_ERROR("Zdc event data not available (moduleSum with side = 0)");
246 return StatusCode::FAILURE;
247 }
248
249 // Get the BCID from the rodBCID vector
250 const std::vector<uint16_t>& rodBCID = rodBCIDHandle(*moduleSumEventInfo_ptr);
251 if (!rodBCID.empty()) {
252 bcid = rodBCID[0]; // Use first BCID from LUCROD
253 ATH_MSG_DEBUG("Retrieved BCID from rodBCID: " << bcid);
254 } else {
255 ATH_MSG_WARNING("rodBCID vector is empty, using EventInfo BCID");
256 bcid = eventInfo->bcid();
257 }
258
259 // Determine the LED type
260 //
261 unsigned int evtLEDType = ZdcEventInfo::LEDNone;
262
263 for (unsigned int idxLED = 0; idxLED < ZdcEventInfo::NumLEDs; idxLED++) {
264 //
265 // Does the BCID match one of those associated with the LEDs?
266 //
267 if (m_LEDBCID[idxLED] == bcid) {
268
269 evtLEDType = idxLED;
270 break;
271 }
272 }
273
274 if (evtLEDType == ZdcEventInfo::LEDNone && eventType == ZdcEventInfo::ZdcEventLED) {
275 //
276 // Thie BCID does not appear to be associated with one of the LEDs, print warning and quit processing
277 //
278 ATH_MSG_WARNING("LED event: Unexpected BCID found in data: bcid = " << bcid << m_configuration);
279 return StatusCode::SUCCESS;
280 }
281 else {
282 ATH_MSG_DEBUG("Event with BCID = " << bcid << " has LED type " << evtLEDType);
283 }
284
285
286 // Create write decoration handles
287 SG::WriteDecorHandle<xAOD::ZdcModuleContainer,unsigned int> LEDTypeHandle(m_ZdcLEDType);
288 SG::WriteDecorHandle<xAOD::ZdcModuleContainer, float> presampleHandle(m_LISPresampleADC);
289 SG::WriteDecorHandle<xAOD::ZdcModuleContainer, int> adcSumHandle(m_LISADCSum);
290 SG::WriteDecorHandle<xAOD::ZdcModuleContainer, int> maxADCHandle(m_LISMaxADC);
291 SG::WriteDecorHandle<xAOD::ZdcModuleContainer, unsigned int> maxSampleHandle(m_LISMaxSample);
292 SG::WriteDecorHandle<xAOD::ZdcModuleContainer, float> avgTimeHandle(m_LISAvgTime);
293
294 ATH_MSG_DEBUG("Processing " << moduleContainer.size() << " modules");
295
296 // Loop over modules and process LIS channels (module=5, type=2)
297 for (const auto* zdcModule : moduleContainer) {
298
299 LISModuleResults results = processLISModule(*zdcModule);
300
301
302
303 ATH_MSG_DEBUG("Writing aux decors to LIS module: side=" << zdcModule->zdcSide()
304 << ", channel=" << zdcModule->zdcChannel());
305
306 // Write decorations
307 presampleHandle(*zdcModule) = results.getPresampleADC();
308 adcSumHandle(*zdcModule) = results.getADCSum();
309 maxADCHandle(*zdcModule) = results.getMaxADC();
310 maxSampleHandle(*zdcModule) = results.getMaxSample();
311 avgTimeHandle(*zdcModule) = results.getAvgTime();
312
313 }
314
315
316 if(eventType == ZdcEventInfo::ZdcEventLED){
317 // Write the LED type to the moduleSum container keep event-level data
318 //
319 LEDTypeHandle(*moduleSumEventInfo_ptr) = evtLEDType;
320 }
321
322 ATH_MSG_DEBUG("Finished event processing");
323
324 return StatusCode::SUCCESS;
325}
#define ATH_MSG_ERROR(x)
LISModuleResults processLISModule(const xAOD::ZdcModule &module)
@ ForwardDet
The forward detectors.
ZdcModule_v1 ZdcModule
Definition ZdcModule.h:15
setEventNumber setTimeStamp bcid

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ reprocessZdc()

StatusCode ZDC::LISAnalysisTool::reprocessZdc ( )
overridevirtual

Implements ZDC::IZdcAnalysisTool.

Definition at line 327 of file LISAnalysisTool.cxx.

327 {
328 if (!m_init) {
329 ATH_MSG_WARNING("Tool not initialized!");
330 return StatusCode::FAILURE;
331 }
332
333 ATH_MSG_DEBUG("Trying to retrieve " << m_zdcModuleContainerName);
334
335 m_zdcModules = nullptr;
337
338 m_zdcSums = nullptr;
340
342
343 return StatusCode::SUCCESS;
344}
const xAOD::ZdcModuleContainer * m_zdcSums
const xAOD::ZdcModuleContainer * m_zdcModules
StatusCode recoZdcModules(xAOD::ZdcModuleContainer const &moduleContainer, xAOD::ZdcModuleContainer const &moduleSumContainer) override

◆ setFADCCorrections()

void ZDC::LISAnalysisTool::setFADCCorrections ( unsigned int runNumber)
private

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_auxSuffix

Gaudi::Property<std::string> ZDC::LISAnalysisTool::m_auxSuffix {this, "AuxSuffix", "", "Suffix for aux data names"}
private

Definition at line 75 of file LISAnalysisTool.h.

75{this, "AuxSuffix", "", "Suffix for aux data names"};

◆ m_calreqNames

const std::vector<std::string> ZDC::LISAnalysisTool::m_calreqNames = {"CalReq1", "CalReq2", "CalReq3"}
private

Definition at line 83 of file LISAnalysisTool.h.

83{"CalReq1", "CalReq2", "CalReq3"};

◆ m_configuration

Gaudi::Property<std::string> ZDC::LISAnalysisTool::m_configuration {this, "Configuration", "default", "Which config to use"}
private

Definition at line 73 of file LISAnalysisTool.h.

73{this, "Configuration", "default", "Which config to use"};

◆ m_DAQModeKey

SG::ReadDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_DAQModeKey {this, "ZdcDAQModeKey", "", "ZDC DAQ mode"}
private

Definition at line 103 of file LISAnalysisTool.h.

103{this, "ZdcDAQModeKey", "", "ZDC DAQ mode"};

◆ m_deltaTSample

float ZDC::LISAnalysisTool::m_deltaTSample {3.125}
private

Definition at line 88 of file LISAnalysisTool.h.

88{3.125}; // ns per sample

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doFADCCorr

bool ZDC::LISAnalysisTool::m_doFADCCorr {}
private

Definition at line 113 of file LISAnalysisTool.h.

113{};

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> ZDC::LISAnalysisTool::m_eventInfoKey {this, "EventInfoKey", "EventInfo", "Location of the event info"}
private

Definition at line 100 of file LISAnalysisTool.h.

100{this, "EventInfoKey", "EventInfo", "Location of the event info"};

◆ m_eventTypeKey

SG::ReadDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_eventTypeKey {this, "ZdcEventTypeKey", "", "ZDC Event type"}
private

Definition at line 101 of file LISAnalysisTool.h.

101{this, "ZdcEventTypeKey", "", "ZDC Event type"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_init

bool ZDC::LISAnalysisTool::m_init {false}
private

Definition at line 69 of file LISAnalysisTool.h.

69{false};

◆ m_LEDBCID

std::vector<unsigned int> ZDC::LISAnalysisTool::m_LEDBCID
private

Definition at line 80 of file LISAnalysisTool.h.

◆ m_LEDCalreqIdx

std::vector<unsigned int> ZDC::LISAnalysisTool::m_LEDCalreqIdx
private

Definition at line 79 of file LISAnalysisTool.h.

◆ m_LEDNames

const std::vector<std::string> ZDC::LISAnalysisTool::m_LEDNames = {"Blue1", "Green", "Blue2"}
private

Definition at line 82 of file LISAnalysisTool.h.

82{"Blue1", "Green", "Blue2"};

◆ m_LISADCSum

SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_LISADCSum {this, "LISADCSum", "", "LIS pulse FADC sum"}
private

Definition at line 108 of file LISAnalysisTool.h.

108{this, "LISADCSum", "", "LIS pulse FADC sum"};

◆ m_LISAvgTime

SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_LISAvgTime {this, "LISAvgTime", "", "LIS average time"}
private

Definition at line 111 of file LISAnalysisTool.h.

111{this, "LISAvgTime", "", "LIS average time"};

◆ m_LISMaxADC

SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_LISMaxADC {this, "LISMaxADC", "", "LIS pulse max FADC value"}
private

Definition at line 109 of file LISAnalysisTool.h.

109{this, "LISMaxADC", "", "LIS pulse max FADC value"};

◆ m_LISMaxSample

SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_LISMaxSample {this, "LISMaxSample", "", "LIS max FADC sample"}
private

Definition at line 110 of file LISAnalysisTool.h.

110{this, "LISMaxSample", "", "LIS max FADC sample"};

◆ m_LISPresampleADC

SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_LISPresampleADC {this, "LISPresampleADC", "", "LIS presample ADC"}
private

Definition at line 107 of file LISAnalysisTool.h.

107{this, "LISPresampleADC", "", "LIS presample ADC"};

◆ m_name

std::string ZDC::LISAnalysisTool::m_name
private

Definition at line 70 of file LISAnalysisTool.h.

◆ m_nBaselineEnd

Gaudi::Property<unsigned int> ZDC::LISAnalysisTool::m_nBaselineEnd {this, "BaselineEnd", 5, "End index for baseline calculation"}
private

Definition at line 77 of file LISAnalysisTool.h.

77{this, "BaselineEnd", 5, "End index for baseline calculation"};

◆ m_nBaselineSamples

unsigned int ZDC::LISAnalysisTool::m_nBaselineSamples {5}
private

Definition at line 91 of file LISAnalysisTool.h.

91{5}; // default to 5 samples for baseline calculation

◆ m_nBaselineStart

Gaudi::Property<unsigned int> ZDC::LISAnalysisTool::m_nBaselineStart {this, "BaselineStart", 0, "Start index for baseline calculation"}
private

Definition at line 76 of file LISAnalysisTool.h.

76{this, "BaselineStart", 0, "Start index for baseline calculation"};

◆ m_numSamples

unsigned int ZDC::LISAnalysisTool::m_numSamples {24}
private

Definition at line 86 of file LISAnalysisTool.h.

86{24};

◆ m_preSample

unsigned int ZDC::LISAnalysisTool::m_preSample {0}
private

Definition at line 87 of file LISAnalysisTool.h.

87{0};

◆ m_robBCIDKey

SG::ReadDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_robBCIDKey {this, "ROBBCIDKey", "", "BCID from LUCROD ROB headers"}
private

Definition at line 102 of file LISAnalysisTool.h.

102{this, "ROBBCIDKey", "", "BCID from LUCROD ROB headers"};

◆ m_sampleAnaEnd

unsigned int ZDC::LISAnalysisTool::m_sampleAnaEnd {23}
private

Definition at line 90 of file LISAnalysisTool.h.

90{23};

◆ m_sampleAnaStart

unsigned int ZDC::LISAnalysisTool::m_sampleAnaStart {5}
private

Definition at line 89 of file LISAnalysisTool.h.

89{5};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeAux

Gaudi::Property<bool> ZDC::LISAnalysisTool::m_writeAux {this, "WriteAux", true, "Write auxiliary data"}
private

Definition at line 74 of file LISAnalysisTool.h.

74{this, "WriteAux", true, "Write auxiliary data"};

◆ m_ZdcLEDType

SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> ZDC::LISAnalysisTool::m_ZdcLEDType {this, "ZdcLEDType", "", "ZDC LED Type (0-Blue1, 1-Green, 2-Blue2}"}
private

Definition at line 106 of file LISAnalysisTool.h.

106{this, "ZdcLEDType", "", "ZDC LED Type (0-Blue1, 1-Green, 2-Blue2}"};

◆ m_zdcModuleContainerName

Gaudi::Property<std::string> ZDC::LISAnalysisTool::m_zdcModuleContainerName {this, "ZdcModuleContainerName", "ZdcModules", "Location of ZDC processed data"}
private

Definition at line 94 of file LISAnalysisTool.h.

94{this, "ZdcModuleContainerName", "ZdcModules", "Location of ZDC processed data"};

◆ m_zdcModules

const xAOD::ZdcModuleContainer* ZDC::LISAnalysisTool::m_zdcModules {nullptr}
private

Definition at line 96 of file LISAnalysisTool.h.

96{nullptr};

◆ m_zdcSumContainerName

Gaudi::Property<std::string> ZDC::LISAnalysisTool::m_zdcSumContainerName {this, "ZdcSumContainerName", "ZdcSums", "Location of ZDC processed sums"}
private

Definition at line 95 of file LISAnalysisTool.h.

95{this, "ZdcSumContainerName", "ZdcSums", "Location of ZDC processed sums"};

◆ m_zdcSums

const xAOD::ZdcModuleContainer* ZDC::LISAnalysisTool::m_zdcSums {nullptr}
private

Definition at line 97 of file LISAnalysisTool.h.

97{nullptr};

The documentation for this class was generated from the following files: