37 if (det.
GetCenter().X()>Center.X()) xCo+=len/2.;
42 if (det.
GetCenter().Y()>Center.Y()) yCo+=len/2.;
51 template <
class ITERATOR>
52 void SortInSpiral(
const ITERATOR
begin,
const ITERATOR
end)
78 double firstPhi = firstVec.Phi();
79 double secondPhi = secondVec.Phi();
85 if (firstPhi>1.57) firstPhi-=6.28;
86 if (secondPhi>1.57) secondPhi-=6.28;
88 if ((*first).GetCenter().Z() <0.0){
89 return firstPhi > secondPhi;
91 return firstPhi < secondPhi;
122 template <
class ITERATOR>
123 ITERATOR FindFirstDownstream(
const ITERATOR begin,
const ITERATOR end,
const double zTolerance)
125 if(begin == end)
return end;
129 ITERATOR prev =
begin;
135 if(fabs(((*geo)->GetCenter() - (*prev)->GetCenter()).
Z()) > zTolerance)
144 template <
class CONTAINER>
145 std::vector<size_t> map(
const CONTAINER& sorted,
const CONTAINER& unsorted)
147 std::vector<size_t> mymap;
148 for(
size_t i = 0; i < sorted.size(); ++i)
150 auto ThisAdgeo = sorted[i];
151 for(
size_t j = 0; j < unsorted.size(); ++j)
153 auto ThisUnsorted = unsorted[j];
155 if (ThisAdgeo->Name() == ThisUnsorted->Name())
167 template <
class CONTAINER>
168 std::vector<size_t> doMapping(CONTAINER& unsorted)
171 auto adgeo = unsorted;
173 const double thickest = 800.;
176 std::sort(adgeo.begin(), adgeo.end(), [](
const auto& first,
const auto&
second)
181 const auto firstDownstream = ::FindFirstDownstream(adgeo.begin(), adgeo.end(), thickest);
185 ::SortInSpiral(adgeo.begin(), firstDownstream);
186 ::SortInSpiral(firstDownstream, adgeo.end());
188 std::vector<size_t> mapping = ::map(adgeo,unsorted);
196 std::vector<size_t>
Mapping(std::vector<geo::AuxDetGeo*>& adgeo)
198 return doMapping(adgeo);
201 std::vector<size_t>
Mapping(std::vector<const geo::AuxDetGeo*>& adgeo)
204 return doMapping(adgeo);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
geo::Point3DBase_t< AuxDetGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML auxiliary detector frame.
Encapsulate the geometry of an auxiliary detector.
std::vector< size_t > Mapping(std::vector< geo::AuxDetGeo * > &adgeo)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
second_as<> second
Type of time stored in seconds, in double precision.
LArSoft geometry interface.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local auxiliary detector frame to world frame.
QTextStream & endl(QTextStream &s)
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.