DetectorUtils.cxx
Go to the documentation of this file.
2 #include <stdexcept>
3 
4 using namespace novaddt::utils;
5 
6 ///----------------------------------
7 /// methods for FarDet
8 ///----------------------------------
10 {
11  auto cellid = hit.Cell().val;
12  //NOTE: Do we think 32 cells per module can ever change
13  //This number can be found in DAQChannelMap but did not want to add that
14  //dependancy to geometry unless needed.
15  const int kCellsPerModule = 32;
16  cellid = cellid % kCellsPerModule;
17  // In vertical planes, high cell numbers have longer fibres.
18  // In horizontal planes it's the opposite, so flip it round.
19  if(hit.View().val == daqchannelmap::X_VIEW)
20  cellid = kCellsPerModule-cellid-1;
21 
22  // This should really never happen, but just to be safe...
23  if(cellid < 0 || cellid >= kCellsPerModule) return 100;
24  // Email from Tom Chase 2011-04-29
25  // NB: this isn't just a ~3.8cm change per cell. Every 8 cells something
26  // different happens.
27  const double kPigtails[kCellsPerModule] = {
28  34.5738, 38.4379, 42.3020, 46.1660, 50.0301, 53.8942, 57.7582, 61.6223,
29  64.7504, 68.6144, 72.4785, 76.3426, 80.2067, 84.0707, 87.9348, 91.0790,
30  95.3301, 99.1941, 103.058, 106.922, 110.786, 114.650, 118.514, 122.379,
31  125.507, 129.371, 133.235, 137.099, 140.963, 144.827, 148.691, 150.751
32  };
33  return kPigtails[cellid];
34 }
35 
37 {
38  return (hit.Cell().val/64)*40.;
39 }
40 
41 
42 ///----------------------------------
43 /// methods for NDOS
44 ///----------------------------------
46 {
47  return 0;
48 }
49 
51 {
52  uint16_t cell=hit.Cell().val;
53  // Cell number starts from 1
54  if (hit.View().val == daqchannelmap::Y_VIEW)
55  if (cell > 31 && cell < 64) return -26;
56  else if (cell > 63) return -40;
57  else return 0;
58  else // X_VIEW
59  if (cell > 7 && cell < 32) return -10;
60  else if (cell > 31) return 5;
61  else return 0;
62 }
63 
64 
65 ///----------------------------------
66 /// methods for DetectorUtils
67 ///----------------------------------
69  fAttens({{0.3137,289.5},{0.1669,852.3}})
70 {
71  //create an inner object based on the detector name
72  if(detector == "fd" || detector == "FD")
73  fInner.reset(new _detail::FDUtil());
74  else if(detector == "ndos" || detector == "NDOS")
75  fInner.reset(new _detail::NDOSUtil());
76  else
77  throw std::logic_error("Unknown detector name:"+detector);
78 }
79 
81 {
82  return GetCellLength(hit) - kCellWidth*cell.val;
83 }
84 
85 double DetectorUtils::DistTimeOffset(double dist) const
86 {
87  return dist/kSpeedOfFiberTransport;
88 }
89 
91 {
92  return GetDCMoffset(hit); // + DistTimeOffset(GetPigtail(hit));
93 }
94 
95 double DetectorUtils::TimeOffsetFull(const DAQHit& hit, double dist) const
96 {
97  return DistTimeOffset(dist) + CellTimeOffset(hit);
98 }
99 
100 
102 {
103  //attenuation in *dist* cm of fiber length
104  double res = 0;
105  for (auto& a: fAttens)
106  res+=a.Eval(dist);
107  return res;
108 }
109 
110 double DetectorUtils::AttenFactor(const DAQHit& hit, double dist) const
111 {
112  // Adopted from PhotonTransport/ImprovedTransport::FiberTransmission
113  double pig = GetPigtail(hit);
114  return AttenuationInFiber(dist+pig)+AttenuationInFiber(2*GetCellLength(hit)-dist+pig);
115 
116 }
double GetDCMoffset(const DAQHit &hit) const
Definition: DetectorUtils.h:87
double AttenuationInFiber(double dist) const
value_type val
Definition: BaseProducts.h:109
double AttenFactor(const DAQHit &hit, double dist) const
double GetPigtail(const DAQHit &) const
double DistTimeOffset(double dist) const
double CellTimeOffset(const DAQHit &hit) const
DetectorUtils(std::string detector)
double dist
Definition: runWimpSim.h:113
Identifier for the Y measuring view of the detector (side)
const double a
double GetDCMoffset(const DAQHit &) const
novaddt::View const & View() const
Definition: DAQHit.h:72
Identifier for the X measuring view of the detector (top)
std::unique_ptr< _detail::VirtualDetUtil > fInner
Definition: DetectorUtils.h:92
double TimeOffsetFull(const DAQHit &hit, double dist) const
double GetReadoutDistance(const DAQHit &hit, const novaddt::Cell &cell) const
double GetPigtail(const DAQHit &) const
Definition: structs.h:12
value_type val
Definition: BaseProducts.h:137
double GetPigtail(const DAQHit &hit) const
Definition: DetectorUtils.h:84
double GetDCMoffset(const DAQHit &) const
novaddt::Cell const & Cell() const
Definition: DAQHit.h:71
const double kSpeedOfFiberTransport
Definition: DetectorUtils.h:11
const double kCellWidth
Definition: DetectorUtils.h:9
std::vector< Atten > fAttens
Definition: DetectorUtils.h:93
double GetCellLength(const novaddt::View &v) const
Definition: DetectorUtils.h:81
enum BeamMode string