All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
icarus_tool::ElectronicsResponse Class Reference
Inheritance diagram for icarus_tool::ElectronicsResponse:
icarus_tool::IElectronicsResponse

Public Member Functions

 ElectronicsResponse (const fhicl::ParameterSet &pset)
 
 ~ElectronicsResponse ()
 
void configure (const fhicl::ParameterSet &pset) override
 
void setResponse (size_t numBins, double binWidth) override
 
void outputHistograms (art::TFileDirectory &) const override
 
size_t getPlane () const override
 
double getFCperADCMicroS () const override
 
double getASICShapingTime () const override
 
const icarusutil::TimeVecgetResponseVec () const override
 
const icarusutil::FrequencyVecgetResponseFFTVec () const override
 

Private Attributes

size_t fPlane
 
double fFCperADCMicroS
 
double fASICShapingTime
 
double fADCPerPCAtLowestASICGain
 
double fBinWidth
 
icarusutil::TimeVec fElectronicsResponseVec
 
icarusutil::FrequencyVec fElectronicsResponseFFTVec
 
std::unique_ptr
< icarus_signal_processing::ICARUSFFT
< double > > 
fFFT
 Object to handle thread safe FFT. More...
 

Additional Inherited Members

- Private Member Functions inherited from icarus_tool::IElectronicsResponse
virtual ~IElectronicsResponse () noexcept=default
 

Detailed Description

Definition at line 24 of file ElectronicsResponse_tool.cc.

Constructor & Destructor Documentation

icarus_tool::ElectronicsResponse::ElectronicsResponse ( const fhicl::ParameterSet &  pset)
explicit

Definition at line 63 of file ElectronicsResponse_tool.cc.

63  :
64  fBinWidth(0.),
65  fFFT(nullptr)
66 {
67  configure(pset);
68 }
void configure(const fhicl::ParameterSet &pset) override
std::unique_ptr< icarus_signal_processing::ICARUSFFT< double > > fFFT
Object to handle thread safe FFT.
icarus_tool::ElectronicsResponse::~ElectronicsResponse ( )
inline

Definition at line 29 of file ElectronicsResponse_tool.cc.

29 {}

Member Function Documentation

void icarus_tool::ElectronicsResponse::configure ( const fhicl::ParameterSet &  pset)
overridevirtual

Implements icarus_tool::IElectronicsResponse.

Definition at line 70 of file ElectronicsResponse_tool.cc.

71 {
72  // Start by recovering the parameters
73  fPlane = pset.get<size_t>("Plane");
74  fFCperADCMicroS = pset.get<double>("FCperADCMicroS");
75  fASICShapingTime = pset.get<double>("ASICShapingTime");
76  fADCPerPCAtLowestASICGain = pset.get<double>("ADCPerPCAtLowestASICGain");
77 
78  return;
79 }
double icarus_tool::ElectronicsResponse::getASICShapingTime ( ) const
inlineoverridevirtual
double icarus_tool::ElectronicsResponse::getFCperADCMicroS ( ) const
inlineoverridevirtual
size_t icarus_tool::ElectronicsResponse::getPlane ( ) const
inlineoverridevirtual
const icarusutil::FrequencyVec& icarus_tool::ElectronicsResponse::getResponseFFTVec ( ) const
inlineoverridevirtual

Implements icarus_tool::IElectronicsResponse.

Definition at line 39 of file ElectronicsResponse_tool.cc.

icarusutil::FrequencyVec fElectronicsResponseFFTVec
const icarusutil::TimeVec& icarus_tool::ElectronicsResponse::getResponseVec ( ) const
inlineoverridevirtual

Implements icarus_tool::IElectronicsResponse.

Definition at line 38 of file ElectronicsResponse_tool.cc.

void icarus_tool::ElectronicsResponse::outputHistograms ( art::TFileDirectory &  histDir) const
overridevirtual

Implements icarus_tool::IElectronicsResponse.

Definition at line 142 of file ElectronicsResponse_tool.cc.

143 {
144  // It is assumed that the input TFileDirectory has been set up to group histograms into a common
145  // folder at the calling routine's level. Here we create one more level of indirection to keep
146  // histograms made by this tool separate.
147  std::string dirName = "ElectronicsPlane_" + std::to_string(fPlane);
148 
149  art::TFileDirectory dir = histDir.mkdir(dirName.c_str());
150 
151  std::string histName = "ElectronicsResponse_" + std::to_string(fPlane);
152 
153  double hiEdge = fElectronicsResponseVec.size() * fBinWidth;
154 
155  TProfile* hist = dir.make<TProfile>(histName.c_str(), "Response;Time(us)", fElectronicsResponseVec.size(), 0., hiEdge);
156 
157  for(size_t idx = 0; idx < fElectronicsResponseVec.size(); idx++) hist->Fill(idx * fBinWidth, fElectronicsResponseVec.at(idx), 1.);
158 
159  // Get the FFT of the response
160  icarusutil::TimeVec powerVec;
161 
162  fFFT->getFFTPower(fElectronicsResponseVec, powerVec);
163 
164  // Now we can plot this...
165  double maxFreq = 0.5 / fBinWidth; // binWidth will be in us, maxFreq will be units of MHz
166  double freqWidth = maxFreq / powerVec.size();
167 
168  histName = "FFT_" + histName;
169 
170  TProfile* fftHist = dir.make<TProfile>(histName.c_str(), "Electronics FFT; Frequency(MHz)", powerVec.size(), 0., maxFreq);
171 
172  for(size_t idx = 0; idx < powerVec.size(); idx++)
173  {
174  float bin = (idx + 0.5) * freqWidth;
175 
176  fftHist->Fill(bin, powerVec.at(idx), 1.);
177  }
178 
179  return;
180 }
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::vector< SigProcPrecision > TimeVec
tuple dir
Definition: dropbox.py:28
std::string to_string(WindowPattern const &pattern)
std::unique_ptr< icarus_signal_processing::ICARUSFFT< double > > fFFT
Object to handle thread safe FFT.
void icarus_tool::ElectronicsResponse::setResponse ( size_t  numBins,
double  binWidth 
)
overridevirtual

