Public Member Functions | Private Attributes | Friends | List of all members
sim::LArVoxelID Class Reference

#include <LArVoxelID.h>

Public Member Functions

 LArVoxelID (const int x=0, const int y=0, const int z=0, const int t=0)
 Expert constructor based on actual bins. More...
 
 LArVoxelID (const TLorentzVector &v)
 Standard constructors. More...
 
 LArVoxelID (const double x, const double y, const double z, const double t)
 
virtual ~LArVoxelID ()
 Destructor. More...
 
int XBin () const
 
int YBin () const
 
int ZBin () const
 
int TBin () const
 
double X () const
 
double Y () const
 
double Z () const
 
double T () const
 
double operator[] (const int) const
 
 operator TLorentzVector () const
 
 operator TVector3 () const
 
bool operator< (const LArVoxelID &) const
 
bool operator== (const LArVoxelID &) const
 Test for equality. Handy, but not usually necessary. More...
 

Private Attributes

std::vector< int > fbins
 

Friends

std::ostream & operator<< (std::ostream &output, const LArVoxelID &)
 

Detailed Description

Definition at line 54 of file LArVoxelID.h.

Constructor & Destructor Documentation

sim::LArVoxelID::LArVoxelID ( const int  x = 0,
const int  y = 0,
const int  z = 0,
const int  t = 0 
)

Expert constructor based on actual bins.

Definition at line 27 of file LArVoxelID.cxx.

