Functions
ddthelpers Namespace Reference

Functions

rb::Cluster cluster_hits (std::vector< art::Ptr< rb::CellHit > > const &hits, int32_t t_start, int32_t t_end, int16_t adc_cut=0)
 
bool is_equal (novaddt::DAQHit const &ddthit, art::Ptr< rb::CellHit > const &cellhit, novaddt::TDC const &event_time)
 
bool is_equal (novaddt::DAQHit const &ddthit, rawdata::RawDigit const &digit, novaddt::TDC const &event_time)
 
bool is_equal (novaddt::DAQHit const &lhs, novaddt::DAQHit const &rhs)
 
void print (novaddt::DAQHit const &h, unsigned long long const &event_time=0)
 
void print (art::Ptr< rb::CellHit > const &h)
 
void print (rawdata::RawDigit const &h)
 
void print (std::vector< novaddt::TriggerDecision > const &decisions)
 

Function Documentation

rb::Cluster ddthelpers::cluster_hits ( std::vector< art::Ptr< rb::CellHit > > const &  hits,
int32_t  t_start,
int32_t  t_end,
int16_t  adc_cut = 0 
)

Definition at line 13 of file DDTHelpers.cxx.

References rb::Cluster::Add(), hits(), is_equal(), and fillBadChanDBTables::result.

Referenced by mono::SlowMonopoleFilt::filter().

15 {
17 
18  for (auto const& hit : hits)
19  if (hit->TDC() >= t_start &&
20  hit->TDC() <= t_end &&
21  hit->ADC() >= adc_cut)
22  result.Add(hit);
23 
24  return result;
25 }
A collection of associated CellHits.
Definition: Cluster.h:47
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
Definition: Cluster.cxx:84
void hits()
Definition: readHits.C:15
Definition: event.h:1
bool ddthelpers::is_equal ( novaddt::DAQHit const &  ddthit,
art::Ptr< rb::CellHit > const &  cellhit,
novaddt::TDC const &  event_time 
)

Definition at line 30 of file DDTHelpers.cxx.

References novaddt::DAQHit::ADC(), rawdata::RawDigit::ADC(), rb::CellHit::Cell(), novaddt::DAQHit::Cell(), rb::CellHit::Plane(), novaddt::DAQHit::Plane(), novaddt::DAQHit::TDC(), rawdata::RawDigit::TDC(), novaddt::TDC::val, novaddt::ADC::val, novaddt::Plane::val, and novaddt::Cell::val.

Referenced by cluster_hits(), mono::SlowMonopoleFilt::filter(), and is_equal().

32 {
33  int64_t ddt_time = ddthit.TDC().val - event_time;
34 
35  if (ddt_time != cellhit->TDC())
36  return false;
37 
38  if (ddthit.ADC().val != cellhit->ADC())
39  return false;
40 
41  if (ddthit.Plane().val != cellhit->Plane())
42  return false;
43 
44  if (ddthit.Cell().val != cellhit->Cell())
45  return false;
46 
47  return true;
48 }
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
unsigned short Plane() const
Definition: CellHit.h:39
unsigned short Cell() const
Definition: CellHit.h:40
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
bool ddthelpers::is_equal ( novaddt::DAQHit const &  ddthit,
rawdata::RawDigit const &  digit,
novaddt::TDC const &  event_time 
)

Definition at line 53 of file DDTHelpers.cxx.

References novaddt::DAQHit::ADC(), rawdata::RawDigit::ADC(), is_equal(), novaddt::DAQHit::TDC(), rawdata::RawDigit::TDC(), novaddt::TDC::val, and novaddt::ADC::val.

55 {
56  int64_t ddt_time = ddthit.TDC().val - event_time;
57 
58  if (ddt_time != digit.TDC())
59  return false;
60 
61  if (ddthit.ADC().val != digit.ADC(0))
62  return false;
63 
64  return true;
65 }
bool ddthelpers::is_equal ( novaddt::DAQHit const &  lhs,
novaddt::DAQHit const &  rhs 
)

Definition at line 70 of file DDTHelpers.cxx.

References novaddt::DAQHit::ADC(), print(), novaddt::DAQHit::TDC(), novaddt::TDC::val, and novaddt::ADC::val.

71 {
72  if (lhs.TDC().val != rhs.TDC().val)
73  return false;
74 
75  if (lhs.ADC().val != rhs.ADC().val)
76  return false;
77 
78  return true;
79 }
void ddthelpers::print ( novaddt::DAQHit const &  h,
unsigned long long const &  event_time = 0 
)

