ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcRecChannelTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * ZdcRecChannelTool.h
7 *
8 * Reconstruct the channel data extracting Energy, timing and quality factor.
9 * Should also get from the database the noise, pedestal and calibration
10 *
11 *FIXME nsamples is a property of a digits collection, not individual
12 * digits (fix ZdcEvenet/ZdcDigits.h. This is confusing, allow too much
13 * room for error (PPM will never run with different number of samples in
14 * a same configuration)
15 *
16 *FIXME ZdcRawChannel missing quality parameter
17 *FIXME ZdcRawChannelCollection must have Identifier (that's why it exists !)
18 *FIXME and not rely on storage order. See a trouble if you create unordered
19 *FIXME sequence
20 *
21 *
22 *TODO This probably should be called ZdcRecTool
23 *
24 *
25 * Created on: Nov 24, 2009
26 * Author: leite
27 */
28
29#ifndef ZDCRECCHANNELTOOL_H_
30#define ZDCRECCHANNELTOOL_H_
31
32
33#include <string>
34#include <map>
35
36#include <gsl/gsl_errno.h>
37#include <gsl/gsl_spline.h>
38#include <gsl/gsl_math.h>
39#include <gsl/gsl_roots.h>
40
41
43#include "GaudiKernel/ToolHandle.h"
44
46
47class IInterface;
48class InterfaceID;
49class StatusCode;
50class Identifier;
52class ZdcID ;
53
54//ROOT is pick expanding typedefs, play safe.
55typedef std::pair<int, int> T_gain_delay_pair;
56
57typedef std::map< std::pair<int, int>, std::vector<int> > T_wfm_map;
58typedef std::pair<std::pair<int, int>, std::vector<int> > T_wfm_pair;
59
60
61inline bool negnum (float x) { return (x<0); }
62inline bool posnum (float x) { return (x>0); }
63
65
70
72{
73public:
74 ZdcRecChannelTool(const std::string& type,
75 const std::string& name,
76 const IInterface* parent);
77
78 virtual ~ZdcRecChannelTool();
79
81 static const InterfaceID& interfaceID();
82
83 virtual StatusCode initialize();
84 virtual StatusCode finalize();
85
86
87
88 int makeRawFromDigits(const ZdcDigitsCollection& data_collection, ZdcRawChannelCollection & raw_collection);
89
90 int getCalibration(const ZdcDigitsCollection& data_collection, ZdcRawChannelCollection & raw_collection);
91
92
93
94
95
96private:
97
98 int getTimingCFD (const Identifier& id, const std::vector< std::vector <int> >& wfm);
99
100 gsl_interp_accel *m_interp_acc{};
101 gsl_spline *m_spline{};
102
103 static double fx(double x0, void *params);
104
105 static double fxCallback(double d,void* v)
106 {
107 CCallbackHolder* h = static_cast<CCallbackHolder*>(v);
108 return h->cls->fx(d, h->cls);
109 }
110
111 std::vector<float> m_cfd_result;
112
113 //Bandwidth limited interpolation (sin(x)/x) method
114 //variables
116 std::vector<float> m_wfm_bwl;
117 std::vector<float> m_bwl_vpeak;
118 std::vector<float> m_bwl_tpeak;
119 int getTimingSinc(const Identifier& id, const std::vector<std::vector <int> >& wfm );
120
121
122 std::vector<float> m_bwl_vpeak2;
123 std::vector<float> m_bwl_tpeak2;
124 int getTimingSinc2(const Identifier& id, const std::vector<std::vector <int> >& wfm );
125
126
127
128 //ZdcRawChannelCollection m_ChannelCollection;
129
130 unsigned int m_nsamples;
132
133 int m_delta; // A number to check for signal
135
136
137 static const int s_FADC_SATURATION = 1022;
138
139 //Timing Algorithms Constants
140 // CFD method
142 float m_cfd_delay ; //ns
143
144 static const int s_CFD_FRACTION = -3;
145 static const int s_SAMPLING_TIME = 25000; // ps
146 static const int s_HALF_SAMPLING_TIME = 12500; //ps
147
148 // According to Andrei: 1 ADC count = 1 GeV High Gain
149 // = 10 GeV High Gain
150 // Electronic gain: x 16 (??)
151 // Keeps as 1 until we understand it
152 static const int s_GAIN_RATIO = 1;
153
154 //ZdcDigitsCollection* m_pedestalData;
155
156 const ZdcID* m_zdcId{};
157
158};
159
160
161#endif /* ZDCRECCHANNELTOOL_H_ */
#define x
bool negnum(float x)
std::pair< std::pair< int, int >, std::vector< int > > T_wfm_pair
std::pair< int, int > T_gain_delay_pair
bool posnum(float x)
std::map< std::pair< int, int >, std::vector< int > > T_wfm_map
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Header file for AthHistogramAlgorithm.
Definition ZdcID.h:25
static double fxCallback(double d, void *v)
static const int s_FADC_SATURATION
std::vector< float > m_bwl_tpeak
int makeRawFromDigits(const ZdcDigitsCollection &data_collection, ZdcRawChannelCollection &raw_collection)
static const int s_SAMPLING_TIME
virtual StatusCode finalize()
static const int s_GAIN_RATIO
int getCalibration(const ZdcDigitsCollection &data_collection, ZdcRawChannelCollection &raw_collection)
static const int s_CFD_FRACTION
int getTimingSinc(const Identifier &id, const std::vector< std::vector< int > > &wfm)
std::vector< float > m_wfm_bwl
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
static const int s_HALF_SAMPLING_TIME
static double fx(double x0, void *params)
int getTimingSinc2(const Identifier &id, const std::vector< std::vector< int > > &wfm)
virtual StatusCode initialize()
std::vector< float > m_bwl_tpeak2
ZdcRecChannelTool(const std::string &type, const std::string &name, const IInterface *parent)
std::vector< float > m_cfd_result
std::vector< float > m_bwl_vpeak
gsl_interp_accel * m_interp_acc
int getTimingCFD(const Identifier &id, const std::vector< std::vector< int > > &wfm)
std::vector< float > m_bwl_vpeak2
ZdcRecChannelTool * cls