Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
novaddt::MoonShadow Class Reference
Inheritance diagram for novaddt::MoonShadow:
art::EDFilter art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::Table< UserConfig >
 

Public Member Functions

 MoonShadow (const fhicl::ParameterSet &p)
 
virtual ~MoonShadow ()
 
virtual bool filter (art::Event &e)
 
virtual void beginJob ()
 
virtual void endJob ()
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

std::string FindEphemerisFile () const
 
std::string FindSmartPrescaleLookup () const
 
double RadToDeg (double rad) const
 
double DegToRad (double deg) const
 
TVector3 AnglesToVector (double zen, double azi) const
 
double GetDot (double zen1, double azi1, double zen2, double azi2) const
 
TVector3 FarDetToAstron (TVector3 &fdVector) const
 
TVector3 AstronToFarDet (TVector3 &astrVector) const
 
double GetPhysLength (TVector3 vec) const
 
double GetEffectiveArea ()
 
void InitLookupTable ()
 
double GetAngularPrescale (double zen1, double azi1, double zen2, double azi2)
 
bool GetAngularPrescaleDecision (double zen1, double azi1, double zen2, double azi2)
 
double GetRate (double zen, double azi)
 
double GetSmartPrescale (double zen1, double azi1, double zen2, double azi2)
 
double GetSmartPrescale (double zen, double azi)
 
bool GetSmartPrescaleDecision (double prescale)
 
void GetHisto (std::string filename, int xmax, int ymax, TH2D *hist)
 
TVector3 GetPhysVec (TVector3 vec) const
 
time_t GetTime (art::Event &e)
 
CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Protected Attributes

int fPrescale
 
std::string fTrack3DLabel
 
std::string fInputHitLabel
 
std::string fInputHitInstance
 
double fDotCut
 
double fLengthCut
 
int fBinCut
 
shadow::NOVASLocate fLocate
 
int fNEvents
 
int fNTracks
 
int fNSunTrigs
 
int fNMoonTrigs
 
TH2D * rate_collected_angular
 
int bin_size
 
double max_rate
 
double angular_stdev
 
std::string fLookupFile
 

Detailed Description

Definition at line 36 of file MoonShadow_module.cc.

Member Typedef Documentation

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

using art::EDFilter::WorkerType = WorkerT<EDFilter>
inherited

Definition at line 38 of file EDFilter.h.

Constructor & Destructor Documentation

novaddt::MoonShadow::MoonShadow ( const fhicl::ParameterSet p)
explicit

Definition at line 105 of file MoonShadow_module.cc.

References bin_size, and InitLookupTable().

106  : fPrescale(pset.get<int>("prescale")),
107  fTrack3DLabel(pset.get<std::string>("Track3DLabel")),
108  fInputHitLabel(pset.get<std::string>("InputHitLabel")),
109  fInputHitInstance(pset.get<std::string>("InputHitInstance")),
110  fDotCut(cos(5*M_PI/180) /*cos(pset.get<double>("AngleCut")*M_PI/180)*/),
111  fLengthCut(pset.get<double>("LengthCut")),
112  fBinCut(pset.get<int>("BinCut")),
114  fNEvents(0), fNTracks(0), fNSunTrigs(0), fNMoonTrigs(0),
115  max_rate(pset.get<double>("AvgRate")),
116  angular_stdev(pset.get<double>("AngularSuppression")),
118  {
119  produces< std::vector<TriggerDecision>>();
120  InitLookupTable();
121  srand(time(NULL));
122 
123  bin_size = 1;
124  }
std::string FindEphemerisFile() const
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
#define M_PI
Definition: SbMath.h:34
shadow::NOVASLocate fLocate
std::string FindSmartPrescaleLookup() const
std::string fInputHitInstance
T cos(T number)
Definition: d0nt_math.hpp:78
enum BeamMode string
novaddt::MoonShadow::~MoonShadow ( )
virtual

Definition at line 207 of file MoonShadow_module.cc.

208  {
209  }

Member Function Documentation

TVector3 novaddt::MoonShadow::AnglesToVector ( double  zen,
double  azi 
) const
protected

Definition at line 246 of file MoonShadow_module.cc.

References std::cos(), M_PI, and std::sin().

