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

#include <SegmentationStripXAlg.h>

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

Public Member Functions

 SegmentationStripXAlg (fhicl::ParameterSet const &pset)
 Default constructor used by derived classes passing the encoding string. More...
 
 SegmentationStripXAlg (const BitFieldCoder *decoder, fhicl::ParameterSet const &pset)
 Default constructor used by derived classes passing an existing decoder. More...
 
 ~SegmentationStripXAlg ()
 
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 &cID) const override
 
bool isBarrel (const gar::raw::CellID_t &cID) const override
 
double getStripLength (const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
 
std::pair< TVector3, TVector3 > getStripEnds (const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
 
std::pair< float, float > CalculateLightPropagation (const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
 
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 override
 
const double & stripSizeX () const override
 
const double & layerDimX () const
 
const double & layerDimY () const
 
const std::stringfieldNameX () const
 
const std::stringfieldNameY () const
 
const std::stringfieldNameLayer () const
 
const std::stringfieldNameSlice () const
 
const unsigned int & nLayers () const override
 
void setStripSizeX (double stripSize)
 
void setFieldNameX (const std::string &fieldName)
 
void setFieldNameY (const std::string &fieldName)
 
void setFieldNameLayer (const std::string &fieldName)
 
void setFieldNameSlice (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 & gridSizeX () const
 
virtual const unsigned int & nPlanes () const
 
virtual const std::stringcellEncoding () const
 
virtual void setDecoder (const BitFieldCoder *decoder)
 

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

std::string _xId
 the field name used for X More...
 
std::string _yId
 the field name used for Y More...
 
std::string _layerId
 the field name used for layer More...
 
std::string _sliceId
 the field name used for slice More...
 
std::string _encoding
 the encoding string More...
 
double _stripSizeX
 the strip size in X More...
 
double _frac
 fraction of tiles to remove at the edge 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 SegmentationStripXAlg.h.

Constructor & Destructor Documentation

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

Default constructor used by derived classes passing the encoding string.

Definition at line 20 of file SegmentationStripXAlg.cxx.

21  : SegmentationAlg(pset)
22  {
23  _type = "StripX";
24  _description = "Cartesian segmentation in the local XY-plane with strip along the Y direction";
25 
26  std::cout << "######### gar::geo::seg::SegmentationStripXAlg() " << std::endl ;
27 
28  this->reconfigure(pset);
29  }
void reconfigure(fhicl::ParameterSet const &pset) override
SegmentationAlg(fhicl::ParameterSet const &pset)
QTextStream & endl(QTextStream &s)
gar::geo::seg::SegmentationStripXAlg::SegmentationStripXAlg ( const BitFieldCoder decoder,
fhicl::ParameterSet const &  pset 
)

Default constructor used by derived classes passing an existing decoder.

Definition at line 33 of file SegmentationStripXAlg.cxx.

34  : SegmentationAlg(decode, pset)
35  {
36  _type = "StripX";
37  _description = "Cartesian segmentation in the local XY-plane with strip along the Y direction";
38 
39  std::cout << "######### gar::geo::seg::SegmentationStripXAlg() " << std::endl ;
40 
41  this->reconfigure(pset);
42  }
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::SegmentationStripXAlg::~SegmentationStripXAlg ( )

Definition at line 45 of file SegmentationStripXAlg.cxx.

46  {
47  }

Member Function Documentation

std::pair< float, float > gar::geo::seg::SegmentationStripXAlg::CalculateLightPropagation ( const gar::geo::GeometryCore geo,
const std::array< double, 3 > &  local,
const gar::raw::CellID_t cID 
) const
overridevirtual

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

Definition at line 167 of file SegmentationStripXAlg.cxx.

168  {
169  float c = (CLHEP::c_light * CLHEP::mm / CLHEP::ns) / CLHEP::cm; // in cm/ns
170  //time1 is left SiPM
171  float time1 = 0.;
172  //time2 is right SiPM
173  float time2 = 0.;
174 
175  time1 = ( _layer_dim_Y / 2 + local[1] ) / c;
176  time2 = ( _layer_dim_Y / 2 - local[1] ) / c;
177 
178  return std::make_pair(time1, time2);
179  }
static constexpr double cm
Definition: Units.h:68
double _layer_dim_Y
layer dimension in Y
static constexpr double mm
Definition: Units.h:65
QAsciiDict< Entry > ns
const std::string& gar::geo::seg::SegmentationStripXAlg::fieldNameLayer ( ) const
inline

Definition at line 57 of file SegmentationStripXAlg.h.

57 { return _layerId; }
std::string _layerId
the field name used for layer
const std::string& gar::geo::seg::SegmentationStripXAlg::fieldNameSlice ( ) const
inline

Definition at line 59 of file SegmentationStripXAlg.h.

59 { return _sliceId; }
std::string _sliceId
the field name used for slice
const std::string& gar::geo::seg::SegmentationStripXAlg::fieldNameX ( ) const
inline

Definition at line 53 of file SegmentationStripXAlg.h.

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

Definition at line 55 of file SegmentationStripXAlg.h.

55 { return _yId; }
std::string _yId
the field name used for Y
gar::raw::CellID_t gar::geo::seg::SegmentationStripXAlg::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 94 of file SegmentationStripXAlg.cxx.

95  {
96  gar::raw::CellID_t cID = 0;
97 
98  _decoder->set(cID, "system", det_id);
99  _decoder->set(cID, "module", module);
100  _decoder->set(cID, "stave", stave);
101  _decoder->set(cID, "layer", layer);
102  _decoder->set(cID, "slice", slice);
103 
104  double localX = localPosition[0];
105  double localY = localPosition[1];
106 
107  //Segmentation in X
108  int nCellsX = int(_layer_dim_X / _stripSizeX);
109  int nCellsY = 1;
110 
111  int _cellIndexX = int ( localX / ( _layer_dim_X / nCellsX ) );
112  int _cellIndexY = int ( localY / ( _layer_dim_Y / nCellsY ) );
113 
114  _decoder->set(cID, _xId, _cellIndexX);
115  _decoder->set(cID, _yId, _cellIndexY);
116 
117  return cID;
118  }
const BitFieldCoder * _decoder
void set(long64 &bitfield, size_t index, ulong64 value) const
double _stripSizeX
the strip size in X
double _layer_dim_X
layer dimension in X
double _layer_dim_Y
layer dimension in Y
std::string _xId
the field name used for X
std::string _yId
the field name used for Y
long long int CellID_t
Definition: CaloRawDigit.h:24
std::array< double, 3 > gar::geo::seg::SegmentationStripXAlg::GetPosition ( const gar::geo::GeometryCore geo,
const gar::raw::CellID_t cID 
) const
overridevirtual

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

Definition at line 76 of file SegmentationStripXAlg.cxx.

77  {
78  std::array<double, 3> cellPosition;
79 
80  int cellIndexX = _decoder->get(cID,_xId);
81  int cellIndexY = _decoder->get(cID,_yId);
82 
83  int nCellsY = 1;
84 
85  cellPosition[0] = ( cellIndexX + 0.5 ) * _stripSizeX;
86  cellPosition[1] = ( cellIndexY + 0.5 ) * (_layer_dim_Y / nCellsY ) - (_layer_dim_Y / 2.);
87  cellPosition[2] = 0.;
88 
89  return cellPosition;
90  }
const BitFieldCoder * _decoder
double _stripSizeX
the strip size in X
double _layer_dim_Y
layer dimension in Y
std::string _xId
the field name used for X
std::string _yId
the field name used for Y
long64 get(long64 bitfield, size_t index) const
std::pair< TVector3, TVector3 > gar::geo::seg::SegmentationStripXAlg::getStripEnds ( const gar::geo::GeometryCore geo,
const std::array< double, 3 > &  local,
const gar::raw::CellID_t cID 
) const
overridevirtual

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

Definition at line 151 of file SegmentationStripXAlg.cxx.

152  {
153  TVector3 stripEnd1(0., 0., 0.);
154  TVector3 stripEnd2(0., 0., 0.);
155 
156  stripEnd1.SetY(-_layer_dim_Y/2.);
157  stripEnd2.SetY(_layer_dim_Y/2.);
158  stripEnd1.SetX(local[0]);
159  stripEnd2.SetX(local[0]);
160  stripEnd1.SetZ(local[2]);
161  stripEnd2.SetZ(local[2]);
162 
163  return std::make_pair(stripEnd1, stripEnd2);
164  }
double _layer_dim_Y
layer dimension in Y
double gar::geo::seg::SegmentationStripXAlg::getStripLength ( const gar::geo::GeometryCore geo,
const std::array< double, 3 > &  local,
const gar::raw::CellID_t cID 
) const
overridevirtual

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

Definition at line 145 of file SegmentationStripXAlg.cxx.

146  {
147  return _layer_dim_Y;
148  }
double _layer_dim_Y
layer dimension in Y
void gar::geo::seg::SegmentationStripXAlg::Initialize ( const gar::geo::GeometryCore geo)
overridevirtual

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

Definition at line 70 of file SegmentationStripXAlg.cxx.

71  {
72 
73  }
bool gar::geo::seg::SegmentationStripXAlg::isBarrel ( const gar::raw::CellID_t cID) const
overridevirtual

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

Definition at line 139 of file SegmentationStripXAlg.cxx.

140  {
141  return true;
142  }
bool gar::geo::seg::SegmentationStripXAlg::isTile ( const gar::raw::CellID_t cID) const
overridevirtual

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

Definition at line 133 of file SegmentationStripXAlg.cxx.

134  {
135  return false;
136  }
const double& gar::geo::seg::SegmentationStripXAlg::layerDimX ( ) const
inline

Definition at line 49 of file SegmentationStripXAlg.h.

49 { return _layer_dim_X; }
double _layer_dim_X
layer dimension in X
const double& gar::geo::seg::SegmentationStripXAlg::layerDimY ( ) const
inline

Definition at line 51 of file SegmentationStripXAlg.h.

51 { return _layer_dim_Y; }
double _layer_dim_Y
layer dimension in Y
const unsigned int& gar::geo::seg::SegmentationStripXAlg::nLayers ( ) const
inlineoverridevirtual

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

Definition at line 61 of file SegmentationStripXAlg.h.

61 { return _nLayers; }
unsigned int _nLayers
number of layers
void gar::geo::seg::SegmentationStripXAlg::PrintParameters ( ) const
overrideprotectedvirtual

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

Definition at line 121 of file SegmentationStripXAlg.cxx.

122  {
123  std::cout << "cell encoding: " << _encoding << std::endl;
124  std::cout << "identifier_x: " << _xId << std::endl;
125  std::cout << "identifier_y: " << _yId << std::endl;
126  std::cout << "strip_size_x: " << _stripSizeX << " cm" << std::endl;
127 
128  std::cout << "identifier_layer: " << _layerId << std::endl;
129  std::cout << "identifier_slice: " << _sliceId << std::endl;
130  }
double _stripSizeX
the strip size in X
std::string _layerId
the field name used for layer
std::string _xId
the field name used for X
std::string _yId
the field name used for Y
std::string _sliceId
the field name used for slice
std::string _encoding
the encoding string
QTextStream & endl(QTextStream &s)
void gar::geo::seg::SegmentationStripXAlg::reconfigure ( fhicl::ParameterSet const &  pset)
overridevirtual

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

Definition at line 50 of file SegmentationStripXAlg.cxx.

51  {
52  _stripSizeX = pset.get<double>("strip_size_x");
53  _encoding = pset.get<std::string>("cellEncoding");
54 
55  _xId = pset.get<std::string>("identifier_x");
56  _yId = pset.get<std::string>("identifier_y");
57  _layerId = pset.get<std::string>("identifier_layer");
58  _sliceId = pset.get<std::string>("identifier_slice");
59 
60  _nLayers = pset.get<unsigned int>("nlayers");
61 
62  _frac = 1./3.;
63 
64  this->PrintParameters();
65 
66  return;
67  }
std::string string
Definition: nybbler.cc:12
double _stripSizeX
the strip size in X
std::string _layerId
the field name used for layer
std::string _xId
the field name used for X
std::string _yId
the field name used for Y
std::string _sliceId
the field name used for slice
double _frac
fraction of tiles to remove at the edge
unsigned int _nLayers
number of layers
std::string _encoding
the encoding string
std::array< double, 3 > gar::geo::seg::SegmentationStripXAlg::ReconstructStripHitPosition ( const gar::geo::GeometryCore geo,
const std::array< double, 3 > &  local,
const float &  xlocal,
const gar::raw::CellID_t cID 
) const
overridevirtual

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

Definition at line 182 of file SegmentationStripXAlg.cxx.

183  {
184  float pos = xlocal;
185  //Need to check if the local position is bigger than the strip length!
186  // bool isBarrel = this->isBarrel(cID);
187  float stripLength = this->getStripLength(geo, local, cID);
188 
189  if( std::abs(pos) > stripLength / 2. ) pos = (pos > 0) ? stripLength / 2. : -stripLength / 2.;
190 
191  std::array<double, 3> newlocal = {local[0], pos, local[2]};
192  return newlocal;
193  }
T abs(T value)
double getStripLength(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
void gar::geo::seg::SegmentationStripXAlg::setFieldNameLayer ( const std::string fieldName)
inline

Definition at line 69 of file SegmentationStripXAlg.h.

69 { _layerId = fieldName; }
std::string _layerId
the field name used for layer
void gar::geo::seg::SegmentationStripXAlg::setFieldNameSlice ( const std::string fieldName)
inline

Definition at line 71 of file SegmentationStripXAlg.h.

71 { _sliceId = fieldName; }
std::string _sliceId
the field name used for slice
void gar::geo::seg::SegmentationStripXAlg::setFieldNameX ( const std::string fieldName)
inline

Definition at line 65 of file SegmentationStripXAlg.h.

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

Definition at line 67 of file SegmentationStripXAlg.h.

67 { _yId = fieldName; }
std::string _yId
the field name used for Y
void gar::geo::seg::SegmentationStripXAlg::setLayerDimXY ( const double &  dimX,
const double &  dimY 
) const
inlineoverridevirtual

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

Definition at line 73 of file SegmentationStripXAlg.h.

73 { _layer_dim_X = dimX; _layer_dim_Y = dimY; }
double _layer_dim_X
layer dimension in X
double _layer_dim_Y
layer dimension in Y
void gar::geo::seg::SegmentationStripXAlg::setStripSizeX ( double  stripSize)
inline

Definition at line 63 of file SegmentationStripXAlg.h.

63 { _stripSizeX = stripSize; }
double _stripSizeX
the strip size in X
void gar::geo::seg::SegmentationStripXAlg::setVariables ( const double &  ,
const double &   
) const
inlineoverridevirtual

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

Definition at line 75 of file SegmentationStripXAlg.h.

75 { /* no op */ }
const double& gar::geo::seg::SegmentationStripXAlg::stripSizeX ( ) const
inlineoverridevirtual

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

Definition at line 47 of file SegmentationStripXAlg.h.

47 { return _stripSizeX; }
double _stripSizeX
the strip size in X

Member Data Documentation

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

the encoding string

Definition at line 90 of file SegmentationStripXAlg.h.

double gar::geo::seg::SegmentationStripXAlg::_frac
protected

fraction of tiles to remove at the edge

Definition at line 94 of file SegmentationStripXAlg.h.

double gar::geo::seg::SegmentationStripXAlg::_layer_dim_X
mutableprotected

layer dimension in X

Definition at line 98 of file SegmentationStripXAlg.h.

double gar::geo::seg::SegmentationStripXAlg::_layer_dim_Y
mutableprotected

layer dimension in Y

Definition at line 100 of file SegmentationStripXAlg.h.

std::string gar::geo::seg::SegmentationStripXAlg::_layerId
protected

the field name used for layer

Definition at line 86 of file SegmentationStripXAlg.h.

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

number of layers

Definition at line 96 of file SegmentationStripXAlg.h.

std::string gar::geo::seg::SegmentationStripXAlg::_sliceId
protected

the field name used for slice

Definition at line 88 of file SegmentationStripXAlg.h.

double gar::geo::seg::SegmentationStripXAlg::_stripSizeX
protected

the strip size in X

Definition at line 92 of file SegmentationStripXAlg.h.

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

the field name used for X

Definition at line 82 of file SegmentationStripXAlg.h.

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

the field name used for Y

Definition at line 84 of file SegmentationStripXAlg.h.


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