Functions
absgeo.cxx File Reference
#include <vector>
#include <cfloat>
#include <math.h>

Go to the source code of this file.

Functions

static float point_to_line (const int x, const int y, const std::pair< int, int > &p1, const std::pair< int, int > &p2)
 
static float min (const float a, const float b, const float c)
 
static float point_to_line_segment (const int x, const int y, const std::pair< int, int > &p1, const std::pair< int, int > &p2)
 
float screen_dist_to_track (const int x, const int y, const std::vector< std::pair< int, int > > &track)
 

Function Documentation

static float min ( const float  a,
const float  b,
const float  c 
)
static

Definition at line 45 of file absgeo.cxx.

References a, b, and plot_validation_datamc::c.

Referenced by generic.models.Organizational.PlotID::__contains__(), AnaPlotMaker(), APDPlots(), canMan::autoPlaceLegend(), file_size_ana::BarChart(), calib::DCMTimingOffset::beginJob(), calib::DriftResponseCalc::beginRun(), calib::DCMTimingOffset::beginRun(), BinSigma(), ana::GenieMultiverseSpectra::BinSigma(), genie::GMCJDriver::BootstrapXSecSplineSummation(), CAF_makeCAFSensitivities_for_FNEX(), fnex::ShifterAndWeighter::CalcLinearInterpWgt(), CheckTrueDate(), compare_cos_numi(), novadaq::timeutils::convertUnixTimeToNovaTime(), ana::TargetCount::CountMass(), DCMOffsetCalculator(), DDTOnMonPlotMaker(), genie::mueloss::KokoulinPetrukhinModel::dE_dx(), demoFitContours(), demoFitSlices(), Canvas.Canvas::draw(), generic.tools.ImageMaker.ImageMaker::draw(), DrawAxes(), fnex::CorrectedSpectrum::DrawDataVsMC(), DrawHiddenParameter(), DrawUtils::DrawPlotStack(), fnex::CorrectedSpectrum::DrawStacks(), calib::TimingCalFilter::endSubRun(), calib::DCMTimingOffset::endSubRun(), ErrorBand(), event_reweighting_all_knobs(), fake_future_data(), fnex::CAFToEventList::FillMCVarVals(), std_candles.StdCandlesPlotter::FillMichelBreakdownPlots(), trk::CosmicTrackAna::FillTrackHistograms(), fnex::NuMuAnalysisSetup::FillVars(), fnex::NuEAnalysisSetup::FillVars(), ana::GenieMultiverseSpectra::FindBandBoundaries(), FindLimitY(), FindMinimum(), ViewBokeh::findRange(), fnex::AnalysisSetupBase::FindRPAWeights(), PandAna.weight.xsec_utils.NuWeightDFWrapper::FindXBin(), PandAna.weight.xsec_utils.NuWeightDFWrapper::FindYBin(), ana::FitToFourier::Fit(), FormatErrorBand(), ana::FormatErrorBand(), futureSig_reach_singlePOTcombo_syst(), genie_syst(), get_cosmic_sample(), POTGetData::get_uptime(), DrawUtils::GetBestYRange(), ana::CovMxSurface::GetContours(), GetLimits(), tdslicer::TDSlicer::GetPoint(), ndreco::NDRecoFxs::getProngProximity(), tdslicer::TDSlicer::GetPtInfo(), ana::GenieMultiverseSpectra::GetSigmaHistograms(), fnex::CorrectedSpectrum::GetStacksCanvasCopy(), ndreco::NDRecoFxs::getTrackProximity(), goodness_of_fit(), lem_server::handle_get_work(), fabricate.AtimesRunner::has_atimes(), HandyFuncs::HorizontalRange(), genie::BLI2DUnifGrid::Init(), genie::BLI2DNonUnifGrid::Init(), mono::DataCheckMonopole::initialize(), fnex::ParameterConstraints::InsertConstraint(), joint_fit_2017_contours(), joint_fit_2017_slices(), joint_fit_2018_contours(), joint_fit_2018_slices(), joint_fit_2019_bestfit(), joint_fit_2019_contours(), joint_fit_2019_slices(), joint_fit_future_bestfit_univ(), joint_fit_future_contour_univ(), genie::RESXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), ana::SingleNucAnalysis::LoadFrom(), ana::NumuCC2p2hAnalysis::LoadFrom(), ana::CrossSectionAnalysis::LoadFrom(), genie::utils::system::LocalTimeAsString(), LogClone(), EmPlot::make_plot(), MakeCAFSensitivities_for_FNEX(), MakeLegend(), std_candles.StdCandlesPlotter::MakeTrueOriginBreakdownPlot(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), ViewHTML::metricsToHTMLTable(), std::numeric_limits< stan::math::fvar< T > >::min(), std::numeric_limits< stan::math::var >::min(), art::ScheduleID::min_id_(), ana::MCMCSamples::MinValue(), multiverse_reweighting(), MyPlotWithSystErrorBand(), Nearline_Watchdog_Plots(), om::OnMonProd::NewRunNumber(), om::OnMonProd::NewSubrunNumber(), fnex::ShifterAndWeighter::NueExtrapSig2017Weight(), zcl::FastMonopoleTriggers::NumberOfHitsInOverlapPlanesCut(), novaddt::FastMMTrigger::NumberOfHitsInOverlapPlanesCut(), novaddt::NNFastMMTrigger::NumberOfHitsInOverlapPlanesCut(), zcl::FmmTriggerEvd::NumberOfHitsInOverlapPlanesCut(), zcl::FastMMStudy::NumberOfHitsInOverlapPlanesCut(), fnex::DataVarVals::NuRecoEVal(), fnex::DataVarVals::NuRecoEVal2017(), fnex::DataVarVals::NuRecoEVal2018(), OnMonPlotMaker(), skim::ParametersNue::ParametersNue(), skim::ParametersNumu::ParametersNumu(), PlotErrorBand(), ana::PlotErrorBand(), ana::PlotWithSystErrorBand(), ana::PlotWithSystErrorBand_Quant(), point_to_line_segment(), canMan::PointDistanceToBox(), pred_err(), PrintTime(), MergeDaqCollections::MergeDaqCollections::produce(), bpfit::BPFPIdMaker::produce(), HandyFuncs::ProfileX(), HandyFuncs::ProfileY(), Projections::projectionTimes(), calib::AttenuationFit::readResults(), fnex::NuEAnalysisSetup::Reconfigure(), run_joint_fit_2020_bestfit(), run_joint_fit_2020_contours(), run_joint_fit_2020_slices(), sensitivity2018(), sensitivity2020(), sensitivity_plot(), evdb::ParameterSetEditRow::SetupSlider(), ViewSTDOUT::showMetricsSummary(), systematics_extrap_comp_from_pred_interp(), systematics_summary_from_pred_interp(), TB_Nearline_Watchdog_Plots(), test_multiverse_class(), TimingUtilitiesTests::testSecMinHourDayMonYear(), Projections::tierEfficiency(), trimmubarid(), trk::CosmicTrackUtilities::TruePathLengthInCell(), Tutorial2019Fit(), Tutorial2019FitContours(), Tutorial2019FitSlices(), om::RawEventUnpacker::UnpackRawEvent(), fnex::MCVarVals::val_at(), fnex::DataVarVals::val_at(), and cmf::CovarianceMatrixMaker::writeResults().

46 {
47  if(a < b && a < c) return a;
48  if(b < a && b < c) return b;
49  return c;
50 }
const double a
const hit & b
Definition: hits.cxx:21
static float point_to_line ( const int  x,
const int  y,
const std::pair< int, int > &  p1,
const std::pair< int, int > &  p2 
)
static

Definition at line 11 of file absgeo.cxx.

References stan::math::fabs(), cet::pow(), std::sqrt(), submit_syst::x, and submit_syst::y.

Referenced by point_to_line_segment().

14 {
15  std::pair<float, float> eten;
16  {
17  std::pair<float, float> ete;
18  ete.first = p1.first - p2.first;
19  ete.second = p1.second - p2.second;
20 
21  eten.first = ete.first /sqrt(ete.first*ete.first + ete.second*ete.second);
22  eten.second = ete.second/sqrt(ete.first*ete.first + ete.second*ete.second);
23  }
24 
25  std::pair<float, float> etp;
26  etp.first = p1.first - x;
27  etp.second = p1.second - y;
28 
29  const double detca = fabs(eten.first*etp.first + eten.second*etp.second);
30 
31  std::pair<float, float> closest_app;
32 
33  closest_app.first = p1.first - eten.first *detca;
34  closest_app.second = p1.second - eten.second*detca;
35 
36  const bool between =
37  (p1.first < closest_app.first && closest_app.first < p2.first) ||
38  (p1.first > closest_app.first && closest_app.first > p2.first);
39 
40  if(between) return sqrt(pow(closest_app.first - x, 2) +
41  pow(closest_app.second - y, 2));
42  else return FLT_MAX;
43 }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
T sqrt(T number)
Definition: d0nt_math.hpp:156
constexpr T pow(T x)
Definition: pow.h:75
static float point_to_line_segment ( const int  x,
const int  y,
const std::pair< int, int > &  p1,
const std::pair< int, int > &  p2 
)
static

Definition at line 52 of file absgeo.cxx.

References min(), point_to_line(), cet::pow(), and std::sqrt().

Referenced by screen_dist_to_track().

55 {
56  const float dist_to_inf_line = point_to_line(x, y, p1, p2);
57  const float dist_to_p1 = sqrt(pow(x - p1.first, 2) + pow(y - p1.second, 2));
58  const float dist_to_p2 = sqrt(pow(x - p2.first, 2) + pow(y - p2.second, 2));
59  return min(dist_to_inf_line, dist_to_p1, dist_to_p2);
60 }
T sqrt(T number)
Definition: d0nt_math.hpp:156
constexpr T pow(T x)
Definition: pow.h:75
static float point_to_line(const int x, const int y, const std::pair< int, int > &p1, const std::pair< int, int > &p2)
Definition: absgeo.cxx:11
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
float screen_dist_to_track ( const int  x,
const int  y,
const std::vector< std::pair< int, int > > &  track 
)

Definition at line 62 of file absgeo.cxx.

References dist, MECModelEnuComparisons::i, and point_to_line_segment().

Referenced by screen_to_activetrack().

64 {
65  float mindist = FLT_MAX;
66  for(unsigned int i = 0; i < track.size()-1; i++){
67  const float dist = point_to_line_segment(x, y, track[i], track[i+1]);
68  if(dist < mindist) mindist = dist;
69  }
70  return mindist;
71 }
Definition: event.h:19
double dist
Definition: runWimpSim.h:113
static float point_to_line_segment(const int x, const int y, const std::pair< int, int > &p1, const std::pair< int, int > &p2)
Definition: absgeo.cxx:52