ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcLEDAnalysisTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ZDCANALYSIS_ZDCLEDANALYSISTOOL_H
6#define ZDCANALYSIS_ZDCLEDANALYSISTOOL_H
7
8#include "AsgTools/AsgTool.h"
14
17
19#include "ZdcAnalysis/ZDCMsg.h"
20#include <TH1.h>
21#include <array>
22
23namespace ZDC
24{
25
27{
28 unsigned int m_presampleADC{};
29 int m_ADCsum{};
30 int m_maxADC{};
31 unsigned int m_maxSample{};
32 float m_avgTime{};
33
34public:
35 ZDCLEDModuleResults(unsigned int presampleADC, unsigned int ADCsum, unsigned int maxADC, unsigned int maxSample, float avgTime) :
36 m_presampleADC(presampleADC),
37 m_ADCsum(ADCsum),
38 m_maxADC(maxADC),
39 m_maxSample(maxSample),
40 m_avgTime(avgTime)
41 {}
42
45 m_ADCsum(0),
46 m_maxADC(0),
47 m_maxSample(0),
48 m_avgTime(0)
49 {}
50
51 unsigned int getPresampleADC() const {return m_presampleADC;}
52 int getADCSum() const {return m_ADCsum;}
53 int getMaxADC() const {return m_maxADC;}
54 unsigned int getMaxSample() const {return m_maxSample;}
55 float getAvgTime() const {return m_avgTime;}
56
57};
58
60{
61
63
64public:
65 ZdcLEDAnalysisTool(const std::string& name);
66 virtual ~ZdcLEDAnalysisTool() override;
67
68 //interface from AsgTool
69 StatusCode initialize() override;
70
71 StatusCode recoZdcModules(const xAOD::ZdcModuleContainer& moduleContainer, const xAOD::ZdcModuleContainer& moduleSumContainer) override;
72 StatusCode reprocessZdc() override;
73
75 {
76 std::function<bool(int, std::string)> msgFunction = [this](int messageZdcLevel, const std::string& message)-> bool
77 {
78 MSG::Level messageAthenaLevel = static_cast<MSG::Level>(messageZdcLevel);
79 bool passesStreamOutputLevel = messageAthenaLevel >= this->msg().level();
80 if (passesStreamOutputLevel) {
81 this->msg(messageAthenaLevel) << message << endmsg;
82 }
83 return passesStreamOutputLevel;
84 };
85
87 }
88
89private:
90
91 // Provide methods
92 //
93 void initialize_ppPbPb2023();
94 void initialize_ppALFA2023();
95 void initialize_zdcStandalone();
96
97 ZDCLEDModuleResults processZDCModule(const xAOD::ZdcModule& module);
98 ZDCLEDModuleResults processRPDModule(const xAOD::ZdcModule& module);
99 ZDCLEDModuleResults processModuleData(int iside, int imod, const std::vector<unsigned short>& data,
100 unsigned int startSample, unsigned int endSample, float gainScale);
101
102 bool m_init{false};
103
104 // Job properties
105 //
106 std::string m_name;
107 Gaudi::Property<std::string> m_configuration{this, "Configuration", "ppPbPb2023", "Which config files to use"};
108 bool m_writeAux{false};
109
110 Gaudi::Property<std::string> m_auxSuffix{this, "AuxSuffix", "", "Append this tag onto end of AuxData"};
111
112 // Configuration settings based on mConfiguration
113 //
114 Gaudi::Property<bool> m_doRPD{this, "doRPD", true, "Process RPD Data?"};
115 Gaudi::Property<bool> m_doZDC{this, "doZDC", true, "Process ZDC Data?"};
116
117 // Configuration for LED identification
118 //
119 std::vector<unsigned int> m_LEDCalreqIdx;
120 std::vector<unsigned int> m_LEDBCID;
121
122 const std::vector<std::string> m_LEDNames = {"Blue1", "Green", "Blue2"};
123 const std::vector<std::string> m_calreqNames = {"CalReq1", "CalReq2", "CalReq3"};
124
125 unsigned int m_HGADCOverflow{4095};
126 unsigned int m_numSamples{24};
127 unsigned int m_preSample{0};
128 float m_deltaTSample{3.125};
129 unsigned int m_sampleAnaStartZDC{0};
130 unsigned int m_sampleAnaEndZDC{23};
131 unsigned int m_sampleAnaStartRPD{0};
132 unsigned int m_sampleAnaEndRPD{23};
133
135
136 // Module container names
137 //
138 Gaudi::Property<std::string> m_zdcModuleContainerName {this, "ZdcModuleContainerName", "ZdcModules", "Location of ZDC processed data"};
140 Gaudi::Property<std::string> m_zdcSumContainerName {this, "ZdcSumContainerName", "ZdcSums", "Location of ZDC processed sums"};
142
143 // Storegate keys
144 //
146 this, "EventInfoKey", "EventInfo", "Location of the event info."};
147
149 this, "ZdcEventTypeKey", "", "ZDC Event type"};
150
152 this, "ROBBCIDKey", "", "BCID from LUCROD ROB headers"};
153
155 this, "ZdcDAQModeKey", "", "ZDC DAQ mode"};
156
157 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDType{this, "ZdcLEDType", "", "ZDC LED Type (0-Blue1, 1-Green, 2-Blue2}"};
158 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDPresampleADC{this, "ZdcLEDPresampleADC", "", "ZDC LED presample"};
159 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDADCSum{this, "ZdcLEDADCSum", "", "ZDC LED pulse FADC sum"};
160 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDMaxADC{this, "ZdcLEDMaxADC", "", "ZDC LED pulse max FADC value"};
161 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDMaxSample{this, "ZdcLEDMaxSample", "", "ZDC LED max FADC sample"};
162 SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_ZdcLEDAvgTime{this, "ZdcLEDAvgTime", "", "ZDC LED average time"};
163
164 // Provide a historam that provides per-ADC channel correction factors for integral and differential
165 // non-linearities
166 //
168 unsigned int m_runNumber{};
170 std::array< std::array<std::unique_ptr<const TH1>,4>,2> m_FADCCorrHG;
171 std::array< std::array<std::unique_ptr<const TH1>,4>,2> m_FADCCorrLG;
172 double getAmplitudeCorrection(int iside, int imod, bool highGain, float fitAmp);
173 void setFADCCorrections(unsigned int runNumber);
174
175};
176
177} // namespace ZDC
178
179#endif
180
181
182
183
#define endmsg
#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.
ZDCLEDModuleResults(unsigned int presampleADC, unsigned int ADCsum, unsigned int maxADC, unsigned int maxSample, float avgTime)
unsigned int getMaxSample() const
unsigned int getPresampleADC() const
Gaudi::Property< std::string > m_auxSuffix
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDADCSum
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDMaxADC
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDAvgTime
double getAmplitudeCorrection(int iside, int imod, bool highGain, float fitAmp)
const xAOD::ZdcModuleContainer * m_zdcModules
Gaudi::Property< bool > m_doZDC
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< bool > m_doRPD
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDMaxSample
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDType
std::array< std::array< std::unique_ptr< const TH1 >, 4 >, 2 > m_FADCCorrLG
std::array< std::array< std::unique_ptr< const TH1 >, 4 >, 2 > m_FADCCorrHG
void setFADCCorrections(unsigned int runNumber)
StatusCode reprocessZdc() override
ZdcLEDAnalysisTool(const std::string &name)
StatusCode recoZdcModules(const xAOD::ZdcModuleContainer &moduleContainer, const xAOD::ZdcModuleContainer &moduleSumContainer) override
const std::vector< std::string > m_LEDNames
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_eventTypeKey
Gaudi::Property< std::string > m_zdcSumContainerName
const xAOD::ZdcModuleContainer * m_zdcSums
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_DAQModeKey
std::vector< unsigned int > m_LEDCalreqIdx
SG::ReadDecorHandleKey< xAOD::ZdcModuleContainer > m_robBCIDKey
Gaudi::Property< std::string > m_zdcModuleContainerName
SG::WriteDecorHandleKey< xAOD::ZdcModuleContainer > m_ZdcLEDPresampleADC
const std::vector< std::string > m_calreqNames
ZDCMsg::MessageFunctionPtr MakeMessageFunction()
Gaudi::Property< std::string > m_configuration
std::vector< unsigned int > m_LEDBCID
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
std::function< bool(int, std::string)> MessageFunction
Definition ZDCMsg.h:12
std::shared_ptr< MessageFunction > MessageFunctionPtr
Definition ZDCMsg.h:14
ZdcModuleContainer_v1 ZdcModuleContainer
ZdcModule_v1 ZdcModule
Definition ZdcModule.h:15
void initialize()
MsgStream & msg
Definition testRead.cxx:32