Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
moonshadowana::MoonShadowAnaHough Class Reference
Inheritance diagram for moonshadowana::MoonShadowAnaHough:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 MoonShadowAnaHough (fhicl::ParameterSet const &p)
 
virtual ~MoonShadowAnaHough ()
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
TVector3 vec (double zen, double azi)
 
double GetDot (double zen1, double azi1, double zen2, double azi2) const
 
TVector3 AnglesToVector (double zen, double azi) const
 
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)
 
std::string FindSmartPrescaleLookup () const
 
void WriteEventInfo (const art::Event &event)
 
void WriteTrackInfo (const rb::Track &track, long timeStart)
 
void WriteHitListInfo (const art::PtrVector< rb::CellHit > hlist, long timeStart, TVector3 start, TVector3 end)
 
int GetX (art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
 
int GetY (art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
 
TVector3 GetDetVec (TVector3 vec) const
 
double GetPhysLength (TVector3 vec) const
 
TVector3 GetPhysVec (TVector3 vec) const
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) 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 ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

TNtuple * fNtuple
 
std::string fTrackModuleLabel
 
art::ServiceHandle< locator::CelestialLocatorloc
 
TH2D * rate_collected_angular
 
int bin_size
 
const double fDotCut = cos(5*M_PI/180)
 
double max_rate
 
double angular_stdev
 
std::string fLookupFile
 
std::string fTrack3DLabel
 
double fLengthCut
 
double fBinCut
 
std::ofstream fOutputEvd
 
bool init
 

Detailed Description

Definition at line 79 of file MoonShadowAnaHough_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

moonshadowana::MoonShadowAnaHough::MoonShadowAnaHough ( fhicl::ParameterSet const &  p)
explicit

Definition at line 139 of file MoonShadowAnaHough_module.cc.

References bin_size, init, and InitLookupTable().

140  : EDAnalyzer (p),
141  //, fTrackModuleLabel (p.get<std::string>("TrackModuleLabel")),
142  max_rate(p.get<double>("AvgRate")),
143  angular_stdev(p.get<double>("AngularSuppression")),
145  fTrack3DLabel(p.get<std::string>("Track3DLabel")),
146  fLengthCut(p.get<double>("LengthCut")),
147  fBinCut(p.get<double>("BinCut"))
148 {
149  InitLookupTable();
150  bin_size = 1;
151 
152  init = false;
153 
154  //fOutputEvd.open("OFFEvd_Data.txt");
155 }
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
enum BeamMode string
moonshadowana::MoonShadowAnaHough::~MoonShadowAnaHough ( )
virtual

Definition at line 157 of file MoonShadowAnaHough_module.cc.

References fOutputEvd.

158 {
159 fOutputEvd.close();
160 }

Member Function Documentation

void moonshadowana::MoonShadowAnaHough::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 293 of file MoonShadowAnaHough_module.cc.

References std::acos(), std::atan2(), dir, febshutoff_auto::end, fBinCut, fLengthCut, fNtuple, fTrack3DLabel, GetAngularPrescale(), art::DataViewImpl::getByLabel(), locator::CelestialLocator::GetMoonPosition_FD(), GetPhysLength(), GetPhysVec(), GetSmartPrescale(), locator::CelestialLocator::GetSunPosition_FD(), makeTrainCVSamples::int, loc, M_PI, febshutoff_auto::start, std::swap(), art::Event::time(), art::Timestamp::timeHigh(), vars, vec(), and void().

293  {
294 
295  // Grab the tracks from the event
297  e.getByLabel(fTrack3DLabel, tracks);
298 
299  // We need the hitlist just so we can get the times for the trigger
301 
302  art::Timestamp ts = e.time();
303  time_t timeSec = ts.timeHigh();
304 
305  double zen_moon, azi_moon, zen_sun, azi_sun;
306  loc->GetMoonPosition_FD(timeSec,zen_moon, azi_moon);
307  loc->GetSunPosition_FD(timeSec,zen_sun, azi_sun);
308 
309  float vars[9];
310  vars[0] = zen_moon; // zen_moon
311  vars[1] = azi_moon; // azi_moon
312 
313  double smartPrescale = GetSmartPrescale(zen_moon, azi_moon, zen_sun, azi_sun);
314 
315  double cos_trk_moon, cos_trk_sun;
316  int trackIndex = 0;
317  for(const novaddt::Track3D& track: *tracks)
318  {
319  const novaddt::HitList& hlist = *hls.at(trackIndex);
320 
321 trackIndex++;
322 
323  TVector3 start = track.Start();
324  TVector3 end = track.End();
325  if(start.Y() < end.Y()) std::swap(start, end);
326 
327  // WORK
328  //Check whether 3D track vector makes sense
329  if(
330  (start.X() == 0 && end.X() == 0) ||
331  (start.Y() == 0 && end.Y() == 0) ||
332  (start.Z() == 0 && end.Z() == 0))
333  {
334  continue;
335  }
336 
337  // Apply length cuts
338  if(GetPhysLength(start-end) < fLengthCut || (int)hlist.size() < fBinCut)
339  {
340  continue;
341  }
342 
343  // Point back along the track towards the moon
344  const TVector3 dir = GetPhysVec((start-end)).Unit();
345 
346  const double zen_trk = acos(dir.Y()) * 180 / M_PI;
347  // docdb 5485 / numix 17 says FD is oriented -27o51'26'' from true North
348  // azi_trk = atan2(-dir.X(), dir.Z()) * 180 / M_PI - 27.857222;
349  // Or: 332o03'58.071769" (clockwise from North). Email from Virgil Bocean
350  // to Alec Habig.
351  double azi_trk = atan2(-dir.X(), dir.Z()) * 180 / M_PI + 332.142778;
352  if(azi_trk < 0) azi_trk += 360;
353  if(azi_trk > 360) azi_trk -= 360;
354 
355  cos_trk_moon = vec(zen_moon, azi_moon).Dot(vec(zen_trk,azi_trk));
356  cos_trk_sun = vec(zen_sun, azi_sun).Dot(vec(zen_trk,azi_trk));
357  (void)cos_trk_sun; // Suppresss "unused variable" warnings
358 
359  vars[2] = zen_trk; // zen_trk
360  vars[3] = azi_trk; // azi_trk
361  vars[4] = hlist.size(); // nhit
362  vars[5] = GetPhysLength(start-end); // len
363  vars[6] = cos_trk_moon; // cosine angle trk and moon
364 
365  double angularPrescale = GetAngularPrescale(zen_moon, azi_moon, zen_trk, azi_trk);
366 
367  vars[7] = smartPrescale;
368  vars[8] = angularPrescale;
369 
370  fNtuple->Fill(vars);
371 
372  } // end of tracks
373 
374 }
std::vector< DAQHit > HitList
Definition: HitList.h:15
void GetMoonPosition_FD(time_t time, double &zen, double &azi)
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:35
Definition: event.h:19
TVector3 GetPhysVec(TVector3 vec) const
T acos(T number)
Definition: d0nt_math.hpp:54
#define M_PI
Definition: SbMath.h:34
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
const std::map< std::pair< std::string, std::string >, Variable > vars
void GetSunPosition_FD(time_t time, double &zen, double &azi)
double GetAngularPrescale(double zen1, double azi1, double zen2, double azi2)
TVector3 vec(double zen, double azi)
TDirectory * dir
Definition: macro.C:5
art::ServiceHandle< locator::CelestialLocator > loc
Float_t e
Definition: plot.C:35
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
double GetSmartPrescale(double zen1, double azi1, double zen2, double azi2)
T atan2(T number)
Definition: d0nt_math.hpp:72
TVector3 moonshadowana::MoonShadowAnaHough::AnglesToVector ( double  zen,
double  azi 
) const
void moonshadowana::MoonShadowAnaHough::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 162 of file MoonShadowAnaHough_module.cc.

References fNtuple, and art::TFileDirectory::make().

163 {
165  fNtuple = tfs->make<TNtuple>("moon_ntuple", "Moon Shadow Ntuple", "zen_moon:azi_moon:zen_trk:azi_trk:nhit:len:dot:smart_pre:ang_pre");
166 }
T * make(ARGS...args) const
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
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::EDAnalyzer::currentContext ( ) const
protectedinherited
std::string moonshadowana::MoonShadowAnaHough::FindSmartPrescaleLookup ( ) const

Definition at line 482 of file MoonShadowAnaHough_module.cc.

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

483 {
484  cet::search_path sp("FW_SEARCH_PATH");
485  std::string lookupFname;
486  sp.find_file(("Eval/PrescaleLookup.txt"), lookupFname);
487  assert(!lookupFname.empty());
488  return lookupFname;
489 }
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 moonshadowana::MoonShadowAnaHough::GetAngularPrescale ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)