Definition at line 84 of file DDTHelpers.cxx.

References novaddt::DAQHit::ADC(), novaddt::DAQHit::Cell(), om::cout, allTimeWatchdog::endl, novadaq::HexUtils::format(), geom(), novaddt::DAQHit::Plane(), geo::GeometryBase::Plane(), makeBrightnessMap::position, novaddt::DAQHit::TDC(), novaddt::TDC::val, novaddt::ADC::val, novaddt::Plane::val, novaddt::Cell::val, novaddt::View::val, POTSpillRate::view, novaddt::DAQHit::View(), daqchannelmap::X_VIEW, and daqchannelmap::Y_VIEW.

Referenced by mono::SlowMonopoleTrigger::algorithm(), mono::SlowMonopoleFilt::filter(), and is_equal().

85 {
86  int64_t relative_time =
87  static_cast<int64_t>(h.TDC().val) - static_cast<int64_t>(event_time);
88 
89  double time_in_us = static_cast<double>(relative_time) / 64.0e6 * 1.0e6;
90 
92  if (h.View().val == daqchannelmap::DetView_TYPE::X_VIEW)
93  view = "xz";
94  else if (h.View().val == daqchannelmap::DetView_TYPE::Y_VIEW)
95  view = "yz";
96  else
97  view = "bad";
98 
100  TVector3 position;
101  geom->Plane(h.Plane().val)->Cell(h.Cell().val)->GetCenter(position);
102 
103  boost::format form("(%2s, %3u, %3u) (%6.2f, %6.2f, %6.2f) "
104  "%5u ADC %20u TDC = %6.2f us");
105  std::cout <<
106  form % view % h.Plane().val % h.Cell().val %
107  position.X() % position.Y() % position.Z() %
108  h.ADC().val % relative_time % time_in_us
109  << std::endl;
110 }
const PlaneGeo * Plane(unsigned int i) const
Identifier for the Y measuring view of the detector (side)
Identifier for the X measuring view of the detector (top)
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void geom(int which=0)
Definition: geom.C:163
void ddthelpers::print ( art::Ptr< rb::CellHit > const &  h)

Definition at line 114 of file DDTHelpers.cxx.

References rawdata::RawDigit::ADC(), rb::CellHit::Cell(), om::cout, allTimeWatchdog::endl, novadaq::HexUtils::format(), kX, kY, rb::CellHit::Plane(), rawdata::RawDigit::TDC(), POTSpillRate::view, and rb::CellHit::View().

115 {
116  boost::format form("%7s %4u %4u %5u %20u");
117 
119  if (h->View() == geo::View_t::kX)
120  view = "xz";
121  else if (h->View() == geo::View_t::kY)
122  view = "yz";
123  else
124  view = "bad";
125 
126  std::cout <<
127  form % view % h->Plane() % h->Cell() %
128  h->ADC() % h->TDC()
129  << std::endl;
130 }
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
const Var kY([](const caf::SRProxy *sr){float tmp=0.f;if(sr->mc.nu.empty()) return tmp;tmp=sr->mc.nu[0].y;return tmp;})
unsigned short Cell() const
Definition: CellHit.h:40
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
Definition: geo.h:1
void ddthelpers::print ( rawdata::RawDigit const &  h)

Definition at line 134 of file DDTHelpers.cxx.

References rawdata::RawDigit::ADC(), om::cout, allTimeWatchdog::endl, novadaq::HexUtils::format(), and rawdata::RawDigit::TDC().

135 {
136  boost::format form("%7s %4u %4u %5u %20u");
137 
138  std::cout <<
139  form % "?" % 0 % 0 %
140  h.ADC(0) % h.TDC()
141  << std::endl;
142 }
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
OStream cout
Definition: OStream.cxx:6
void ddthelpers::print ( std::vector< novaddt::TriggerDecision > const &  decisions)

Definition at line 146 of file DDTHelpers.cxx.

References om::cout, d, allTimeWatchdog::endl, and novadaq::HexUtils::format().

147 {
148  boost::format form("%20u %6u %6u");
149 
150  for (auto const& d : decisions)
151  std::cout <<
152  form % d.start() % (d.start() + d.duration()) % d.duration()
153  << std::endl;
154 }
Float_t d
Definition: plot.C:236
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
OStream cout
Definition: OStream.cxx:6