Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gar::geo::seg::SegmentationGridXYAlg Class Reference

#include <SegmentationGridXYAlg.h>

Inheritance diagram for gar::geo::seg::SegmentationGridXYAlg:
gar::geo::seg::SegmentationAlg

Public Member Functions

 SegmentationGridXYAlg (fhicl::ParameterSet const &pset)
 Default constructor used by derived classes passing the encoding string. More...
 
 SegmentationGridXYAlg (const BitFieldCoder *decoder, fhicl::ParameterSet const &pset)
 Default constructor used by derived classes passing an existing decoder. More...
 
 ~SegmentationGridXYAlg ()
 
void reconfigure (fhicl::ParameterSet const &pset) override
 
void Initialize (const gar::geo::GeometryCore &geo) override
 
std::array< double, 3 > GetPosition (const gar::geo::GeometryCore &geo, const gar::raw::CellID_t &cID) const override
 
gar::raw::CellID_t GetCellID (const gar::geo::GeometryCore &geo, const unsigned int &det_id, const unsigned int &stave, const unsigned int &module, const unsigned int &layer, const unsigned int &slice, const std::array< double, 3 > &localPosition) const override
 determine the cell ID based on the position More...
 
bool isTile (const gar::raw::CellID_t &) const override
 
bool isBarrel (const gar::raw::CellID_t &cID) const override
 
const double & gridSizeX () const override
 
const double & gridSizeY () const
 
const double & offsetX () const
 
const double & offsetY () const
 
const std::stringfieldNameX () const
 
const std::stringfieldNameY () const
 
const unsigned int & nLayers () const override
 
void setGridSizeX (double cellSize)
 
void setGridSizeY (double cellSize)
 
void setOffsetX (double offset)
 
void setOffsetY (double offset)
 
void setFieldNameX (const std::string &fieldName)
 
void setFieldNameY (const std::string &fieldName)
 
void setLayerDimXY (const double &dimX, const double &dimY) const override
 
void setVariables (const double &, const double &) const override
 
- Public Member Functions inherited from gar::geo::seg::SegmentationAlg
virtual ~SegmentationAlg ()
 
virtual const std::stringname () const
 
virtual void setName (const std::string &value)
 
virtual const std::stringtype () const
 
virtual const std::stringdescription () const
 
virtual const BitFieldCoderdecoder () const
 
virtual const double & stripSizeX () const
 
virtual const unsigned int & nPlanes () const
 
virtual const std::stringcellEncoding () const
 
virtual void setDecoder (const BitFieldCoder *decoder)
 
