Public Member Functions | Private Member Functions | Private Attributes | List of all members
util::SignalShapingServiceDUNE Class Reference

#include <SignalShapingServiceDUNE.h>

Inheritance diagram for util::SignalShapingServiceDUNE:
SignalShapingService

Public Member Functions

 SignalShapingServiceDUNE (const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
 
 ~SignalShapingServiceDUNE ()
 
void reconfigure (const fhicl::ParameterSet &pset)
 
std::vector< DoubleVecGetNoiseFactVec () const override
 
double GetASICGain (Channel channel) const override
 
double GetShapingTime (Channel channel) const override
 
double GetRawNoise (Channel channel) const override
 
double GetDeconNoise (Channel channel) const override
 
double GetDeconNorm () const override
 
unsigned int GetSignalSize () const override
 
int FieldResponseTOffset (detinfo::DetectorClocksData const &clockData, Channel const channel) const override
 
const util::SignalShapingSignalShaping (Channel channel) const override
 
const util::SignalShapingElectronicShaping (unsigned int channel) const
 
template<class T >
void Convolute (detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
 
template<class T >
void ConvoluteElectronicResponse (detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
 
void Convolute (detinfo::DetectorClocksData const &clockData, Channel channel, FloatVector &func) const override
 
void Convolute (detinfo::DetectorClocksData const &clockData, Channel channel, DoubleVector &func) const override
 
void ConvoluteElectronicResponse (detinfo::DetectorClocksData const &clockData, Channel channel, FloatVector &func) const
 
void ConvoluteElectronicResponse (detinfo::DetectorClocksData const &clockData, Channel channel, DoubleVector &func) const
 
template<class T >
void Deconvolute (detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
 
void Deconvolute (detinfo::DetectorClocksData const &clockData, Channel channel, DoubleVector &func) const override
 
void Deconvolute (detinfo::DetectorClocksData const &clockData, Channel channel, FloatVector &func) const override
 
- Public Member Functions inherited from SignalShapingService
virtual ~SignalShapingService ()
 

Private Member Functions

void init () const
 
void init ()
 
void SetFieldResponse (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
 
void SetElectResponse (double shapingtime, double gain)
 
void SetRCResponse ()
 
void SetFilters (detinfo::DetectorClocksData const &clockData)
 
void SetResponseSampling (detinfo::DetectorClocksData const &clockData, bool elect_only=false)
 

Private Attributes

bool fInit
 Initialization flag. More...
 
int fNFieldBins
 number of bins for field response More...
 
double fCol3DCorrection
 correction factor to account for 3D path of More...
 
double fInd3DCorrection
 correction factor to account for 3D path of More...
 
double fColFieldRespAmp
 amplitude of response to field More...
 
double fIndUFieldRespAmp
 amplitude of response to field More...
 
double fIndVFieldRespAmp
 amplitude of response to field More...
 
std::vector< double > fFieldResponseTOffset
 Time offset for field response in ns. More...
 
std::vector< double > fCalibResponseTOffset
 
double fInputFieldRespSamplingPeriod
 Sampling period in the input field response. More...
 
double fDeconNorm
 
double fADCPerPCAtLowestASICGain
 Pulse amplitude gain for a 1 pc charge impulse after convoluting it the with field and electronics response with the lowest ASIC gain setting of 4.7 mV/fC. More...
 
std::vector< DoubleVecfNoiseFactVec
 
std::vector< double > fASICGainInMVPerFC
 
std::vector< double > fShapeTimeConst
 time constants for exponential shaping More...
 
TF1 * fColFilterFunc
 Parameterized collection filter function. More...
 
TF1 * fIndUFilterFunc
 Parameterized induction filter function. More...
 
TF1 * fIndVFilterFunc
 Parameterized induction filter function. More...
 
bool fUseFunctionFieldShape
 Flag that allows to use a parameterized field response instead of the hardcoded version. More...
 
bool fUseHistogramFieldShape
 Flag that turns on field response shapes from histograms. More...
 
bool fGetFilterFromHisto
 Flag that allows to use a filter function from a histogram instead of the functional dependency. More...
 
TF1 * fColFieldFunc
 Parameterized collection field shape function. More...
 
TF1 * fIndUFieldFunc
 Parameterized induction field shape function. More...
 
TF1 * fIndVFieldFunc
 Parameterized induction field shape function. More...
 
TH1F * fFieldResponseHist [3]
 Histogram used to hold the field response, hardcoded for the time being. More...
 
TH1D * fFilterHist [3]
 Histogram used to hold the collection filter, hardcoded for the time being. More...
 
util::SignalShaping fColSignalShaping
 
util::SignalShaping fIndUSignalShaping
 
util::SignalShaping fIndVSignalShaping
 
util::SignalShaping fColElectResponseSignalShaping
 
util::SignalShaping fIndUElectResponseSignalShaping
 
util::SignalShaping fIndVElectResponseSignalShaping
 
std::vector< double > fColFieldResponse
 
std::vector< double > fIndUFieldResponse
 
std::vector< double > fIndVFieldResponse
 
std::vector< double > fElectResponse
 
std::vector< TComplex > fColFilter
 
std::vector< TComplex > fIndUFilter
 
std::vector< TComplex > fIndVFilter
 

Additional Inherited Members

- Public Types inherited from SignalShapingService
using Channel = unsigned int
 
using FloatVector = std::vector< float >
 
using DoubleVector = std::vector< double >
 
using DoubleVectorVector = std::vector< DoubleVector >
 

Detailed Description

Definition at line 49 of file SignalShapingServiceDUNE.h.

Constructor & Destructor Documentation

util::SignalShapingServiceDUNE::SignalShapingServiceDUNE ( const fhicl::ParameterSet pset,
art::ActivityRegistry reg 
)

Definition at line 23 of file SignalShapingServiceDUNE_service.cc.

25  : fInit(false)
26 {
27  reconfigure(pset);
28 }
void reconfigure(const fhicl::ParameterSet &pset)
util::SignalShapingServiceDUNE::~SignalShapingServiceDUNE ( )

Definition at line 33 of file SignalShapingServiceDUNE_service.cc.

34 {}

Member Function Documentation

template<class T >
void util::SignalShapingServiceDUNE::Convolute ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
std::vector< T > &  func 
) const
inline

Definition at line 181 of file SignalShapingServiceDUNE.h.

182  {
184 
185  //negative number
186  int time_offset = FieldResponseTOffset(clockData, channel);
187 
188  std::vector<T> temp;
189  if (time_offset <=0){
190  temp.assign(func.begin(),func.begin()-time_offset);
191  func.erase(func.begin(),func.begin()-time_offset);
192  func.insert(func.end(),temp.begin(),temp.end());
193  }else{
194  temp.assign(func.end()-time_offset,func.end());
195  func.erase(func.end()-time_offset,func.end());
196  func.insert(func.begin(),temp.begin(),temp.end());
197  }
198 }
uint8_t channel
Definition: CRTFragment.hh:201
void Convolute(std::vector< T > &func) const
const util::SignalShaping & SignalShaping(Channel channel) const override
int FieldResponseTOffset(detinfo::DetectorClocksData const &clockData, Channel const channel) const override
void util::SignalShapingServiceDUNE::Convolute ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
FloatVector func 
) const
overridevirtual

Implements SignalShapingService.

Definition at line 844 of file SignalShapingServiceDUNE_service.cc.

845  {
846  return Convolute<float>(clockData, channel, func);
847 }
uint8_t channel
Definition: CRTFragment.hh:201
def func()
Definition: docstring.py:7
void util::SignalShapingServiceDUNE::Convolute ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
DoubleVector func 
) const
overridevirtual

Implements SignalShapingService.

Definition at line 850 of file SignalShapingServiceDUNE_service.cc.

851  {
852  return Convolute<double>(clockData, channel, func);
853 }
uint8_t channel
Definition: CRTFragment.hh:201
def func()
Definition: docstring.py:7
template<class T >
void util::SignalShapingServiceDUNE::ConvoluteElectronicResponse ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
std::vector< T > &  func 
) const
inline

Definition at line 201 of file SignalShapingServiceDUNE.h.

202  {
204 
205  //negative number
206  int time_offset = FieldResponseTOffset(clockData, channel);
207 
208  std::vector<T> temp;
209  if (time_offset <=0){
210  temp.assign(func.begin(),func.begin()-time_offset);
211  func.erase(func.begin(),func.begin()-time_offset);
212  func.insert(func.end(),temp.begin(),temp.end());
213  }else{
214  temp.assign(func.end()-time_offset,func.end());
215  func.erase(func.end()-time_offset,func.end());
216  func.insert(func.begin(),temp.begin(),temp.end());
217  }
218 }
uint8_t channel
Definition: CRTFragment.hh:201
void Convolute(std::vector< T > &func) const
const util::SignalShaping & ElectronicShaping(unsigned int channel) const
int FieldResponseTOffset(detinfo::DetectorClocksData const &clockData, Channel const channel) const override
void util::SignalShapingServiceDUNE::ConvoluteElectronicResponse ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
FloatVector func 
) const

Definition at line 855 of file SignalShapingServiceDUNE_service.cc.

856  {
857  return ConvoluteElectronicResponse<float>(clockData, channel, func);
858 }
uint8_t channel
Definition: CRTFragment.hh:201
def func()
Definition: docstring.py:7
void util::SignalShapingServiceDUNE::ConvoluteElectronicResponse ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
DoubleVector func 
) const

Definition at line 861 of file SignalShapingServiceDUNE_service.cc.

862  {
863  return ConvoluteElectronicResponse<double>(clockData, channel, func);
864 }
uint8_t channel
Definition: CRTFragment.hh:201
def func()
Definition: docstring.py:7
template<class T >
void util::SignalShapingServiceDUNE::Deconvolute ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
std::vector< T > &  func 
) const
inline

Definition at line 225 of file SignalShapingServiceDUNE.h.

226  {
228 
229  int time_offset = FieldResponseTOffset(clockData, channel);
230 
231  std::vector<T> temp;
232  if (time_offset <=0){
233  temp.assign(func.end()+time_offset,func.end());
234  func.erase(func.end()+time_offset,func.end());
235  func.insert(func.begin(),temp.begin(),temp.end());
236  }else{
237  temp.assign(func.begin(),func.begin()+time_offset);
238  func.erase(func.begin(),func.begin()+time_offset);
239  func.insert(func.end(),temp.begin(),temp.end());
240  }
241 }
void Deconvolute(std::vector< T > &func) const
uint8_t channel
Definition: CRTFragment.hh:201
const util::SignalShaping & SignalShaping(Channel channel) const override
int FieldResponseTOffset(detinfo::DetectorClocksData const &clockData, Channel const channel) const override
void util::SignalShapingServiceDUNE::Deconvolute ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
DoubleVector func 
) const
overridevirtual

Implements SignalShapingService.

Definition at line 873 of file SignalShapingServiceDUNE_service.cc.

874  {
875  return Deconvolute<double>(clockData, channel, func);
876 }
uint8_t channel
Definition: CRTFragment.hh:201
def func()
Definition: docstring.py:7
void util::SignalShapingServiceDUNE::Deconvolute ( detinfo::DetectorClocksData const &  clockData,
Channel  channel,
FloatVector func 
) const
overridevirtual

Implements SignalShapingService.

Definition at line 867 of file SignalShapingServiceDUNE_service.cc.

868  {
869  return Deconvolute<float>(clockData, channel, func);
870 }
uint8_t channel
Definition: CRTFragment.hh:201
def func()
Definition: docstring.py:7
const util::SignalShaping & util::SignalShapingServiceDUNE::ElectronicShaping ( unsigned int  channel) const

Definition at line 213 of file SignalShapingServiceDUNE_service.cc.

213  {
214  const string myname = "SignalShapingServiceDUNE::ElectronicShaping: ";
215  if(!fInit)
216  init();
217 
218  // Figure out plane type.
219 
221  //geo::SigType_t sigtype = geom->SignalType(channel);
222 
223  // we need to distinguis between the U and V planes
224  geo::View_t view = geom->View(channel);
225 
226  // Return appropriate shaper.
227 
228  if(view == geo::kU)
230  else if (view == geo::kV)
232  else if(view == geo::kZ)
234  else
235  throw cet::exception("SignalShapingServiceDUNE") << myname
236  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
237 
239 }
util::SignalShaping fColElectResponseSignalShaping
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
util::SignalShaping fIndUElectResponseSignalShaping
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
util::SignalShaping fIndVElectResponseSignalShaping
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int util::SignalShapingServiceDUNE::FieldResponseTOffset ( detinfo::DetectorClocksData const &  clockData,
Channel const  channel 
) const
overridevirtual

Implements SignalShapingService.

Definition at line 818 of file SignalShapingServiceDUNE_service.cc.

819  {
820  const string myname = "SignalShapingServiceDUNE::FieldResponseTOffset: ";
822  //geo::SigType_t sigtype = geom->SignalType(channel);
823 
824  // we need to distinguis between the U and V planes
825  geo::View_t view = geom->View(channel);
826 
827  double time_offset = 0;
828 
829  if(view == geo::kU)
830  time_offset = fFieldResponseTOffset.at(0) + fCalibResponseTOffset.at(0);
831  else if(view == geo::kV)
832  time_offset = fFieldResponseTOffset.at(1) + fCalibResponseTOffset.at(1);
833  else if(view == geo::kZ)
834  time_offset = fFieldResponseTOffset.at(2) + fCalibResponseTOffset.at(2);
835  else
836  throw cet::exception("SignalShapingServiceDUNEt") << myname
837  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
838 
839  return clockData.TPCClock().Ticks(time_offset/1.e3);
840 
841 }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< double > fFieldResponseTOffset
Time offset for field response in ns.
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double util::SignalShapingServiceDUNE::GetASICGain ( Channel  channel) const
overridevirtual

Implements SignalShapingService.

Definition at line 247 of file SignalShapingServiceDUNE_service.cc.

247  {
248  const string myname = "SignalShapingServiceDUNE::GetASICGain: ";
250  //geo::SigType_t sigtype = geom->SignalType(channel);
251 
252  // we need to distinguis between the U and V planes
253  geo::View_t view = geom->View(channel);
254 
255  double gain = 0;
256  if(view == geo::kU)
257  gain = fASICGainInMVPerFC.at(0);
258  else if(view == geo::kV)
259  gain = fASICGainInMVPerFC.at(1);
260  else if(view == geo::kZ)
261  gain = fASICGainInMVPerFC.at(2);
262  else
263  throw cet::exception("SignalShapingServiceDUNEt") << myname
264  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
265  return gain;
266 }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double util::SignalShapingServiceDUNE::GetDeconNoise ( Channel  channel) const
overridevirtual

Implements SignalShapingService.

Definition at line 332 of file SignalShapingServiceDUNE_service.cc.

332  {
333  const string myname = "SignalShapingServiceDUNE::GetDeconNoise: ";
334  unsigned int plane;
336  //geo::SigType_t sigtype = geom->SignalType(channel);
337 
338  // we need to distinguis between the U and V planes
339  geo::View_t view = geom->View(channel);
340 
341  if(view == geo::kU)
342  plane = 0;
343  else if(view == geo::kV)
344  plane = 1;
345  else if(view == geo::kZ)
346  plane = 2;
347  else
348  throw cet::exception("SignalShapingServiceDUNEt") << myname
349  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
350 
351  double shapingtime = fShapeTimeConst.at(plane);
352  int temp;
353  if (shapingtime == 0.5){
354  temp = 0;
355  }else if (shapingtime == 1.0){
356  temp = 1;
357  }else if (shapingtime == 2.0){
358  temp = 2;
359  }else{
360  temp = 3;
361  }
362  auto tempNoise = fNoiseFactVec.at(plane);
363  double deconNoise = tempNoise.at(temp);
364 
365  deconNoise = deconNoise /4096.*2000./4.7 *6.241*1000/fDeconNorm;
366  return deconNoise;
367 }
std::vector< double > fShapeTimeConst
time constants for exponential shaping
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< DoubleVec > fNoiseFactVec
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double util::SignalShapingServiceDUNE::GetDeconNorm ( ) const
overridevirtual

Implements SignalShapingService.

Definition at line 369 of file SignalShapingServiceDUNE_service.cc.

369  {
370  return fDeconNorm;
371 }
std::vector< DoubleVec > util::SignalShapingServiceDUNE::GetNoiseFactVec ( ) const
overridevirtual

Implements SignalShapingService.

Definition at line 242 of file SignalShapingServiceDUNE_service.cc.

242  {
243  return fNoiseFactVec;
244 }
std::vector< DoubleVec > fNoiseFactVec
double util::SignalShapingServiceDUNE::GetRawNoise ( Channel  channel) const
overridevirtual

Implements SignalShapingService.

Definition at line 292 of file SignalShapingServiceDUNE_service.cc.

292  {
293  const string myname = "SignalShapingServiceDUNE::GetRawNoise: ";
294  unsigned int plane;
296  //geo::SigType_t sigtype = geom->SignalType(channel);
297 
298  // we need to distinguis between the U and V planes
299  geo::View_t view = geom->View(channel);
300 
301  if(view == geo::kU)
302  plane = 0;
303  else if(view == geo::kV)
304  plane = 1;
305  else if(view == geo::kZ)
306  plane = 2;
307  else
308  throw cet::exception("SignalShapingServiceDUNEt") << myname
309  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
310 
311  double shapingtime = fShapeTimeConst.at(plane);
312  double gain = fASICGainInMVPerFC.at(plane);
313  int temp;
314  if (shapingtime == 0.5){
315  temp = 0;
316  }else if (shapingtime == 1.0){
317  temp = 1;
318  }else if (shapingtime == 2.0){
319  temp = 2;
320  }else{
321  temp = 3;
322  }
323  double rawNoise;
324 
325  auto tempNoise = fNoiseFactVec.at(plane);
326  rawNoise = tempNoise.at(temp);
327 
328  rawNoise *= gain/4.7;
329  return rawNoise;
330 }
std::vector< double > fShapeTimeConst
time constants for exponential shaping
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< DoubleVec > fNoiseFactVec
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double util::SignalShapingServiceDUNE::GetShapingTime ( Channel  channel) const
overridevirtual

Implements SignalShapingService.

Definition at line 270 of file SignalShapingServiceDUNE_service.cc.

270  {
271  const string myname = "SignalShapingServiceDUNE::GetShapingTime: ";
273  //geo::SigType_t sigtype = geom->SignalType(channel);
274 
275  // we need to distinguis between the U and V planes
276  geo::View_t view = geom->View(channel);
277 
278  double shaping_time = 0;
279 
280  if(view == geo::kU)
281  shaping_time = fShapeTimeConst.at(0);
282  else if(view == geo::kV)
283  shaping_time = fShapeTimeConst.at(1);
284  else if(view == geo::kZ)
285  shaping_time = fShapeTimeConst.at(2);
286  else
287  throw cet::exception("SignalShapingServiceDUNEt") << myname
288  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
289  return shaping_time;
290 }
std::vector< double > fShapeTimeConst
time constants for exponential shaping
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int util::SignalShapingServiceDUNE::GetSignalSize ( ) const
overridevirtual

Implements SignalShapingService.

Definition at line 373 of file SignalShapingServiceDUNE_service.cc.

373  {
374  return SignalShaping(0).Response().size();
375 }
const std::vector< double > & Response() const
Definition: SignalShaping.h:77
const util::SignalShaping & SignalShaping(Channel channel) const override
void util::SignalShapingServiceDUNE::init ( ) const
inlineprivate

Definition at line 104 of file SignalShapingServiceDUNE.h.

104 {const_cast<SignalShapingServiceDUNE*>(this)->init();}
SignalShapingServiceDUNE(const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
void util::SignalShapingServiceDUNE::init ( )
private

Definition at line 381 of file SignalShapingServiceDUNE_service.cc.

382 {
383  if(!fInit) {
384  fInit = true;
385 
386  // Do microboone-specific configuration of SignalShaping by providing
387  // microboone response and filter functions.
388 
389  // Calculate field and electronics response functions.
390 
391  // Lazy evaluation in a multi-threaded environment is problematic.
392  // The best we can do here is to use the global data available
393  // through detector-properties service.
394  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
395  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob(clockData);
396  SetFieldResponse(clockData, detProp);
398 
399  // Configure convolution kernels.
400 
405  //fColSignalShaping.SetPeakResponseTime(0.);
409 
411 
416  //fIndUSignalShaping.SetPeakResponseTime(0.);
420 
422 
427  //fIndVSignalShaping.SetPeakResponseTime(0.);
431 
432 
433  SetResponseSampling(clockData);
434  SetResponseSampling(clockData, true);
435 
436  // Calculate filter functions.
437 
438  SetFilters(clockData);
439 
440  // Configure deconvolution kernels.
441 
444 
447 
450  }
451 }
void set_normflag(bool flag)
util::SignalShaping fColElectResponseSignalShaping
std::vector< double > fShapeTimeConst
time constants for exponential shaping
void SetFilters(detinfo::DetectorClocksData const &clockData)
void AddResponseFunction(const std::vector< double > &resp, bool ResetResponse=false)
void SetResponseSampling(detinfo::DetectorClocksData const &clockData, bool elect_only=false)
void CalculateDeconvKernel() const
util::SignalShaping fIndUElectResponseSignalShaping
util::SignalShaping fIndVElectResponseSignalShaping
void SetFieldResponse(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
void SetElectResponse(double shapingtime, double gain)
void AddFilterFunction(const std::vector< TComplex > &filt)
void util::SignalShapingServiceDUNE::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 39 of file SignalShapingServiceDUNE_service.cc.

40 {
41  // Reset initialization flag.
42 
43  fInit = false;
44 
45  // Reset kernels.
46 
50 
51  // Fetch fcl parameters.
52 
53  fNFieldBins = pset.get<int>("FieldBins");
54  fCol3DCorrection = pset.get<double>("Col3DCorrection");
55  fInd3DCorrection = pset.get<double>("Ind3DCorrection");
56  fColFieldRespAmp = pset.get<double>("ColFieldRespAmp");
57  fIndUFieldRespAmp = pset.get<double>("IndUFieldRespAmp");
58  fIndVFieldRespAmp = pset.get<double>("IndVFieldRespAmp");
59 
60  fDeconNorm = pset.get<double>("DeconNorm");
61  fADCPerPCAtLowestASICGain = pset.get<double>("ADCPerPCAtLowestASICGain");
62  fASICGainInMVPerFC = pset.get<std::vector<double> >("ASICGainInMVPerFC");
63  fShapeTimeConst = pset.get<std::vector<double> >("ShapeTimeConst");
64  fNoiseFactVec = pset.get<std::vector<DoubleVec> >("NoiseFactVec");
65 
66  fInputFieldRespSamplingPeriod = pset.get<double>("InputFieldRespSamplingPeriod");
67 
68  fFieldResponseTOffset = pset.get<std::vector<double> >("FieldResponseTOffset");
69  fCalibResponseTOffset = pset.get<std::vector<double> >("CalibResponseTOffset");
70 
71  fUseFunctionFieldShape= pset.get<bool>("UseFunctionFieldShape");
72  fUseHistogramFieldShape = pset.get<bool>("UseHistogramFieldShape");
73 
74  fGetFilterFromHisto= pset.get<bool>("GetFilterFromHisto");
75 
76  // Construct parameterized collection filter function.
77  if(!fGetFilterFromHisto)
78  {
79  mf::LogInfo("SignalShapingServiceDUNE") << "Getting Filter from .fcl file";
80  std::string colFilt = pset.get<std::string>("ColFilter");
81  std::vector<double> colFiltParams =
82  pset.get<std::vector<double> >("ColFilterParams");
83  fColFilterFunc = new TF1("colFilter", colFilt.c_str());
84  for(unsigned int i=0; i<colFiltParams.size(); ++i)
85  fColFilterFunc->SetParameter(i, colFiltParams[i]);
86 
87  // Construct parameterized induction filter function.
88 
89  std::string indUFilt = pset.get<std::string>("IndUFilter");
90  std::vector<double> indUFiltParams = pset.get<std::vector<double> >("IndUFilterParams");
91  fIndUFilterFunc = new TF1("indUFilter", indUFilt.c_str());
92  for(unsigned int i=0; i<indUFiltParams.size(); ++i)
93  fIndUFilterFunc->SetParameter(i, indUFiltParams[i]);
94 
95  std::string indVFilt = pset.get<std::string>("IndVFilter");
96  std::vector<double> indVFiltParams = pset.get<std::vector<double> >("IndVFilterParams");
97  fIndVFilterFunc = new TF1("indVFilter", indVFilt.c_str());
98  for(unsigned int i=0; i<indVFiltParams.size(); ++i)
99  fIndVFilterFunc->SetParameter(i, indVFiltParams[i]);
100 
101  }
102  else
103  {
104 
105  std::string histoname = pset.get<std::string>("FilterHistoName");
106  mf::LogInfo("SignalShapingServiceDUNE") << " using filter from .root file ";
107  int fNPlanes=3;
108 
109  // constructor decides if initialized value is a path or an environment variable
111  cet::search_path sp("FW_SEARCH_PATH");
112  sp.find_file(pset.get<std::string>("FilterFunctionFname"), fname);
113 
114  TFile * in=new TFile(fname.c_str(),"READ");
115  for(int i=0;i<fNPlanes;i++){
116  TH1D * temp=(TH1D *)in->Get(Form(histoname.c_str(),i));
117  fFilterHist[i]=new TH1D(Form(histoname.c_str(),i),Form(histoname.c_str(),i),temp->GetNbinsX(),0,temp->GetNbinsX());
118  temp->Copy(*fFilterHist[i]);
119  }
120 
121  in->Close();
122 
123  }
124 
125  /////////////////////////////////////
126  if(fUseFunctionFieldShape)
127  {
128  std::string colField = pset.get<std::string>("ColFieldShape");
129  std::vector<double> colFieldParams =
130  pset.get<std::vector<double> >("ColFieldParams");
131  fColFieldFunc = new TF1("colField", colField.c_str());
132  for(unsigned int i=0; i<colFieldParams.size(); ++i)
133  fColFieldFunc->SetParameter(i, colFieldParams[i]);
134 
135  // Construct parameterized induction filter function.
136 
137  std::string indUField = pset.get<std::string>("IndUFieldShape");
138  std::vector<double> indUFieldParams = pset.get<std::vector<double> >("IndUFieldParams");
139  fIndUFieldFunc = new TF1("indUField", indUField.c_str());
140  for(unsigned int i=0; i<indUFieldParams.size(); ++i)
141  fIndUFieldFunc->SetParameter(i, indUFieldParams[i]);
142  // Warning, last parameter needs to be multiplied by the FFTSize, in current version of the code,
143 
144  std::string indVField = pset.get<std::string>("IndVFieldShape");
145  std::vector<double> indVFieldParams = pset.get<std::vector<double> >("IndVFieldParams");
146  fIndVFieldFunc = new TF1("indVField", indVField.c_str());
147  for(unsigned int i=0; i<indVFieldParams.size(); ++i)
148  fIndVFieldFunc->SetParameter(i, indVFieldParams[i]);
149  // Warning, last parameter needs to be multiplied by the FFTSize, in current version of the code,
150 
151  } else if ( fUseHistogramFieldShape ) {
152  mf::LogInfo("SignalShapingServiceDUNE") << " using the field response provided from a .root file " ;
153  int fNPlanes = 3;
154 
155  // constructor decides if initialized value is a path or an environment variable
157  cet::search_path sp("FW_SEARCH_PATH");
158  sp.find_file( pset.get<std::string>("FieldResponseFname"), fname );
159  std::string histoname = pset.get<std::string>("FieldResponseHistoName");
160 
161  std::unique_ptr<TFile> fin(new TFile(fname.c_str(), "READ"));
162  if ( !fin->IsOpen() ) throw art::Exception( art::errors::NotFound ) << "Could not find the field response file " << fname << "!" << std::endl;
163 
164  std::string iPlane[3] = { "U", "V", "Y" };
165 
166  for ( int i = 0; i < fNPlanes; i++ ) {
167  TString iHistoName = Form( "%s_%s", histoname.c_str(), iPlane[i].c_str());
168  TH1F *temp = (TH1F*) fin->Get( iHistoName );
169  if ( !temp ) throw art::Exception( art::errors::NotFound ) << "Could not find the field response histogram " << iHistoName << std::endl;
170  if ( temp->GetNbinsX() > fNFieldBins ) throw art::Exception( art::errors::InvalidNumber ) << "FieldBins should always be larger than or equal to the number of the bins in the input histogram!" << std::endl;
171 
172  fFieldResponseHist[i] = new TH1F( iHistoName, iHistoName, temp->GetNbinsX(), temp->GetBinLowEdge(1), temp->GetBinLowEdge( temp->GetNbinsX() + 1) );
173  temp->Copy(*fFieldResponseHist[i]);
174  fFieldResponseHist[i]->SetDirectory(0);
175  }
176 
177  fin->Close();
178  }
179 }
double fColFieldRespAmp
amplitude of response to field
TF1 * fColFilterFunc
Parameterized collection filter function.
bool fUseFunctionFieldShape
Flag that allows to use a parameterized field response instead of the hardcoded version.
bool fGetFilterFromHisto
Flag that allows to use a filter function from a histogram instead of the functional dependency...
std::vector< double > fShapeTimeConst
time constants for exponential shaping
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
double fCol3DCorrection
correction factor to account for 3D path of
int fNFieldBins
number of bins for field response
TF1 * fIndUFieldFunc
Parameterized induction field shape function.
std::vector< double > fFieldResponseTOffset
Time offset for field response in ns.
std::vector< DoubleVec > fNoiseFactVec
double fIndVFieldRespAmp
amplitude of response to field
double fADCPerPCAtLowestASICGain
Pulse amplitude gain for a 1 pc charge impulse after convoluting it the with field and electronics re...
double fInd3DCorrection
correction factor to account for 3D path of
double fIndUFieldRespAmp
amplitude of response to field
T get(std::string const &key) const
Definition: ParameterSet.h:271
TF1 * fIndUFilterFunc
Parameterized induction filter function.
bool fUseHistogramFieldShape
Flag that turns on field response shapes from histograms.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
TF1 * fIndVFieldFunc
Parameterized induction field shape function.
TF1 * fColFieldFunc
Parameterized collection field shape function.
TF1 * fIndVFilterFunc
Parameterized induction filter function.
TH1D * fFilterHist[3]
Histogram used to hold the collection filter, hardcoded for the time being.
double fInputFieldRespSamplingPeriod
Sampling period in the input field response.
QTextStream & endl(QTextStream &s)
TH1F * fFieldResponseHist[3]
Histogram used to hold the field response, hardcoded for the time being.
void util::SignalShapingServiceDUNE::SetElectResponse ( double  shapingtime,
double  gain 
)
private

Definition at line 575 of file SignalShapingServiceDUNE_service.cc.

576 {
577  // Get services.
578 
581 
582  MF_LOG_DEBUG("SignalShapingDUNE") << "Setting DUNE electronics response function...";
583 
584  int nticks = fft->FFTSize();
585  fElectResponse.resize(nticks, 0.);
586  std::vector<double> time(nticks,0.);
587 
588  //Gain and shaping time variables from fcl file:
589  double Ao = 1.0;
590  double To = shapingtime; //peaking time
591 
592  // this is actually sampling time, in ns
593  // mf::LogInfo("SignalShapingDUNE") << "Check sampling intervals: "
594  // << fSampleRate << " ns"
595  // << "Check number of samples: " << fNTicks;
596 
597  // The following sets the microboone electronics response function in
598  // time-space. Function comes from BNL SPICE simulation of DUNE35t
599  // electronics. SPICE gives the electronics transfer function in
600  // frequency-space. The inverse laplace transform of that function
601  // (in time-space) was calculated in Mathematica and is what is being
602  // used below. Parameters Ao and To are cumulative gain/timing parameters
603  // from the full (ASIC->Intermediate amp->Receiver->ADC) electronics chain.
604  // They have been adjusted to make the SPICE simulation to match the
605  // actual electronics response. Default params are Ao=1.4, To=0.5us.
606  double max = 0;
607 
608  for(size_t i = 0; i < fElectResponse.size(); ++i){
609 
610  //convert time to microseconds, to match fElectResponse[i] definition
611  time[i] = (1.*i)*fInputFieldRespSamplingPeriod *1e-3;
612  fElectResponse[i] =
613  4.31054*exp(-2.94809*time[i]/To)*Ao - 2.6202*exp(-2.82833*time[i]/To)*cos(1.19361*time[i]/To)*Ao
614  -2.6202*exp(-2.82833*time[i]/To)*cos(1.19361*time[i]/To)*cos(2.38722*time[i]/To)*Ao
615  +0.464924*exp(-2.40318*time[i]/To)*cos(2.5928*time[i]/To)*Ao
616  +0.464924*exp(-2.40318*time[i]/To)*cos(2.5928*time[i]/To)*cos(5.18561*time[i]/To)*Ao
617  +0.762456*exp(-2.82833*time[i]/To)*sin(1.19361*time[i]/To)*Ao
618  -0.762456*exp(-2.82833*time[i]/To)*cos(2.38722*time[i]/To)*sin(1.19361*time[i]/To)*Ao
619  +0.762456*exp(-2.82833*time[i]/To)*cos(1.19361*time[i]/To)*sin(2.38722*time[i]/To)*Ao
620  -2.6202*exp(-2.82833*time[i]/To)*sin(1.19361*time[i]/To)*sin(2.38722*time[i]/To)*Ao
621  -0.327684*exp(-2.40318*time[i]/To)*sin(2.5928*time[i]/To)*Ao +
622  +0.327684*exp(-2.40318*time[i]/To)*cos(5.18561*time[i]/To)*sin(2.5928*time[i]/To)*Ao
623  -0.327684*exp(-2.40318*time[i]/To)*cos(2.5928*time[i]/To)*sin(5.18561*time[i]/To)*Ao
624  +0.464924*exp(-2.40318*time[i]/To)*sin(2.5928*time[i]/To)*sin(5.18561*time[i]/To)*Ao;
625 
626  if(fElectResponse[i] > max) max = fElectResponse[i];
627 
628  }// end loop over time buckets
629 
630 
631  MF_LOG_DEBUG("SignalShapingDUNE") << " Done.";
632 
633  //normalize fElectResponse[i], before the convolution
634 
635  for(auto& element : fElectResponse){
636  element /= max;
637  element *= fADCPerPCAtLowestASICGain * 1.60217657e-7;
638  element *= gain / 4.7;
639  }
640 
641  return;
642 
643 }
double fADCPerPCAtLowestASICGain
Pulse amplitude gain for a 1 pc charge impulse after convoluting it the with field and electronics re...
int FFTSize() const
Definition: LArFFT.h:69
const double e
static int max(int a, int b)
#define MF_LOG_DEBUG(id)
double fInputFieldRespSamplingPeriod
Sampling period in the input field response.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void util::SignalShapingServiceDUNE::SetFieldResponse ( detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp 
)
private

in cm

number of bins //KP

Definition at line 456 of file SignalShapingServiceDUNE_service.cc.

458 {
459  // Get services.
460 
462 
463  // Get plane pitch.
464 
465  double xyz1[3] = {0.};
466  double xyz2[3] = {0.};
467  double xyzl[3] = {0.};
468  // should always have at least 2 planes
469  geo->Plane(0).LocalToWorld(xyzl, xyz1);
470  geo->Plane(1).LocalToWorld(xyzl, xyz2);
471 
472  // this assumes all planes are equidistant from each other,
473  // probably not a bad assumption
474  double pitch = xyz2[0] - xyz1[0]; ///in cm
475 
476  fColFieldResponse.resize(fNFieldBins, 0.);
477  fIndUFieldResponse.resize(fNFieldBins, 0.);
478  fIndVFieldResponse.resize(fNFieldBins, 0.);
479 
480  // set the response for the collection plane first
481  // the first entry is 0
482 
483  double driftvelocity=detProp.DriftVelocity()/1000.;
484  int nbinc = TMath::Nint(fCol3DCorrection*(std::abs(pitch))/(driftvelocity*sampling_rate(clockData))); ///number of bins //KP
485  double integral = 0;
486  ////////////////////////////////////////////////////
488  {
490  int signalSize = fft->FFTSize();
491  std::vector<double> ramp(signalSize);
492  // TComplex kernBin;
493  // int size = signalSize/2;
494  // int bin=0;
495  //std::vector<TComplex> freqSig(size+1);
496  std::vector<double> bipolar(signalSize);
497 
498 
499  fColFieldResponse.resize(signalSize, 0.);
500  fIndUFieldResponse.resize(signalSize, 0.);
501  fIndVFieldResponse.resize(signalSize, 0.);
502 
503  // Hardcoding. Bad. Temporary hopefully.
504  fIndUFieldFunc->SetParameter(4,fIndUFieldFunc->GetParameter(4)*signalSize);
505  fIndVFieldFunc->SetParameter(4,fIndVFieldFunc->GetParameter(4)*signalSize);
506 
507  //double integral = 0.;
508  for(int i = 0; i < signalSize; i++) {
509  ramp[i]=fColFieldFunc->Eval(i);
510  fColFieldResponse[i]=ramp[i];
511  integral += fColFieldResponse[i];
512  // rampc->Fill(i,ramp[i]);
513  bipolar[i]=fIndUFieldFunc->Eval(i);
514  fIndUFieldResponse[i]=bipolar[i];
515  bipolar[i]=fIndVFieldFunc->Eval(i);
516  fIndVFieldResponse[i]=bipolar[i];
517  // bipol->Fill(i,bipolar[i]);
518  }
519 
520  for(int i = 0; i < signalSize; ++i){
522  }
523 
524  //this might be not necessary if the function definition is not defined in the middle of the signal range
525  fft->ShiftData(fIndUFieldResponse,signalSize/2.0);
526  } else if ( fUseHistogramFieldShape ) {
527 
528  // Ticks in nanosecond
529  // Calculate the normalization of the collection plane
530  for ( int ibin = 1; ibin <= fFieldResponseHist[2]->GetNbinsX(); ibin++ )
531  integral += fFieldResponseHist[2]->GetBinContent( ibin );
532 
533  // Induction plane
534  for ( int ibin = 1; ibin <= fFieldResponseHist[0]->GetNbinsX(); ibin++ )
535  fIndUFieldResponse[ibin-1] = fIndUFieldRespAmp*fFieldResponseHist[0]->GetBinContent( ibin )/integral;
536 
537  for ( int ibin = 1; ibin <= fFieldResponseHist[1]->GetNbinsX(); ibin++ )
538  fIndVFieldResponse[ibin-1] = fIndVFieldRespAmp*fFieldResponseHist[1]->GetBinContent( ibin )/integral;
539 
540  for ( int ibin = 1; ibin <= fFieldResponseHist[2]->GetNbinsX(); ibin++ )
541  fColFieldResponse[ibin-1] = fColFieldRespAmp*fFieldResponseHist[2]->GetBinContent( ibin )/integral;
542  }else
543  {
544  //////////////////////////////////////////////////
545  mf::LogInfo("SignalShapingServiceDUNE") << " using the old field shape ";
546  double integral = 0.;
547  for(int i = 1; i < nbinc; ++i){
548  fColFieldResponse[i] = fColFieldResponse[i-1] + 1.0;
549  integral += fColFieldResponse[i];
550  }
551 
552  for(int i = 0; i < nbinc; ++i){
554  }
555 
556  // now the induction plane
557 
558 
559  int nbini = TMath::Nint(fInd3DCorrection*(fabs(pitch))/(driftvelocity*sampling_rate(clockData)));//KP
560  for(int i = 0; i < nbini; ++i){
561  fIndUFieldResponse[i] = fIndUFieldRespAmp/(1.*nbini);
562  fIndUFieldResponse[nbini+i] = -fIndUFieldRespAmp/(1.*nbini);
563  }
564 
565  for(int i = 0; i < nbini; ++i){
566  fIndVFieldResponse[i] = fIndVFieldRespAmp/(1.*nbini);
567  fIndVFieldResponse[nbini+i] = -fIndVFieldRespAmp/(1.*nbini);
568  }
569 
570  }
571 
572  return;
573 }
double fColFieldRespAmp
amplitude of response to field
bool fUseFunctionFieldShape
Flag that allows to use a parameterized field response instead of the hardcoded version.
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
void ShiftData(std::vector< TComplex > &input, double shift)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
double fCol3DCorrection
correction factor to account for 3D path of
int fNFieldBins
number of bins for field response
TF1 * fIndUFieldFunc
Parameterized induction field shape function.
double fIndVFieldRespAmp
amplitude of response to field
T abs(T value)
int FFTSize() const
Definition: LArFFT.h:69
double fInd3DCorrection
correction factor to account for 3D path of
double fIndUFieldRespAmp
amplitude of response to field
bool fUseHistogramFieldShape
Flag that turns on field response shapes from histograms.
TF1 * fIndVFieldFunc
Parameterized induction field shape function.
TF1 * fColFieldFunc
Parameterized collection field shape function.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1343
TH1F * fFieldResponseHist[3]
Histogram used to hold the field response, hardcoded for the time being.
void util::SignalShapingServiceDUNE::SetFilters ( detinfo::DetectorClocksData const &  clockData)
private

Definition at line 650 of file SignalShapingServiceDUNE_service.cc.

651 {
652  // Get services.
653 
655 
656  double ts = sampling_rate(clockData);
657  int n = fft->FFTSize() / 2;
658 
659  // Calculate collection filter.
660 
661  fColFilter.resize(n+1);
662  fIndUFilter.resize(n+1);
663  fIndVFilter.resize(n+1);
664 
666  {
667  fColFilterFunc->SetRange(0, double(n));
668 
669  for(int i=0; i<=n; ++i) {
670  double freq = 500. * i / (ts * n); // Cycles / microsecond.
671  double f = fColFilterFunc->Eval(freq);
672  fColFilter[i] = TComplex(f, 0.);
673  }
674 
675 
676  // Calculate induction filter.
677 
678  fIndUFilterFunc->SetRange(0, double(n));
679 
680  for(int i=0; i<=n; ++i) {
681  double freq = 500. * i / (ts * n); // Cycles / microsecond.
682  double f = fIndUFilterFunc->Eval(freq);
683  fIndUFilter[i] = TComplex(f, 0.);
684  }
685 
686  fIndVFilterFunc->SetRange(0, double(n));
687 
688  for(int i=0; i<=n; ++i) {
689  double freq = 500. * i / (ts * n); // Cycles / microsecond.
690  double f = fIndVFilterFunc->Eval(freq);
691  fIndVFilter[i] = TComplex(f, 0.);
692  }
693 
694  }
695  else
696  {
697 
698  for(int i=0; i<=n; ++i) {
699  double f = fFilterHist[2]->GetBinContent(i); // hardcoded plane numbers. Bad. To change later.
700  fColFilter[i] = TComplex(f, 0.);
701  double g = fFilterHist[1]->GetBinContent(i);
702  fIndVFilter[i] = TComplex(g, 0.);
703  double h = fFilterHist[0]->GetBinContent(i);
704  fIndUFilter[i] = TComplex(h, 0.);
705  }
706  }
707 
708  //fIndUSignalShaping.AddFilterFunction(fIndFilter);
709  //fIndVSignalShaping.AddFilterFunction(fIndVFilter);
710  //fColSignalShaping.AddFilterFunction(fColFilter);
711 
712 }
TF1 * fColFilterFunc
Parameterized collection filter function.
bool fGetFilterFromHisto
Flag that allows to use a filter function from a histogram instead of the functional dependency...
static constexpr double g
Definition: Units.h:144
int FFTSize() const
Definition: LArFFT.h:69
std::void_t< T > n
TF1 * fIndUFilterFunc
Parameterized induction filter function.
TF1 * fIndVFilterFunc
Parameterized induction filter function.
TH1D * fFilterHist[3]
Histogram used to hold the collection filter, hardcoded for the time being.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
void util::SignalShapingServiceDUNE::SetRCResponse ( )
private
void util::SignalShapingServiceDUNE::SetResponseSampling ( detinfo::DetectorClocksData const &  clockData,
bool  elect_only = false 
)
private

VELOCITY-OUT ... comment out kDVel usage here

VELOCITY-OUT ... comment out kDVel usage here

VELOCITY-OUT ... comment out kDVel usage here

Definition at line 717 of file SignalShapingServiceDUNE_service.cc.

718 {
719  // Get services
722 
723  // Operation permitted only if output of rebinning has a larger bin size
725  throw cet::exception(__FUNCTION__) << "\033[93m"
726  << "Invalid operation: cannot rebin to a more finely binned vector!"
727  << "\033[00m" << std::endl;
728 
729  int nticks = fft->FFTSize();
730  std::vector<double> SamplingTime( nticks, 0. );
731  for ( int itime = 0; itime < nticks; itime++ ) {
732  SamplingTime[itime] = (1.*itime) * sampling_rate(clockData);
733  /// VELOCITY-OUT ... comment out kDVel usage here
734  //SamplingTime[itime] = (1.*itime) * sampling_rate(clockData) / kDVel;
735  }
736 
737  // Sampling
738  for ( int iplane = 0; iplane < 3; iplane++ ) {
739  const std::vector<double>* pResp;
740  if (not elect_only) {
741  switch ( iplane ) {
742  case 0: pResp = &(fIndUSignalShaping.Response_save()); break;
743  case 1: pResp = &(fIndVSignalShaping.Response_save()); break;
744  default: pResp = &(fColSignalShaping.Response_save()); break;
745  }
746  } else {
747  switch ( iplane ) {
748  case 0: pResp = &(fIndUElectResponseSignalShaping.Response_save()); break;
749  case 1: pResp = &(fIndVElectResponseSignalShaping.Response_save()); break;
750  default: pResp = &(fColElectResponseSignalShaping.Response_save()); break;
751  }
752  }
753 
754  std::vector<double> SamplingResp(nticks , 0. );
755 
756 
757  int nticks_input = pResp->size();
758  std::vector<double> InputTime(nticks_input, 0. );
759  for ( int itime = 0; itime < nticks_input; itime++ ) {
760  InputTime[itime] = (1.*itime) * fInputFieldRespSamplingPeriod;
761  }
762 
763 
764  /*
765  Much more sophisticated approach using a linear (trapezoidal) interpolation
766  Current default!
767  */
768  int SamplingCount = 0;
769  for ( int itime = 0; itime < nticks; itime++ ) {
770  int low = -1, up = -1;
771  for ( int jtime = 0; jtime < nticks_input; jtime++ ) {
772  if ( InputTime[jtime] == SamplingTime[itime] ) {
773  SamplingResp[itime] = (*pResp)[jtime];
774  /// VELOCITY-OUT ... comment out kDVel usage here
775  //SamplingResp[itime] = kDVel * (*pResp)[jtime];
776  SamplingCount++;
777  break;
778  } else if ( InputTime[jtime] > SamplingTime[itime] ) {
779  low = jtime - 1;
780  up = jtime;
781  SamplingResp[itime] = (*pResp)[low] + ( SamplingTime[itime] - InputTime[low] ) * ( (*pResp)[up] - (*pResp)[low] ) / ( InputTime[up] - InputTime[low] );
782  /// VELOCITY-OUT ... comment out kDVel usage here
783  //SamplingResp[itime] *= kDVel;
784  SamplingCount++;
785  break;
786  } else {
787  SamplingResp[itime] = 0.;
788  }
789  } // for ( int jtime = 0; jtime < nticks; jtime++ )
790  } // for ( int itime = 0; itime < nticks; itime++ )
791  SamplingResp.resize( SamplingCount, 0.);
792 
793 
794  if (not elect_only) {
795  switch ( iplane ) {
796  case 0: fIndUSignalShaping.AddResponseFunction( SamplingResp, true ); break;
797  case 1: fIndVSignalShaping.AddResponseFunction( SamplingResp, true ); break;
798  default: fColSignalShaping.AddResponseFunction( SamplingResp, true ); break;
799  }
800  } else {
801  switch ( iplane ) {
802  case 0: fIndUElectResponseSignalShaping.AddResponseFunction( SamplingResp, true ); break;
803  case 1: fIndVElectResponseSignalShaping.AddResponseFunction( SamplingResp, true ); break;
804  default: fColElectResponseSignalShaping.AddResponseFunction( SamplingResp, true ); break;
805  }
806 
807  }
808 
809 
810 
811  } // for ( int iplane = 0; iplane < fNPlanes; iplane++ )
812 
813  return;
814 }
const std::vector< double > & Response_save() const
Definition: SignalShaping.h:78
util::SignalShaping fColElectResponseSignalShaping
void AddResponseFunction(const std::vector< double > &resp, bool ResetResponse=false)
int FFTSize() const
Definition: LArFFT.h:69
util::SignalShaping fIndUElectResponseSignalShaping
util::SignalShaping fIndVElectResponseSignalShaping
double fInputFieldRespSamplingPeriod
Sampling period in the input field response.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
const util::SignalShaping & util::SignalShapingServiceDUNE::SignalShaping ( Channel  channel) const
overridevirtual

Implements SignalShapingService.

Definition at line 185 of file SignalShapingServiceDUNE_service.cc.

185  {
186  const string myname = "SignalShapingServiceDUNE::ctor: ";
187  if(!fInit)
188  init();
189 
190  // Figure out plane type.
191 
193  //geo::SigType_t sigtype = geom->SignalType(channel);
194 
195  // we need to distinguis between the U and V planes
196  geo::View_t view = geom->View(channel);
197 
198  // Return appropriate shaper.
199 
200  if(view == geo::kU)
201  return fIndUSignalShaping;
202  else if (view == geo::kV)
203  return fIndVSignalShaping;
204  else if(view == geo::kZ)
205  return fColSignalShaping;
206  else
207  throw cet::exception("SignalShapingServiceDUNEt") << myname
208  << "can't determine view for channel " << channel << " with geometry " << geom->DetectorName() << "\n";
209 
210 return fColSignalShaping;
211 }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:132
uint8_t channel
Definition: CRTFragment.hh:201
Planes which measure U.
Definition: geo_types.h:129
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

double util::SignalShapingServiceDUNE::fADCPerPCAtLowestASICGain
private

Pulse amplitude gain for a 1 pc charge impulse after convoluting it the with field and electronics response with the lowest ASIC gain setting of 4.7 mV/fC.

Definition at line 134 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fASICGainInMVPerFC
private

Definition at line 136 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fCalibResponseTOffset
private

Definition at line 131 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fCol3DCorrection
private

correction factor to account for 3D path of

Definition at line 125 of file SignalShapingServiceDUNE.h.

util::SignalShaping util::SignalShapingServiceDUNE::fColElectResponseSignalShaping
private

Definition at line 155 of file SignalShapingServiceDUNE.h.

TF1* util::SignalShapingServiceDUNE::fColFieldFunc
private

Parameterized collection field shape function.

Definition at line 144 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fColFieldRespAmp
private

amplitude of response to field

Definition at line 127 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fColFieldResponse
private

Definition at line 160 of file SignalShapingServiceDUNE.h.

std::vector<TComplex> util::SignalShapingServiceDUNE::fColFilter
private

Definition at line 168 of file SignalShapingServiceDUNE.h.

TF1* util::SignalShapingServiceDUNE::fColFilterFunc
private

Parameterized collection filter function.

Definition at line 138 of file SignalShapingServiceDUNE.h.

util::SignalShaping util::SignalShapingServiceDUNE::fColSignalShaping
private

Definition at line 151 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fDeconNorm
private

Definition at line 133 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fElectResponse
private

Definition at line 165 of file SignalShapingServiceDUNE.h.

TH1F* util::SignalShapingServiceDUNE::fFieldResponseHist[3]
private

Histogram used to hold the field response, hardcoded for the time being.

Definition at line 147 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fFieldResponseTOffset
private

Time offset for field response in ns.

Definition at line 130 of file SignalShapingServiceDUNE.h.

TH1D* util::SignalShapingServiceDUNE::fFilterHist[3]
private

Histogram used to hold the collection filter, hardcoded for the time being.

Definition at line 148 of file SignalShapingServiceDUNE.h.

bool util::SignalShapingServiceDUNE::fGetFilterFromHisto
private

Flag that allows to use a filter function from a histogram instead of the functional dependency.

Definition at line 143 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fInd3DCorrection
private

correction factor to account for 3D path of

Definition at line 126 of file SignalShapingServiceDUNE.h.

util::SignalShaping util::SignalShapingServiceDUNE::fIndUElectResponseSignalShaping
private

Definition at line 156 of file SignalShapingServiceDUNE.h.

TF1* util::SignalShapingServiceDUNE::fIndUFieldFunc
private

Parameterized induction field shape function.

Definition at line 145 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fIndUFieldRespAmp
private

amplitude of response to field

Definition at line 128 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fIndUFieldResponse
private

Definition at line 161 of file SignalShapingServiceDUNE.h.

std::vector<TComplex> util::SignalShapingServiceDUNE::fIndUFilter
private

Definition at line 169 of file SignalShapingServiceDUNE.h.

TF1* util::SignalShapingServiceDUNE::fIndUFilterFunc
private

Parameterized induction filter function.

Definition at line 139 of file SignalShapingServiceDUNE.h.

util::SignalShaping util::SignalShapingServiceDUNE::fIndUSignalShaping
private

Definition at line 152 of file SignalShapingServiceDUNE.h.

util::SignalShaping util::SignalShapingServiceDUNE::fIndVElectResponseSignalShaping
private

Definition at line 157 of file SignalShapingServiceDUNE.h.

TF1* util::SignalShapingServiceDUNE::fIndVFieldFunc
private

Parameterized induction field shape function.

Definition at line 146 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fIndVFieldRespAmp
private

amplitude of response to field

Definition at line 129 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fIndVFieldResponse
private

Definition at line 162 of file SignalShapingServiceDUNE.h.

std::vector<TComplex> util::SignalShapingServiceDUNE::fIndVFilter
private

Definition at line 170 of file SignalShapingServiceDUNE.h.

TF1* util::SignalShapingServiceDUNE::fIndVFilterFunc
private

Parameterized induction filter function.

Definition at line 140 of file SignalShapingServiceDUNE.h.

util::SignalShaping util::SignalShapingServiceDUNE::fIndVSignalShaping
private

Definition at line 153 of file SignalShapingServiceDUNE.h.

bool util::SignalShapingServiceDUNE::fInit
private

Initialization flag.

Definition at line 117 of file SignalShapingServiceDUNE.h.

double util::SignalShapingServiceDUNE::fInputFieldRespSamplingPeriod
private

Sampling period in the input field response.

Definition at line 132 of file SignalShapingServiceDUNE.h.

int util::SignalShapingServiceDUNE::fNFieldBins
private

number of bins for field response

Definition at line 124 of file SignalShapingServiceDUNE.h.

std::vector<DoubleVec> util::SignalShapingServiceDUNE::fNoiseFactVec
private

Definition at line 135 of file SignalShapingServiceDUNE.h.

std::vector<double> util::SignalShapingServiceDUNE::fShapeTimeConst
private

time constants for exponential shaping

Definition at line 137 of file SignalShapingServiceDUNE.h.

bool util::SignalShapingServiceDUNE::fUseFunctionFieldShape
private

Flag that allows to use a parameterized field response instead of the hardcoded version.

Definition at line 141 of file SignalShapingServiceDUNE.h.

bool util::SignalShapingServiceDUNE::fUseHistogramFieldShape
private

Flag that turns on field response shapes from histograms.

Definition at line 142 of file SignalShapingServiceDUNE.h.


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