Definition at line 394 of file MoonShadowAnaHough_module.cc.

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

Referenced by analyze(), and GetAngularPrescaleDecision().

395  {
396  double dTheta = acos(GetDot(zen1, azi1, zen2, azi2)) * 180 / M_PI;
397  return exp(-dTheta*dTheta/(angular_stdev*angular_stdev));
398  }
T acos(T number)
Definition: d0nt_math.hpp:54
#define M_PI
Definition: SbMath.h:34
double GetDot(double zen1, double azi1, double zen2, double azi2) const
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
bool moonshadowana::MoonShadowAnaHough::GetAngularPrescaleDecision ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)

Definition at line 399 of file MoonShadowAnaHough_module.cc.

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

400  {
401  double prescale = GetAngularPrescale(zen1, azi1, zen2, azi2);
402 
403  double r = (double)rand() / (double)RAND_MAX;
404 
405  return r < prescale;
406  }
double GetAngularPrescale(double zen1, double azi1, double zen2, double azi2)
TRandom3 r(0)
TVector3 moonshadowana::MoonShadowAnaHough::GetDetVec ( TVector3  vec) const

Definition at line 267 of file MoonShadowAnaHough_module.cc.

References moonshadowana::CELL_WIDTH, makeTrainCVSamples::int, moonshadowana::N_CELLS, moonshadowana::PLANE_WIDTH, submit_syst::x, submit_syst::y, and test::z.