31  {
32  fbins = std::vector<int>(4);
33  fbins[0] = x;
34  fbins[1] = y;
35  fbins[2] = z;
36  fbins[3] = t;
37 
38  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
list x
Definition: train.py:276
sim::LArVoxelID::LArVoxelID ( const TLorentzVector &  v)
explicit

Standard constructors.

Definition at line 42 of file LArVoxelID.cxx.

43  {
44  // Copy each axis from the vector and convert it to a bin.
45  fbins = std::vector<int>(4);
47  for ( Ssiz_t a = 0; a != 4; ++a ){
48  fbins[a] = voxelCalc->AxisToBin( a, coord[a] );
49  }
50  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
const double a
sim::LArVoxelID::LArVoxelID ( const double  x,
const double  y,
const double  z,
const double  t 
)

Definition at line 53 of file LArVoxelID.cxx.

54  {
56 
57  // Convert each axis into its corresponding bin.
58  fbins = std::vector<int>(4);
59  fbins[0] = voxelCalc->XAxisToBin( x );
60  fbins[1] = voxelCalc->YAxisToBin( y );
61  fbins[2] = voxelCalc->ZAxisToBin( z );
62  fbins[3] = voxelCalc->TAxisToBin( t );
63  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
int ZAxisToBin(const double value) const
int XAxisToBin(const double value) const
int TAxisToBin(const double value) const
list x
Definition: train.py:276
int YAxisToBin(const double value) const
sim::LArVoxelID::~LArVoxelID ( )
virtual

Destructor.

Definition at line 67 of file LArVoxelID.cxx.

67 {}

Member Function Documentation

sim::LArVoxelID::operator TLorentzVector ( ) const

Definition at line 172 of file LArVoxelID.cxx.

173  {
174  return TLorentzVector( X(), Y(), Z(), T() );
175  }
double Y() const
Definition: LArVoxelID.cxx:79
double Z() const
Definition: LArVoxelID.cxx:86
double X() const
Definition: LArVoxelID.cxx:72
double T() const
Definition: LArVoxelID.cxx:93
sim::LArVoxelID::operator TVector3 ( ) const

Definition at line 178 of file LArVoxelID.cxx.

179  {
180  return TVector3( X(), Y(), Z() );
181  }
double Y() const
Definition: LArVoxelID.cxx:79
double Z() const
Definition: LArVoxelID.cxx:86
double X() const
Definition: LArVoxelID.cxx:72
bool sim::LArVoxelID::operator< ( const LArVoxelID other) const

The comparison operator. This a key function, since it establishes the sort order of the voxels in a list.

Definition at line 135 of file LArVoxelID.cxx.

136  {
137  // What is a good sort order for voxels in the list? I'm not sure.
138  // For now, pick an ordering but be prepared to change it: sort by
139  // T, Z, X, then Y.
140 
141  if ( fbins[3] < other.fbins[3] ) return true;
142 
143  if ( fbins[3] == other.fbins[3] ){
144  if ( fbins[2] < other.fbins[2] ) return true;
145 
146  if ( fbins[2] == other. fbins[2] ){
147  if ( fbins[0] < other.fbins[0] ) return true;
148 
149  if ( fbins[0] == other.fbins[0] ){
150  if ( fbins[1] < other.fbins[1] ) return true;
151  }
152  }
153  }
154 
155  return false;
156  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
bool sim::LArVoxelID::operator== ( const LArVoxelID other) const

Test for equality. Handy, but not usually necessary.

Definition at line 160 of file LArVoxelID.cxx.

161  {
162  if ( fbins[0] == other.fbins[0] &&
163  fbins[1] == other.fbins[1] &&
164  fbins[2] == other.fbins[2] &&
165  fbins[3] == other.fbins[3] )
166  return true;
167 
168  return false;
169  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double sim::LArVoxelID::operator[] ( const int  i) const

Definition at line 100 of file LArVoxelID.cxx.

101  {
102  switch (i){
103  case 0:
104  return X(); break;
105  case 1:
106  return Y(); break;
107  case 2:
108  return Z(); break;
109  case 3:
110  return T(); break;
111  }
112  // I suppose I should put some error processing here; for now
113  // I'll just return zero.
114  return 0;
115  }
double Y() const
Definition: LArVoxelID.cxx:79
double Z() const
Definition: LArVoxelID.cxx:86
double X() const
Definition: LArVoxelID.cxx:72
double T() const
Definition: LArVoxelID.cxx:93
double sim::LArVoxelID::T ( ) const

Definition at line 93 of file LArVoxelID.cxx.

94  {
96  return voxelCalc->TBinToAxis(fbins[3]);
97  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double TBinToAxis(const int value) const
int sim::LArVoxelID::TBin ( ) const
inline

Definition at line 140 of file LArVoxelID.h.

140 { return fbins[3]; }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double sim::LArVoxelID::X ( ) const

The accessors I expect to be used: The values of the co-ordinates at the bin centers.

Definition at line 72 of file LArVoxelID.cxx.

73  {
75  return voxelCalc->XBinToAxis(fbins[0]);
76  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double XBinToAxis(const int value) const
int sim::LArVoxelID::XBin ( ) const
inline

Definition at line 137 of file LArVoxelID.h.

137 { return fbins[0]; }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double sim::LArVoxelID::Y ( ) const

Definition at line 79 of file LArVoxelID.cxx.

80  {
82  return voxelCalc->YBinToAxis(fbins[1]);
83  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double YBinToAxis(const int value) const
int sim::LArVoxelID::YBin ( ) const
inline

Definition at line 138 of file LArVoxelID.h.

138 { return fbins[1]; }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double sim::LArVoxelID::Z ( void  ) const

Definition at line 86 of file LArVoxelID.cxx.

87  {
89  return voxelCalc->ZBinToAxis(fbins[2]);
90  }
std::vector< int > fbins
Definition: LArVoxelID.h:91
double ZBinToAxis(const int value) const
int sim::LArVoxelID::ZBin ( ) const
inline

Definition at line 139 of file LArVoxelID.h.

139 { return fbins[2]; }
std::vector< int > fbins
Definition: LArVoxelID.h:91

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const LArVoxelID id 
)
friend

Put the contents on the output stream. We have a choice: write the bin number, or write the position represented by the bins. For now, let's pick writing the positions.

Definition at line 121 of file LArVoxelID.cxx.

122  {
123  output << "(" << id.X()
124  << "," << id.Y()
125  << "," << id.Z()
126  << "," << id.T()
127  << ")";
128 
129  return output;
130  }

Member Data Documentation

std::vector<int> sim::LArVoxelID::fbins
private

Definition at line 91 of file LArVoxelID.h.


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