Functions | Variables
hits.cxx File Reference
#include <gtk/gtk.h>
#include <vector>
#include <algorithm>
#include <stdint.h>
#include "event.h"
#include "drawing.h"
#include "geo.h"
#include "status.h"

Go to the source code of this file.

Functions

static bool by_charge (const hit &a, const hit &b)
 
 __attribute__ ((unused)) static bool by_time(const hit &a
 
static void colorhit (const int32_t adc, float &red, float &green, float &blue, const bool active)
 
void draw_hit (cairo_t *cr, const hit &thishit, GtkWidget **edarea)
 
void draw_hits (cairo_t **cr, const DRAWPARS *const drawpars, GtkWidget **edarea)
 

Variables

std::vector< noeeventtheevents
 
int gevi
 
int pixx
 
int pixy
 
int active_plane
 
int active_cell
 
const hitb
 

Function Documentation

__attribute__ ( (unused)  ) const

Referenced by by_charge().

static bool by_charge ( const hit a,
const hit b 
)
static

Definition at line 15 of file hits.cxx.

References __attribute__(), a, hit::adc, and b.

Referenced by draw_hits().

16 {
17  return a.adc < b.adc;
18 }
int16_t adc
Definition: event.h:3
static void colorhit ( const int32_t  adc,
float &  red,
float &  green,
float &  blue,
const bool  active 
)
static

Definition at line 28 of file hits.cxx.

References rootlogon::blue, rootlogon::green, art::left(), and red().

Referenced by draw_hit().

30 {
31  const float graycut = 85;
32 
33  const float mingray = 0.02, maxgray = 0.3;
34 
35  if(adc < graycut) red = green = blue = mingray + (maxgray - mingray)*(adc/graycut);
36  else if(adc < 600) blue = 1.0, red = 0.2, green = 0.3;
37  else if(adc < 1400) green = 1, red = blue = 0;
38  else red = 1, green = blue = 0;
39 
40  // Brighten this hit while trying to retain some of its original color, but
41  // just make it white if that is what it takes to make a difference.
42  if(active){
43  const float goal = 1.3;
44  const float left = 3 - red - blue - green;
45  if(left < goal){
46  red = blue = green = 1;
47  }
48  else{
49  red += goal*(1 - red)/left;
50  blue += goal*(1 - blue)/left;
51  green += goal*(1 - green)/left;
52  }
53  }
54 }
void red()
Definition: red.C:20
tuple blue
Definition: rootlogon.py:65
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
void draw_hit ( cairo_t *  cr,
const hit thishit,
GtkWidget **  edarea 
)

Definition at line 58 of file hits.cxx.

References active_cell, active_plane, hit::adc, rootlogon::blue, hit::cell, colorhit(), det_to_screen_x(), det_to_screen_y(), rootlogon::green, kX, kY, pixx, pixy, hit::plane, red(), and scintpix_from_pixx().

Referenced by change_highlighted_cell(), and draw_hits().

59 {
60  const noe_view_t V = thishit.plane%2 == 1?kX:kY;
61 
62  // Get position of upper left corner. If the zoom carries this hit entirely
63  // out of the view in screen y, don't waste cycles displaying it.
64  const int screenx = det_to_screen_x(thishit.plane);
65  if(screenx+pixx < 0) return;
66  if(screenx > edarea[V]->allocation.width) return;
67 
68  const int screeny = det_to_screen_y(thishit.plane, thishit.cell);
69  if(screeny+pixy < 0) return;
70  if(screeny > edarea[V]->allocation.height) return;
71 
72  float red, green, blue;
73 
74  colorhit(thishit.adc, red, green, blue,
75  thishit.plane == active_plane && thishit.cell == active_cell);
76 
77  cairo_set_source_rgb(cr, red, green, blue);
78 
79  // If we're representing cells with a very small number of pixels,
80  // draw all the way across to the next plane in the view to be easier
81  // to look at. If cells are visually large, make them closer to the
82  // actual size of the scintillator.
83  // XXX how about a yexpand to show the scintillator size in y?
84  // XXX are tracks correctly aligned with hits in both expanded and unexpanded
85  // styles? (Probably not!)
86  const bool xexpand = pixx <= 3;
87  const int epixx = xexpand?pixx:scintpix_from_pixx(pixx);
88 
89  // This is the only part of drawing an event that takes any time
90  // I have measured drawing a line to be twice as fast as drawing a
91  // rectangle of width 1, so it is totally worth it to have a special
92  // case. This really helps with drawing big events.
93  if(pixy == 1){
94  cairo_move_to(cr, screenx, screeny+0.5);
95  cairo_line_to(cr, screenx+epixx, screeny+0.5);
96  cairo_stroke(cr);
97  }
98  // This is a smaller gain, but it is definitely faster by about 10%.
99  else if(pixy == 2){
100  cairo_move_to(cr, screenx, screeny+0.5);
101  cairo_line_to(cr, screenx+epixx, screeny+0.5);
102  cairo_move_to(cr, screenx, screeny+1.5);
103  cairo_line_to(cr, screenx+epixx, screeny+1.5);
104  cairo_stroke(cr);
105  }
106  else{
107  cairo_rectangle(cr, screenx+0.5, screeny+0.5,
108  epixx-1, pixy-1);
109  cairo_fill(cr);
110  }
111 }
GtkWidget * edarea[kXorY]
Definition: drawing.cxx:20
int pixy
Definition: geo.cxx:24
int pixx
Definition: geo.cxx:24
uint16_t plane
Definition: event.h:2
void red()
Definition: red.C:20
int active_plane
Definition: main.cxx:78
uint16_t cell
Definition: event.h:2
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;})
tuple blue
Definition: rootlogon.py:65
int16_t adc
Definition: event.h:3
int active_cell
Definition: main.cxx:78
int det_to_screen_y(const int plane, const int cell)
Definition: geo.cxx:119
static void colorhit(const int32_t adc, float &red, float &green, float &blue, const bool active)
Definition: hits.cxx:28
Definition: geo.h:1
int scintpix_from_pixx(const int x)
Definition: geo.cxx:61
int det_to_screen_x(const int plane)
Definition: geo.cxx:100
noe_view_t
Definition: geo.h:1
void draw_hits ( cairo_t **  cr,
const DRAWPARS *const  drawpars,
GtkWidget **  edarea 
)