Referenced by WriteTrackInfo().

268 {
269  int x = int((vec.X() + CELL_WIDTH * N_CELLS /2) / CELL_WIDTH);
270  int y = int((vec.Y() + CELL_WIDTH * N_CELLS /2) / CELL_WIDTH);
271  int z = int(vec.Z() / PLANE_WIDTH);
272 
273  return TVector3(x,y,z);
274 }
const double CELL_WIDTH
const unsigned N_CELLS
const double PLANE_WIDTH
Eigen::VectorXd vec
z
Definition: test.py:28
double moonshadowana::MoonShadowAnaHough::GetDot ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
) const

Definition at line 467 of file MoonShadowAnaHough_module.cc.

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

Referenced by GetAngularPrescale().

468  {
469  if(zen1 == zen2 && azi1 == azi2)
470  return 1;
471 
472  zen1 *= M_PI / 180;
473  zen2 *= M_PI / 180;
474  azi1 *= M_PI / 180;
475  azi2 *= M_PI / 180;
476  double dot = sin(zen1)*cos(azi1)*sin(zen2)*cos(azi2) + sin(zen1)*sin(azi1)*sin(zen2)*sin(azi2) + cos(zen1)*cos(zen2);
477 
478  return dot;
479  }
#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
void moonshadowana::MoonShadowAnaHough::GetHisto ( std::string  filename,
int  xmax,
int  ymax,
TH2D *  hist 
)

Definition at line 420 of file MoonShadowAnaHough_module.cc.

References MECModelEnuComparisons::i, calib::j, art::TFileDirectory::make(), febshutoff_auto::val, xmax, and ymax.

Referenced by InitLookupTable().

421 {
422  std::ifstream data;
423  data.open(filename.c_str());
424  for(int j=0; j<ymax;j++)
425  {
426  for(int i=0; i<xmax; i++)
427  {
428  double val;
429  data >> val;
430  hist->SetBinContent(i,j, val);
431  }
432  }
434  TH2D* htmp = tfs->make<TH2D>("LookupPrescale_stored", "", 360, 0, 360, 90, 0, 90);
435  htmp = (TH2D*)hist->Clone();
436  htmp->Write();
437  data.close();
438 }
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
T * make(ARGS...args) const
double moonshadowana::MoonShadowAnaHough::GetPhysLength ( TVector3  vec) const

Definition at line 276 of file MoonShadowAnaHough_module.cc.

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

Referenced by analyze().