247  {
248  zen *= M_PI / 180;
249  azi *= M_PI / 180;
250  // Doesn't matter which axis is which
251  return TVector3(sin(zen)*cos(azi), sin(zen)*sin(azi), cos(zen));
252  }
#define M_PI
Definition: SbMath.h:34
T sin(T number)
Definition: d0nt_math.hpp:132
T cos(T number)
Definition: d0nt_math.hpp:78
TVector3 novaddt::MoonShadow::AstronToFarDet ( TVector3 &  astrVector) const
protected

Definition at line 275 of file MoonShadow_module.cc.

276  {
277  throw "Not implemented";
278 
279  }
void novaddt::MoonShadow::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 211 of file MoonShadow_module.cc.

212  {
213  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDFilter::currentContext ( ) const
protectedinherited
double novaddt::MoonShadow::DegToRad ( double  deg) const
inlineprotected

Definition at line 216 of file MoonShadow_module.cc.

References M_PI.

217  {
218  return deg * M_PI / 180;
219  }
static constexpr Double_t deg
Definition: Munits.h:165
#define M_PI
Definition: SbMath.h:34
void novaddt::MoonShadow::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 440 of file MoonShadow_module.cc.

References om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, fNEvents, fNMoonTrigs, fNSunTrigs, fNTracks, and rate_collected_angular.

441  {
442  delete rate_collected_angular;
443  std::cout << "=== novaddt::MoonShadow endJob " << std::endl;
444  std::cout << "\tNumber of events: " << fNEvents << std::endl;
445  std::cout << "\tNumber of tracks: " << fNTracks << std::endl;
446  std::cout << "\tNumber of sun triggers: " << fNSunTrigs << std::endl;
447  std::cout << "\tNumber of moon triggers: " << fNMoonTrigs << std::endl;
448  }
OStream cout
Definition: OStream.cxx:6
TVector3 novaddt::MoonShadow::FarDetToAstron ( TVector3 &  fdVector) const
protected

Definition at line 269 of file MoonShadow_module.cc.

270  {
271  throw "Not implemented";
272 
273  }
bool novaddt::MoonShadow::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 316 of file MoonShadow_module.cc.

References std::acos(), std::atan2(), dir, febshutoff_auto::end, fBinCut, fDotCut, fLengthCut, fLocate, fNEvents, fNMoonTrigs, fNSunTrigs, fNTracks, fPrescale, fTrack3DLabel, GetAngularPrescaleDecision(), art::DataViewImpl::getByLabel(), GetDot(), shadow::NOVASLocate::GetMoonPosition(), GetPhysLength(), GetPhysVec(), GetSmartPrescale(), GetSmartPrescaleDecision(), shadow::NOVASLocate::GetSunPosition(), GetTime(), makeTrainCVSamples::int, it, M_PI, std::max(), std::min(), art::Event::put(), runNovaSAM::ret, febshutoff_auto::start, std::swap(), confusionMatrixTree::t, daqdataformats::TRIG_ID_DATA_MOON, and daqdataformats::TRIG_ID_DATA_SUN.

317  {
318  ++fNEvents;
319 
320  std::unique_ptr<std::vector<TriggerDecision>> td(new std::vector<TriggerDecision>);
321 
322  // Grab the tracks from the event
324  evt.getByLabel(fTrack3DLabel, tracks);
325 
326  // We need the hitlist just so we can get the times for the trigger
328 
329  //time_t t = GetTime(hls);
330  time_t t = GetTime(evt);
331  // std::cout << "Time_t: " << asctime(gmtime(&t)) << std::endl;
332 
333  double zen_moon, azi_moon;
334  fLocate.GetMoonPosition(t, zen_moon, azi_moon);
335  double zen_sun, azi_sun;
336  fLocate.GetSunPosition(t, zen_sun, azi_sun);
337 
338  int trackIndex = 0;
339 
340  double smartPrescale = GetSmartPrescale(zen_moon, azi_moon, zen_sun, azi_sun);
341  double smartPrescaleSun = GetSmartPrescale(zen_sun, azi_sun);
342  double smartPrescaleMoon = GetSmartPrescale(zen_moon, azi_moon);
343  double smartPrescaleTot = smartPrescaleSun + smartPrescaleMoon;
344  smartPrescaleSun = smartPrescale * (smartPrescaleSun/smartPrescaleTot);
345  smartPrescaleMoon = smartPrescale * (smartPrescaleMoon/smartPrescaleTot);
346 
347  for(const Track3D& track: *tracks){
348  const HitList& hlist = *hls.at(trackIndex);
349  ++trackIndex;
350 
351  TVector3 start = track.Start();
352  TVector3 end = track.End();
353  if(start.Y() < end.Y()) std::swap(start, end);
354 
355  // WORK
356  //Check whether 3D track vector makes sense
357  if(
358  (start.X() == 0 && end.X() == 0) ||
359  (start.Y() == 0 && end.Y() == 0) ||
360  (start.Z() == 0 && end.Z() == 0))
361  {
362  continue;
363  }
364 
365 
366 
367  // Apply length cuts
368  if(GetPhysLength(start-end) < fLengthCut || (int)hlist.size() < fBinCut)
369  {
370  continue;
371  }
372 
373 
374  ++fNTracks;
375 
376 
377 
378 
379 
380  // Point back along the track towards the moon
381  const TVector3 dir = GetPhysVec((start-end)).Unit();
382 
383  const double zen_trk = acos(dir.Y()) * 180 / M_PI;
384  // docdb 5485 / numix 17 says FD is oriented -27o51'26'' from true North
385  // azi_trk = atan2(-dir.X(), dir.Z()) * 180 / M_PI - 27.857222;
386  // Or: 332o03'58.071769" (clockwise from North). Email from Virgil Bocean
387  // to Alec Habig.
388  double azi_trk = atan2(-dir.X(), dir.Z()) * 180 / M_PI + 332.142778;
389  if(azi_trk < 0) azi_trk += 360;
390  if(azi_trk > 360) azi_trk -= 360;
391 
392  const double dotMoon = GetDot(zen_moon, azi_moon, zen_trk, azi_trk);
393  const double dotSun = GetDot(zen_sun, azi_sun, zen_trk, azi_trk);
394 
395  // Inline &&'s call all these functions, so this is made to avoid extra calling
396  bool trigMoon = (dotMoon > fDotCut);
397  if(trigMoon) { trigMoon = trigMoon && GetSmartPrescaleDecision(smartPrescale); }
398  if(trigMoon) { trigMoon = trigMoon && GetAngularPrescaleDecision(zen_moon, azi_moon, zen_trk, azi_trk); }
399 
400  bool trigSun = (dotSun > fDotCut);
401  if(trigSun) { trigSun = trigSun && GetSmartPrescaleDecision(smartPrescale); }
402  if(trigSun) { trigSun = trigSun && GetAngularPrescaleDecision(zen_sun, azi_sun, zen_trk, azi_trk); }
403 
404 
405  if(trigMoon || trigSun){
406  auto mint = hlist.front().TDC().val;
407  auto maxt = hlist.back().TDC().val;
408  for(const DAQHit& it: hlist){
409  mint = std::min(mint, it.TDC().val);
410  maxt = std::max(maxt, it.TDC().val);
411  }
412 
413  // Add 12.5us padding to each end of the window
414  mint -= 800;
415  maxt += 800;
416 
417  if(trigMoon){
418  ++fNMoonTrigs;
419  td->emplace_back(mint, maxt-mint,
421  fPrescale);
422  }
423  if(trigSun){
424  ++fNSunTrigs;
425  td->emplace_back(mint, maxt-mint,
427  fPrescale);
428  }
429  }
430 
431  } // end of tracks
432 
433 
434 
435  const bool ret = !td->empty();
436  evt.put(std::move(td));
437  return ret;
438  }
T max(const caf::Proxy< T > &a, T b)
set< int >::iterator it
double GetSmartPrescale(double zen1, double azi1, double zen2, double azi2)
std::vector< DAQHit > HitList
Definition: HitList.h:15
Definition: event.h:19
double GetDot(double zen1, double azi1, double zen2, double azi2) const
T acos(T number)
Definition: d0nt_math.hpp:54
#define M_PI
Definition: SbMath.h:34
bool GetSmartPrescaleDecision(double prescale)
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
void GetMoonPosition(time_t t, double &zen, double &azi)
shadow::NOVASLocate fLocate
int evt
time_t GetTime(art::Event &e)
void GetSunPosition(time_t t, double &zen, double &azi)
TVector3 GetPhysVec(TVector3 vec) const
TDirectory * dir
Definition: macro.C:5
bool GetAngularPrescaleDecision(double zen1, double azi1, double zen2, double azi2)
T min(const caf::Proxy< T > &a, T b)
double GetPhysLength(TVector3 vec) const
T atan2(T number)
Definition: d0nt_math.hpp:72
std::string novaddt::MoonShadow::FindEphemerisFile ( ) const
protected

Definition at line 226 of file MoonShadow_module.cc.

References ana::assert(), cet::search_path::find_file(), and string.

227  {
228  cet::search_path sp("FW_SEARCH_PATH");
229  std::string ephemerisFname;
230  sp.find_file(("MoonShadowTrigger/novas/JPLEPH"), ephemerisFname);
231  assert(!ephemerisFname.empty());
232  return ephemerisFname;
233  }
assert(nhit_max >=nhit_nbins)
enum BeamMode string
std::string novaddt::MoonShadow::FindSmartPrescaleLookup ( ) const
protected

Definition at line 235 of file MoonShadow_module.cc.

References ana::assert(), cet::search_path::find_file(), and string.

236  {
237  cet::search_path sp("FW_SEARCH_PATH");
238  std::string lookupFname;
239  sp.find_file(("MoonShadowTrigger/smart_prescale/PrescaleLookup.txt"), lookupFname);
240  assert(!lookupFname.empty());
241  return lookupFname;
242  }
assert(nhit_max >=nhit_nbins)
enum BeamMode string
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
double novaddt::MoonShadow::GetAngularPrescale ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)
protected