virtual double getStripLength (const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
 
virtual std::pair< TVector3, TVector3 > getStripEnds (const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
 
virtual std::pair< float, float > CalculateLightPropagation (const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
 
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
 

Protected Member Functions

void PrintParameters () const override
 
- Protected Member Functions inherited from gar::geo::seg::SegmentationAlg
 SegmentationAlg (fhicl::ParameterSet const &pset)
 
 SegmentationAlg (const BitFieldCoder *decoder, fhicl::ParameterSet const &pset)
 

Protected Attributes

double _gridSizeX
 the grid size in X More...
 
double _offsetX
 the coordinate offset in X More...
 
double _gridSizeY
 the grid size in Y More...
 
double _offsetY
 the coordinate offset in Y More...
 
std::string _xId
 the field name used for X More...
 
std::string _yId
 the field name used for Y More...
 
std::string _encoding
 the encoding string More...
 
unsigned int _nLayers
 number of layers More...
 
double _layer_dim_X
 layer dimension in X More...
 
double _layer_dim_Y
 layer dimension in Y More...
 
- Protected Attributes inherited from gar::geo::seg::SegmentationAlg
std::string _name
 
std::string _type
 
std::string _description
 
std::string _encoding
 
double _gridSizeX
 
double _stripSizeX
 
unsigned int _nLayers
 
unsigned int _nPlanes
 
const BitFieldCoder_decoder = 0
 

Additional Inherited Members

- Static Protected Member Functions inherited from gar::geo::seg::SegmentationAlg
static double binToPosition (gar::raw::CellID_t bin, double cellSize, double offset=0)
 
static int positionToBin (double position, double cellSize, double offset=0)
 

Detailed Description

Definition at line 18 of file SegmentationGridXYAlg.h.

Constructor & Destructor Documentation

gar::geo::seg::SegmentationGridXYAlg::SegmentationGridXYAlg ( fhicl::ParameterSet const &  pset)

Default constructor used by derived classes passing the encoding string.

Definition at line 16 of file SegmentationGridXYAlg.cxx.

17  : SegmentationAlg(pset)
18  {
19  _type = "GridXY";
20  _description = "Cartesian segmentation in the local XY-plane";
21 
22  std::cout << " ######### gar::geo::seg::SegmentationGridXYAlg() " << std::endl ;
23 
24  this->reconfigure(pset);
25  }
void reconfigure(fhicl::ParameterSet const &pset) override
SegmentationAlg(fhicl::ParameterSet const &pset)
QTextStream & endl(QTextStream &s)
gar::geo::seg::SegmentationGridXYAlg::SegmentationGridXYAlg ( const BitFieldCoder decoder,
fhicl::ParameterSet const &  pset 
)

Default constructor used by derived classes passing an existing decoder.

Definition at line 29 of file SegmentationGridXYAlg.cxx.

30  : SegmentationAlg(decode, pset)
31  {
32  _type = "GridXY";
33  _description = "Cartesian segmentation in the local XY-plane";
34 
35  std::cout << " ######### gar::geo::seg::SegmentationGridXYAlg() " << std::endl ;
36 
37  this->reconfigure(pset);
38  }
void reconfigure(fhicl::ParameterSet const &pset) override
void decode(std::any const &a, Hep2Vector &result)
Definition: CLHEP_ps.h:12
SegmentationAlg(fhicl::ParameterSet const &pset)
QTextStream & endl(QTextStream &s)
gar::geo::seg::SegmentationGridXYAlg::~SegmentationGridXYAlg ( )

Definition at line 41 of file SegmentationGridXYAlg.cxx.

42  {
43  }

Member Function Documentation

const std::string& gar::geo::seg::SegmentationGridXYAlg::fieldNameX ( ) const
inline

Definition at line 47 of file SegmentationGridXYAlg.h.

47 { return _xId; }
std::string _xId
the field name used for X
const std::string& gar::geo::seg::SegmentationGridXYAlg::fieldNameY ( ) const
inline

Definition at line 49 of file SegmentationGridXYAlg.h.

49 { return _yId; }
std::string _yId
the field name used for Y
gar::raw::CellID_t gar::geo::seg::SegmentationGridXYAlg::GetCellID ( const gar::geo::GeometryCore geo,
const unsigned int &  det_id,
const unsigned int &  stave,
const unsigned int &  module,
const unsigned int &  layer,
const unsigned int &  slice,
const std::array< double, 3 > &  localPosition 
) const
overridevirtual

determine the cell ID based on the position

Implements gar::geo::seg::SegmentationAlg.

Definition at line 84 of file SegmentationGridXYAlg.cxx.

85  {
86  gar::raw::CellID_t cID = 0;
87 
88  _decoder->set(cID, "system", det_id);
89  _decoder->set(cID, "module", module);
90  _decoder->set(cID, "stave", stave);
91  _decoder->set(cID, "layer", layer);
92  _decoder->set(cID, "slice", slice);
93 
94  _decoder->set(cID, _xId, positionToBin(localPosition[0], _gridSizeX, _offsetX));
95  _decoder->set(cID, _yId, positionToBin(localPosition[1], _gridSizeY, _offsetY));
96 
97  return cID;
98  }
const BitFieldCoder * _decoder
double _offsetY
the coordinate offset in Y
void set(long64 &bitfield, size_t index, ulong64 value) const
std::string _xId
the field name used for X
static int positionToBin(double position, double cellSize, double offset=0)
double _offsetX
the coordinate offset in X
long long int CellID_t
Definition: CaloRawDigit.h:24
std::string _yId
the field name used for Y
std::array< double, 3 > gar::geo::seg::SegmentationGridXYAlg::GetPosition ( const gar::geo::GeometryCore geo,
const gar::raw::CellID_t cID 
) const
overridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 72 of file SegmentationGridXYAlg.cxx.

73  {
74  std::array<double, 3> cellPosition;
75  cellPosition[0] = binToPosition(_decoder->get(cID, _xId), _gridSizeX, _offsetX);
76  cellPosition[1] = binToPosition(_decoder->get(cID, _yId), _gridSizeY, _offsetY);
77  cellPosition[2] = 0.;
78 
79  return cellPosition;
80  }
const BitFieldCoder * _decoder
double _offsetY
the coordinate offset in Y
std::string _xId
the field name used for X
double _offsetX
the coordinate offset in X
static double binToPosition(gar::raw::CellID_t bin, double cellSize, double offset=0)
long64 get(long64 bitfield, size_t index) const
std::string _yId
the field name used for Y
const double& gar::geo::seg::SegmentationGridXYAlg::gridSizeX ( ) const
inlineoverridevirtual

Reimplemented from gar::geo::seg::SegmentationAlg.

Definition at line 39 of file SegmentationGridXYAlg.h.

39 { return _gridSizeX; }
const double& gar::geo::seg::SegmentationGridXYAlg::gridSizeY ( ) const
inline

Definition at line 41 of file SegmentationGridXYAlg.h.

41 { return _gridSizeY; }
void gar::geo::seg::SegmentationGridXYAlg::Initialize ( const gar::geo::GeometryCore geo)
overridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 66 of file SegmentationGridXYAlg.cxx.

67  {
68 
69  }
bool gar::geo::seg::SegmentationGridXYAlg::isBarrel ( const gar::raw::CellID_t cID) const
overridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 101 of file SegmentationGridXYAlg.cxx.

102  {
103  bool isBarrel = true;
104 
105  int det_id = _decoder->get(cID, "system");
106  int module = _decoder->get(cID, "module");
107  if( det_id == 2 && (module == 0 || module == 6) ) isBarrel = false;
108 
109  return isBarrel;
110  }
const BitFieldCoder * _decoder
long64 get(long64 bitfield, size_t index) const
bool isBarrel(const gar::raw::CellID_t &cID) const override
bool gar::geo::seg::SegmentationGridXYAlg::isTile ( const gar::raw::CellID_t ) const
inlineoverridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 35 of file SegmentationGridXYAlg.h.

35 { return true; }
const unsigned int& gar::geo::seg::SegmentationGridXYAlg::nLayers ( ) const
inlineoverridevirtual

Reimplemented from gar::geo::seg::SegmentationAlg.

Definition at line 51 of file SegmentationGridXYAlg.h.

51 { return _nLayers; }
unsigned int _nLayers
number of layers
const double& gar::geo::seg::SegmentationGridXYAlg::offsetX ( ) const
inline

Definition at line 43 of file SegmentationGridXYAlg.h.

43 { return _offsetX; }
double _offsetX
the coordinate offset in X
const double& gar::geo::seg::SegmentationGridXYAlg::offsetY ( ) const
inline

Definition at line 45 of file SegmentationGridXYAlg.h.

45 { return _offsetY; }
double _offsetY
the coordinate offset in Y
void gar::geo::seg::SegmentationGridXYAlg::PrintParameters ( ) const
overrideprotectedvirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 113 of file SegmentationGridXYAlg.cxx.

114  {
115  std::cout << "cell encoding: " << _encoding << std::endl;
116  std::cout << "identifier_x: " << _xId << std::endl;
117  std::cout << "identifier_y: " << _yId << std::endl;
118  std::cout << "grid_size_x: " << _gridSizeX << " cm" << std::endl;
119  std::cout << "grid_size_y: " << _gridSizeY << " cm" << std::endl;
120  std::cout << "offset_x: " << _offsetX << " cm" << std::endl;
121  std::cout << "offset_y: " << _offsetY << " cm" << std::endl;
122  }
double _offsetY
the coordinate offset in Y
std::string _encoding
the encoding string
std::string _xId
the field name used for X
double _offsetX
the coordinate offset in X
std::string _yId
the field name used for Y
QTextStream & endl(QTextStream &s)
void gar::geo::seg::SegmentationGridXYAlg::reconfigure ( fhicl::ParameterSet const &  pset)
overridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 46 of file SegmentationGridXYAlg.cxx.

47  {
48  _xId = pset.get<std::string>("identifier_x");
49  _yId = pset.get<std::string>("identifier_y");
50  _encoding = pset.get<std::string>("cellEncoding");
51 
52  _gridSizeX = pset.get<double>("grid_size_x");
53  _gridSizeY = pset.get<double>("grid_size_y");
54 
55  _offsetX = pset.get<double>("offset_x");
56  _offsetY = pset.get<double>("offset_y");
57 
58  _nLayers = pset.get<unsigned int>("nlayers");
59 
61 
62  return;
63  }
double _offsetY
the coordinate offset in Y
std::string string
Definition: nybbler.cc:12
std::string _encoding
the encoding string
std::string _xId
the field name used for X
double _offsetX
the coordinate offset in X
std::string _yId
the field name used for Y
unsigned int _nLayers
number of layers
void gar::geo::seg::SegmentationGridXYAlg::setFieldNameX ( const std::string fieldName)
inline

Definition at line 61 of file SegmentationGridXYAlg.h.

61 { _xId = fieldName; }
std::string _xId
the field name used for X
void gar::geo::seg::SegmentationGridXYAlg::setFieldNameY ( const std::string fieldName)
inline

Definition at line 63 of file SegmentationGridXYAlg.h.

63 { _yId = fieldName; }
std::string _yId
the field name used for Y
void gar::geo::seg::SegmentationGridXYAlg::setGridSizeX ( double  cellSize)
inline

Definition at line 53 of file SegmentationGridXYAlg.h.

53 { _gridSizeX = cellSize; }
void gar::geo::seg::SegmentationGridXYAlg::setGridSizeY ( double  cellSize)
inline

Definition at line 55 of file SegmentationGridXYAlg.h.

55 { _gridSizeY = cellSize; }
void gar::geo::seg::SegmentationGridXYAlg::setLayerDimXY ( const double &  dimX,
const double &  dimY 
) const
inlineoverridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 65 of file SegmentationGridXYAlg.h.

65 { _layer_dim_X = dimX; _layer_dim_Y = dimY; }
double _layer_dim_Y
layer dimension in Y
double _layer_dim_X
layer dimension in X
void gar::geo::seg::SegmentationGridXYAlg::setOffsetX ( double  offset)
inline

Definition at line 57 of file SegmentationGridXYAlg.h.

57 { _offsetX = offset; }
double _offsetX
the coordinate offset in X
void gar::geo::seg::SegmentationGridXYAlg::setOffsetY ( double  offset)
inline

Definition at line 59 of file SegmentationGridXYAlg.h.

59 { _offsetY = offset; }
double _offsetY
the coordinate offset in Y
void gar::geo::seg::SegmentationGridXYAlg::setVariables ( const double &  ,
const double &   
) const
inlineoverridevirtual

Implements gar::geo::seg::SegmentationAlg.

Definition at line 68 of file SegmentationGridXYAlg.h.

68 { /* no op */ }

Member Data Documentation

std::string gar::geo::seg::SegmentationGridXYAlg::_encoding
protected

the encoding string

Definition at line 87 of file SegmentationGridXYAlg.h.

double gar::geo::seg::SegmentationGridXYAlg::_gridSizeX
protected

the grid size in X

Definition at line 75 of file SegmentationGridXYAlg.h.

double gar::geo::seg::SegmentationGridXYAlg::_gridSizeY
protected

the grid size in Y

Definition at line 79 of file SegmentationGridXYAlg.h.

double gar::geo::seg::SegmentationGridXYAlg::_layer_dim_X
mutableprotected

layer dimension in X

Definition at line 91 of file SegmentationGridXYAlg.h.

double gar::geo::seg::SegmentationGridXYAlg::_layer_dim_Y
mutableprotected

layer dimension in Y

Definition at line 93 of file SegmentationGridXYAlg.h.

unsigned int gar::geo::seg::SegmentationGridXYAlg::_nLayers
protected

number of layers

Definition at line 89 of file SegmentationGridXYAlg.h.

double gar::geo::seg::SegmentationGridXYAlg::_offsetX
protected

the coordinate offset in X

Definition at line 77 of file SegmentationGridXYAlg.h.

double gar::geo::seg::SegmentationGridXYAlg::_offsetY
protected

the coordinate offset in Y

Definition at line 81 of file SegmentationGridXYAlg.h.

std::string gar::geo::seg::SegmentationGridXYAlg::_xId
protected

the field name used for X

Definition at line 83 of file SegmentationGridXYAlg.h.

std::string gar::geo::seg::SegmentationGridXYAlg::_yId
protected

the field name used for Y

Definition at line 85 of file SegmentationGridXYAlg.h.


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