277  {
278  double x = vec.X() * CELL_WIDTH;
279  double y = vec.Y() * CELL_WIDTH;
280  double z = vec.Z() * PLANE_WIDTH;
281 
282  return sqrt(x*x + y*y + z*z);
283  }
const double CELL_WIDTH
T sqrt(T number)
Definition: d0nt_math.hpp:156
const double PLANE_WIDTH
Eigen::VectorXd vec
z
Definition: test.py:28
TVector3 moonshadowana::MoonShadowAnaHough::GetPhysVec ( TVector3  vec) const

Definition at line 284 of file MoonShadowAnaHough_module.cc.

References moonshadowana::CELL_WIDTH, moonshadowana::PLANE_WIDTH, submit_syst::x, submit_syst::y, and test::z.

Referenced by analyze().

285 {
286  double x = vec.X() * CELL_WIDTH;
287  double y = vec.Y() * CELL_WIDTH;
288  double z = vec.Z() * PLANE_WIDTH;
289 
290  return TVector3(x,y,z);
291 }
const double CELL_WIDTH
const double PLANE_WIDTH
Eigen::VectorXd vec
z
Definition: test.py:28
double moonshadowana::MoonShadowAnaHough::GetRate ( double  zen,
double  azi 
)

Definition at line 382 of file MoonShadowAnaHough_module.cc.

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

Referenced by GetSmartPrescale().

383  {
384  if(zen > 90)
385  return 0;
386  // Smart prescale is ratio of maximal rate to expected rate divided by angular prescale factor for given position
387  int bin_azi = round(azi/bin_size);
388  int bin_zen = round(zen/bin_size);
389 
390  //return 0;
391  return rate_collected_angular->GetBinContent(bin_azi, bin_zen);
392  }
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
double moonshadowana::MoonShadowAnaHough::GetSmartPrescale ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)

Definition at line 440 of file MoonShadowAnaHough_module.cc.

References GetRate(), and max_rate.

Referenced by analyze().

441  {
442  double rate1 = GetRate(zen1, azi1);
443  double rate2 = GetRate(zen2, azi2);
444 
445  if(rate1 == 0 && rate2 == 0)
446  return 0;
447 
448  return max_rate / (rate1 + rate2);
449  }
double GetRate(double zen, double azi)
double moonshadowana::MoonShadowAnaHough::GetSmartPrescale ( double  zen,
double  azi 
)

Definition at line 450 of file MoonShadowAnaHough_module.cc.

References GetRate(), and max_rate.

451  {
452  double rate = GetRate(zen, azi);
453 
454  if(rate == 0)
455  return 0;
456 
457  return max_rate / rate;
458  }
double GetRate(double zen, double azi)
bool moonshadowana::MoonShadowAnaHough::GetSmartPrescaleDecision ( double  prescale)

Definition at line 460 of file MoonShadowAnaHough_module.cc.

References r(), and central_limit::rand.

461  {
462  // Is it good enough for small prescale factors ~1/100?
463  double r = (double)rand() / (double)RAND_MAX;
464  return r < prescale;
465  }
TRandom3 r(0)
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
int moonshadowana::MoonShadowAnaHough::GetX ( art::Ptr< rb::CellHit h,
TVector3  start,
TVector3  end 
)

Definition at line 240 of file MoonShadowAnaHough_module.cc.

References rb::CellHit::Plane(), stan::math::round(), submit_syst::x, and test::z.

Referenced by WriteHitListInfo().

241 {
242  int z = h->Plane();
243 
244  double xSpread = end.X() - start.X();
245  double zSpread = end.Z() - start.Z();
246 
247  double zSpreadLoc = z - start.Z();
248 
249  double x = start.X() + xSpread * zSpreadLoc/zSpread;
250 
251  return round(x);
252 }
unsigned short Plane() const
Definition: CellHit.h:39
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
z
Definition: test.py:28
int moonshadowana::MoonShadowAnaHough::GetY ( art::Ptr< rb::CellHit h,
TVector3  start,
TVector3  end 
)

Definition at line 253 of file MoonShadowAnaHough_module.cc.

References rb::CellHit::Plane(), stan::math::round(), submit_syst::y, and test::z.

Referenced by WriteHitListInfo().

254 {
255  int z = h->Plane();
256 
257  double ySpread = end.Y() - start.Y();
258  double zSpread = end.Z() - start.Z();
259 
260  double zSpreadLoc = z - start.Z();
261 
262  double y = start.Y() + ySpread * zSpreadLoc/zSpread;
263 
264  return round(y);
265 }
unsigned short Plane() const
Definition: CellHit.h:39
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
z
Definition: test.py:28
void moonshadowana::MoonShadowAnaHough::InitLookupTable ( )