Implements icarus_tool::IElectronicsResponse.

Definition at line 81 of file ElectronicsResponse_tool.cc.

82 {
83  // The input binWidth is in nanoseconds, we need to convert to microseconds to match the
84  // parameters for the electronics response which are given in us
85  double timeCorrect = 1.e-3;
86 
87  fBinWidth = binWidth * timeCorrect;
88 
89  fElectronicsResponseVec.resize(numBins, 0.);
90 
91  // Check that we have initialized our FFT object
92  if (!fFFT) fFFT = std::make_unique<icarus_signal_processing::ICARUSFFT<double>>(numBins);
93 
94  // This note from Filippo:
95  // The following sets the ICARUS electronics response function in
96  // time-space. Function comes from BNL SPICE simulation of ICARUS
97  // electronics. SPICE gives the electronics transfer function in
98  // frequency-space. The inverse laplace transform of that function
99  // (in time-space) was calculated in Mathematica and is what is being
100  // used below. Parameters Ao and To are cumulative gain/timing parameters
101  // from the full (ASIC->Intermediate amp->Receiver->ADC) electronics chain.
102  // They have been adjusted to make the SPICE simulation to match the
103  // actual electronics response. Default params are Ao=1.4, To=0.5us.
104 
105  for(size_t timeIdx = 0; timeIdx < numBins; timeIdx++)
106  {
107  double funcArg = double(timeIdx) * fBinWidth / fASICShapingTime;
108 
109  fElectronicsResponseVec[timeIdx] = funcArg * exp(-funcArg);
110  }
111 
112  // normalize fElectResponse[i], before the convolution
113  // Put in overall normalization in a pedantic way:
114  // first put in the pulse area per eleectron at the lowest gain setting,
115  // then normalize by the actual ASIC gain setting used.
116  // This code is executed only during initialization of service,
117  // so don't worry about code inefficiencies here.
118  // double last_integral=0;
119  // double last_max=0;
120 
121  // ICARUS Normalization are the following
122  // Field response is normalized to 1 electron. Shaping function written as (t/tau)*exp(-t/tau) is normalized to 1
123  // From test pulse measurement with FLIC@CERN we have 0.027 fC/(ADC*us)
124  // Therefore 0.027*6242 electrons/(ADC*us)
125 
126  // The below scales the response by 1./FCperADCMicroS... but this gets taken out in the normalization
127  std::transform(fElectronicsResponseVec.begin(),fElectronicsResponseVec.end(),fElectronicsResponseVec.begin(),std::bind(std::divides<double>(),std::placeholders::_1,fFCperADCMicroS));
128 
129  //double respIntegral = fBinWidth * std::accumulate(fElectronicsResponseVec.begin(),fElectronicsResponseVec.end(),0.);
130  double respIntegral = std::accumulate(fElectronicsResponseVec.begin(),fElectronicsResponseVec.end(),0.);
131 
132  std::transform(fElectronicsResponseVec.begin(),fElectronicsResponseVec.end(),fElectronicsResponseVec.begin(),std::bind(std::divides<double>(),std::placeholders::_1,respIntegral));
133 
134  // Resize and pad with zeroes
135  fElectronicsResponseFFTVec.resize(fElectronicsResponseVec.size(),std::complex<double>(0.,0.));
136 
138 
139  return;
140 }
icarusutil::FrequencyVec fElectronicsResponseFFTVec
static constexpr Sample_t transform(Sample_t sample)
std::unique_ptr< icarus_signal_processing::ICARUSFFT< double > > fFFT
Object to handle thread safe FFT.

Member Data Documentation

double icarus_tool::ElectronicsResponse::fADCPerPCAtLowestASICGain
private

Definition at line 46 of file ElectronicsResponse_tool.cc.

double icarus_tool::ElectronicsResponse::fASICShapingTime
private

Definition at line 45 of file ElectronicsResponse_tool.cc.

double icarus_tool::ElectronicsResponse::fBinWidth
private

Definition at line 49 of file ElectronicsResponse_tool.cc.

icarusutil::FrequencyVec icarus_tool::ElectronicsResponse::fElectronicsResponseFFTVec
private

Definition at line 55 of file ElectronicsResponse_tool.cc.

icarusutil::TimeVec icarus_tool::ElectronicsResponse::fElectronicsResponseVec
private

Definition at line 52 of file ElectronicsResponse_tool.cc.

double icarus_tool::ElectronicsResponse::fFCperADCMicroS
private

Definition at line 44 of file ElectronicsResponse_tool.cc.

std::unique_ptr<icarus_signal_processing::ICARUSFFT<double> > icarus_tool::ElectronicsResponse::fFFT
private

Object to handle thread safe FFT.

Definition at line 58 of file ElectronicsResponse_tool.cc.

size_t icarus_tool::ElectronicsResponse::fPlane
private

Definition at line 43 of file ElectronicsResponse_tool.cc.


The documentation for this class was generated from the following file: