ATLAS Offline Software
RPDAnalysisTool.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_RPDANALYSISTOOL_H
6 #define ZDCANALYSIS_RPDANALYSISTOOL_H
7 
9 #include "AsgTools/AsgTool.h"
10 #include "AsgTools/AsgToolMacros.h"
11 
15 
16 namespace ZDC {
17 
20  public:
21  explicit RPDAnalysisTool(std::string const& name);
22  ~RPDAnalysisTool() override = default;
23 
24  // this tool should never be copied or moved
25  RPDAnalysisTool(RPDAnalysisTool const&) = delete;
29 
30  StatusCode initialize() override;
31 
32  private:
33  StatusCode recoZdcModules(xAOD::ZdcModuleContainer const& moduleContainer, xAOD::ZdcModuleContainer const& moduleSumContainer) override;
34  StatusCode reprocessZdc() override;
35 
36  // reconstruction steps
37  void reset();
38  void readAOD(xAOD::ZdcModuleContainer const& moduleContainer);
39  void analyze();
40  void writeAOD(xAOD::ZdcModuleContainer const& moduleContainer, xAOD::ZdcModuleContainer const& moduleSumContainer) const;
41 
42  StatusCode initializeWriteKey(std::string const& containerName, SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> & writeHandleKey, std::string const& key);
43  ZDCMsg::MessageFunctionPtr MakeMessageFunction();
44 
45  bool m_initialized = false;
46  // tool properties to be configured in Python
47  std::string m_configuration;
48  bool m_writeAux;
49  std::string m_auxSuffix;
51  std::string m_ZDCSumContainerName;
52  // these are optional and null by default; if their values are set, they will overwrite the bulk configuration from config string
53  RPDUtils::OptionalToolProperty<unsigned int> m_forceNSamples; // total number of FADC samples in readout window
54  RPDUtils::OptionalToolProperty<unsigned int> m_forceNBaselineSamples; // number of baseline samples; the sample equal to this number is the start of signal region
55  RPDUtils::OptionalToolProperty<unsigned int> m_forceEndSignalSample; // samples before (not including) this sample are the signal region; 0 or Nsamples goes to end of window
56  RPDUtils::OptionalToolProperty<float> m_forcePulse2ndDerivThresh; // second differences less than or equal to this number indicate a pulse
57  RPDUtils::OptionalToolProperty<float> m_forcePostPulseFracThresh; // if there is a good pulse and post-pulse and size of post-pulse as a fraction of good pulse is less than or equal to this number, ignore post-pulse
58  RPDUtils::OptionalToolProperty<unsigned int> m_forceGoodPulseSampleStart; // pulses before this sample are considered pre-pulses
59  RPDUtils::OptionalToolProperty<unsigned int> m_forceGoodPulseSampleStop; // pulses after this sample are considered post-pulses
60  RPDUtils::OptionalToolProperty<float> m_forceNominalBaseline; // the global nominal baseline; used when pileup is detected
61  RPDUtils::OptionalToolProperty<float> m_forcePileupBaselineSumThresh; // baseline sum (after subtracting nominal baseline) less than this number indicates there is NO pileup
62  RPDUtils::OptionalToolProperty<float> m_forcePileupBaselineStdDevThresh; // baseline standard deviations less than this number indicate there is NO pileup
63  RPDUtils::OptionalToolProperty<unsigned int> m_forceNNegativesAllowed; // maximum number of negative ADC values after baseline and pileup subtraction allowed in signal range
64  RPDUtils::OptionalToolProperty<unsigned int> m_forceADCOverflow; // ADC values greater than or equal to this number are considered overflow
65  std::array<RPDUtils::OptionalToolProperty<std::vector<float>>, 2> m_forceOutputCalibFactors; // multiplicative calibration factors to apply to RPD output, e.g., sum/max ADC, per channel, per side
66 
67  // one for each side
68  std::array<std::unique_ptr<RPDDataAnalyzer>, 2> m_dataAnalyzers;
69 
70  // read/write handles
71  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chBaselineKey {this, "RPDChannelBaseline", "", "RPD channel baseline"};
72  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupExpFitParamsKey {this, "RPDChannelPileupExpFitParams", "", "RPD channel pileup exponential fit parameters: exp( [0] + [1]*sample )"};
73  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupStretchedExpFitParamsKey {this, "RPDChannelPileupStretchedExpFitParams", "", "RPD channel pileup stretched exponential fit parameters: exp( [0] + [1]*(sample + 4)**0.5 + [2]*(sample + 4)**-0.5 )"};
74  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupExpFitParamErrsKey {this, "RPDChannelPileupExpFitParamErrs", "", "RPD channel pileup exponential fit parameter errors"};
75  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupStretchedExpFitParamErrsKey {this, "RPDChannelPileupStretchedExpFitParamErrs", "", "RPD channel pileup stretched exponential fit parameter errors"};
76  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupExpFitMSEKey {this, "RPDChannelPileupExpFitMSE", "", "RPD Channel pileup exponential fit mean squared error in baseline samples"};
77  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupStretchedExpFitMSEKey {this, "RPDChannelPileupStretchedExpFitMSE", "", "RPD channel pileup stretched exponential fit mean squared error in baseline samples"};
78  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chAmplitudeKey {this, "RPDChannelAmplitude", "", "RPD channel sum ADC (baseline and pileup subtracted)"};
79  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chAmplitudeCalibKey {this, "RPDChannelAmplitudeCalib", "", "RPD channel sum ADC (baseline and pileup subtracted) with output calibration factors applied"};
80  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chMaxADCKey {this, "RPDChannelMaxADC", "", "RPD channel max ADC (baseline and pileup subtracted)"};
81  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chMaxADCCalibKey {this, "RPDChannelMaxADCCalib", "", "RPD channel max ADC (baseline and pileup subtracted) with output calibration factors applied"};
82  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chMaxSampleKey {this, "RPDChannelMaxSample", "", "RPD channel max sample"};
83  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chStatusKey {this, "RPDChannelStatus", "", "RPD channel status"};
84  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_chPileupFracKey {this, "RPDChannelPileupFrac", "", "RPD channel pileup as fraction of total (nominal baseline-subtracted) sum ADC"};
85 
86  SG::WriteDecorHandleKey<xAOD::ZdcModuleContainer> m_sideStatusKey {this, "ZdcSumRPDStatus", "", "RPD side level status"};
87 
88  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {this, "EventInfoKey", "EventInfo", "Location of the event info."};
89 };
90 
91 } // namespace ZDC
92 
93 #endif
ZDC::RPDAnalysisTool::m_auxSuffix
std::string m_auxSuffix
Definition: RPDAnalysisTool.h:49
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
ZDC::RPDAnalysisTool::m_forceOutputCalibFactors
std::array< RPDUtils::OptionalToolProperty< std::vector< float > >, 2 > m_forceOutputCalibFactors
Definition: RPDAnalysisTool.h:65
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
ZDC::RPDAnalysisTool::m_configuration
std::string m_configuration
Definition: RPDAnalysisTool.h:47
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
ZDC::RPDAnalysisTool::m_forceGoodPulseSampleStart
RPDUtils::OptionalToolProperty< unsigned int > m_forceGoodPulseSampleStart
Definition: RPDAnalysisTool.h:58
initialize
void initialize()
Definition: run_EoverP.cxx:894
ZDC::RPDAnalysisTool
Definition: RPDAnalysisTool.h:18
IZdcAnalysisTool.h
SG::ReadHandleKey< xAOD::EventInfo >
vmem-sz.analyze
def analyze(libname)
Definition: vmem-sz.py:47
ZDC::RPDAnalysisTool::m_writeAux
bool m_writeAux
Definition: RPDAnalysisTool.h:48
ZDC::RPDAnalysisTool::m_forceNSamples
RPDUtils::OptionalToolProperty< unsigned int > m_forceNSamples
Definition: RPDAnalysisTool.h:53
RPDUtils::OptionalToolProperty< unsigned int >
ZDC::IZdcAnalysisTool
Definition: IZdcAnalysisTool.h:15
ZDC::RPDAnalysisTool::m_forcePulse2ndDerivThresh
RPDUtils::OptionalToolProperty< float > m_forcePulse2ndDerivThresh
Definition: RPDAnalysisTool.h:56
ZDC::RPDAnalysisTool::m_ZDCSumContainerName
std::string m_ZDCSumContainerName
Definition: RPDAnalysisTool.h:51
ZDC::RPDAnalysisTool::~RPDAnalysisTool
~RPDAnalysisTool() override=default
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ZDC::RPDAnalysisTool::m_ZDCModuleContainerName
std::string m_ZDCModuleContainerName
Definition: RPDAnalysisTool.h:50
ZDC::RPDAnalysisTool::m_forcePostPulseFracThresh
RPDUtils::OptionalToolProperty< float > m_forcePostPulseFracThresh
Definition: RPDAnalysisTool.h:57
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ZDC::RPDAnalysisTool::operator=
RPDAnalysisTool & operator=(RPDAnalysisTool const &)=delete
ZDC::RPDAnalysisTool::m_forceNominalBaseline
RPDUtils::OptionalToolProperty< float > m_forceNominalBaseline
Definition: RPDAnalysisTool.h:60
ZDC::RPDAnalysisTool::m_forcePileupBaselineSumThresh
RPDUtils::OptionalToolProperty< float > m_forcePileupBaselineSumThresh
Definition: RPDAnalysisTool.h:61
ZDC::RPDAnalysisTool::m_forcePileupBaselineStdDevThresh
RPDUtils::OptionalToolProperty< float > m_forcePileupBaselineStdDevThresh
Definition: RPDAnalysisTool.h:62
ZDC::RPDAnalysisTool::m_dataAnalyzers
std::array< std::unique_ptr< RPDDataAnalyzer >, 2 > m_dataAnalyzers
Definition: RPDAnalysisTool.h:68
ZDC::RPDAnalysisTool::operator=
RPDAnalysisTool & operator=(RPDAnalysisTool &&)=delete
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ZDC::RPDAnalysisTool::m_forceEndSignalSample
RPDUtils::OptionalToolProperty< unsigned int > m_forceEndSignalSample
Definition: RPDAnalysisTool.h:55
ZDCMsg::MessageFunctionPtr
std::shared_ptr< MessageFunction > MessageFunctionPtr
Definition: ZDCMsg.h:14
RPDDataAnalyzer.h
EventInfo.h
ZDC::RPDAnalysisTool::RPDAnalysisTool
RPDAnalysisTool(RPDAnalysisTool const &)=delete
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
ZDC
Definition: RPDAnalysisTool.cxx:12
CxxUtils::reset
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
Definition: bitmask.h:251
ZDC::RPDAnalysisTool::RPDAnalysisTool
RPDAnalysisTool(RPDAnalysisTool &&)=delete
AsgToolMacros.h
ZDC::RPDAnalysisTool::m_forceNNegativesAllowed
RPDUtils::OptionalToolProperty< unsigned int > m_forceNNegativesAllowed
Definition: RPDAnalysisTool.h:63
ZDC::RPDAnalysisTool::m_forceGoodPulseSampleStop
RPDUtils::OptionalToolProperty< unsigned int > m_forceGoodPulseSampleStop
Definition: RPDAnalysisTool.h:59
AsgTool.h
checker_macros.h
Define macros for attributes used to control the static checker.
ZDC::RPDAnalysisTool::m_forceNBaselineSamples
RPDUtils::OptionalToolProperty< unsigned int > m_forceNBaselineSamples
Definition: RPDAnalysisTool.h:54
ZDC::RPDAnalysisTool::m_forceADCOverflow
RPDUtils::OptionalToolProperty< unsigned int > m_forceADCOverflow
Definition: RPDAnalysisTool.h:64
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37