Definition at line 408 of file MoonShadowAnaHough_module.cc.

References fLookupFile, GetHisto(), and rate_collected_angular.

Referenced by MoonShadowAnaHough().

409  {
410  // Init lookup table and make 2d hist with expected rate
411  // Get histogram with full rates in 2degx2deg bins
412  int azi_max = 360;
413  int zen_max = 90;
414 
415  rate_collected_angular = new TH2D("LookupPrescale", "", azi_max, 0, 360, zen_max, 0, 90);
416 
417  GetHisto(fLookupFile, azi_max, zen_max, rate_collected_angular);
418  }
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::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
TVector3 moonshadowana::MoonShadowAnaHough::vec ( double  zen,
double  azi 
)

Definition at line 376 of file MoonShadowAnaHough_module.cc.

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

Referenced by analyze().

376  {
377  zen *= M_PI / 180;
378  azi *= M_PI / 180;
379  return TVector3(sin(zen)*cos(azi), sin(zen)*sin(azi), cos(zen));
380 }
#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
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

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

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }
void moonshadowana::MoonShadowAnaHough::WriteEventInfo ( const art::Event event)

Definition at line 169 of file MoonShadowAnaHough_module.cc.

References allTimeWatchdog::endl, fOutputEvd, fTrack3DLabel, init, rb::Cluster::Is2D(), art::Event::run(), string, art::Event::subRun(), art::Event::time(), art::Timestamp::timeHigh(), art::to_string(), and WriteTrackInfo().

170 {
171  if(!init)
172  {
173  fOutputEvd.open(std::string("OFFEvd_Data_") + std::string(std::to_string(event.run())) + std::string("_") + std::string(std::to_string(event.subRun())) + std::string(".txt"));
174  init = true;
175  }
176 
177  // Event info
178  fOutputEvd << "E " << event.event() << " ";
179  fOutputEvd << event.time().timeHigh() << std::endl;
180 
181  // Tracks
183  event.getByLabel(fTrack3DLabel, "", tracks);
184 
185  for(unsigned int trkIdx = 0; trkIdx < tracks->size(); ++trkIdx)
186  {
187  const rb::Track& trk = (*tracks)[trkIdx];
188  if(trk.Is2D())continue;
189 
190 
191 
192  WriteTrackInfo(trk, event.time().timeHigh());
193  }
194 }
SubRunNumber_t subRun() const
Definition: Event.h:72
bool Is2D() const
Definition: Cluster.h:96
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:35
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
Track finder for cosmic rays.
void WriteTrackInfo(const rb::Track &track, long timeStart)
Timestamp time() const
Definition: Event.h:61
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
RunNumber_t run() const
Definition: Event.h:77
enum BeamMode string
void moonshadowana::MoonShadowAnaHough::WriteHitListInfo ( const art::PtrVector< rb::CellHit hlist,
long  timeStart,
TVector3  start,
TVector3  end 
)

Definition at line 222 of file MoonShadowAnaHough_module.cc.

References art::PtrVector< T >::at(), rb::CellHit::Cell(), allTimeWatchdog::endl, fOutputEvd, GetX(), GetY(), make_syst_table_plots::h, makeTrainCVSamples::int, calib::j, rb::CellHit::Plane(), art::PtrVector< T >::size(), rawdata::RawDigit::TDC(), POTSpillRate::view, and rb::CellHit::View().

Referenced by WriteTrackInfo().

