4 #include "Geometry/GeometryCore.h" 21 _description =
"Cartesian segmentation in the local XY-plane, containing integer number of strips";
23 std::cout <<
"######### gar::geo::seg::MinervaSegmentationAlg() " <<
std::endl ;
34 _description =
"Cartesian segmentation in the local XY-plane, containing integer number of strips";
36 std::cout <<
"######### gar::geo::seg::MinervaSegmentationAlg() " <<
std::endl ;
78 std::array<double, 3> cellPosition;
95 double localX = localPosition[0];
96 double localY = localPosition[1];
97 double localZ = localPosition[2];
113 double cellOriginY = ( _cellIndexY + 0.5 ) * (
_stripSizeY * 2);
114 double cellOriginZ = - 1.;
116 double localy = localY - cellOriginY;
117 double localz = localZ - cellOriginZ;
122 if(localy > localz) {
125 if(localy < localz) {
141 else if( localy > 0 ) {
143 if(localy > -localz) {
146 if(localy < -localz) {
164 MF_LOG_ERROR(
"MinervaSegmentationAlg") <<
"Cannot determine if localX > | < 0";
179 double cellOriginX = ( _cellIndexX + 0.5 ) * (
_stripSizeX * 2);
181 double cellOriginZ = 1.;
183 double localx = localX - cellOriginX;
184 double localz = localZ - cellOriginZ;
189 if(localx > localz) {
192 if(localx < localz) {
208 else if( localx > 0 ) {
210 if(localx > -localz) {
213 if(localx < -localz) {
231 MF_LOG_ERROR(
"MinervaSegmentationAlg") <<
"Cannot determine if localX > | < 0";
266 if(comp == 1 || comp == 2) {
306 for(
auto &it : m_Deposits)
315 int triangleNb =
_decoder->
get(cellID,
"triangle");
318 if(triangleNb == 0 || triangleNb == 3)
320 if(triangleNb == 0) {
321 std::vector<gar::sdp::CaloDeposit> vechit = it.second;
322 std::sort(vechit.begin(), vechit.end());
325 float stepLength = 0.;
326 float time = vechit.at(0).Time();
327 int trackID = vechit.at(0).TrackID();
328 double pos[3] = { vechit.at(0).X(), vechit.at(0).Y(), vechit.at(0).Z() };
330 for(
auto const &
hit : vechit) {
331 esum +=
hit.Energy();
332 stepLength +=
hit.StepLength();
337 auto find = m_Deposits.find( complementary_cellID );
338 if(find != m_Deposits.end()) {
339 std::vector<gar::sdp::CaloDeposit> vechit_comp = find->second;
340 std::sort(vechit_comp.begin(), vechit_comp.end());
342 for(
auto const &
hit : vechit_comp) {
343 esum +=
hit.Energy();
344 stepLength +=
hit.StepLength();
348 m_Deposits.erase(find->first);
351 fDeposits.emplace_back( trackID, time, esum, pos, cellID, stepLength );
354 if(triangleNb == 3) {
356 std::vector<gar::sdp::CaloDeposit> vechit = it.second;
357 std::sort(vechit.begin(), vechit.end());
360 float stepLength = 0.;
361 float time = vechit.at(0).Time();
362 int trackID = vechit.at(0).TrackID();
363 double pos[3] = { vechit.at(0).X(), vechit.at(0).Y(), vechit.at(0).Z() };
365 for(
auto const &
hit : vechit) {
366 esum +=
hit.Energy();
367 stepLength +=
hit.StepLength();
372 auto find = m_Deposits.find( complementary_cellID );
373 if(find != m_Deposits.end()) {
374 std::vector<gar::sdp::CaloDeposit> vechit_comp = find->second;
375 std::sort(vechit_comp.begin(), vechit_comp.end());
377 for(
auto const &
hit : vechit_comp) {
378 esum +=
hit.Energy();
379 stepLength +=
hit.StepLength();
383 m_Deposits.erase(find->first);
386 fDeposits.emplace_back( trackID, time, esum, pos, cellID, stepLength );
390 if(triangleNb == 1 || triangleNb == 2)
392 if(triangleNb == 1) {
393 std::vector<gar::sdp::CaloDeposit> vechit = it.second;
394 std::sort(vechit.begin(), vechit.end());
397 float stepLength = 0.;
398 float time = vechit.at(0).Time();
399 int trackID = vechit.at(0).TrackID();
400 double pos[3] = { vechit.at(0).X(), vechit.at(0).Y(), vechit.at(0).Z() };
402 for(
auto const &
hit : vechit) {
403 esum +=
hit.Energy();
404 stepLength +=
hit.StepLength();
409 auto find = m_Deposits.find( complementary_cellID );
410 if(find != m_Deposits.end()) {
411 std::vector<gar::sdp::CaloDeposit> vechit_comp = find->second;
412 std::sort(vechit_comp.begin(), vechit_comp.end());
414 for(
auto const &
hit : vechit_comp) {
415 esum +=
hit.Energy();
416 stepLength +=
hit.StepLength();
420 m_Deposits.erase(find->first);
422 fDeposits.emplace_back( trackID, time, esum, pos, cellID, stepLength );
425 if(triangleNb == 2) {
426 std::vector<gar::sdp::CaloDeposit> vechit = it.second;
427 std::sort(vechit.begin(), vechit.end());
430 float stepLength = 0.;
431 float time = vechit.at(0).Time();
432 int trackID = vechit.at(0).TrackID();
433 double pos[3] = { vechit.at(0).X(), vechit.at(0).Y(), vechit.at(0).Z() };
435 for(
auto const &
hit : vechit) {
436 esum +=
hit.Energy();
437 stepLength +=
hit.StepLength();
442 auto find = m_Deposits.find( complementary_cellID );
443 if(find != m_Deposits.end()) {
444 std::vector<gar::sdp::CaloDeposit> vechit_comp = find->second;
445 std::sort(vechit_comp.begin(), vechit_comp.end());
447 for(
auto const &
hit : vechit_comp) {
448 esum +=
hit.Energy();
449 stepLength +=
hit.StepLength();
453 m_Deposits.erase(find->first);
455 fDeposits.emplace_back( trackID, time, esum, pos, cellID, stepLength );
460 m_Deposits.erase(it.first);
double _stripSizeX
the strip size in X
double _layer_dim_X
layer dimension in X
const BitFieldCoder * _decoder
MinervaSegmentationAlg(fhicl::ParameterSet const &pset)
Default constructor used by derived classes passing the encoding string.
std::string _sliceId
the field name used for slice
std::string _encoding
the encoding string
void set(long64 &bitfield, size_t index, ulong64 value) const
std::string _yId
the field name used for Y
double _frac
fraction of tiles to remove at the edge
#define MF_LOG_ERROR(category)
Description of geometry of one entire detector.
void AddHitsMinerva(std::map< gar::raw::CellID_t, std::vector< gar::sdp::CaloDeposit > > &m_Deposits, std::vector< gar::sdp::CaloDeposit > &fDeposits) const
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
gar::raw::CellID_t GetComplementaryCellID(gar::raw::CellID_t cellID, unsigned int comp) const
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
T get(std::string const &key) const
double _layer_dim_Y
layer dimension in Y
void reconfigure(fhicl::ParameterSet const &pset) override
Detector simulation of raw signals on wires.
double _stripSizeY
the strip size in Y
std::string _zId
the field name used for Z
General GArSoft Utilities.
long64 get(long64 bitfield, size_t index) const
std::array< double, 3 > GetPosition(const gar::geo::GeometryCore &geo, const gar::raw::CellID_t &cID) const override
std::string _xId
the field name used for X
void PrintParameters() const override
void decode(std::any const &a, Hep2Vector &result)
LArSoft geometry interface.
~MinervaSegmentationAlg()
std::string _layerId
the field name used for layer
QTextStream & endl(QTextStream &s)
unsigned int _nPlanes
number of planes
void Initialize(const gar::geo::GeometryCore &geo) override