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

#include <SegmentationStripYAlg.h>

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

Public Member Functions

 SegmentationStripYAlg (fhicl::ParameterSet const &pset)
 Default constructor used by derived classes passing the encoding string. More...
 
 SegmentationStripYAlg (const BitFieldCoder *decoder, fhicl::ParameterSet const &pset)
 Default constructor used by derived classes passing an existing decoder. More...
 
 ~SegmentationStripYAlg ()
 
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 & stripSizeY () const
 
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 setStripSizeY (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 double & stripSizeX () 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 _stripSizeY
 the strip size in Y 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 SegmentationStripYAlg.h.

Constructor & Destructor Documentation

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

Default constructor used by derived classes passing the encoding string.

Definition at line 20 of file SegmentationStripYAlg.cxx.

21  : SegmentationAlg(pset)
22  {
23  _type = "StripY";
24  _description = "Cartesian segmentation in the local XY-plane with strip along the Y direction";
25 
26  std::cout << "######### gar::geo::seg::SegmentationStripYAlg() " << 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::SegmentationStripYAlg::SegmentationStripYAlg ( const BitFieldCoder decoder,
fhicl::ParameterSet const &  pset 
)

Default constructor used by derived classes passing an existing decoder.

Definition at line 33 of file SegmentationStripYAlg.cxx.

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

Definition at line 45 of file SegmentationStripYAlg.cxx.

46  {
47  }

Member Function Documentation

std::pair< float, float > gar::geo::seg::SegmentationStripYAlg::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 169 of file SegmentationStripYAlg.cxx.

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

Definition at line 57 of file SegmentationStripYAlg.h.

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

Definition at line 59 of file SegmentationStripYAlg.h.

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

Definition at line 53 of file SegmentationStripYAlg.h.

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

Definition at line 55 of file SegmentationStripYAlg.h.

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

97  {
98  gar::raw::CellID_t cID = 0;
99 
100  _decoder->set(cID, "system", det_id);
101  _decoder->set(cID, "module", module);
102  _decoder->set(cID, "stave", stave);
103  _decoder->set(cID, "layer", layer);
104  _decoder->set(cID, "slice", slice);
105 
106  double localX = localPosition[0];
107  double localY = localPosition[1];
108 
109  //Segmentation in Y
110  int nCellsX = 1;
111  int nCellsY = int(_layer_dim_Y / _stripSizeY);
112 
113  int _cellIndexX = int ( localX / ( _layer_dim_X / nCellsX ) );
114  int _cellIndexY = int ( localY / ( _layer_dim_Y / nCellsY ) );
115 
116  _decoder->set(cID, _xId, _cellIndexX);
117  _decoder->set(cID, _yId, _cellIndexY);
118 
119  return cID;
120  }
const BitFieldCoder * _decoder
void set(long64 &bitfield, size_t index, ulong64 value) const
double _layer_dim_X
layer dimension in X
double _layer_dim_Y
layer dimension in Y
long long int CellID_t
Definition: CaloRawDigit.h:24
double _stripSizeY
the strip size in Y
std::string _yId
the field name used for Y
std::string _xId
the field name used for X
std::array< double, 3 > gar::geo::seg::SegmentationStripYAlg::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 SegmentationStripYAlg.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  //Segmentation in Y
84  int nCellsX = 1;
85  // int nCellsY = int(_layer_dim_Y / _stripSizeY);
86 
87  cellPosition[0] = ( cellIndexX + 0.5 ) * (_layer_dim_X / nCellsX ) - (_layer_dim_X / 2.);
88  cellPosition[1] = ( cellIndexY + 0.5 ) * _stripSizeY;
89  cellPosition[2] = 0.;
90 
91  return cellPosition;
92  }
const BitFieldCoder * _decoder
double _layer_dim_X
layer dimension in X
double _stripSizeY
the strip size in Y
long64 get(long64 bitfield, size_t index) const
std::string _yId
the field name used for Y
std::string _xId
the field name used for X
std::pair< TVector3, TVector3 > gar::geo::seg::SegmentationStripYAlg::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 153 of file SegmentationStripYAlg.cxx.

154  {
155  TVector3 stripEnd1(0., 0., 0.);
156  TVector3 stripEnd2(0., 0., 0.);
157 
158  stripEnd1.SetX(-_layer_dim_X/2.);
159  stripEnd2.SetX(_layer_dim_X/2.);
160  stripEnd1.SetY(local[1]);
161  stripEnd2.SetY(local[1]);
162  stripEnd1.SetZ(local[2]);
163  stripEnd2.SetZ(local[2]);
164 
165  return std::make_pair(stripEnd1, stripEnd2);
166  }
double _layer_dim_X
layer dimension in X
double gar::geo::seg::SegmentationStripYAlg::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 147 of file SegmentationStripYAlg.cxx.

148  {
149  return _layer_dim_X;
150  }
double _layer_dim_X
layer dimension in X
void gar::geo::seg::SegmentationStripYAlg::Initialize ( const gar::geo::GeometryCore geo)
overridevirtual

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

Definition at line 70 of file SegmentationStripYAlg.cxx.

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

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

Definition at line 141 of file SegmentationStripYAlg.cxx.

142  {
143  return true;
144  }
bool gar::geo::seg::SegmentationStripYAlg::isTile ( const gar::raw::CellID_t cID) const
overridevirtual

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

Definition at line 135 of file SegmentationStripYAlg.cxx.

136  {
137  return false;
138  }
const double& gar::geo::seg::SegmentationStripYAlg::layerDimX ( ) const
inline

Definition at line 49 of file SegmentationStripYAlg.h.

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

Definition at line 51 of file SegmentationStripYAlg.h.

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

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

Definition at line 61 of file SegmentationStripYAlg.h.

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

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

Definition at line 123 of file SegmentationStripYAlg.cxx.

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

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

Definition at line 50 of file SegmentationStripYAlg.cxx.

51  {
52  _stripSizeY = pset.get<double>("strip_size_y");
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  }
double _frac
fraction of tiles to remove at the edge
std::string string
Definition: nybbler.cc:12
unsigned int _nLayers
number of layers
double _stripSizeY
the strip size in Y
std::string _sliceId
the field name used for slice
std::string _yId
the field name used for Y
std::string _encoding
the encoding string
std::string _xId
the field name used for X
std::string _layerId
the field name used for layer
std::array< double, 3 > gar::geo::seg::SegmentationStripYAlg::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 184 of file SegmentationStripYAlg.cxx.

185  {
186  float pos = xlocal;
187  //Need to check if the local position is bigger than the strip length!
188  // bool isBarrel = this->isBarrel(cID);
189  float stripLength = this->getStripLength(geo, local, cID);
190 
191  if( std::abs(pos) > stripLength / 2. ) pos = (pos > 0) ? stripLength / 2. : -stripLength / 2.;
192 
193  std::array<double, 3> newlocal = {pos, local[1], local[2]};
194  return newlocal;
195  }
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::SegmentationStripYAlg::setFieldNameLayer ( const std::string fieldName)
inline

Definition at line 69 of file SegmentationStripYAlg.h.

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

Definition at line 71 of file SegmentationStripYAlg.h.

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

Definition at line 65 of file SegmentationStripYAlg.h.

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

Definition at line 67 of file SegmentationStripYAlg.h.

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

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

Definition at line 73 of file SegmentationStripYAlg.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::SegmentationStripYAlg::setStripSizeY ( double  stripSize)
inline

Definition at line 63 of file SegmentationStripYAlg.h.

63 { _stripSizeY = stripSize; }
double _stripSizeY
the strip size in Y
void gar::geo::seg::SegmentationStripYAlg::setVariables ( const double &  ,
const double &   
) const
inlineoverridevirtual

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

Definition at line 76 of file SegmentationStripYAlg.h.

76 { /* no op */ }
const double& gar::geo::seg::SegmentationStripYAlg::stripSizeY ( ) const
inline

Definition at line 47 of file SegmentationStripYAlg.h.

47 { return _stripSizeY; }
double _stripSizeY
the strip size in Y

Member Data Documentation

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

the encoding string

Definition at line 91 of file SegmentationStripYAlg.h.

double gar::geo::seg::SegmentationStripYAlg::_frac
protected

fraction of tiles to remove at the edge

Definition at line 95 of file SegmentationStripYAlg.h.

double gar::geo::seg::SegmentationStripYAlg::_layer_dim_X
mutableprotected

layer dimension in X

Definition at line 99 of file SegmentationStripYAlg.h.

double gar::geo::seg::SegmentationStripYAlg::_layer_dim_Y
mutableprotected

layer dimension in Y

Definition at line 101 of file SegmentationStripYAlg.h.

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

the field name used for layer

Definition at line 87 of file SegmentationStripYAlg.h.

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

number of layers

Definition at line 97 of file SegmentationStripYAlg.h.

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

the field name used for slice

Definition at line 89 of file SegmentationStripYAlg.h.

double gar::geo::seg::SegmentationStripYAlg::_stripSizeY
protected

the strip size in Y

Definition at line 93 of file SegmentationStripYAlg.h.

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

the field name used for X

Definition at line 83 of file SegmentationStripYAlg.h.

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

the field name used for Y

Definition at line 85 of file SegmentationStripYAlg.h.


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