Definition at line 126 of file MoonShadow_module.cc.

References std::acos(), angular_stdev, stan::math::exp(), GetDot(), and M_PI.

Referenced by GetAngularPrescaleDecision().

127  {
128  double dTheta = acos(GetDot(zen1, azi1, zen2, azi2)) * 180 / M_PI;
129  return exp(-dTheta*dTheta/(angular_stdev*angular_stdev));
130  }
double GetDot(double zen1, double azi1, double zen2, double azi2) const
T acos(T number)
Definition: d0nt_math.hpp:54
#define M_PI
Definition: SbMath.h:34
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
bool novaddt::MoonShadow::GetAngularPrescaleDecision ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)
protected

Definition at line 131 of file MoonShadow_module.cc.

References GetAngularPrescale(), r(), and central_limit::rand.

Referenced by filter().

132  {
133  double prescale = GetAngularPrescale(zen1, azi1, zen2, azi2);
134 
135  double r = (double)rand() / (double)RAND_MAX;
136 
137  return r < prescale;
138  }
double GetAngularPrescale(double zen1, double azi1, double zen2, double azi2)
TRandom3 r(0)
double novaddt::MoonShadow::GetDot ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
) const
protected

Definition at line 254 of file MoonShadow_module.cc.

References std::cos(), stan::math::dot(), M_PI, and std::sin().