Definition at line 116 of file hits.cxx.

References by_charge(), draw_hit(), DRAWPARS::firsttick, gevi, hits(), MECModelEnuComparisons::i, kX, kXorY, kY, DRAWPARS::lasttick, hit::plane, set_eventn_status_progress(), hit::tdc, and theevents.

Referenced by draw_event().

117 {
118  if(theevents[gevi].hits.empty()) return;
119 
120  for(int i = 0; i < kXorY; i++) cairo_set_line_width(cr[i], 1.0);
121 
122  std::vector<hit> & THEhits = theevents[gevi].hits;
123 
124  std::sort(THEhits.begin(), THEhits.end(), by_charge);
125 
126  const int big = 100000;
127  const bool bigevent = THEhits.size() > big;
128 
129  int ndrawn = 0;
130  for(unsigned int i = 0; i < THEhits.size(); i++){
131  const hit & thishit = THEhits[i];
132 
133  if(thishit.tdc < drawpars->firsttick ||
134  thishit.tdc > drawpars->lasttick) continue;
135 
136  if(bigevent && (++ndrawn)%big == 0)
137  set_eventn_status_progress(ndrawn, THEhits.size());
138 
139  draw_hit(cr[thishit.plane%2 == 1?kX:kY], thishit, edarea);
140  }
141 }
GtkWidget * edarea[kXorY]
Definition: drawing.cxx:20
static bool by_charge(const hit &a, const hit &b)
Definition: hits.cxx:15
void set_eventn_status_progress(const int nhit, const int tothits)
Definition: status.cxx:187
Definition: geo.h:1
uint16_t plane
Definition: event.h:2
int32_t tdc
Definition: event.h:5
int gevi
Definition: main.cxx:76
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;})
void hits()
Definition: readHits.C:15
std::vector< noeevent > theevents
Definition: noe_module.cc:28
void draw_hit(cairo_t *cr, const hit &thishit, GtkWidget **edarea)
Definition: hits.cxx:58
Definition: structs.h:12
Definition: geo.h:1
int32_t firsttick
Definition: drawing.h:4
int32_t lasttick
Definition: drawing.h:4