223 {
224  for (size_t j=0; j < hlist.size(); ++j) {
225  art::Ptr<rb::CellHit> h = hlist.at(j);
226 
227  if(j != 0)
228  fOutputEvd << ",";
229 
230  int view = (int)h->View();
231  fOutputEvd << ((long)h->TDC())/64 << "/";
232  fOutputEvd << (view == 0 ? (int)h->Cell() : GetX(h, start, end)) << "/";
233  fOutputEvd << (view == 1 ? (int)h->Cell() : GetY(h, start, end)) << "/";
234  fOutputEvd << (int)h->Plane() << "/";
235  fOutputEvd << view + 1;
236  }
237 
239 }
int GetY(art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
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
unsigned short Cell() const
Definition: CellHit.h:40
int GetX(art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
const double j
Definition: BetheBloch.cxx:29
reference at(size_type n)
Definition: PtrVector.h:365
size_type size() const
Definition: PtrVector.h:308
void moonshadowana::MoonShadowAnaHough::WriteTrackInfo ( const rb::Track track,
long  timeStart 
)

Definition at line 196 of file MoonShadowAnaHough_module.cc.

References rb::Cluster::AllCells(), febshutoff_auto::end, allTimeWatchdog::endl, fOutputEvd, GetDetVec(), febshutoff_auto::start, rb::Prong::Start(), rb::Track::Stop(), std::swap(), and WriteHitListInfo().

Referenced by WriteEventInfo().

197 {
198  TVector3 start = GetDetVec(track.Start());
199  TVector3 end = GetDetVec(track.Stop());
200  if(start.Y() < end.Y()) std::swap(start, end); // all tracks are down-going
201 
202  //Check whether 3D track vector makes sense
203  if(
204  (start.X() == 0 && end.X() == 0) ||
205  (start.Y() == 0 && end.Y() == 0) ||
206  (start.Z() == 0 && end.Z() == 0))
207  {
208  return;
209  }
210 
211  // Track info
212  fOutputEvd << "T ";
213  fOutputEvd << "(" << start.X() << "," << start.Y() << "," << start.Z() << ") ";
214  fOutputEvd << "(" << end.X() << "," << end.Y() << "," << end.Z() << ")";
216 
217  art::PtrVector<rb::CellHit> hlist = track.AllCells();
218 
219  WriteHitListInfo(hlist, timeStart, start, end);
220 
221 }
void WriteHitListInfo(const art::PtrVector< rb::CellHit > hlist, long timeStart, TVector3 start, TVector3 end)
virtual TVector3 Start() const
Definition: Prong.h:73
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
TVector3 GetDetVec(TVector3 vec) const
TVector3 Stop() const
Position of the final trajectory point.
Definition: Track.cxx:186

Member Data Documentation

double moonshadowana::MoonShadowAnaHough::angular_stdev
private

Definition at line 124 of file MoonShadowAnaHough_module.cc.

Referenced by GetAngularPrescale().

int moonshadowana::MoonShadowAnaHough::bin_size
private

Definition at line 117 of file MoonShadowAnaHough_module.cc.

Referenced by GetRate(), and MoonShadowAnaHough().

double moonshadowana::MoonShadowAnaHough::fBinCut
private

Definition at line 132 of file MoonShadowAnaHough_module.cc.

Referenced by analyze().

const double moonshadowana::MoonShadowAnaHough::fDotCut = cos(5*M_PI/180)
private

Definition at line 120 of file MoonShadowAnaHough_module.cc.

double moonshadowana::MoonShadowAnaHough::fLengthCut
private

Definition at line 130 of file MoonShadowAnaHough_module.cc.

Referenced by analyze().

std::string moonshadowana::MoonShadowAnaHough::fLookupFile
private

Definition at line 126 of file MoonShadowAnaHough_module.cc.

Referenced by InitLookupTable().

TNtuple* moonshadowana::MoonShadowAnaHough::fNtuple
private

Definition at line 112 of file MoonShadowAnaHough_module.cc.

Referenced by analyze(), and beginJob().

std::ofstream moonshadowana::MoonShadowAnaHough::fOutputEvd
private
std::string moonshadowana::MoonShadowAnaHough::fTrack3DLabel
private

Definition at line 128 of file MoonShadowAnaHough_module.cc.

Referenced by analyze(), and WriteEventInfo().

std::string moonshadowana::MoonShadowAnaHough::fTrackModuleLabel
private

Definition at line 113 of file MoonShadowAnaHough_module.cc.

bool moonshadowana::MoonShadowAnaHough::init
private
art::ServiceHandle<locator::CelestialLocator> moonshadowana::MoonShadowAnaHough::loc
private

Definition at line 114 of file MoonShadowAnaHough_module.cc.

Referenced by analyze().

double moonshadowana::MoonShadowAnaHough::max_rate
private

Definition at line 122 of file MoonShadowAnaHough_module.cc.

Referenced by GetSmartPrescale().

TH2D* moonshadowana::MoonShadowAnaHough::rate_collected_angular
private

Definition at line 116 of file MoonShadowAnaHough_module.cc.

Referenced by GetRate(), and InitLookupTable().


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