ATLAS Offline Software
TileRawChannelBuilderFitFilterCool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILERECUTILS_TILERAWCHANNELBUILDERFITFILTERCOOL_H
6 #define TILERECUTILS_TILERAWCHANNELBUILDERFITFILTERCOOL_H
7 
8 /********************************************************************
9  *
10  * NAME: TileRawChannelBuilderFitFilterCool.h
11  * PACKAGE: offline/TileCalorimeter/TileRecUtils
12  *
13  * AUTHOR : K. Gellerstedt, Algorithm by Richard John Teuscher
14  * CREATED: Dec 03 2003
15  *
16  * PURPOSE: Build TileRawChannels from digits using fitting
17  *
18  * Input: TileDigitsContainer
19  * Output: TileRawChannelContainer
20  * Parameters: TileRawChannelCont - Name of output container in SG
21  * FrameLength
22  * MaxIterate
23  * RMSChannelNoise
24  ********************************************************************/
25 #include "GaudiKernel/IIncidentListener.h"
26 // Tile includes
31 
32 #define PHYS_START_T_HI -75.5
33 #define PHYS_START_T_LO -75.5
34 #define PHYS_DT_HI 0.5
35 #define PHYS_DT_LO 0.5
36 #define CIS_START_T_HI -100.
37 #define CIS_START_T_LO -100.
38 #define SCIS_START_T_HI -72.
39 #define SCIS_START_T_LO -72.
40 #define CIS_DT_HI 2
41 #define LEAK_START_T_HI -100.
42 #define LEAK_START_T_LO -100.
43 #define SLEAK_START_T_HI -72.
44 #define SLEAK_START_T_LO -72.
45 #define CIS_DT_LO 2
46 #define LAS_START_T_HI -68.
47 #define LAS_START_T_LO -68.
48 #define LAS_DT_HI 1.8
49 #define LAS_DT_LO 1.8
50 
51 
53  , public IIncidentListener {
54  public:
55 
56  // constructor
57  TileRawChannelBuilderFitFilterCool(const std::string& type, const std::string& name,
58  const IInterface *parent);
59  // destructor
61 
62  // virtual methods
63  virtual StatusCode initialize() override;
64  virtual StatusCode finalize() override;
65 
66  // Inherited from TileRawChannelBuilder
67  virtual TileRawChannel * rawChannel(const TileDigits* digits, const EventContext& ctx) override;
68 
72  static const InterfaceID& interfaceID();
73 
74  virtual void handle(const Incident&) override;
75 
76  private:
77 
78  void pulseFit(const TileDigits* digit, double &amplitude, double &time, double &pedestal, double &chi2, const EventContext &ctx);
79 
80  // generic functions for pulse interpolation
81  double pulse(double x, const std::vector<double> * xvec, const std::vector<double> * yvec, bool zeroOutside = false) const;
82 
83  double scaledPulse(double x, const std::vector<double> * xvec, const std::vector<double> * yvec) const {
84  return m_fnParameters[1] + m_fnParameters[2] * pulse(x, xvec, yvec, false);
85  }
86 
87  double derivative(double x, const std::vector<double> * xvec, const std::vector<double> * yvec) const {
88  return pulse(x, xvec, yvec, true);
89  }
90 
91  std::vector<double> m_dummy; // dummy vector which can be passed to the functions above
92 
93  // Pulse shape function variables
94  double m_t0Fit;
95  // Parameters for pulse shape functions
96  // [0] - phase, [1] - pedestal, [2] - amplitude
97  double m_fnParameters[3];
98  int m_iPeak0;
99  double m_minTime;
100  double m_maxTime;
101  double m_minTau;
102  double m_maxTau;
103 
104  // Precalculated values for 1 iter
105  std::vector<double> m_gPhysLo;
106  std::vector<double> m_dgPhysLo;
107  std::vector<double> m_gPhysHi;
108  std::vector<double> m_dgPhysHi;
109 
110  // Parameters
116 
117  double m_saturatedSampleError; // which error in terms of RMS is assigned to the saturated sample
118  double m_zeroSampleError; // which error in terms of RMS is assigned to the zero sample (== 0)
119  double m_noiseThresholdRMS; // for pedestal-like events only 2-parametric fit is applied
120  double m_maxTimeFromPeak; // max.time for fitting the pulse shapes. Samples with t>t0+m_MaxTimeFromPeak are not fitted.
121 
122  double m_noiseLow; // default low gain noise from TileInfo used in simulation
123  double m_noiseHigh; // default high gain noise from TileInfo used in simulation
124 
125  // Pulse shapes
127 
128  ToolHandle<TileCondToolPulseShape> m_tileToolPulseShape{this,
129  "TileCondToolPulseShape", "TileCondToolPulseShape", "Tile pulse shape tool"};
130 
131  ToolHandle<TileCondToolPulseShape> m_tileToolLeak100Shape{this,
132  "TileCondToolLeak100Shape", "", "Tile CIS leakage shape for 100 pF capacitor tool"};
133 
134  ToolHandle<TileCondToolPulseShape> m_tileToolLeak5p2Shape{this,
135  "TileCondToolLeak5p2Shape", "", "Tile CIS leakage shape for 5.2 pF capacitor tool"};
136 
137  ToolHandle<TileCondToolPulseShape> m_tileToolPulse5p2Shape{this,
138  "TileCondToolPulse5p2Shape", "", "Tile CIS pulse shape for 5.2 pF capacitor tool"};
139 
140  ToolHandle<TileCondToolNoiseSample> m_tileToolNoiseSample{this,
141  "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"};
142 
144 
145 };
146 
147 #define DTIME 25.0 // 25 ns distance between subsequent samples
148 #endif
TileRawChannelBuilderFitFilterCool::m_pulseShapes
const TilePulseShapesStruct * m_pulseShapes
Definition: TileRawChannelBuilderFitFilterCool.h:126
TileRawChannelBuilderFitFilterCool::pulse
double pulse(double x, const std::vector< double > *xvec, const std::vector< double > *yvec, bool zeroOutside=false) const
pulse interpolation
Definition: TileRawChannelBuilderFitFilterCool.cxx:1820
TileRawChannelBuilderFitFilterCool::derivative
double derivative(double x, const std::vector< double > *xvec, const std::vector< double > *yvec) const
Definition: TileRawChannelBuilderFitFilterCool.h:87
TileRawChannelBuilderFitFilterCool::m_dummy
std::vector< double > m_dummy
Definition: TileRawChannelBuilderFitFilterCool.h:91
TileRawChannelBuilderFitFilterCool::m_t0Fit
double m_t0Fit
Definition: TileRawChannelBuilderFitFilterCool.h:94
TileRawChannelBuilderFitFilterCool::m_fnParameters
double m_fnParameters[3]
Definition: TileRawChannelBuilderFitFilterCool.h:97
TileRawChannelBuilderFitFilterCool::m_gPhysHi
std::vector< double > m_gPhysHi
Definition: TileRawChannelBuilderFitFilterCool.h:107
TileRawChannelBuilderFitFilterCool::m_shapes
TilePulseShapesStruct * m_shapes
Definition: TileRawChannelBuilderFitFilterCool.h:143
TileRawChannelBuilderFitFilterCool::m_tileToolNoiseSample
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
Definition: TileRawChannelBuilderFitFilterCool.h:140
TileRawChannelBuilderFitFilterCool::m_extraSamplesLeft
int m_extraSamplesLeft
Definition: TileRawChannelBuilderFitFilterCool.h:114
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
x
#define x
TileRawChannelBuilderFitFilterCool::m_maxTimeFromPeak
double m_maxTimeFromPeak
Definition: TileRawChannelBuilderFitFilterCool.h:120
TileRawChannelBuilderFitFilterCool::m_tileToolLeak5p2Shape
ToolHandle< TileCondToolPulseShape > m_tileToolLeak5p2Shape
Definition: TileRawChannelBuilderFitFilterCool.h:134
TileRawChannelBuilderFitFilterCool::m_minTau
double m_minTau
Definition: TileRawChannelBuilderFitFilterCool.h:101
TileRawChannelBuilderFitFilterCool::m_noiseThresholdRMS
double m_noiseThresholdRMS
Definition: TileRawChannelBuilderFitFilterCool.h:119
TilePulseShapes.h
TileCondToolNoiseSample.h
TileRawChannelBuilderFitFilterCool::m_gPhysLo
std::vector< double > m_gPhysLo
Definition: TileRawChannelBuilderFitFilterCool.h:105
TileRawChannelBuilderFitFilterCool::m_channelNoiseRMS
int m_channelNoiseRMS
Definition: TileRawChannelBuilderFitFilterCool.h:112
TileRawChannelBuilderFitFilterCool::m_minTime
double m_minTime
Definition: TileRawChannelBuilderFitFilterCool.h:99
TileRawChannelBuilderFitFilterCool::m_dgPhysHi
std::vector< double > m_dgPhysHi
Definition: TileRawChannelBuilderFitFilterCool.h:108
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileRawChannelBuilderFitFilterCool::pulseFit
void pulseFit(const TileDigits *digit, double &amplitude, double &time, double &pedestal, double &chi2, const EventContext &ctx)
Calculate energy, time and chi2 for one channel using fitted pulse shape.
Definition: TileRawChannelBuilderFitFilterCool.cxx:603
TileRawChannelBuilderFitFilterCool::m_tileToolLeak100Shape
ToolHandle< TileCondToolPulseShape > m_tileToolLeak100Shape
Definition: TileRawChannelBuilderFitFilterCool.h:131
TileRawChannelBuilderFitFilterCool::m_noiseHigh
double m_noiseHigh
Definition: TileRawChannelBuilderFitFilterCool.h:123
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
TileRawChannel
Definition: TileRawChannel.h:35
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileRawChannelBuilderFitFilterCool::finalize
virtual StatusCode finalize() override
Definition: TileRawChannelBuilderFitFilterCool.cxx:527
TilePulseShapesStruct
Definition: TilePulseShapes.h:31
TileRawChannelBuilderFitFilterCool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: TileRawChannelBuilderFitFilterCool.cxx:34
TileRawChannelBuilder
Definition: TileRawChannelBuilder.h:59
TileCondToolPulseShape.h
TileRawChannelBuilderFitFilterCool::m_extraSamplesRight
int m_extraSamplesRight
Definition: TileRawChannelBuilderFitFilterCool.h:115
TileRawChannelBuilderFitFilterCool::m_maxTime
double m_maxTime
Definition: TileRawChannelBuilderFitFilterCool.h:100
TileRawChannelBuilderFitFilterCool::TileRawChannelBuilderFitFilterCool
TileRawChannelBuilderFitFilterCool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: TileRawChannelBuilderFitFilterCool.cxx:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileDigits
Definition: TileDigits.h:30
TileRawChannelBuilderFitFilterCool::m_maxTau
double m_maxTau
Definition: TileRawChannelBuilderFitFilterCool.h:102
TileRawChannelBuilderFitFilterCool::m_tileToolPulse5p2Shape
ToolHandle< TileCondToolPulseShape > m_tileToolPulse5p2Shape
Definition: TileRawChannelBuilderFitFilterCool.h:137
TileRawChannelBuilder.h
TileRawChannelBuilderFitFilterCool::~TileRawChannelBuilderFitFilterCool
~TileRawChannelBuilderFitFilterCool()
Destructor.
Definition: TileRawChannelBuilderFitFilterCool.cxx:77
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileRawChannelBuilderFitFilterCool::m_zeroSampleError
double m_zeroSampleError
Definition: TileRawChannelBuilderFitFilterCool.h:118
TileRawChannelBuilderFitFilterCool::initialize
virtual StatusCode initialize() override
Initializer.
Definition: TileRawChannelBuilderFitFilterCool.cxx:84
TileRawChannelBuilderFitFilterCool
Definition: TileRawChannelBuilderFitFilterCool.h:53
python.output.AtlRunQueryRoot.yvec
yvec
Definition: AtlRunQueryRoot.py:989
TileRawChannelBuilderFitFilterCool::m_tileToolPulseShape
ToolHandle< TileCondToolPulseShape > m_tileToolPulseShape
Definition: TileRawChannelBuilderFitFilterCool.h:128
TileRawChannelBuilderFitFilterCool::scaledPulse
double scaledPulse(double x, const std::vector< double > *xvec, const std::vector< double > *yvec) const
Definition: TileRawChannelBuilderFitFilterCool.h:83
TileRawChannelBuilderFitFilterCool::m_noiseLow
double m_noiseLow
Definition: TileRawChannelBuilderFitFilterCool.h:122
TileRawChannelBuilderFitFilterCool::m_iPeak0
int m_iPeak0
Definition: TileRawChannelBuilderFitFilterCool.h:98
TileRawChannelBuilderFitFilterCool::m_frameLength
int m_frameLength
Definition: TileRawChannelBuilderFitFilterCool.h:111
TileRawChannelBuilderFitFilterCool::m_dgPhysLo
std::vector< double > m_dgPhysLo
Definition: TileRawChannelBuilderFitFilterCool.h:106
TileRawChannelBuilderFitFilterCool::m_saturatedSampleError
double m_saturatedSampleError
Definition: TileRawChannelBuilderFitFilterCool.h:117
TileRawChannelBuilderFitFilterCool::handle
virtual void handle(const Incident &) override
Definition: TileRawChannelBuilderFitFilterCool.cxx:164
TileRawChannelBuilderFitFilterCool::rawChannel
virtual TileRawChannel * rawChannel(const TileDigits *digits, const EventContext &ctx) override
Builder virtual method to be implemented by subclasses.
Definition: TileRawChannelBuilderFitFilterCool.cxx:534
TileRawChannelBuilderFitFilterCool::m_maxIterate
int m_maxIterate
Definition: TileRawChannelBuilderFitFilterCool.h:113