Functions
geo::CRU Namespace Reference

Functions

static bool sortAuxDet (const AuxDetGeo &ad1, const AuxDetGeo &ad2)
 
static bool sortAuxDetSensitive (const AuxDetSensitiveGeo &ad1, const AuxDetSensitiveGeo &ad2)
 
static bool sortCryo (const CryostatGeo &c1, const CryostatGeo &c2)
 
static bool sortTPC (const TPCGeo &t1, const TPCGeo &t2)
 
static bool sortPlane (const PlaneGeo &p1, const PlaneGeo &p2)
 
bool sortWire (WireGeo const &w1, WireGeo const &w2)
 

Function Documentation

static bool geo::CRU::sortAuxDet ( const AuxDetGeo ad1,
const AuxDetGeo ad2 
)
static

Definition at line 32 of file GeoObjectSorterCRU.cxx.

33  {
34 
35  // sort based off of GDML name, assuming ordering is encoded
36  std::string ad1name = (ad1.TotalVolume())->GetName();
37  std::string ad2name = (ad2.TotalVolume())->GetName();
38 
39  // assume volume name is "volAuxDet##"
40  int ad1Num = atoi( ad1name.substr( 9, ad1name.size()).c_str() );
41  int ad2Num = atoi( ad2name.substr( 9, ad2name.size()).c_str() );
42 
43  return ad1Num < ad2Num;
44 
45  }
std::string string
Definition: nybbler.cc:12
static bool geo::CRU::sortAuxDetSensitive ( const AuxDetSensitiveGeo ad1,
const AuxDetSensitiveGeo ad2 
)
static

Definition at line 49 of file GeoObjectSorterCRU.cxx.

50  {
51 
52  // sort based off of GDML name, assuming ordering is encoded
53  std::string ad1name = (ad1.TotalVolume())->GetName();
54  std::string ad2name = (ad2.TotalVolume())->GetName();
55 
56  // assume volume name is "volAuxDetSensitive##"
57  int ad1Num = atoi( ad1name.substr( 9, ad1name.size()).c_str() );
58  int ad2Num = atoi( ad2name.substr( 9, ad2name.size()).c_str() );
59 
60  return ad1Num < ad2Num;
61 
62  }
std::string string
Definition: nybbler.cc:12
static bool geo::CRU::sortCryo ( const CryostatGeo c1,
const CryostatGeo c2 
)
static

Definition at line 66 of file GeoObjectSorterCRU.cxx.

67  {
68  double xyz1[3] = {0.}, xyz2[3] = {0.};
69  double local[3] = {0.};
70  c1.LocalToWorld(local, xyz1);
71  c2.LocalToWorld(local, xyz2);
72 
73  return xyz1[0] < xyz2[0];
74  }
static bool geo::CRU::sortPlane ( const PlaneGeo p1,
const PlaneGeo p2 
)
static

Definition at line 99 of file GeoObjectSorterCRU.cxx.

100  {
101  double xyz1[3] = {0.};
102  double xyz2[3] = {0.};
103  double local[3] = {0.};
104  p1.LocalToWorld(local, xyz1);
105  p2.LocalToWorld(local, xyz2);
106 
107  // drift direction is negative, plane number increases in drift direction
108  return xyz1[0] > xyz2[0];
109  }
static bool geo::CRU::sortTPC ( const TPCGeo t1,
const TPCGeo t2 
)
static

Definition at line 79 of file GeoObjectSorterCRU.cxx.

80  {
81  double xyz1[3] = {0.};
82  double xyz2[3] = {0.};
83  double local[3] = {0.};
84  t1.LocalToWorld(local, xyz1);
85  t2.LocalToWorld(local, xyz2);
86 
87  // First sort all TPCs into same-z groups
88  if(xyz1[2]<xyz2[2]) return true;
89 
90  // Within a same-z group, sort TPCs into same-y groups
91  if(xyz1[2] == xyz2[2] && xyz1[1] < xyz2[1]) return true;
92 
93  return false;
94  }
bool geo::CRU::sortWire ( WireGeo const &  w1,
WireGeo const &  w2 
)

Definition at line 113 of file GeoObjectSorterCRU.cxx.

113  {
114  // wire sorting algorithm
115  // z_low -> z_high
116  // for same-z group
117  // the sorting either from bottom (y) left (z) corner up for strip angles > pi/2
118  // and horizontal wires
119  // or from top corner to bottom otherwise
120  // we assume all wires in the plane are parallel
121 
122  // w1 geo info
123  auto center1 = w1.GetCenter<geo::Point_t>();
124  auto start1 = w1.GetStart<geo::Point_t>();
125  auto end1 = w1.GetEnd<geo::Point_t>();
126  auto Delta = end1-start1;
127  //double dx1 = Delta.X();
128  double dy1 = Delta.Y();
129  double dz1 = Delta.Z();
130 
131  // w2 geo info
132  auto center2 = w2.GetCenter<geo::Point_t>();
133 
134  auto CheckTol = [](double val, double tol = 1.E-4){
135  return (std::abs( val ) < tol);
136  };
137 
138  if( CheckTol(dz1) ){ // wires perpendicular to z axis
139  return (center1.Z() < center2.Z());
140  }
141 
142  if( CheckTol(dy1) ){ // wires perpendicular to y axis
143  return (center1.Y() < center2.Y());
144  }
145 
146  // wires at angle with same z center
147  if( CheckTol( center2.Z() - center1.Z() ) ){
148  if( dz1 < 0 ){ dy1 = -dy1; } // always compare here upstream - downstream ends
149  if( dy1 < 0 ){ return (center1.Y() < center2.Y()); }
150  if( dy1 > 0 ){ return (center1.Y() > center2.Y()); }
151  }
152 
153  // otherwise sorted in z
154  return ( center1.Z() < center2.Z() );
155  }
auto const tol
Definition: SurfXYZTest.cc:16
T abs(T value)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184