DetectorUtils.h
Go to the documentation of this file.
1 #ifndef __DETECTOTRUTILS__H
2 #define __DETECTOTRUTILS__H
3 
5 
6 namespace novaddt{
7 namespace utils{
8 
9 const double kCellWidth = 3.97; //cm
10 const double kPlaneWidth = 6.654; //cm
11 const double kSpeedOfFiberTransport = 15.3; // cm/ns, "first principles" calib.
12 const double kTDC_to_ns = 15.625; // 1/64E6=15.625 ns
13 
14 namespace _detail{
15 
16 
18 public:
19  virtual ~VirtualDetUtil(){};
20  virtual double GetPigtail(const DAQHit& ) const = 0;
21  virtual double GetDCMoffset(const DAQHit& ) const = 0;
22  virtual double GetCellLength(const novaddt::View&) const = 0;
23 };
24 
25 
26 class FDUtil: public VirtualDetUtil{
27 public:
28  double GetPigtail(const DAQHit& ) const;
29  double GetDCMoffset(const DAQHit& ) const;
30  double GetCellLength(const novaddt::View&) const
31  {
32  return 1560;
33  }
34 };
35 
36 class NDOSUtil: public VirtualDetUtil{
37 public:
38  double GetPigtail(const DAQHit& ) const;
39  double GetDCMoffset(const DAQHit& ) const;
40  double GetCellLength(const novaddt::View& v) const
41  {
42  return (v.val==daqchannelmap::X_VIEW)?920:1000;
43  }
44 };
45 
46 }//end of _detail
47 
48 
49 // \brief an exponent part for attenuation
50 class Atten
51 {
52 public:
53  Atten(double C, double L):fC(C),fL(L){}
54  double Eval(double x) const { return fC*std::exp(-x/fL); }
55 private:
56  double fC;
57  double fL;
58 
59 };
60 
62 {
63 public:
65  void SetAttenuationParameters(std::vector<Atten> attens){fAttens=attens;}
66 
67  double DistTimeOffset(double dist) const;
68  double CellTimeOffset(const DAQHit& hit) const;
69  double PigTimeOffset (const DAQHit& hit) const {
70  return DistTimeOffset(GetPigtail(hit));
71  }
72 
73  double TimeOffsetFull(const DAQHit& hit, double dist) const;
74  double AttenuationInFiber(double dist) const;
75  double AttenFactor(const DAQHit& hit, double dist) const;
76  double GetReadoutDistance(const DAQHit& hit,const novaddt::Cell& cell) const;
77  //simple conversion constants
78  const double TDC_to_ns(){return kTDC_to_ns;}
79  const double ns_to_TDC(){return 1./kTDC_to_ns;}
80  //delegate these methods to inner object
81  double GetCellLength(const novaddt::View& v) const{
82  return fInner->GetCellLength(v);
83  }
84  double GetPigtail(const DAQHit& hit) const {
85  return fInner->GetPigtail(hit);
86  }
87  double GetDCMoffset(const DAQHit& hit) const{
88  return fInner->GetDCMoffset(hit);
89  }
90 
91 private:
92  std::unique_ptr<_detail::VirtualDetUtil> fInner; // class for concrete detector
93  std::vector<Atten> fAttens; //vector of attenuation parameters
94 };
95 
96 } //end of namespace utils
97 } //end of namespace novaddt
98 
99 
100 #endif
double GetDCMoffset(const DAQHit &hit) const
Definition: DetectorUtils.h:87
double Eval(double x) const
Definition: DetectorUtils.h:54
virtual double GetCellLength(const novaddt::View &) const =0
static constexpr Double_t fC
Definition: Munits.h:236
Atten(double C, double L)
Definition: DetectorUtils.h:53
double dist
Definition: runWimpSim.h:113
const double C
virtual double GetDCMoffset(const DAQHit &) const =0
const double kTDC_to_ns
Definition: DetectorUtils.h:12
static constexpr double L
Identifier for the X measuring view of the detector (top)
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
std::unique_ptr< _detail::VirtualDetUtil > fInner
Definition: DetectorUtils.h:92
virtual double GetPigtail(const DAQHit &) const =0
void SetAttenuationParameters(std::vector< Atten > attens)
Definition: DetectorUtils.h:65
double PigTimeOffset(const DAQHit &hit) const
Definition: DetectorUtils.h:69
double GetCellLength(const novaddt::View &) const
Definition: DetectorUtils.h:30
Definition: structs.h:12
const double kPlaneWidth
Definition: DetectorUtils.h:10
value_type val
Definition: BaseProducts.h:137
double GetPigtail(const DAQHit &hit) const
Definition: DetectorUtils.h:84
const double kSpeedOfFiberTransport
Definition: DetectorUtils.h:11
const double kCellWidth
Definition: DetectorUtils.h:9
double GetCellLength(const novaddt::View &v) const
Definition: DetectorUtils.h:40
std::vector< Atten > fAttens
Definition: DetectorUtils.h:93
double GetCellLength(const novaddt::View &v) const
Definition: DetectorUtils.h:81
enum BeamMode string