SegmentationAlg.cxx
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 #include <sstream>
7 #include <cmath>
8 #include <algorithm>
9 #include <iomanip>
10 
11 namespace gar {
12  namespace geo {
13  namespace seg {
14 
15  //----------------------------------------------------------------------------
17  _name("Segmentation"), _type("Segmentation"), _encoding(pset.get<std::string>("cellEncoding")), _decoder(new BitFieldCoder(pset.get<std::string>("cellEncoding"))) {
18  }
19 
20  //----------------------------------------------------------------------------
22  _name("Segmentation"), _type("Segmentation"), _encoding(pset.get<std::string>("cellEncoding")), _decoder(newDecoder) {
23  }
24 
25  //----------------------------------------------------------------------------
27  if (_decoder != 0) {
28  delete _decoder;
29  }
30  }
31 
32  //----------------------------------------------------------------------------
33  void SegmentationAlg::setDecoder(const BitFieldCoder* newDecoder) {
34  if ( _decoder == newDecoder )
35  return; //self assignment
36  else {
37  delete _decoder;
38  }
39  _decoder = newDecoder;
40  }
41 
42  //----------------------------------------------------------------------------
43  double SegmentationAlg::binToPosition(gar::raw::CellID_t bin, double cellSize, double offset) {
44  return bin * cellSize + offset;
45  }
46 
47  //----------------------------------------------------------------------------
48  int SegmentationAlg::positionToBin(double position, double cellSize, double offset) {
49  return int( floor((position + 0.5 * cellSize - offset) / cellSize) );
50  }
51 
52  //----------------------------------------------------------------------------
53  double SegmentationAlg::getStripLength(const gar::geo::GeometryCore& , const std::array<double, 3> & , const gar::raw::CellID_t& ) const {
54  return 0.;
55  }
56 
57  //----------------------------------------------------------------------------
58  std::pair<TVector3, TVector3> SegmentationAlg::getStripEnds(const gar::geo::GeometryCore& , const std::array<double, 3> & , const gar::raw::CellID_t& ) const {
59  return std::make_pair( TVector3(0, 0, 0), TVector3(0, 0, 0) );
60  }
61 
62  //----------------------------------------------------------------------------
63  std::pair<float, float> SegmentationAlg::CalculateLightPropagation(const gar::geo::GeometryCore& , const std::array<double, 3> & , const gar::raw::CellID_t& ) const {
64  return std::make_pair( 0., 0. );
65  }
66 
67  //----------------------------------------------------------------------------
68  std::array<double, 3> SegmentationAlg::ReconstructStripHitPosition(const gar::geo::GeometryCore& , const std::array<double, 3> & , const float & , const gar::raw::CellID_t& ) const {
69  return std::array<double, 3>{ {0., 0., 0.} };
70  }
71  }//seg
72  }//geo
73  } //gar
virtual std::array< double, 3 > ReconstructStripHitPosition(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const float &xlocal, const gar::raw::CellID_t &cID) const
const BitFieldCoder * _decoder
std::string string
Definition: nybbler.cc:12
STL namespace.
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
virtual void setDecoder(const BitFieldCoder *decoder)
virtual std::pair< float, float > CalculateLightPropagation(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
static int positionToBin(double position, double cellSize, double offset=0)
static double binToPosition(gar::raw::CellID_t bin, double cellSize, double offset=0)
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
virtual std::pair< TVector3, TVector3 > getStripEnds(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
long long int CellID_t
Definition: CaloRawDigit.h:24
General GArSoft Utilities.
QTextStream & bin(QTextStream &s)
SegmentationAlg(fhicl::ParameterSet const &pset)
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
LArSoft geometry interface.
Definition: ChannelGeo.h:16
virtual double getStripLength(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const