ATLAS Offline Software
LArWFParamTool.h
Go to the documentation of this file.
1 //Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
8 #ifndef LARWFPARAMTOOL_H
9 #define LARWFPARAMTOOL_H
10 
12 
13 #include "GaudiKernel/ToolHandle.h"
14 
20 #include <optional>
21 
22 static const InterfaceID IID_LArWFParamTool("LArWFParamTool", 1 , 0);
23 
24 class LArOnlineID_Base;
25 class LArEM_ID;
26 class LArOnOffIdMapping;
27 
28 class LArWFParamTool : public AthAlgTool
29 {
30 
31 public:
32 
33  enum {
34  FailExtract = -999 ,
36  DefaultNotSet = 0
37  } ;
38 
39  // Retrieve interface ID
40  static const InterfaceID& interfaceID() { return IID_LArWFParamTool; }
41 
42  // constructor
43  LArWFParamTool(const std::string& type, const std::string& name, const IInterface* parent ) ;
44 
45  // destructor
46  virtual ~LArWFParamTool();
47 
48  virtual StatusCode initialize();
49  virtual StatusCode finalize(){return StatusCode::SUCCESS;}
50 
51  // this is supposed to be a quick test on cali waves, to flags those
52  // clearly problematic. but cuts must be tuned, so for the time being
53  // don't call this method!
54  //unsigned checkStatus(const LArCaliWave &larCaliWave) const ;
55 
56 
57  StatusCode getLArWaveParams(const LArCaliWave& larCaliWave,
58  const HWIdentifier chid,
60  LArWFParams& wfParams,
62  std::optional<LArCaliWave>& omegaScan,
63  std::optional<LArCaliWave>& resOscill0,
64  std::optional<LArCaliWave>& resOscill1
65  ) const;
66 
67 
68  enum { OK = 0 ,
69  TooShort = 1 ,
70  NotFilled = 2 ,
71  LowStat = 3 ,
72  Noisy = 4 ,
73  Oscillating = 5
74  } ;
75 
76 private:
77 
78  static const double m_DEFAULT;
79  static const double m_TINY;
80  static const double m_SQRT_EPSILON;
81  static const double m_EPSILON;
82 
83 
84  struct WaveTiming_t {
85  unsigned Tstart;
86  unsigned Tpeak;
87  unsigned Tcross;
88  unsigned Tmin;
89  //unsigned Ttail;
90  double Amplitude;
91  };
92 
93  const LArEM_Base_ID* m_emId = nullptr;
94  const LArOnlineID_Base* m_onlineHelper = nullptr;
95 
97 
98 
99  double m_Tshaper;
100 
101  std::vector<bool> m_cosRespScan ;
102  std::vector<double> m_omegamin;
103  std::vector<double> m_omegamax;
104  std::vector<unsigned> m_npoints ;
105 
106  //AlgTool properties:
107  std::vector<bool> m_storeResOscill;
108  unsigned int m_NBaseline;
112  bool m_isSC;
113  std::vector<int> m_TtailMin;
114  std::vector<int> m_TtailMax;
115  std::vector<int> m_DeltaTtail;
116 
117 
118  //Internal data structures
119  struct waveRange_t {
120  unsigned min;
121  unsigned max;
122  };
123 
126  double omegamin;
127  double omegamax;
128  int Npoint;
129  double DeltaOmega;
131  };
132 
133 
134  WaveTiming_t timeExtr(LArWave& gCali) const;
135  double expTail(const LArWave& gCali, const WaveTiming_t& wt) const;
136  StatusCode GetFstep(const LArWave& gCali, LArWFParams& wfParams, const WaveTiming_t& wt) const;
137  double fstepMin (const LArWave& gCali, double fstep, const double Tc, const unsigned Ttail) const;
138  double dFstep (const LArWave& gCali, const double fstep, const double Tc, const unsigned Ttail) const ;
139  static LArWave stepResp (const LArWave& gCali, const double fstep, const double Tc) ;
140  static LArWave stepCorr(const LArWave& gCali, const double& fstep, const double& Tc) ;
141  LArWave dstepRespDfstep (const LArWave& gCali, const double& fstep, const double& Tc) const ;
142  static double dstepCorrDfstep (const double t, const double& fstep, const double& Tc ) ;
143  static LArWave dstepCorrDfstep(const LArWave& gCali, const double& fstep, const double& Tcal ) ;
144  StatusCode RTM_Omega0(const LArWave& gCali, const HWIdentifier chid, LArWFParams& wfParams, const WaveTiming_t& wt, const LArOnOffIdMapping *cabling, std::optional<LArCaliWave>& omegaScan) const;
145  StatusCode RTM_Taur(const LArWave& gCali, LArWFParams& wfParams, const WaveTiming_t& wt) const;
146  double logChi2CosRespShaper (const double omega, const LArWave& gCali, const LArWFParams& wf, const waveRange_t& range) const;
147  double logChi2InjRespRes (const double taur, const LArWave& gCali, const LArWFParams& wf, const waveRange_t& range ) const ;
148  LArWave cosRespShaper (const LArWave& gCali, const double& fstep, const double& tcal, const double& w, const double& tsh ) const ;
149  static LArWave cosResp (const LArWave& gCali, const double& fstep, const double& tcal, const double& omega) ;
150  static LArWave injRespRes (const LArWave& w, const double omega0, const double taur) ;
151  static LArWave injCorr(const unsigned N, const double dt,const double omega0, const double taur) ;
152  double omega0MinNum (double omegaMin, double omegaMax, const double tol,const LArWave& gCali, const LArWFParams& wf, const waveRange_t&) const;
153  static LArWave cosCorr(const unsigned N, const double dt, const double fstep, const double tcal, const double omega) ;
154  double taurMinNum (const double taurmin, const double taurmax, const double tol, const LArWave& gCali, const LArWFParams& wf,const waveRange_t&) const;
155 
156  double fminbr(double a, double b, const double tol, double (LArWFParamTool::*f)(double, const LArWave&, const LArWFParams&, const waveRange_t&) const,
157  const LArWave& gCali, const LArWFParams& wf, const waveRange_t& range) const;
158 
159  unsigned checkStatus(const LArCaliWave &larCaliWave) const ;
160 
161  omegaScanParams_t OmegaScanHelper(const Identifier id, const WaveTiming_t& wt) const;
162 
163 
164 };
165 #endif
LArWave
Definition: LArWave.h:31
LArWFParamTool::cosCorr
static LArWave cosCorr(const unsigned N, const double dt, const double fstep, const double tcal, const double omega)
Definition: LArWFParamTool.cxx:737
LArWFParamTool::timeExtr
WaveTiming_t timeExtr(LArWave &gCali) const
Definition: LArWFParamTool.cxx:287
LArWFParamTool::WaveTiming_t::Tmin
unsigned Tmin
Definition: LArWFParamTool.h:88
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
LArWFParamTool::m_storeResOscill
std::vector< bool > m_storeResOscill
Definition: LArWFParamTool.h:107
LArWFParamTool::omega0MinNum
double omega0MinNum(double omegaMin, double omegaMax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
Definition: LArWFParamTool.cxx:801
LArWFParamTool::m_omegamin
std::vector< double > m_omegamin
Definition: LArWFParamTool.h:102
LArWFParamTool::injCorr
static LArWave injCorr(const unsigned N, const double dt, const double omega0, const double taur)
Definition: LArWFParamTool.cxx:765
LArWFParamTool::OK
@ OK
Definition: LArWFParamTool.h:68
LArEM_Base_ID
This class factors out code common between LArEM_ID and LArEM_SuperCell_ID.
Definition: LArEM_Base_ID.h:38
LArWFParamTool::waveRange_t::max
unsigned max
Definition: LArWFParamTool.h:121
LArWFParamTool::m_ShiftToStart
bool m_ShiftToStart
Definition: LArWFParamTool.h:109
LArWFParamTool::taurMinNum
double taurMinNum(const double taurmin, const double taurmax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
Definition: LArWFParamTool.cxx:810
LArWFParamTool::m_TtailMax
std::vector< int > m_TtailMax
Definition: LArWFParamTool.h:114
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArWFParamTool::stepCorr
static LArWave stepCorr(const LArWave &gCali, const double &fstep, const double &Tc)
Definition: LArWFParamTool.cxx:398
LArWFParamTool::dFstep
double dFstep(const LArWave &gCali, const double fstep, const double Tc, const unsigned Ttail) const
Definition: LArWFParamTool.cxx:376
LArWFParamTool::getLArWaveParams
StatusCode getLArWaveParams(const LArCaliWave &larCaliWave, const HWIdentifier chid, const CaloGain::CaloGain gain, LArWFParams &wfParams, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan, std::optional< LArCaliWave > &resOscill0, std::optional< LArCaliWave > &resOscill1) const
Definition: LArWFParamTool.cxx:197
LArWFParamTool::omegaScanParams_t::DeltaOmega
double DeltaOmega
Definition: LArWFParamTool.h:129
LArWFParamTool::dstepRespDfstep
LArWave dstepRespDfstep(const LArWave &gCali, const double &fstep, const double &Tc) const
Definition: LArWFParamTool.cxx:410
LArWFParamTool::NotFilled
@ NotFilled
Definition: LArWFParamTool.h:70
LArWaveHelper
Definition: LArWaveHelper.h:14
LArWFParamTool::stepResp
static LArWave stepResp(const LArWave &gCali, const double fstep, const double Tc)
Definition: LArWFParamTool.cxx:391
LArWFParamTool::omegaScanParams_t::omegamax
double omegamax
Definition: LArWFParamTool.h:127
LArWFParams
Definition: LArWFParams.h:20
LArWFParamTool::OmegaScanHelper
omegaScanParams_t OmegaScanHelper(const Identifier id, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:498
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
LArWFParamTool::m_omegamax
std::vector< double > m_omegamax
Definition: LArWFParamTool.h:103
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LArWFParamTool::omegaScanParams_t::Npoint
int Npoint
Definition: LArWFParamTool.h:128
LArWFParamTool::m_cosRespScan
std::vector< bool > m_cosRespScan
Definition: LArWFParamTool.h:101
HWIdentifier
Definition: HWIdentifier.h:13
LArWFParamTool::m_npoints
std::vector< unsigned > m_npoints
Definition: LArWFParamTool.h:104
LArCaliWave.h
LArWFParamTool::WaveTiming_t::Tcross
unsigned Tcross
Definition: LArWFParamTool.h:87
LArWFParamTool::injRespRes
static LArWave injRespRes(const LArWave &w, const double omega0, const double taur)
Definition: LArWFParamTool.cxx:761
LArWFParamTool::omegaScanParams_t::omegamin
double omegamin
Definition: LArWFParamTool.h:126
LArWFParamTool::Oscillating
@ Oscillating
Definition: LArWFParamTool.h:73
LArWFParamTool::FailExtract
@ FailExtract
Definition: LArWFParamTool.h:34
LArCaliWave
Definition: LArCaliWave.h:44
LArOnOffIdMapping.h
LArWFParamTool::m_SQRT_EPSILON
static const double m_SQRT_EPSILON
Definition: LArWFParamTool.h:80
LArWFParamTool::interfaceID
static const InterfaceID & interfaceID()
Definition: LArWFParamTool.h:40
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArWFParamTool::GetFstep
StatusCode GetFstep(const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:348
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
LArWFParamTool::cosRespShaper
LArWave cosRespShaper(const LArWave &gCali, const double &fstep, const double &tcal, const double &w, const double &tsh) const
Definition: LArWFParamTool.cxx:720
AthAlgTool.h
LArWFParamTool::WaveTiming_t::Tstart
unsigned Tstart
Definition: LArWFParamTool.h:85
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
LArWFParamTool::dstepCorrDfstep
static double dstepCorrDfstep(const double t, const double &fstep, const double &Tc)
Definition: LArWFParamTool.cxx:414
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LArWFParamTool::fminbr
double fminbr(double a, double b, const double tol, double(LArWFParamTool::*f)(double, const LArWave &, const LArWFParams &, const waveRange_t &) const, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
Definition: LArWFParamTool.cxx:868
LArWFParamTool::m_SubtractBaseline
bool m_SubtractBaseline
Definition: LArWFParamTool.h:110
LArWFParamTool::m_isSC
bool m_isSC
Definition: LArWFParamTool.h:112
LArWFParamTool::LArWFParamTool
LArWFParamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArWFParamTool.cxx:36
LArWFParamTool::fstepMin
double fstepMin(const LArWave &gCali, double fstep, const double Tc, const unsigned Ttail) const
Definition: LArWFParamTool.cxx:360
LArWFParamTool::omegaScanParams_t::range
waveRange_t range
Definition: LArWFParamTool.h:130
LArWFParamTool::logChi2CosRespShaper
double logChi2CosRespShaper(const double omega, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
Definition: LArWFParamTool.cxx:716
LArWFParamTool::WaveTiming_t
Definition: LArWFParamTool.h:84
LArWFParamTool::expTail
double expTail(const LArWave &gCali, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:315
LArWFParamTool::RTM_Taur
StatusCode RTM_Taur(const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:683
LArWFParamTool::m_EPSILON
static const double m_EPSILON
Definition: LArWFParamTool.h:81
LArWFParamTool
Definition: LArWFParamTool.h:29
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
LArWFParamTool::TooShort
@ TooShort
Definition: LArWFParamTool.h:69
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
LArWFParamTool::WaveTiming_t::Amplitude
double Amplitude
Definition: LArWFParamTool.h:90
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
LArWFParamTool::finalize
virtual StatusCode finalize()
Definition: LArWFParamTool.h:49
LArWFParamTool::Noisy
@ Noisy
Definition: LArWFParamTool.h:72
LArWFParamTool::m_onlineHelper
const LArOnlineID_Base * m_onlineHelper
Definition: LArWFParamTool.h:94
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
LArWFParamTool::m_UseOmegaScanHelper
bool m_UseOmegaScanHelper
Definition: LArWFParamTool.h:111
LArWFParamTool::checkStatus
unsigned checkStatus(const LArCaliWave &larCaliWave) const
Definition: LArWFParamTool.cxx:979
LArWFParamTool::~LArWFParamTool
virtual ~LArWFParamTool()
LArWFParamTool::DefaultNotSet
@ DefaultNotSet
Definition: LArWFParamTool.h:36
LArWFParamTool::omegaScanParams_t
Definition: LArWFParamTool.h:124
LArWFParamTool::m_TtailMin
std::vector< int > m_TtailMin
Definition: LArWFParamTool.h:113
a
TList * a
Definition: liststreamerinfos.cxx:10
LArWaveHelper.h
LArWFParamTool::DoExtract
@ DoExtract
Definition: LArWFParamTool.h:35
LArWFParamTool::omegaScanParams_t::cosRespScan
bool cosRespScan
Definition: LArWFParamTool.h:125
LArWFParams.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArWFParamTool::waveRange_t
Definition: LArWFParamTool.h:119
LArWFParamTool::m_Tshaper
double m_Tshaper
Definition: LArWFParamTool.h:99
LArWFParamTool::m_TINY
static const double m_TINY
Definition: LArWFParamTool.h:79
LArWFParamTool::m_DeltaTtail
std::vector< int > m_DeltaTtail
Definition: LArWFParamTool.h:115
LArEM_ID
Helper class for LArEM offline identifiers.
Definition: LArEM_ID.h:118
LArWFParamTool::m_DEFAULT
static const double m_DEFAULT
Definition: LArWFParamTool.h:78
LArWFParamTool::logChi2InjRespRes
double logChi2InjRespRes(const double taur, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
Definition: LArWFParamTool.cxx:757
LArWFParamTool::m_wHelper
LArWaveHelper m_wHelper
Definition: LArWFParamTool.h:96
AthAlgTool
Definition: AthAlgTool.h:26
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
CaloGain.h
LArWFParamTool::m_NBaseline
unsigned int m_NBaseline
Definition: LArWFParamTool.h:108
LArWFParamTool::m_emId
const LArEM_Base_ID * m_emId
Definition: LArWFParamTool.h:93
LArWFParamTool::initialize
virtual StatusCode initialize()
Definition: LArWFParamTool.cxx:112
LArWFParamTool::LowStat
@ LowStat
Definition: LArWFParamTool.h:71
LArWFParamTool::WaveTiming_t::Tpeak
unsigned Tpeak
Definition: LArWFParamTool.h:86
LArWFParamTool::waveRange_t::min
unsigned min
Definition: LArWFParamTool.h:120
LArWFParamTool::RTM_Omega0
StatusCode RTM_Omega0(const LArWave &gCali, const HWIdentifier chid, LArWFParams &wfParams, const WaveTiming_t &wt, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan) const
Definition: LArWFParamTool.cxx:426
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
LArWFParamTool::cosResp
static LArWave cosResp(const LArWave &gCali, const double &fstep, const double &tcal, const double &omega)
Definition: LArWFParamTool.cxx:727