Referenced by filter(), and GetAngularPrescale().

255  {
256  if(zen1 == zen2 && azi1 == azi2)
257  return 1;
258 
259  zen1 *= M_PI / 180;
260  zen2 *= M_PI / 180;
261  azi1 *= M_PI / 180;
262  azi2 *= M_PI / 180;
263  double dot = sin(zen1)*cos(azi1)*sin(zen2)*cos(azi2) + sin(zen1)*sin(azi1)*sin(zen2)*sin(azi2) + cos(zen1)*cos(zen2);
264 
265  return dot;
266  }
#define M_PI
Definition: SbMath.h:34
double dot(const std::vector< double > &x, const std::vector< double > &y)
Definition: dot.hpp:10
T sin(T number)
Definition: d0nt_math.hpp:132
T cos(T number)
Definition: d0nt_math.hpp:78
double novaddt::MoonShadow::GetEffectiveArea ( )
protected
void novaddt::MoonShadow::GetHisto ( std::string  filename,
int  xmax,
int  ymax,
TH2D *  hist 
)
protected

Definition at line 140 of file MoonShadow_module.cc.

References MECModelEnuComparisons::i, calib::j, febshutoff_auto::val, xmax, and ymax.

Referenced by InitLookupTable().

141 {
142  std::ifstream data;
143  data.open(filename.c_str());
144  for(int j=0; j<ymax;j++)
145  {
146  for(int i=0; i<xmax; i++)
147  {
148  double val;
149  data >> val;
150  hist->SetBinContent(i,j, val);
151  }
152  }
153 
154  data.close();
155 }
std::map< std::string, double > xmax
string filename
Definition: shutoffs.py:106
const XML_Char const XML_Char * data
Definition: expat.h:268
Double_t ymax
Definition: plot.C:25
const double j
Definition: BetheBloch.cxx:29
double novaddt::MoonShadow::GetPhysLength ( TVector3  vec) const
protected