Variable Documentation

int active_cell

Definition at line 78 of file main.cxx.

Referenced by draw_hit().

int active_plane

Definition at line 78 of file main.cxx.

Referenced by draw_hit().

const hit& b
Initial value:
{
return a.tdc < b.tdc
int32_t tdc
Definition: event.h:5
const double a
const hit & b
Definition: hits.cxx:21

Definition at line 21 of file hits.cxx.

Referenced by AddBin(), evdb::View2D::AddBox(), daqdataformats::VERSION_NAMESPACE::RawDataBlock::addMicroBlock4(), ana::KrigeKernel::AddPoint(), tbana::DetectorRateShutOff::analyze(), air::AirKalmanAna::analyze(), novaddt::HotMapMaker::AppendCold(), novaddt::HotMapMaker::AppendHot(), novaddt::HotMapMaker::AppendRate(), genie::KNOHadronization::AverageChMult(), art::RangeSet::back(), fnex::CovarianceMatrixMaker::beginJob(), stan::math::beta_rng(), bin_composition_pie_chart(), genie::utils::nuclear::BindEnergy(), by_charge(), vdt::Segment::CalcChi2Line0(), Calculate2DChi2(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), beamlinereco::WCTrackAlg::calculateTheMomentum(), stan::math::categorical_logit_rng(), stan::math::categorical_rng(), earms::GridSearch::ChooseBestProngDir(), geo::ClosestApproach(), genie::utils::kinematics::CohQ2Lim(), ana::CombineExposures(), boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::compare_index(), boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::compare_index(), compareEvents(), genie::RSHelicityAmplModelNCn::Compute(), genie::RSHelicityAmplModelNCp::Compute(), genie::RSHelicityAmplModelCC::Compute(), stan::math::LDLT_factor< var, R, C >::compute(), genie::alvarezruso::AREikonalSolution::Con(), CLHEP::MixMaxRng::convert1double(), genie::geometry::PlaneParam::ConvertMaster2Top(), ana::CountingExperimentPValue(), ana::CountingExperimentPValueByLL(), fnex::CovarianceBinUtility::CovarianceBinUtility(), genie::utils::nuclear::DensityGaus(), genie::mueloss::gsl::PetrukhinShestakovIntegrand::DoEval(), genie::mueloss::gsl::KokoulinPetrukhinIntegrand::DoEval(), genie::utils::gsl::dXSec_Log_Wrapper::DoEval(), evd::TQPad::Draw(), draw_event(), evd::GeometryDrawer::DrawCells2D(), evd::GeometryDrawer::DrawDCMBoxes(), evd::GeometryDrawer::DrawHighlightCell(), evd::RecoBaseDrawer::DrawHoughResults2D(), fnex::MultiExperiment::DrawParallelPlots(), fnex::CorrectedSpectrum::DrawStacks(), ana::CovMxSurface::DrawSurfacePoint(), DrawSurfacePoint(), stan::mcmc::softabs_metric< Model, BaseRNG >::dtau_dq(), calib::SystematicUncertaintyScaleAna::endJob(), dt::Cand::EstimateStraightLine(), osc::_PMNS< T >::EvalEqn11(), osc::_PMNS< T >::EvalEqn2(), fiducial_mass(), flat::FileListBranchPolicy::FileListBranchPolicy(), cmf::ChiSqrCalculator::FillChiSqrHistograms(), cmf::ChiSqrCalculator::FillCovarianceMatrix(), fnex::CovarianceFitHelper::FillCovarianceMatrix(), fnex::CovarianceFitHelper::FillEnergySpectra(), art::RootInputTree::fillGroups(), cmf::CovarianceBinUtility::FillOffsetAndBinMaps(), cmf::CovarianceMatrixMaker::FillSpectrum(), cmf::SpectrumPredictionMaker::FindOscillationPoints(), fit_thresh_corrs(), fit_thresh_corrs_fb(), trk::WindowTrackingAlg::FitWindow(), fnex::FixedBinning::FixedBinning(), stan::math::fmax(), genie::utils::nuclear::FmI2(), stan::math::fmin(), sn::SNBackgroundRejection::FOM(), FOMCalc(), g4lbneCrossChecks(), g4minervaCrossChecks(), GammaFit(), genie::BBA03ELFormFactorsModel::Gen(), numusand::NumuSandFxs::getAveTrackdEdxLast4Cells(), numusand::NumuSandFxs::getAveTrackdEdxLast6Cells(), numusand::NumuSandFxs::getAveTrackdEdxLast8Cells(), trackinfo::TrackInfoFxs::getAveTrackdEdxLastCells(), DrawUtils::GetBestYRange(), ana::covmx::CovarianceMatrix::GetBinning(), ana::LabelsAndBins::GetBins1D(), ana::covmx::CovarianceMatrix::GetFullBinning(), genie::alvarezruso::AlvarezRusoCOHPiPDXSec::GetLeptonMass(), evg::MCTruthToDk2NuHackItr::GetMCTruthPtr(), novaddt::MichelETrigger::GetSmartPrescale(), LSTME::Png3dVars::getSortedIndices(), SliceLID::Png3dVars::getSortedIndices(), fnex::CorrectedSpectrum::GetStacksCanvasCopy(), Grid(), gsDefaultInterp(), gt(), cheat::BackTracker::HitCollectionEfficiency(), stan::math::hypergeometric_log(), stan::math::hypergeometric_lpmf(), stan::math::inc_beta_dda(), stan::math::inc_beta_ddb(), genie::utils::kinematics::InelYLim_X(), genie::utils::kinematics::electromagnetic::InelYLim_X(), fnex::CovarianceFitHelper::Initialize(), cet::map_vector< Value >::insert(), rb::Track::InterpolateDir(), rb::Track::InterpolateXY(), stan::math::inv_Phi(), stan::math::LDLT_factor< T, R, C >::inverse(), util::ipow(), isCloseEnough(), genie::geometry::PlaneParam::IsValid(), hdf5::Join(), hough::IslandsTH2::LabelIslands(), art::left(), lin_solve(), novaddt::TrackFit::LinFit(), novaddt::NNFastMMTrigger::LinFit(), zcl::FmmTrackerValidation::LinFit(), novaddt::UpMuTrigger::LinFit(), zcl::FastMMStudy::LinFit(), novaddt::UpMuAna::LinFit(), upmuana::UpMuAnalysis::LinFit(), upmuana::UpMuRecoAna::LinFit(), geo::LinFit(), novaddt::UpMuTrigger::LinFitLLR(), novaddt::UpMuAna::LinFitLLR(), upmuana::LlrUpmu::LLR(), upmuana::UpMuAnalysis::LLR(), upmuana::UpMuRecoAna::LLR(), genie::NievesQELCCPXSec::LmunuAnumu(), dbutils::RunHistory::Load(), nerd::NERDEval::load_anchors(), nova::dbi::RunHistory::LoadDAQRunHistory(), g4n::LoadNeutronFates(), lsqr_fprime(), lt(), geo::ltKey(), fnex::CovarianceFitHelper::Make1DSpectra(), cmf::CovarianceFitHelper::Make1DSpectra(), make_extrap_figure(), make_pi0_xcheck(), nerd::NERDProng::MakeCluster(), MakeCovMx(), cmf::PlotUtilities::MakeEnergySpectraFromBins(), cmf::SpectrumPredictionMaker::MakeHiddenParameterHistograms(), evdb::ColorScale::MakeHSVScale(), novaddt::HotMapMaker::MakeMask(), evtsum::EventSummary::MakeOutput(), cmf::PlotUtilities::MakeSpectrumHistogram(), MakeTestStandPlots_AllRuns(), MakeTestStandPlots_NewRuns(), cmf::RandomUniverseUtility::MakeUniverseHistograms(), stan::math::matrix_exp_2x2(), Eigen::matrix_exp_pade13(), Eigen::matrix_exp_pade3(), Eigen::matrix_exp_pade5(), Eigen::matrix_exp_pade7(), Eigen::matrix_exp_pade9(), std::max(), MAX(), stan::math::mdivide_left(), stan::math::mdivide_left_ldlt(), stan::math::mdivide_left_spd(), stan::math::mdivide_left_tri(), stan::math::mdivide_left_tri_low(), stan::math::mdivide_right(), stan::math::mdivide_right_tri_low(), nl::TimeSeriesData::MeanValue(), mec_tuning(), mec_tuning_fitter_2020(), dt::DiscreteTracker::MergeParasiteTracks(), min(), std::min(), evd::RawDrawingOptions::ModuleList(), evd::RecoDrawingOptions::ModuleList(), hough::MultiHough2P::MultiMap(), genie::geometry::PlaneParam::Normalize(), cmf::PlotUtilities::NormalizeBinContents(), fnex::CovarianceFitHelper::NormalizeHistograms(), nus17_fiducial_mass(), art::operator!=(), stan::math::operator!=(), cet::operator!=(), CLHEP::operator!=(), art::operator&&(), ana::_Cut< T >::operator&&(), order_cuts::operator()(), order_chns::operator()(), ana::_Var< T >::operator*(), stan::math::operator*(), ana::_Var< T >::operator+(), stan::math::operator+(), cmf::OscParamPoint::operator+=(), ana::_Var< T >::operator-(), stan::math::var::operator->(), ana::_Var< T >::operator/(), art::operator<(), stan::math::operator<(), lem::LiteHit::operator<(), nova::database::Column::operator<(), nutools::dbi::Column::operator<(), nova::dbi::Column::operator<(), caf::operator<(), CLHEP::operator<(), art::operator<<(), CLHEP::operator<<(), nova::dbi::operator<<(), nova::database::operator<<(), genie::flux::operator<<(), stan::math::operator<=(), nova::database::Column::operator<=(), nutools::dbi::Column::operator<=(), nova::dbi::Column::operator<=(), CLHEP::operator<=(), art::BoolCache::operator=(), stan::math::operator==(), nova::database::Column::operator==(), CLHEP::operator==(), stan::math::operator>(), nova::database::Column::operator>(), nutools::dbi::Column::operator>(), nova::dbi::Column::operator>(), CLHEP::operator>(), stan::math::operator>=(), nova::database::Column::operator>=(), nutools::dbi::Column::operator>=(), nova::dbi::Column::operator>=(), CLHEP::operator>=(), ana::_Cut< T >::operator||(), art::operator||(), overlayFBplots(), overlayFBplotsH(), evdb::ParamFrame::ParamFrame(), genie::geometry::PlaneParam::PlaneParam(), plot_3NDvsFD(), plot_3NDvsFD_FHC(), plot_3NDvsFD_RHC(), plot_abstree(), plot_datamc_ND_numu(), plot_datamc_ND_numu_REW(), plot_ND_numu_NOMvsREW(), plot_NDvsFD_REW(), plot_NDvsFD_weights(), plot_NDvsFD_weights_FHC(), plot_NDvsFD_weights_RHC(), plot_pi0_xcheck(), art::DataViewImpl::PMValue::PMValue(), sim::PhotonSignal::PoissonLambda(), cmf::RandomUniverseUtility::PoissonSpectrumBinByBin(), calib::Calibrator::postBeginRun(), g4n::NeutronSubstitutionProcess::PostStepDoIt(), ana::_Cut< caf::SRProxy >::POT(), pots(), genie::P33PaschosLalakulichPXSec::PPiStar(), ana::Kriger::Predict(), caf::SRBranchRegistry::Print(), genie::geometry::PlaneParam::Print(), PrintTableFourBins(), cvntf::CVNCosmicTFFilt::produce(), cvn::CVNCosmicMapper::produce(), fhicl::ParameterSetRegistry::put(), cet::registry_via_id< K, V >::put(), genie::SmithMonizUtils::Q2lim1_SM(), genie::SmithMonizUtils::Q2lim2_SM(), evdb::ScanFrame::RadioButton(), evdb::ParameterSetEditRow::RadioButtonClicked(), art::MixOp< PROD, OPROD >::readFromFile(), ana::RefineSeeds(), HepGeom::Reflect3D::Reflect3D(), refresh(), resolutionplotterbias(), hough::MultiHough2P::ReweightHits(), RunCalibration(), stan::model::rvalue(), BrightnessModelPlots::SchedulePlots(), evdb::ColorScale::SetBounds(), genie::utils::gsl::d5XSecAR::SetFlip(), HepGeom::Transform3D::setIdentity(), nova::dbi::RunHistory::SetIsBad(), evdb::ParameterSetEditRow::SetupCheckButton(), evdb::ParameterSetEditRow::SetupRadioButtons(), calib::DriftCache::SetUseEpochs(), calib::AbsCache::SetUseEpochs(), calib::AttenCache::SetUseEpochs(), show_potential(), slid::ShowerLID::ShowerLID(), ana::SimpleFOM(), hough::Hough2P::SmoothMap(), hough::MultiHough2P::SmoothMap(), solve(), osc::analytic::SolveCubic(), ana::MCMCSamples::SortedLLs(), evd::RawDataDrawer::StickFigure(), cet::map_vector< Value >::swap(), art::ValidHandle< T >::swap(), systematics_summary_from_pred_interp(), ana::systsQ3Q0(), TEST(), calib::ThresholdCorrMap::ThresholdCorrAt(), art::detail::throw_if_invalid(), time_wide_plot(), caf::SRBranchRegistry::ToFile(), ana::BayesianMarginal::ToHistogram(), train_dectree_caf(), lem::dec::Forest::TrainSingle(), rb::Track::Trajectory(), ncid::NCNNKeras::TransMomFraction(), earms::ElasticArms::UpdateVia(), uptime(), cmf::SelectionUtility::UsesDetAndBeam(), cmf::SelectionUtility::UsesDetBeamAndSel(), osc::VacuumHamiltonian(), ana::Var2D(), ana::Var3D(), VarContainer::VarContainer(), genie::geometry::PlaneParam::Vd(), genie::geometry::PlaneParam::Vn(), genie::SmithMonizUtils::vQES_SM_lim(), cmf::RandomUniverses::writeResults(), genie::ReinDFRPXSec::XSec(), genie::BergerSehgalFMCOHPiPXSec2015::XSec(), genie::BergerSehgalCOHPiPXSec2015::XSec(), genie::ReinSehgalCOHPiPXSec::XSec(), zheevq3(), rb::Track::ZipWith(), and calib::ThresholdCorrMap::~ThresholdCorrMap().

int gevi

Definition at line 76 of file main.cxx.

Referenced by draw_hits().

int pixx

Definition at line 24 of file geo.cxx.

Referenced by draw_hit().

int pixy

Definition at line 24 of file geo.cxx.

Referenced by draw_hit().

std::vector<noeevent> theevents

Definition at line 28 of file noe_module.cc.

Referenced by draw_hits().