7 #include "Geometry/GeometryCore.h" 23 _type =
"MultiGridStripXY";
24 _description =
"Cartesian segmentation in the local XY-plane, containing integer number of tiles/strips/cells";
26 std::cout <<
"######### gar::geo::seg::SegmentationMultiGridStripXYAlg() " <<
std::endl ;
36 _type =
"MultiGridStripXY";
37 _description =
"Cartesian segmentation in the local XY-plane, containing integer number of tiles/strips/cells";
39 std::cout <<
"######### gar::geo::seg::SegmentationMultiGridStripXYAlg() " <<
std::endl ;
96 std::array<double, 3> cellPosition;
106 cellPosition[2] = 0.;
113 cellPosition[0] = cellPosition[0] / std::fabs(cellPosition[0]) * (
_layer_dim_X -
_frac ) / 2.;
118 cellPosition[1] = cellPosition[1] / std::fabs(cellPosition[1]) * (
_layer_dim_Y -
_frac ) / 2.;
128 float r_point = std::sqrt( cellPosition[0]*cellPosition[0] + cellPosition[1]*cellPosition[1] );
137 cellPosition[1] = cellPosition[1] / std::fabs(cellPosition[1]) * (
_layer_dim_Y -
_frac ) ;
142 cellPosition[0] = cellPosition[0] / std::fabs(cellPosition[0]) * (
_layer_dim_X -
_frac ) ;
164 cellPosition[1] = ( cellIndexY + 0.5 ) *
_stripSizeY;
165 cellPosition[2] = 0.;
168 cellPosition[1] = ( cellIndexY + 0.5 ) *
_stripSizeY;
169 cellPosition[0] = ( cellIndexX + 0.5 ) * (
_layer_dim_X / nCellsX );
174 cellPosition[0] -= n * (
_stripSizeX / std::tan(angle) ) / 2.;
176 cellPosition[2] = 0.;
187 cellPosition[0] = ( cellIndexX + 0.5 ) *
_stripSizeX;
189 cellPosition[2] = 0.;
192 cellPosition[0] = ( cellIndexX + 0.5 ) *
_stripSizeX;
193 cellPosition[1] = ( cellIndexY + 0.5 ) * (
_layer_dim_Y / nCellsY );
198 cellPosition[1] -= n * (
_stripSizeY / std::tan(angle) ) / 2.;
200 cellPosition[2] = 0.;
223 double localX = localPosition[0];
224 double localY = localPosition[1];
281 std::cout <<
"grid_barrel_layers: ";
286 std::cout <<
"strip_barrel_layers: ";
291 std::cout <<
"grid_endcap_layers: ";
296 std::cout <<
"strip_endcap_layers: ";
307 std::vector<unsigned int> _gridFirst;
308 std::vector<unsigned int> _gridLast;
310 for(
unsigned int i = 0; i < grid.size(); i++)
312 std::vector<std::string> descriptors ;
316 std::for_each( value.begin(), value.end(),
t ) ;
322 _gridFirst.push_back(std::atoi(descriptors.at(0).c_str()));
323 _gridLast.push_back(std::atoi(descriptors.at(1).c_str()));
326 std::array<std::vector<unsigned int>, 2>
_list = {{_gridFirst, _gridLast}};
335 unsigned int det_id =
_decoder->
get(cID,
"system");
338 std::array<std::vector<unsigned int>, 2>
_list;
346 for(
unsigned int i = 0; i < _list.at(0).size(); i++)
348 if( layer >= _list.at(0).at(i) && layer <= _list.at(1).at(i) )
369 if( det_id == 2 && (module == 0 || module == 6) ) isBarrel =
false;
377 double stripLength = 0.;
411 TVector3 stripEnd1(0., 0., 0.);
412 TVector3 stripEnd2(0., 0., 0.);
430 stripEnd1.SetY(local[1]);
431 stripEnd2.SetY(local[1]);
432 stripEnd1.SetZ(local[2]);
433 stripEnd2.SetZ(local[2]);
449 stripEnd1.SetX(local[0]);
450 stripEnd2.SetX(local[0]);
451 stripEnd1.SetZ(local[2]);
452 stripEnd2.SetZ(local[2]);
455 return std::make_pair(stripEnd1, stripEnd2);
483 time1 = ( strip_dim / 2. + local[0] ) / c;
484 time2 = ( strip_dim / 2. - local[0] ) / c;
499 time1 = ( strip_dim / 2. + local[1] ) / c;
500 time2 = ( strip_dim / 2. - local[1] ) / c;
504 return std::make_pair(time1, time2);
516 if(
std::abs(pos) > stripLength / 2. ) pos = (pos > 0) ? stripLength / 2. : -stripLength / 2.;
518 if(
std::abs(pos) > stripLength ) pos = (pos > 0) ? stripLength : 0.;
521 std::array<double, 3> newlocal;
524 newlocal = {
pos, local[1], local[2]};
527 newlocal = {local[0],
pos, local[2]};
static constexpr double cm
std::string _xId
the field name used for X
std::pair< float, float > CalculateLightPropagation(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
double _frac
fraction of tiles to remove at the edge
unsigned int _nLayers
number of layers
const BitFieldCoder * _decoder
double getStripLength(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
void Initialize(const gar::geo::GeometryCore &geo) override
double _gridSizeX
the grid size in X
SegmentationMultiGridStripXYAlg(fhicl::ParameterSet const &pset)
Default constructor used by derived classes passing the encoding string.
std::string _encoding
the encoding string
void set(long64 &bitfield, size_t index, ulong64 value) const
double _EndcapSideLength
Endcap Side Length.
std::vector< std::string > _gridBarrelLayers
the layers (start::end) for grid in Barrel
std::array< std::vector< unsigned int >, 2 > TokenizeLayerVectors(std::vector< std::string > grid) const
double _gridSizeY
the grid size in Y
double _offsetY
the coordinate offset in Y
bool isTile(const gar::raw::CellID_t &cID) const override
double _stripSizeY
the strip size in Y
Description of geometry of one entire detector.
void reconfigure(fhicl::ParameterSet const &pset) override
static int positionToBin(double position, double cellSize, double offset=0)
double _layer_dim_X
layer dimension in X
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
static double binToPosition(gar::raw::CellID_t bin, double cellSize, double offset=0)
void PrintParameters() const override
std::string _layerId
the field name used for layer
std::string _sliceId
the field name used for slice
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
double _offsetX
the coordinate offset in X
T get(std::string const &key) const
double _stripSizeX
the strip size in X
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
unsigned int _active_slice
active slice number
~SegmentationMultiGridStripXYAlg()
std::array< double, 3 > GetPosition(const gar::geo::GeometryCore &geo, const gar::raw::CellID_t &cID) const override
General GArSoft Utilities.
long64 get(long64 bitfield, size_t index) const
std::string _yId
the field name used for Y
std::vector< std::string > _stripBarrelLayers
the layers (start::end) for strips in Barrel
std::vector< std::string > _gridEndcapLayers
the layers (start::end) for grid in Endcap
bool _OnSameLayer
are the strips on the same layer?
static constexpr double mm
void decode(std::any const &a, Hep2Vector &result)
std::pair< TVector3, TVector3 > getStripEnds(const gar::geo::GeometryCore &geo, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const override
bool isBarrel(const gar::raw::CellID_t &cID) const override
std::vector< std::string > _stripEndcapLayers
the layers (start::end) for strips in Endcap
LArSoft geometry interface.
double _InnerAngle
Inner Angle.
QTextStream & endl(QTextStream &s)
double _layer_dim_Y
layer dimension in Y