Definition at line 281 of file MoonShadow_module.cc.

References novaddt::smt::Constants::CELL_WIDTH, novaddt::smt::Constants::PLANE_WIDTH, std::sqrt(), submit_syst::x, submit_syst::y, and test::z.

Referenced by filter().

282  {
286 
287  return sqrt(x*x + y*y + z*z);
288  }
T sqrt(T number)
Definition: d0nt_math.hpp:156
const double CELL_WIDTH
Definition: Constants.h:12
Eigen::VectorXd vec
z
Definition: test.py:28
const double PLANE_WIDTH
Definition: Constants.h:11
TVector3 novaddt::MoonShadow::GetPhysVec ( TVector3  vec) const
protected

Definition at line 306 of file MoonShadow_module.cc.

References novaddt::smt::Constants::CELL_WIDTH, novaddt::smt::Constants::PLANE_WIDTH, submit_syst::x, submit_syst::y, and test::z.

Referenced by filter().

307 {
311 
312  return TVector3(x,y,z);
313 }
const double CELL_WIDTH
Definition: Constants.h:12
Eigen::VectorXd vec
z
Definition: test.py:28
const double PLANE_WIDTH
Definition: Constants.h:11
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
double novaddt::MoonShadow::GetRate ( double  zen,
double  azi 
)
protected

Definition at line 170 of file MoonShadow_module.cc.

References bin_size, rate_collected_angular, and stan::math::round().

Referenced by GetSmartPrescale().

171  {
172  if(zen > 90)
173  return 0;
174  // Smart prescale is ratio of maximal rate to expected rate divided by angular prescale factor for given position
175  int bin_azi = round(azi/bin_size);
176  int bin_zen = round(zen/bin_size);
177 
178  //return 0;
179  return rate_collected_angular->GetBinContent(bin_azi, bin_zen);
180  }
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
double novaddt::MoonShadow::GetSmartPrescale ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)
protected

Definition at line 181 of file MoonShadow_module.cc.

References GetRate(), and max_rate.

Referenced by filter().

182  {
183  double rate1 = GetRate(zen1, azi1);
184  double rate2 = GetRate(zen2, azi2);
185 
186  if(rate1 == 0 && rate2 == 0)
187  return 0;
188 
189  return max_rate / (rate1 + rate2);
190  }
double GetRate(double zen, double azi)
double novaddt::MoonShadow::GetSmartPrescale ( double  zen,
double  azi 
)
protected

Definition at line 191 of file MoonShadow_module.cc.

References GetRate(), and max_rate.

192  {
193  double rate = GetRate(zen, azi);
194 
195  if(rate == 0)
196  return 0;
197 
198  return max_rate / rate;
199  }
double GetRate(double zen, double azi)
bool novaddt::MoonShadow::GetSmartPrescaleDecision ( double  prescale)
protected

Definition at line 200 of file MoonShadow_module.cc.

References r(), and central_limit::rand.

Referenced by filter().

201  {
202  // Is it good enough for small prescale factors ~1/100?
203  double r = (double)rand() / (double)RAND_MAX;
204  return r < prescale;
205  }
TRandom3 r(0)
time_t novaddt::MoonShadow::GetTime ( art::Event e)
protected

Definition at line 293 of file MoonShadow_module.cc.

References fInputHitInstance, fInputHitLabel, art::DataViewImpl::getByLabel(), submit_syst::header, novadaq::timeutils::NOVA_EPOCH, novadaq::timeutils::NOVA_TIME_FACTOR, and novaddt::EventHeader::timeStart.

