ATLAS Offline Software
CscCalibTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CSCCALIBTOOLBASE_H
6 #define CSCCALIBTOOLBASE_H
7 
8 /*******************************************************************************
9  Name : CscCalibToolBase.h
10  Package : offline/MuonSpectrometer/MuonCalib/MuonCalibTools
11  Author : Ketevi A. Assamagan
12  Created : March 2005
13 
14  DESCRIPTION:
15  This class is the base class for run time CSC calibration tools.
16  These calibration tools need theCSC conditions data. The conditions data
17  are written and read with a different set of tools. The production of the
18  conditions data can be done via ATHENA or standalone
19 *******************************************************************************/
20 
25 
26 #include "TF1.h"
27 
28 #include <atomic>
29 #include <inttypes.h>
30 #include <memory>
31 #include <mutex>
32 #include <vector>
33 
34 class CscCondDbData;
35 
36 class CscCalibTool : public extends<AthAlgTool, ICscCalibTool> {
37 
38 public:
39  CscCalibTool(const std::string&, const std::string&, const IInterface*);
40  virtual ~CscCalibTool () = default;
41 
42  virtual StatusCode initialize() override final;
43 
48  virtual int femtoCoulombToADCCount (uint32_t stripHashId, const double femtoCoulombs) const override final;
49 
52  virtual int numberOfElectronsToADCCount(uint32_t stripHashId, const int numberOfElecEquiv) const override final;
53 
55  virtual double adcCountToFemtoCoulomb (const float adcCounts, const float slope) const override final;
56  virtual double adcCountToFemtoCoulomb (uint32_t stripHashId, const float adcCounts) const override final;
57 
59  virtual double adcCountToNumberOfElectrons (const float adcValue, const float slope) const override final;
60  virtual double adcCountToNumberOfElectrons (uint32_t stripHashId, const float adcValue) const override final;
61 
64  virtual bool adcToCharge(const std::vector<uint16_t>& samples, uint32_t stripHashId,
65  std::vector<float>& charges) const override final;
66 
70  virtual bool findCharge(const float samplingTime, const unsigned int samplingPhase,
71  const std::vector<float>& samples,double & charge, double & time) const override final;
72 
73 
76  virtual double stripNoise ( uint32_t stripHashId, const bool convert=true ) const override final;
77 
80  virtual double stripRMS ( uint32_t stripHashId, const bool convert=true ) const override final;
81 
84  virtual double stripF001 ( uint32_t stripHashId, const bool convert=true ) const override final;
85 
88  virtual double stripPedestal ( uint32_t stripHashId, const bool convert=true ) const override final;
89 
92  virtual bool isGood ( uint32_t stripHashId ) const override final;
93 
95  virtual int stripStatusBit ( uint32_t stripHashId ) const override final;
96 
98  virtual bool stripT0phase ( uint32_t stripHashId ) const override final;
99 
101  virtual double stripT0base ( uint32_t stripHashId ) const override final;
102 
105  virtual double func (const double x, const float slope) const override final;
106  virtual double func_prime (const double x, const float slope) const override final;
107 
108  virtual double signal (const double z) const override final;
109  virtual double signal_amplitude (const double driftTime, const double samplingTime) const override final;
110  virtual double getZ0() const override final;
111 
112  virtual double getSamplingTime() const override final;
113  virtual double getTimeOffset() const override final;
114  virtual double getSignalWidth() const override final;
115  virtual double getNumberOfIntegration() const override final;
116  virtual double getNumberOfIntegration2() const override final;
117 
118  // virtual Double_t bipfunc (const Double_t *x, const Double_t *par);
119  // virtual Double_t dualbipfunc (const Double_t *x, const Double_t *par);
120 
121  // To add bipolar functions and extract drftTime and stripCharge after addition,
122  // this function is defined. Return value is pair and the first one is driftTime.
123  virtual std::pair<double,double> addBipfunc(const double driftTime0, const double stripCharge0,
124  const double driftTime1, const double stripCharge1) const override final;
125 
126  // 09/2010
127  virtual std::vector<float> getSamplesFromBipolarFunc(const double driftTime0, const double stripCharge0) const override final;
128  virtual double getLatency() const override final;
129 
130 
131  mutable std::atomic_int m_messageCnt_t0base{};
132  mutable std::atomic_int m_messageCnt_t0phase{};
133  //private:
134  // ../src/CscCalibTool.cxx: In member function 'virtual bool CscCalibTool::stripT0phase(uint32_t) const':
135  // ../src/CscCalibTool.cxx:351: error: increment of data-member 'CscCalibTool::m_messageCnt_t0phase' in read-only structure
136  // ../src/CscCalibTool.cxx: In member function 'virtual double CscCalibTool::stripT0base(uint32_t) const':
137  // ../src/CscCalibTool.cxx:371: error: increment of data-member 'CscCalibTool::m_messageCnt_t0base' in read-only structure
138  // due to const in format?
139 
140 private:
141  float getPSlope(uint32_t stripHashId) const;
142 
143 
144 protected:
145 
146  SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"};
147 
150 
151  float m_slope;
152  float m_noise;
153  float m_pedestal;
154 
156  // define bipolar functional shape
157  // Parameters are from Kostas presentation at the following link (09/2007)
158  // http://indico.cern.ch/getFile.py/access?contribId=1&resId=1&materialId=slides&confId=18787
161 
164  double m_timeOffset; // bipolar's start time (or drift time)
165 
166  double m_latency; // new in 2010....latency may be controlled in CscCalibTool.
167 
168  unsigned int m_nSamples;
169 
171  bool m_use2Samples; // for the use of only 2 samples for strip charge
172 
173 };
174 
175 #endif
CscCalibTool::stripT0base
virtual double stripT0base(uint32_t stripHashId) const override final
return T0base related to 5 ASM.
Definition: CscCalibTool.cxx:307
CscCalibTool::m_readFromDatabase
bool m_readFromDatabase
Definition: CscCalibTool.h:148
CscCalibTool::signal_amplitude
virtual double signal_amplitude(const double driftTime, const double samplingTime) const override final
Definition: CscCalibTool.cxx:607
CscCalibTool::stripNoise
virtual double stripNoise(uint32_t stripHashId, const bool convert=true) const override final
return the noise(sigma) on the readout strip in ADC counts or Number of Electrons number of electrons...
Definition: CscCalibTool.cxx:146
CscCalibTool::getSamplesFromBipolarFunc
virtual std::vector< float > getSamplesFromBipolarFunc(const double driftTime0, const double stripCharge0) const override final
Definition: CscCalibTool.cxx:617
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CscCalibTool::m_timeOffset
double m_timeOffset
Definition: CscCalibTool.h:164
CscCalibTool
Definition: CscCalibTool.h:36
CscCalibTool::~CscCalibTool
virtual ~CscCalibTool()=default
CscCondDbData.h
CscCalibTool::getLatency
virtual double getLatency() const override final
Definition: CscCalibTool.cxx:693
CscCalibTool::adcToCharge
virtual bool adcToCharge(const std::vector< uint16_t > &samples, uint32_t stripHashId, std::vector< float > &charges) const override final
Conversion of ADC value to charge - Here the charges is returned in numbers of equivalent electrons.
Definition: CscCalibTool.cxx:554
ICscCalibTool.h
CscCalibTool::m_use2Samples
bool m_use2Samples
Definition: CscCalibTool.h:171
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
x
#define x
CscCalibTool::initialize
virtual StatusCode initialize() override final
Definition: CscCalibTool.cxx:63
CscCalibTool::findCharge
virtual bool findCharge(const float samplingTime, const unsigned int samplingPhase, const std::vector< float > &samples, double &charge, double &time) const override final
Given sampling values for a CSC strip, find the corresponding charge by fitting the time samples.
Definition: CscCalibTool.cxx:364
CscCalibTool::stripStatusBit
virtual int stripStatusBit(uint32_t stripHashId) const override final
return status bit
Definition: CscCalibTool.cxx:265
CscCalibTool::CscCalibTool
CscCalibTool(const std::string &, const std::string &, const IInterface *)
Definition: CscCalibTool.cxx:12
CscCalibTool::func
virtual double func(const double x, const float slope) const override final
these function used in the AOD <-> conversion; may not be needed once we integrate the calibration se...
Definition: CscCalibTool.cxx:341
CscCalibTool::getSignalWidth
virtual double getSignalWidth() const override final
Definition: CscCalibTool.cxx:695
CscCalibTool::getSamplingTime
virtual double getSamplingTime() const override final
Definition: CscCalibTool.cxx:692
CscCalibTool::getNumberOfIntegration
virtual double getNumberOfIntegration() const override final
Definition: CscCalibTool.cxx:696
CscCalibTool::signal
virtual double signal(const double z) const override final
Definition: CscCalibTool.cxx:600
TRT::Hit::driftTime
@ driftTime
Definition: HitInfo.h:43
CscCalibTool::adcCountToNumberOfElectrons
virtual double adcCountToNumberOfElectrons(const float adcValue, const float slope) const override final
given one CSC ADC sample value, convert that to charge in number of equivalent electrons
Definition: CscCalibTool.cxx:138
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
z
#define z
CscCalibTool::func_prime
virtual double func_prime(const double x, const float slope) const override final
Definition: CscCalibTool.cxx:355
CscCalibTool::m_integrationNumber2
double m_integrationNumber2
Definition: CscCalibTool.h:160
CscCalibTool::getZ0
virtual double getZ0() const override final
ROOT version of bipolar function.
Definition: CscCalibTool.cxx:591
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
AthAlgTool.h
CscCalibTool::stripF001
virtual double stripF001(uint32_t stripHashId, const bool convert=true) const override final
return the F001 on the readout strip in ADC counts or Number of Electrons number of electrons by defa...
Definition: CscCalibTool.cxx:201
CscCalibTool::m_messageCnt_t0phase
std::atomic_int m_messageCnt_t0phase
Definition: CscCalibTool.h:132
CscCalibTool::getTimeOffset
virtual double getTimeOffset() const override final
Definition: CscCalibTool.cxx:694
CscCalibTool::m_slope
float m_slope
Definition: CscCalibTool.h:151
CscCalibTool::m_slopeFromDatabase
bool m_slopeFromDatabase
Definition: CscCalibTool.h:149
CscCalibTool::m_signalWidth
double m_signalWidth
Definition: CscCalibTool.h:163
CscCalibTool::getPSlope
float getPSlope(uint32_t stripHashId) const
Definition: CscCalibTool.cxx:92
CscCalibTool::stripRMS
virtual double stripRMS(uint32_t stripHashId, const bool convert=true) const override final
return the RMS on the readout strip in ADC counts or Number of Electrons number of electrons by defau...
Definition: CscCalibTool.cxx:173
CscCalibTool::m_nSamples
unsigned int m_nSamples
Definition: CscCalibTool.h:168
charge
double charge(const T &p)
Definition: AtlasPID.h:538
TMVAToMVAUtils::convert
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
Definition: TMVAToMVAUtils.h:114
CscCalibTool::m_noise
float m_noise
Definition: CscCalibTool.h:152
CscCalibTool::m_readKey
SG::ReadCondHandleKey< CscCondDbData > m_readKey
Definition: CscCalibTool.h:146
SG::ReadCondHandleKey< CscCondDbData >
CscCalibTool::getNumberOfIntegration2
virtual double getNumberOfIntegration2() const override final
Definition: CscCalibTool.cxx:697
CscCalibTool::m_latency
double m_latency
Definition: CscCalibTool.h:166
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
CscCalibTool::m_samplingTime
double m_samplingTime
Definition: CscCalibTool.h:162
CscCalibTool::m_onlineHLT
bool m_onlineHLT
Definition: CscCalibTool.h:170
CscCalibTool::m_integrationNumber
double m_integrationNumber
ROOT version of bipolar function.
Definition: CscCalibTool.h:159
CscCalibTool::stripPedestal
virtual double stripPedestal(uint32_t stripHashId, const bool convert=true) const override final
return the pedestal on the readout strip in ADC counts or Number of Electrons
Definition: CscCalibTool.cxx:227
CscCalibTool::isGood
virtual bool isGood(uint32_t stripHashId) const override final
return the status of this strip, good channel, dead channel, noisy channel - it will return true for ...
Definition: CscCalibTool.cxx:254
CscCalibTool::adcCountToFemtoCoulomb
virtual double adcCountToFemtoCoulomb(const float adcCounts, const float slope) const override final
given one CSC ADC sample value, convert that to charge in femtoCoulomb
Definition: CscCalibTool.cxx:332
CscCalibTool::numberOfElectronsToADCCount
virtual int numberOfElectronsToADCCount(uint32_t stripHashId, const int numberOfElecEquiv) const override final
Here the charge on the CSC strip is given in number of equivalent electrons; conversion to ADC counts...
Definition: CscCalibTool.cxx:112
checker_macros.h
Define macros for attributes used to control the static checker.
CscCalibTool::m_messageCnt_t0base
std::atomic_int m_messageCnt_t0base
Definition: CscCalibTool.h:131
CscCalibTool::m_pedestal
float m_pedestal
Definition: CscCalibTool.h:153
CscCalibTool::femtoCoulombToADCCount
virtual int femtoCoulombToADCCount(uint32_t stripHashId, const double femtoCoulombs) const override final
given a charge on the CSC strip, convert that to ADC counts this is needed in the digitization for ex...
Definition: CscCalibTool.cxx:126
CscCalibTool::addBipfunc
virtual std::pair< double, double > addBipfunc(const double driftTime0, const double stripCharge0, const double driftTime1, const double stripCharge1) const override final
Definition: CscCalibTool.cxx:643
CscCalibTool::stripT0phase
virtual bool stripT0phase(uint32_t stripHashId) const override final
return T0phase related to 5 ASM.
Definition: CscCalibTool.cxx:283
CscCondDbData
Definition: CscCondDbData.h:24