ATLAS Offline Software
Loading...
Searching...
No Matches
LISAnalysisTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ZDCANALYSIS_LISANALYSISTOOL_H
6#define ZDCANALYSIS_LISANALYSISTOOL_H
7
9#include "AsgTools/AsgTool.h"
15
19#include "TH1.h"
20
21#include <array>
22#include <memory>
23#include <vector>
24#include <string>
25namespace ZDC {
26
27// Bit definitions for LIS module status mask
29 LIS_ValidData , // Bit 0: Good Pulse Bit
30 LIS_BadBit , // Bit 1: Generic bad bit (set if any specific issue bits are set)
31 LIS_HighPedestal , // Bit 2: Presumple significantly higher then nominal pedestal
32 LIS_EarlyPulse , // Bit 3: Max sample precedes nominal pulse window
33 LIS_LatePulse , // Bit 4: Max sample follows nominal pulse window
34 LIS_Overflow , // Bit 5: Overflow in any sample
36};
37
38// Results class to hold processed LIS waveform quantities
40 unsigned int m_presampleADC{};
41 int m_ADCsum{};
42 int m_maxADC{};
43 unsigned int m_maxSample{};
44 float m_avgTime{};
45 unsigned int m_moduleStatus{};
46
47
48public:
49 LISModuleResults(float presampleADC, int ADCsum, int maxADC, unsigned int maxSample, float avgTime, unsigned int moduleStatus) :
50 m_presampleADC(presampleADC),
51 m_ADCsum(ADCsum),
52 m_maxADC(maxADC),
53 m_maxSample(maxSample),
54 m_avgTime(avgTime),
55 m_moduleStatus(moduleStatus)
56
57 {}
58
59 LISModuleResults() = default;
60
61 unsigned int getPresampleADC() const { return m_presampleADC; }
62 int getADCSum() const { return m_ADCsum; }
63 int getMaxADC() const { return m_maxADC; }
64 unsigned int getMaxSample() const { return m_maxSample; }
65 float getAvgTime() const { return m_avgTime; }
66 unsigned int getmoduleStatus() const { return m_moduleStatus; }
67};
68
71
72public:
73 explicit LISAnalysisTool(std::string const& name);
74 virtual ~LISAnalysisTool() override = default;
75
76 StatusCode initialize() override;
77 StatusCode recoZdcModules(xAOD::ZdcModuleContainer const& moduleContainer, xAOD::ZdcModuleContainer const& moduleSumContainer) override;
78 StatusCode reprocessZdc() override;
79
80private:
81 // Configuration initialization methods
82 void initialize_default();
83
84 // Processing methods
85 LISModuleResults processLISModule(const xAOD::ZdcModule& module, unsigned int lumiBlock);
86 LISModuleResults processModuleData(int side, int channel,
87 const std::vector<unsigned short>& data,
88 unsigned int startSample, unsigned int endSample,
89 unsigned int lumiBlock);
90
91 // Utility method to set a bit in the status word
92 void setStatusBit(unsigned int& statusWord, unsigned int bitIndex);
93 bool CheckStatusBit(unsigned int statusWord, unsigned int bitIndex) { return (statusWord & (1 << bitIndex)) != 0; }
94 StatusCode SetPedestals(unsigned int runNumber);
95 float GetPedestal(int channel, unsigned int lumiBlock);
96
97 bool m_init{false};
98 bool m_MominalPedestals{false};
99 std::string m_name;
100 unsigned int m_runNumber{0};
101 const int m_nLISChannels = 8;
102 const int m_nSamples = 24;
103
104 const int m_ADCSaturationValue = 3800; // Assuming 12-bit ADC saturation at 4095
105
106 // Job properties
107 Gaudi::Property<std::string> m_configuration{this, "Configuration", "default", "Which config to use"};
108 Gaudi::Property<bool> m_writeAux{this, "WriteAux", true, "Write auxiliary data"};
109 Gaudi::Property<std::string> m_auxSuffix{this, "AuxSuffix", "", "Suffix for aux data names"};
110 Gaudi::Property<unsigned int> m_nBaselineStart{this, "BaselineStart", 0, "Start index for baseline calculation"};
111 Gaudi::Property<unsigned int> m_nBaselineEnd{this, "BaselineEnd", 5, "End index for baseline calculation"};
112 Gaudi::Property<unsigned int> m_nPulsStart{this, "PulseStart", 6, "Start index for pulse analysis"}; // May change after looking at pulse shapes more
113 Gaudi::Property<unsigned int> m_nPulsEnd{this, "PulseEnd", 12, "End index for pulse analysis"}; // May change after looking at pulse shapes more
114 Gaudi::Property<std::vector<float>> m_channelPedestals{this, "ChannelPedestals",
115 {100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0 },
116 "Per-channel pedestal values to subtract from ADCs"}; // May change after looking at pulse shapes more
117
118 std::vector<unsigned int> m_LEDCalreqIdx;
119 std::vector<unsigned int> m_LEDBCID;
120
121 const std::vector<std::string> m_LEDNames = {"Blue1", "Green", "Blue2"};
122 const std::vector<std::string> m_calreqNames = {"CalReq1", "CalReq2", "CalReq3"};
123
124 // Configuration settings
125 unsigned int m_numSamples{24};
126 unsigned int m_preSample{0};
127 float m_deltaTSample{3.125}; // ns per sample
128 unsigned int m_sampleAnaStart{5};
129 unsigned int m_sampleAnaEnd{23};
130 unsigned int m_nBaselineSamples{5}; // default to 5 samples for baseline calculation
131
132 // Module container names
133 Gaudi::Property<std::string> m_zdcModuleContainerName{this, "ZdcModuleContainerName", "ZdcModules", "Location of ZDC processed data"};
134 Gaudi::Property<std::string> m_zdcSumContainerName{this, "ZdcSumContainerName", "ZdcSums", "Location of ZDC processed sums"};
137
138 // Read handles
139 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo", "Location of the event info"};
140 SG::ReadDecorHandleKey<xAOD::ZdcModuleContainer> m_eventTypeKey{this, "ZdcEventTypeKey", "", "ZDC Event type"};
141 SG::ReadDecorHandleKey<xAOD::ZdcModuleContainer> m_robBCIDKey {this, "ROBBCIDKey", "", "BCID from LUCROD ROB headers"};
142 SG::ReadDecorHandleKey<xAOD::ZdcModuleContainer> m_DAQModeKey{this, "ZdcDAQModeKey", "", "ZDC DAQ mode"};
143
144 // Write decoration handles for LIS-specific outputs
145 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDType{this, "ZdcLEDType", "", "ZDC LED Type (0-Blue1, 1-Green, 2-Blue2}"};
146 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_LISPresampleADC{this, "LISPresampleADC", "", "LIS presample ADC"};
147 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_LISADCSum{this, "LISADCSum", "", "LIS pulse FADC sum"};
148 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_LISMaxADC{this, "LISMaxADC", "", "LIS pulse max FADC value"};
149 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_LISMaxSample{this, "LISMaxSample", "", "LIS max FADC sample"};
150 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_LISAvgTime{this, "LISAvgTime", "", "LIS average time"};
151 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_LISModuleStatus{this, "LISModuleStatus", "", "LIS module status"};
152
153 // Pedestal histograms (one per channel)
154 std::array<std::unique_ptr<TH1>, 8> m_LISPedestals;
155
157 double getAmplitudeCorrection(int iside, int imod, bool highGain, float fitAmp);
158 void setFADCCorrections(unsigned int runNumber);
159
160
161};
162
163} // namespace ZDC
164
165#endif // ZDCANALYSIS_LISANALYSISTOOL_H
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
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
const std::vector< std::string > m_LEDNames
LISAnalysisTool(std::string const &name)
Gaudi::Property< std::string > m_auxSuffix
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_robBCIDKey
unsigned int m_sampleAnaStart
Gaudi::Property< unsigned int > m_nPulsStart
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::vector< float > > m_channelPedestals
std::vector< unsigned int > m_LEDCalreqIdx
StatusCode reprocessZdc() override
std::vector< unsigned int > m_LEDBCID
double getAmplitudeCorrection(int iside, int imod, bool highGain, float fitAmp)
Gaudi::Property< std::string > m_configuration
unsigned int m_nBaselineSamples
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_DAQModeKey
LISModuleResults processLISModule(const xAOD::ZdcModule &module, unsigned int lumiBlock)
const xAOD::ZdcModuleContainer * m_zdcSums
Gaudi::Property< std::string > m_zdcModuleContainerName
void setFADCCorrections(unsigned int runNumber)
virtual ~LISAnalysisTool() override=default
Gaudi::Property< unsigned int > m_nPulsEnd
const xAOD::ZdcModuleContainer * m_zdcModules
void setStatusBit(unsigned int &statusWord, unsigned int bitIndex)
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISAvgTime
const std::vector< std::string > m_calreqNames
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_LISModuleStatus
Gaudi::Property< std::string > m_zdcSumContainerName
unsigned int m_sampleAnaEnd
bool CheckStatusBit(unsigned int statusWord, unsigned int bitIndex)
LISModuleResults processModuleData(int side, int channel, const std::vector< unsigned short > &data, unsigned int startSample, unsigned int endSample, unsigned int lumiBlock)
std::array< std::unique_ptr< TH1 >, 8 > m_LISPedestals
StatusCode recoZdcModules(xAOD::ZdcModuleContainer const &moduleContainer, xAOD::ZdcModuleContainer const &moduleSumContainer) override
LISModuleResults(float presampleADC, int ADCsum, int maxADC, unsigned int maxSample, float avgTime, unsigned int moduleStatus)
unsigned int m_presampleADC
unsigned int getPresampleADC() const
unsigned int getmoduleStatus() const
unsigned int getMaxSample() const
LISModuleResults()=default
unsigned int m_moduleStatus
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
LISModuleStatusBits
@ LIS_NumStatusBits
@ LIS_LatePulse
@ LIS_HighPedestal
@ LIS_Overflow
@ LIS_EarlyPulse
@ LIS_ValidData
ZdcModuleContainer_v1 ZdcModuleContainer
ZdcModule_v1 ZdcModule
Definition ZdcModule.h:15
void initialize()