Referenced by filter().

294  {
296 
298 
299  uint64_t secs = header->timeStart/novadaq::timeutils::NOVA_TIME_FACTOR;
300 
301  uint64_t nova_time = novadaq::timeutils::NOVA_EPOCH + secs;
302 
303  return time_t(nova_time);
304  }
const uint32_t NOVA_EPOCH
const uint64_t NOVA_TIME_FACTOR
std::string fInputHitInstance
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void novaddt::MoonShadow::InitLookupTable ( )
protected

Definition at line 158 of file MoonShadow_module.cc.

References fLookupFile, GetHisto(), and rate_collected_angular.

Referenced by MoonShadow().

159  {
160  // Init lookup table and make 2d hist with expected rate
161  // Get histogram with full rates in 2degx2deg bins
162  int azi_max = 360;
163  int zen_max = 90;
164 
165  rate_collected_angular = new TH2D("LookupPrescale", "", azi_max, 0, 360, zen_max, 0, 90);
166 
167  GetHisto(fLookupFile, azi_max, zen_max, rate_collected_angular);
168  }
void GetHisto(std::string filename, int xmax, int ymax, TH2D *hist)
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
double novaddt::MoonShadow::RadToDeg ( double  rad) const
inlineprotected

Definition at line 220 of file MoonShadow_module.cc.

References M_PI.

221  {
222  return rad * 180 / M_PI;
223  }
#define M_PI
Definition: SbMath.h:34
static constexpr Double_t rad
Definition: Munits.h:162
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

double novaddt::MoonShadow::angular_stdev
protected

Definition at line 98 of file MoonShadow_module.cc.

Referenced by GetAngularPrescale().

int novaddt::MoonShadow::bin_size
protected

Definition at line 93 of file MoonShadow_module.cc.

Referenced by GetRate(), and MoonShadow().

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

int novaddt::MoonShadow::fBinCut
protected

Definition at line 85 of file MoonShadow_module.cc.

Referenced by filter().

double novaddt::MoonShadow::fDotCut
protected

Definition at line 83 of file MoonShadow_module.cc.

Referenced by filter().

std::string novaddt::MoonShadow::fInputHitInstance
protected

Definition at line 82 of file MoonShadow_module.cc.

Referenced by GetTime().

std::string novaddt::MoonShadow::fInputHitLabel
protected

Definition at line 81 of file MoonShadow_module.cc.

Referenced by GetTime().

double novaddt::MoonShadow::fLengthCut
protected

Definition at line 84 of file MoonShadow_module.cc.

Referenced by filter().

shadow::NOVASLocate novaddt::MoonShadow::fLocate
protected

Definition at line 87 of file MoonShadow_module.cc.

Referenced by filter().

std::string novaddt::MoonShadow::fLookupFile
protected

Definition at line 100 of file MoonShadow_module.cc.

Referenced by InitLookupTable().

int novaddt::MoonShadow::fNEvents
protected

Definition at line 89 of file MoonShadow_module.cc.

Referenced by endJob(), and filter().

int novaddt::MoonShadow::fNMoonTrigs
protected

Definition at line 89 of file MoonShadow_module.cc.

Referenced by endJob(), and filter().

int novaddt::MoonShadow::fNSunTrigs
protected

Definition at line 89 of file MoonShadow_module.cc.

Referenced by endJob(), and filter().

int novaddt::MoonShadow::fNTracks
protected

Definition at line 89 of file MoonShadow_module.cc.

Referenced by endJob(), and filter().

int novaddt::MoonShadow::fPrescale
protected

Definition at line 78 of file MoonShadow_module.cc.

Referenced by filter().

std::string novaddt::MoonShadow::fTrack3DLabel
protected

Definition at line 80 of file MoonShadow_module.cc.

Referenced by filter().

double novaddt::MoonShadow::max_rate
protected

Definition at line 96 of file MoonShadow_module.cc.

Referenced by GetSmartPrescale().

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

TH2D* novaddt::MoonShadow::rate_collected_angular
protected

Definition at line 92 of file MoonShadow_module.cc.

Referenced by endJob(), GetRate(), and InitLookupTable().


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