QwAnalysis
QwTreeLine Class Reference

One-dimensional (u, v, or x) track stubs and associated hits. More...

#include <QwTreeLine.h>

+ Inheritance diagram for QwTreeLine:
+ Collaboration diagram for QwTreeLine:

Public Member Functions

 QwTreeLine ()
 Default constructor. More...
 
 QwTreeLine (int _a_beg, int _a_end, int _b_beg, int _b_end)
 Constructor with tree search results. More...
 
 QwTreeLine (double offset, double slope)
 Constructor with offset and slope. More...
 
 QwTreeLine (const QwTreeLine &that)
 Copy constructor. More...
 
 QwTreeLine (const QwTreeLine *that)
 Copy constructor. More...
 
virtual ~QwTreeLine ()
 Destructor. More...
 
QwTreeLineoperator= (const QwTreeLine &treeline)
 Assignment operator. More...
 
bool IsVoid () const
 Is this tree line void? More...
 
void SetVoid (const bool isvoid=true)
 
bool IsValid () const
 Is this tree line valid? More...
 
void SetValid (const bool isvoid=false)
 
bool IsNotVoid () const
 Is this tree line not void? More...
 
void SetNotVoid (const bool isvoid=false)
 
bool IsUsed () const
 Is this tree line used? More...
 
void SetUsed (const bool isused=true)
 
bool IsNotUsed () const
 Is this tree line not used? More...
 
void SetNotUsed (const bool isused=false)
 
double GetChiWeight ()
 Get the weighted chi^2. More...
 
QwHitGetBestWireHit (double offset=0.0)
 Get the hit with the smallest drift distance. More...
 
void Print (const Option_t *options=0) const
 
void PrintValid ()
 
void SetOffset (const double offset)
 Set the offset. More...
 
double GetOffset () const
 Get the offset. More...
 
void SetSlope (const double slope)
 Set the slope. More...
 
double GetSlope () const
 Get the slope. More...
 
void SetChi (const double chi)
 Set the chi^2. More...
 
double GetChi () const
 Get the chi^2. More...
 
void SetCov (const double *cov)
 Set the covariance. More...
 
const double * GetCov () const
 Get the covariance. More...
 
void SetMatchingPattern (std::vector< int > &box)
 Set the matching pattern. More...
 
std::pair< double, double > CalculateDistance (int row, double width, unsigned int bins, double error)
 calculate the upper and lower bound of the drift distance give the row number More...
 
std::vector< QwTreeLine * > GetListAsVector () const
 Get vector for linked list of treelines. More...
 
Creating, adding, and getting hits and hit containers
void AddHit (const QwHit *hit)
 Add a single hit. More...
 
void AddHitList (const std::vector< QwHit * > &fQwHits)
 Add a list of hits. More...
 
Int_t GetNumberOfHits () const
 Get the number of hits. More...
 
QwHitGetHit (int i=0)
 Get a specific hit. More...
 
const QwHitGetHit (int i=0) const
 Get a specific hit (const version) More...
 
const std::vector< QwHit * > & GetListOfHits () const
 Get the list of hits. More...
 
void ClearHits ()
 Clear the list of hits without deleting. More...
 
void DeleteHit (const size_t i)
 Delete a single hit. More...
 
void DeleteHits ()
 Delete the hits in the list. More...
 
Positions and resolutions in wire planes
double GetPositionFirst (const double binwidth)
 Returns position at the first detector plane. More...
 
double GetPositionLast (const double binwidth)
 Returns position at the last detector plane. More...
 
double GetResolutionFirst (const double binwidth)
 Returns resolution at the first detector plane. More...
 
double GetResolutionLast (const double binwidth)
 Returns resolution at the last detector plane. More...
 
Calculate the residuals
double GetAverageResidual () const
 Get the average residuals. More...
 
void SetAverageResidual (const double residual)
 Set the average residuals. More...
 
double CalculateAverageResidual ()
 Calculate the average residuals. More...
 
void SetAverageResidual ()
 Calculate and set the average residuals. More...
 
- Public Member Functions inherited from VQwTrackingElement
 VQwTrackingElement ()
 Default constructor. More...
 
 VQwTrackingElement (const VQwTrackingElement &that)
 
virtual ~VQwTrackingElement ()
 Virtual destructor. More...
 
VQwTrackingElementoperator= (const VQwTrackingElement &that)
 Assignment operator. More...
 
const QwDetectorInfoGetDetectorInfo () const
 Get the detector info pointer. More...
 
void SetDetectorInfo (const QwDetectorInfo *detectorinfo)
 Set the detector info pointer. More...
 
EQwRegionID GetRegion () const
 Get the region. More...
 
void SetRegion (EQwRegionID region)
 Set the region. More...
 
EQwDetectorPackage GetPackage () const
 Get the package. More...
 
void SetPackage (EQwDetectorPackage package)
 Set the package. More...
 
int GetOctant () const
 Get the octant number. More...
 
void SetOctant (int octant)
 Set the octant number. More...
 
EQwDirectionID GetDirection () const
 Get the direction. More...
 
void SetDirection (EQwDirectionID direction)
 Set the direction. More...
 
int GetPlane () const
 Get the plane number. More...
 
void SetPlane (int plane)
 Set the plane number. More...
 
int GetElement () const
 Get the element number. More...
 
void SetElement (int element)
 Set the element number. More...
 
void SetGeometryTo (const VQwTrackingElement &e)
 Copy the geometry info from another object. More...
 
- Public Member Functions inherited from QwObjectCounter< QwTreeLine >
 QwObjectCounter ()
 Default constructor. More...
 
 QwObjectCounter (const QwObjectCounter &)
 Copy constructor. More...
 
virtual ~QwObjectCounter ()
 Destructor. More...
 

Data Fields

std::vector< int > fMatchingPattern
 
double fOffset
 track offset More...
 
double fSlope
 track slope More...
 
double fChi
 chi squared(?) More...
 
double fCov [3]
 covariance matrix of offset and slope More...
 
int a_beg
 
int a_end
 bin in first layer More...
 
int b_beg
 
int b_end
 bin in last layer More...
 
int fNumHits
 number of hits on this treeline More...
 
int fNumMiss
 number of planes without hits More...
 
QwHitfHits [2 *MAX_LAYERS]
 
int fHashArray [2 *MAX_LAYERS]
 ///< all hits that satisfy road requirement More...
 
int fR3Offset
 offset of demultiplexed group of 8 More...
 
int fR3FirstWire
 
int fR3LastWire
 first and last wire in group of 8 More...
 
QwTreeLinenext
 

Private Member Functions

void Initialize ()
 Initialization. More...
 
 ClassDef (QwTreeLine, 1)
 

Private Attributes

Int_t fNQwHits
 Number of hits in this tree line. More...
 
std::vector< QwHit * > fQwHits
 List of hits in this tree line. More...
 
bool fIsVoid
 has been found void More...
 
bool fIsUsed
 has been used (part of parttrack) More...
 
double fAverageResidual
 ///< link to next list element More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const QwTreeLine &tl)
 Output stream operator. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from QwObjectCounter< QwTreeLine >
static size_t GetObjectsCreated ()
 Get number of objects ever created. More...
 
static size_t GetObjectsAlive ()
 Get number of objects still alive. More...
 
- Protected Member Functions inherited from VQwTrackingElement
 ClassDef (VQwTrackingElement, 1)
 
- Protected Attributes inherited from VQwTrackingElement
const QwDetectorInfofDetectorInfo
 
EQwRegionID fRegion
 ///< Detector info pointer More...
 
EQwDetectorPackage fPackage
 Package. More...
 
int fOctant
 Octant number. More...
 
EQwDirectionID fDirection
 Direction. More...
 
int fPlane
 Plane number. More...
 
int fElement
 Element number. More...
 

Detailed Description

One-dimensional (u, v, or x) track stubs and associated hits.

The QwTreeLine has a pointer to a set of hits. It is passed to various track fitting procedures and carries around the fit results.

Todo:
This class needs a non-trivial copy constructor which ensures that the hits are copied correctly.

Definition at line 51 of file QwTreeLine.h.

Constructor & Destructor Documentation

QwTreeLine::QwTreeLine ( )

Default constructor.

Definition at line 23 of file QwTreeLine.cc.

References Initialize().

24 {
25  // Initialize
26  Initialize();
27 }
void Initialize()
Initialization.
Definition: QwTreeLine.cc:101

+ Here is the call graph for this function:

QwTreeLine::QwTreeLine ( int  _a_beg,
int  _a_end,
int  _b_beg,
int  _b_end 
)

Constructor with tree search results.

Definition at line 31 of file QwTreeLine.cc.

References a_beg, a_end, b_beg, b_end, and Initialize().

32 {
33  // Initialize
34  Initialize();
35 
36  // Tree search
37  a_beg = _a_beg;
38  a_end = _a_end;
39  b_beg = _b_beg;
40  b_end = _b_end;
41 }
int b_end
bin in last layer
Definition: QwTreeLine.h:219
void Initialize()
Initialization.
Definition: QwTreeLine.cc:101
int a_end
bin in first layer
Definition: QwTreeLine.h:218

+ Here is the call graph for this function:

QwTreeLine::QwTreeLine ( double  offset,
double  slope 
)

Constructor with offset and slope.

Definition at line 45 of file QwTreeLine.cc.

References fOffset, fSlope, and Initialize().

46 {
47  // Initialize
48  Initialize();
49 
50  // Offset and slope
51  fOffset = offset;
52  fSlope = slope;
53 }
double fOffset
track offset
Definition: QwTreeLine.h:213
double fSlope
track slope
Definition: QwTreeLine.h:214
void Initialize()
Initialization.
Definition: QwTreeLine.cc:101

+ Here is the call graph for this function:

QwTreeLine::QwTreeLine ( const QwTreeLine that)

Copy constructor.

Definition at line 56 of file QwTreeLine.cc.

References Initialize().

57 : VQwTrackingElement(that)
58 {
59  // Initialize
60  Initialize();
61 
62  // Copy object
63  *this = that;
64 }
void Initialize()
Initialization.
Definition: QwTreeLine.cc:101
VQwTrackingElement()
Default constructor.

+ Here is the call graph for this function:

QwTreeLine::QwTreeLine ( const QwTreeLine that)

Copy constructor.

Definition at line 67 of file QwTreeLine.cc.

References Initialize().

68 : VQwTrackingElement(*that)
69 {
70  // Initialize
71  Initialize();
72 
73  // Null pointer
74  if (that == 0) return;
75 
76  // Copy object
77  *this = *that;
78 }
void Initialize()
Initialization.
Definition: QwTreeLine.cc:101
VQwTrackingElement()
Default constructor.

+ Here is the call graph for this function:

QwTreeLine::~QwTreeLine ( )
virtual

Destructor.

Delete the tree line and the lists of hits depending on it

Definition at line 84 of file QwTreeLine.cc.

References DeleteHits(), fHits, and MAX_LAYERS.

85 {
86  // Delete the hits in this treeline
87  for (int i = 0; i < 2 * MAX_LAYERS; ++i) {
88 
89  if (fHits[i]) delete fHits[i];
90  fHits[i] = 0;
91  }
92 
93  DeleteHits();
94  // No recursive delete of the next pointer is done here
95 }
void DeleteHits()
Delete the hits in the list.
Definition: QwTreeLine.cc:201
QwHit * fHits[2 *MAX_LAYERS]
Definition: QwTreeLine.h:224
#define MAX_LAYERS
Definition: globals.h:8

+ Here is the call graph for this function:

Member Function Documentation

void QwTreeLine::AddHit ( const QwHit hit)

Add a single hit.

Definition at line 219 of file QwTreeLine.cc.

References fNQwHits, and fQwHits.

Referenced by AddHitList(), QwTrackingTreeMatch::MatchRegion3(), QwTrackingTreeCombine::TlCheckForX(), and QwTrackingTreeCombine::TlMatchHits().

220 {
221  if (hit) fQwHits.push_back(new QwHit(hit));
222  fNQwHits++;
223 }
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
Hit structure uniquely defining each hit.
Definition: QwHit.h:43
Int_t fNQwHits
Number of hits in this tree line.
Definition: QwTreeLine.h:56

+ Here is the caller graph for this function:

void QwTreeLine::AddHitList ( const std::vector< QwHit * > &  fQwHits)

Add a list of hits.

Definition at line 226 of file QwTreeLine.cc.

References AddHit().

Referenced by operator=().

227 {
228  for (std::vector<QwHit*>::const_iterator hit = hitlist.begin();
229  hit != hitlist.end(); hit++)
230  AddHit(*hit);
231 }
void AddHit(const QwHit *hit)
Add a single hit.
Definition: QwTreeLine.cc:219

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double QwTreeLine::CalculateAverageResidual ( )

Calculate the average residuals.

Calculate average residual of this partial track over all treelines

Returns
Average residual

Definition at line 296 of file QwTreeLine.cc.

References fAverageResidual, GetHit(), GetNumberOfHits(), QwHit::GetTreeLineResidual(), and QwHit::IsUsed().

Referenced by QwTrackingTreeMatch::MatchRegion3(), SetAverageResidual(), and QwTrackingTreeCombine::TlTreeLineSort().

297 {
298  int numHits = 0;
299  double sumResiduals = 0.0;
300  // loop over hits
301  for (Int_t i = 0; i < GetNumberOfHits(); i++) {
302  const QwHit* hit = GetHit(i);
303  if (hit->IsUsed()) {
304  sumResiduals += hit->GetTreeLineResidual();
305  numHits++;
306  }
307  } // end of loop over hits
308  fAverageResidual = sumResiduals / numHits;
309  return fAverageResidual;
310 }
Int_t GetNumberOfHits() const
Get the number of hits.
Definition: QwTreeLine.h:109
const Bool_t & IsUsed() const
Definition: QwHit.h:101
double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235
QwHit * GetHit(int i=0)
Get a specific hit.
Definition: QwTreeLine.cc:234
const Double_t & GetTreeLineResidual() const
Definition: QwHit.h:97
Hit structure uniquely defining each hit.
Definition: QwHit.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair< double, double > QwTreeLine::CalculateDistance ( int  row,
double  width,
unsigned int  bins,
double  error 
)

calculate the upper and lower bound of the drift distance give the row number

Definition at line 374 of file QwTreeLine.cc.

References fMatchingPattern.

Referenced by QwTrackingTreeCombine::TlTreeLineSort().

375 {
376  std::pair<double,double> boundary(0,0);
377  int bin = fMatchingPattern.at(row);
378 
379  double dx = width / bins, lower = 0, upper = 0;
380  bin += 1;
381  if (bin <= (int) (bins/2)) bin = bins - bin + 1;
382  lower = (bin - 1) * dx - width / 2 - resolution;
383  upper = bin * dx - width / 2 + resolution;
384  boundary.first = lower;
385  boundary.second = upper;
386 
387  return boundary;
388 }
std::vector< int > fMatchingPattern
Definition: QwTreeLine.h:212

+ Here is the caller graph for this function:

QwTreeLine::ClassDef ( QwTreeLine  ,
 
)
private
void QwTreeLine::ClearHits ( )

Clear the list of hits without deleting.

Definition at line 194 of file QwTreeLine.cc.

References fNQwHits, and fQwHits.

Referenced by DeleteHits(), Initialize(), and operator=().

195 {
196  fQwHits.clear();
197  fNQwHits = 0;
198 }
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
Int_t fNQwHits
Number of hits in this tree line.
Definition: QwTreeLine.h:56

+ Here is the caller graph for this function:

void QwTreeLine::DeleteHit ( const size_t  i)

Delete a single hit.

Definition at line 209 of file QwTreeLine.cc.

References fNQwHits, and fQwHits.

Referenced by QwTrackingTreeCombine::TlMatchHits().

210 {
211  if (fQwHits.at(i)) {
212  delete fQwHits.at(i);
213  fQwHits.erase(fQwHits.begin()+i);
214  fNQwHits--;
215  }
216 }
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
Int_t fNQwHits
Number of hits in this tree line.
Definition: QwTreeLine.h:56

+ Here is the caller graph for this function:

void QwTreeLine::DeleteHits ( )

Delete the hits in the list.

Definition at line 201 of file QwTreeLine.cc.

References ClearHits(), and fQwHits.

Referenced by ~QwTreeLine().

202 {
203  for (size_t i = 0; i < fQwHits.size(); i++)
204  delete fQwHits.at(i);
205  ClearHits();
206 }
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
void ClearHits()
Clear the list of hits without deleting.
Definition: QwTreeLine.cc:194

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double QwTreeLine::GetAverageResidual ( ) const
inline

Get the average residuals.

Definition at line 163 of file QwTreeLine.h.

References fAverageResidual.

Referenced by QwPartialTrack::CalculateAverageResidual(), and QwTrackingTreeCombine::TcTreeLineCombine().

163 { return fAverageResidual; }
double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235

+ Here is the caller graph for this function:

QwHit * QwTreeLine::GetBestWireHit ( double  offset = 0.0)

Get the hit with the smallest drift distance.

Determine the hit with the smallest drift distance, i.e. a first order estimate of the crossing of the track with the central wire plane.

Parameters
offsetOptional offset to the position
Returns
Hit with smallest drift distance

Definition at line 277 of file QwTreeLine.cc.

References GetHit(), and GetNumberOfHits().

278 {
279  double best_position = 9999.9;
280  int best_hit = 0;
281  // Get the best measured hit in the back
282  for (int hit = 0; hit < GetNumberOfHits(); hit++) {
283  double position = fabs(GetHit(hit)->GetDriftPosition() - offset);
284  if (position < best_position) {
285  best_position = position;
286  best_hit = hit;
287  }
288  }
289  return GetHit(best_hit);
290 }
Int_t GetNumberOfHits() const
Get the number of hits.
Definition: QwTreeLine.h:109
QwHit * GetHit(int i=0)
Get a specific hit.
Definition: QwTreeLine.cc:234

+ Here is the call graph for this function:

double QwTreeLine::GetChi ( ) const
inline

Get the chi^2.

Definition at line 183 of file QwTreeLine.h.

References fChi.

183 { return fChi; }
double fChi
chi squared(?)
Definition: QwTreeLine.h:215
double QwTreeLine::GetChiWeight ( )

Get the weighted chi^2.

Determine the chi^2 for a tree line, weighted by the number of hits.

Returns
Weighted chi^2

Definition at line 257 of file QwTreeLine.cc.

References QwLog::endl(), fChi, fNumHits, fNumMiss, and QwMessage.

258 {
259  double weight;
260  // NOTE Added +1 to get this to work if fNumHits == fNumMiss (region 2 cosmics)
261  if (fNumHits >= fNumMiss)
262  weight = (double) (fNumHits + fNumMiss + 1)
263  / (fNumHits - fNumMiss + 1);
264  else {
265  QwMessage << "miss = " << fNumMiss << ", hits = " << fNumHits << QwLog::endl;
266  return 100000.0; // This is bad...
267  }
268  return weight * fChi;
269 }
double fChi
chi squared(?)
Definition: QwTreeLine.h:215
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
int fNumHits
number of hits on this treeline
Definition: QwTreeLine.h:221
int fNumMiss
number of planes without hits
Definition: QwTreeLine.h:222
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

const double* QwTreeLine::GetCov ( ) const
inline

Get the covariance.

Definition at line 187 of file QwTreeLine.h.

References fCov.

187 { return fCov; }
double fCov[3]
covariance matrix of offset and slope
Definition: QwTreeLine.h:216
QwHit * QwTreeLine::GetHit ( int  i = 0)

Get a specific hit.

Definition at line 234 of file QwTreeLine.cc.

References fNQwHits, and fQwHits.

Referenced by CalculateAverageResidual(), GetBestWireHit(), QwTrackingTreeCombine::r3_PartialTrackFit(), QwTrackingTreeCombine::TlMatchHits(), and QwTrackingTreeCombine::TlTreeCombine().

235 {
236  if (fNQwHits == 0 || i >= fNQwHits)
237  return 0;
238  else
239  return fQwHits.at(i);
240 }
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
Int_t fNQwHits
Number of hits in this tree line.
Definition: QwTreeLine.h:56

+ Here is the caller graph for this function:

const QwHit * QwTreeLine::GetHit ( int  i = 0) const

Get a specific hit (const version)

Definition at line 243 of file QwTreeLine.cc.

References fNQwHits, and fQwHits.

244 {
245  if (fNQwHits == 0 || i >= fNQwHits)
246  return 0;
247  else
248  return fQwHits.at(i);
249 }
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
Int_t fNQwHits
Number of hits in this tree line.
Definition: QwTreeLine.h:56
std::vector<QwTreeLine*> QwTreeLine::GetListAsVector ( ) const
inline

Get vector for linked list of treelines.

Definition at line 194 of file QwTreeLine.h.

References next.

194  {
195  std::vector<QwTreeLine*> list;
196  QwTreeLine* treeline = const_cast<QwTreeLine*>(this);
197  while (treeline) {
198  list.push_back(treeline);
199  treeline = treeline->next;
200  }
201  return list;
202  }
One-dimensional (u, v, or x) track stubs and associated hits.
Definition: QwTreeLine.h:51
QwTreeLine * next
Definition: QwTreeLine.h:231
const std::vector<QwHit*>& QwTreeLine::GetListOfHits ( ) const
inline

Get the list of hits.

Definition at line 115 of file QwTreeLine.h.

References fQwHits.

Referenced by QwTrackingTreeMatch::MatchRegion3(), QwTrackingTreeSort::rcCommonWires_r3(), and QwTrackingTreeCombine::TlMatchHits().

115 { return fQwHits; };
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58

+ Here is the caller graph for this function:

Int_t QwTreeLine::GetNumberOfHits ( ) const
inline

Get the number of hits.

Definition at line 109 of file QwTreeLine.h.

References fNQwHits.

Referenced by CalculateAverageResidual(), GetBestWireHit(), QwTrackingTreeSort::rcCommonWires_r3(), QwTrackingTreeCombine::TlMatchHits(), and QwTrackingTreeCombine::TlTreeCombine().

109 { return fNQwHits; }
Int_t fNQwHits
Number of hits in this tree line.
Definition: QwTreeLine.h:56

+ Here is the caller graph for this function:

double QwTreeLine::GetOffset ( ) const
inline

Get the offset.

Definition at line 175 of file QwTreeLine.h.

References fOffset.

175 { return fOffset; }
double fOffset
track offset
Definition: QwTreeLine.h:213
double QwTreeLine::GetPositionFirst ( const double  binwidth)
inline

Returns position at the first detector plane.

Definition at line 140 of file QwTreeLine.h.

References a_beg, and a_end.

Referenced by QwTrackingTreeCombine::TlTreeLineSort().

140  {
141  //return 0.5 * (a_beg + a_end) * binwidth + 0.5*binwidth;
142  return 0.5*(a_beg + a_end)*binwidth;
143  }
int a_end
bin in first layer
Definition: QwTreeLine.h:218

+ Here is the caller graph for this function:

double QwTreeLine::GetPositionLast ( const double  binwidth)
inline

Returns position at the last detector plane.

Definition at line 145 of file QwTreeLine.h.

References b_beg, and b_end.

Referenced by QwTrackingTreeCombine::TlTreeLineSort().

145  {
146  return 0.5*(b_beg+b_end)*binwidth;
147  //return 0.5 * (b_beg + b_end) * binwidth + 0.5*binwidth;
148 
149  }
int b_end
bin in last layer
Definition: QwTreeLine.h:219

+ Here is the caller graph for this function:

double QwTreeLine::GetResolutionFirst ( const double  binwidth)
inline

Returns resolution at the first detector plane.

Definition at line 151 of file QwTreeLine.h.

References a_beg, and a_end.

Referenced by QwTrackingTreeCombine::TlTreeLineSort().

151  {
152  return (a_end - a_beg) * binwidth;
153  }
int a_end
bin in first layer
Definition: QwTreeLine.h:218

+ Here is the caller graph for this function:

double QwTreeLine::GetResolutionLast ( const double  binwidth)
inline

Returns resolution at the last detector plane.

Definition at line 155 of file QwTreeLine.h.

References b_beg, and b_end.

Referenced by QwTrackingTreeCombine::TlTreeLineSort().

155  {
156  return (b_end - b_beg) * binwidth;
157  }
int b_end
bin in last layer
Definition: QwTreeLine.h:219

+ Here is the caller graph for this function:

double QwTreeLine::GetSlope ( ) const
inline

Get the slope.

Definition at line 179 of file QwTreeLine.h.

References fSlope.

179 { return fSlope; }
double fSlope
track slope
Definition: QwTreeLine.h:214
void QwTreeLine::Initialize ( )
private

Initialization.

Perform object initialization

Definition at line 101 of file QwTreeLine.cc.

References a_beg, a_end, b_beg, b_end, ClearHits(), fAverageResidual, fChi, fCov, fHashArray, fHits, fIsUsed, fIsVoid, fNumHits, fNumMiss, fOffset, fR3FirstWire, fR3LastWire, fR3Offset, fSlope, MAX_LAYERS, and next.

Referenced by QwTreeLine().

102 {
103  // Clear the list of hits
104  ClearHits();
105 
106  // Reset the void and used flags
107  fIsVoid = false; // treeline is not void yet
108  fIsUsed = false; // treeline is not part of a partial track yet
109 
110  // Tree search
111  a_beg = 0;
112  a_end = 0;
113  b_beg = 0;
114  b_end = 0;
115 
116  next = 0; // no next element yet in linked-list
117 
118  fOffset = fSlope = 0.0;
119  fChi = 0.0;
120 
121  for (int i = 0; i < 3; i++)
122  fCov[i] = 0.0;
123 
124  fNumHits = 0;
125  fNumMiss = 0;
126 
127  for (int i = 0; i < 2 * MAX_LAYERS; i++) {
128  fHits[i] = 0;
129  fHashArray[i] = 0;
130  }
131 
132  fAverageResidual = 0;
133 
135 }
double fChi
chi squared(?)
Definition: QwTreeLine.h:215
int fHashArray[2 *MAX_LAYERS]
///&lt; all hits that satisfy road requirement
Definition: QwTreeLine.h:226
double fOffset
track offset
Definition: QwTreeLine.h:213
bool fIsUsed
has been used (part of parttrack)
Definition: QwTreeLine.h:207
int fR3Offset
offset of demultiplexed group of 8
Definition: QwTreeLine.h:228
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206
double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235
double fCov[3]
covariance matrix of offset and slope
Definition: QwTreeLine.h:216
double fSlope
track slope
Definition: QwTreeLine.h:214
int fR3LastWire
first and last wire in group of 8
Definition: QwTreeLine.h:229
int b_end
bin in last layer
Definition: QwTreeLine.h:219
int fNumHits
number of hits on this treeline
Definition: QwTreeLine.h:221
int fNumMiss
number of planes without hits
Definition: QwTreeLine.h:222
int fR3FirstWire
Definition: QwTreeLine.h:229
QwTreeLine * next
Definition: QwTreeLine.h:231
QwHit * fHits[2 *MAX_LAYERS]
Definition: QwTreeLine.h:224
#define MAX_LAYERS
Definition: globals.h:8
int a_end
bin in first layer
Definition: QwTreeLine.h:218
void ClearHits()
Clear the list of hits without deleting.
Definition: QwTreeLine.cc:194

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool QwTreeLine::IsNotUsed ( ) const
inline

Is this tree line not used?

Definition at line 99 of file QwTreeLine.h.

References fIsUsed.

99 { return ! fIsUsed; }
bool fIsUsed
has been used (part of parttrack)
Definition: QwTreeLine.h:207
bool QwTreeLine::IsNotVoid ( ) const
inline

Is this tree line not void?

Definition at line 93 of file QwTreeLine.h.

References fIsVoid.

93 { return ! fIsVoid; }
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206
bool QwTreeLine::IsUsed ( ) const
inline

Is this tree line used?

Definition at line 96 of file QwTreeLine.h.

References fIsUsed.

Referenced by QwPartialTrack::CalculateAverageResidual().

96 { return fIsUsed; }
bool fIsUsed
has been used (part of parttrack)
Definition: QwTreeLine.h:207

+ Here is the caller graph for this function:

bool QwTreeLine::IsValid ( ) const
inline

Is this tree line valid?

Definition at line 90 of file QwTreeLine.h.

References fIsVoid.

Referenced by PrintValid(), and QwTrackingTreeCombine::TlTreeLineSort().

90 { return ! fIsVoid; }
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206

+ Here is the caller graph for this function:

bool QwTreeLine::IsVoid ( ) const
inline

Is this tree line void?

Definition at line 87 of file QwTreeLine.h.

References fIsVoid.

Referenced by QwTrackingTreeSearch::exists(), operator<<(), QwTrackingTreeSort::rcTreeConnSort(), QwTrackingTreeCombine::TlTreeCombine(), and QwTrackingTreeCombine::TlTreeLineSort().

87 { return fIsVoid; }
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206

+ Here is the caller graph for this function:

QwTreeLine & QwTreeLine::operator= ( const QwTreeLine that)

Assignment operator.

Assignment operator

Definition at line 141 of file QwTreeLine.cc.

References a_beg, a_end, AddHitList(), b_beg, b_end, ClearHits(), fAverageResidual, fChi, fCov, fHashArray, fHits, fMatchingPattern, fNumHits, fNumMiss, fOffset, fQwHits, fR3FirstWire, fR3LastWire, fR3Offset, fSlope, VQwTrackingElement::GetDirection(), VQwTrackingElement::GetPackage(), VQwTrackingElement::GetPlane(), VQwTrackingElement::GetRegion(), MAX_LAYERS, next, VQwTrackingElement::operator=(), VQwTrackingElement::SetDirection(), VQwTrackingElement::SetPackage(), VQwTrackingElement::SetPlane(), and VQwTrackingElement::SetRegion().

142 {
143  if (this == &that) return *this;
144 
146 
148 
149  fOffset = that.fOffset;
150  fSlope = that.fSlope;
151  fChi = that.fChi;
153  for (size_t i = 0; i < 3; i++)
154  fCov[i] = that.fCov[i];
155 
156  a_beg = that.a_beg;
157  a_end = that.a_end;
158  b_beg = that.b_beg;
159  b_end = that.b_end;
160 
161  fNumHits = that.fNumHits;
162  fNumMiss = that.fNumMiss;
163 
164  fR3Offset = that.fR3Offset;
165  fR3FirstWire = that.fR3FirstWire;
166  fR3LastWire = that.fR3LastWire;
167 
168  SetPackage(that.GetPackage());
169  SetRegion(that.GetRegion());
170  SetPlane(that.GetPlane());
171  SetDirection(that.GetDirection());
172 
173  next = 0;
174 
175  // Copy the hits
176  for (int i = 0; i < 2 * MAX_LAYERS; i++) {
177 
178  fHashArray[i] = that.fHashArray[i];
179 
180  if (that.fHits[i]) {
181  this->fHits[i] = new QwHit(that.fHits[i]);
182  }
183  }
184 
185  // Copy hits
186  ClearHits();
187  AddHitList(that.fQwHits);
188 
189  return *this;
190 }
double fChi
chi squared(?)
Definition: QwTreeLine.h:215
void SetPlane(int plane)
Set the plane number.
int fHashArray[2 *MAX_LAYERS]
///&lt; all hits that satisfy road requirement
Definition: QwTreeLine.h:226
double fOffset
track offset
Definition: QwTreeLine.h:213
int fR3Offset
offset of demultiplexed group of 8
Definition: QwTreeLine.h:228
void SetRegion(EQwRegionID region)
Set the region.
double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
double fCov[3]
covariance matrix of offset and slope
Definition: QwTreeLine.h:216
double fSlope
track slope
Definition: QwTreeLine.h:214
void SetPackage(EQwDetectorPackage package)
Set the package.
int fR3LastWire
first and last wire in group of 8
Definition: QwTreeLine.h:229
void AddHitList(const std::vector< QwHit * > &fQwHits)
Add a list of hits.
Definition: QwTreeLine.cc:226
EQwRegionID GetRegion() const
Get the region.
int GetPlane() const
Get the plane number.
VQwTrackingElement & operator=(const VQwTrackingElement &that)
Assignment operator.
int b_end
bin in last layer
Definition: QwTreeLine.h:219
int fNumHits
number of hits on this treeline
Definition: QwTreeLine.h:221
void SetDirection(EQwDirectionID direction)
Set the direction.
std::vector< int > fMatchingPattern
Definition: QwTreeLine.h:212
int fNumMiss
number of planes without hits
Definition: QwTreeLine.h:222
int fR3FirstWire
Definition: QwTreeLine.h:229
QwTreeLine * next
Definition: QwTreeLine.h:231
QwHit * fHits[2 *MAX_LAYERS]
Definition: QwTreeLine.h:224
Hit structure uniquely defining each hit.
Definition: QwHit.h:43
#define MAX_LAYERS
Definition: globals.h:8
int a_end
bin in first layer
Definition: QwTreeLine.h:218
EQwDirectionID GetDirection() const
Get the direction.
void ClearHits()
Clear the list of hits without deleting.
Definition: QwTreeLine.cc:194
EQwDetectorPackage GetPackage() const
Get the package.

+ Here is the call graph for this function:

void QwTreeLine::Print ( const Option_t *  options = 0) const

Print the tree line in a linked list

Definition at line 317 of file QwTreeLine.cc.

References next, and Print().

Referenced by Print(), QwTrackingWorker::ProcessEvent(), and QwTrackingTreeCombine::TlTreeLineSort().

317  {
318  if (!this) return;
319  std::cout << *this << std::endl;
320  if (next) next->Print(options);
321 }
void Print(const Option_t *options=0) const
Definition: QwTreeLine.cc:317
QwTreeLine * next
Definition: QwTreeLine.h:231

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwTreeLine::PrintValid ( )

Print the valid tree lines in a linked list

Definition at line 327 of file QwTreeLine.cc.

References IsValid(), next, and PrintValid().

Referenced by PrintValid().

327  {
328  if (!this) return;
329  if (this->IsValid()) std::cout << *this << std::endl;
330  next->PrintValid();
331 }
void PrintValid()
Definition: QwTreeLine.cc:327
bool IsValid() const
Is this tree line valid?
Definition: QwTreeLine.h:90
QwTreeLine * next
Definition: QwTreeLine.h:231

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwTreeLine::SetAverageResidual ( const double  residual)
inline

Set the average residuals.

Definition at line 165 of file QwTreeLine.h.

References fAverageResidual.

165 { fAverageResidual = residual; }
double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235
void QwTreeLine::SetAverageResidual ( )
inline

Calculate and set the average residuals.

Definition at line 169 of file QwTreeLine.h.

References CalculateAverageResidual(), and fAverageResidual.

double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235
double CalculateAverageResidual()
Calculate the average residuals.
Definition: QwTreeLine.cc:296

+ Here is the call graph for this function:

void QwTreeLine::SetChi ( const double  chi)
inline

Set the chi^2.

Definition at line 181 of file QwTreeLine.h.

References fChi.

Referenced by QwTrackingTreeMatch::MatchRegion3(), and QwTrackingTreeCombine::TlMatchHits().

181 { fChi = chi; }
double fChi
chi squared(?)
Definition: QwTreeLine.h:215

+ Here is the caller graph for this function:

void QwTreeLine::SetCov ( const double *  cov)
inline

Set the covariance.

Definition at line 185 of file QwTreeLine.h.

References fCov.

Referenced by QwTrackingTreeCombine::TlCheckForX(), and QwTrackingTreeCombine::TlMatchHits().

185 { fCov[0] = cov[0]; fCov[1] = cov[1]; fCov[2] = cov[2]; }
double fCov[3]
covariance matrix of offset and slope
Definition: QwTreeLine.h:216

+ Here is the caller graph for this function:

void QwTreeLine::SetMatchingPattern ( std::vector< int > &  box)

Set the matching pattern.

Definition at line 367 of file QwTreeLine.cc.

References fMatchingPattern.

Referenced by QwTrackingTreeSearch::_SearchTreeLines().

368 {
369  std::vector<int>::iterator iter = box.begin();
370  while (iter != box.end())
371  fMatchingPattern.push_back(*iter++);
372 }
std::vector< int > fMatchingPattern
Definition: QwTreeLine.h:212

+ Here is the caller graph for this function:

void QwTreeLine::SetNotUsed ( const bool  isused = false)
inline

Definition at line 100 of file QwTreeLine.h.

References fIsUsed.

100 { fIsUsed = isused; }
bool fIsUsed
has been used (part of parttrack)
Definition: QwTreeLine.h:207
void QwTreeLine::SetNotVoid ( const bool  isvoid = false)
inline

Definition at line 94 of file QwTreeLine.h.

References fIsVoid.

94 { fIsVoid = isvoid; }
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206
void QwTreeLine::SetOffset ( const double  offset)
inline

Set the offset.

Definition at line 173 of file QwTreeLine.h.

References fOffset.

Referenced by QwTrackingTreeMatch::MatchRegion3(), and QwTrackingTreeCombine::TlMatchHits().

173 { fOffset = offset; }
double fOffset
track offset
Definition: QwTreeLine.h:213

+ Here is the caller graph for this function:

void QwTreeLine::SetSlope ( const double  slope)
inline

Set the slope.

Definition at line 177 of file QwTreeLine.h.

References fSlope.

Referenced by QwTrackingTreeMatch::MatchRegion3(), and QwTrackingTreeCombine::TlMatchHits().

177 { fSlope = slope; }
double fSlope
track slope
Definition: QwTreeLine.h:214

+ Here is the caller graph for this function:

void QwTreeLine::SetUsed ( const bool  isused = true)
inline

Definition at line 97 of file QwTreeLine.h.

References fIsUsed.

Referenced by QwTrackingTreeCombine::TlTreeCombine().

97 { fIsUsed = isused; }
bool fIsUsed
has been used (part of parttrack)
Definition: QwTreeLine.h:207

+ Here is the caller graph for this function:

void QwTreeLine::SetValid ( const bool  isvoid = false)
inline

Definition at line 91 of file QwTreeLine.h.

References fIsVoid.

Referenced by QwTrackingTreeMatch::MatchRegion3(), QwTrackingTreeSort::rcTreeConnSort(), QwTrackingTreeCombine::TlCheckForX(), and QwTrackingTreeCombine::TlMatchHits().

91 { fIsVoid = isvoid; }
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206

+ Here is the caller graph for this function:

void QwTreeLine::SetVoid ( const bool  isvoid = true)
inline

Definition at line 88 of file QwTreeLine.h.

References fIsVoid.

Referenced by QwTrackingTreeSort::rcTreeConnSort(), QwTrackingTreeCombine::TlCheckForX(), and QwTrackingTreeCombine::TlMatchHits().

88 { fIsVoid = isvoid; }
bool fIsVoid
has been found void
Definition: QwTreeLine.h:206

+ Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const QwTreeLine tl 
)
friend

Output stream operator.

Stream some info about the tree line

Parameters
streamStream as lhs of the operator
tlTree line as rhs of the operator
Returns
Stream as result of the operator

Definition at line 340 of file QwTreeLine.cc.

340  {
341  stream << "tl: ";
342  if (tl.a_beg + tl.a_end + tl.b_beg + tl.b_end != 0) {
343  stream << tl.a_beg << "," << tl.a_end << " -- ";
344  stream << tl.b_beg << "," << tl.b_end << " ";
345  }
346  if (tl.GetRegion() != kRegionIDNull) { // treeline has geometry identification
347  stream << "(" << tl.GetRegion() << "/" << "?UD"[tl.GetPackage()];
348  stream << "/" << "?xyuvrq"[tl.GetDirection()];
349  if (tl.GetPlane() > 0)
350  stream << "/" << tl.GetPlane() << ")";
351  else
352  stream << ")";
353  }
354  if (tl.fChi > 0.0) { // treeline has been fitted
355  stream << "; fOffset = " << tl.fOffset/Qw::cm << " cm";
356  stream << ", fSlope = " << tl.fSlope;
357  stream << ", fResidual = " << tl.fAverageResidual/Qw::cm << " cm";
358  stream << ", fChi = " << tl.fChi;
359  stream << "; hits (" << tl.fQwHits.size() << "):";
360  for (size_t hit = 0; hit < tl.fQwHits.size(); hit++)
361  stream << " " << tl.fQwHits.at(hit)->GetPlane() << ":" << tl.fQwHits.at(hit)->GetElement();
362  }
363  if (tl.IsVoid()) stream << " (void)";
364  return stream;
365 }
double fChi
chi squared(?)
Definition: QwTreeLine.h:215
double fOffset
track offset
Definition: QwTreeLine.h:213
double fAverageResidual
///&lt; link to next list element
Definition: QwTreeLine.h:235
std::vector< QwHit * > fQwHits
List of hits in this tree line.
Definition: QwTreeLine.h:58
double fSlope
track slope
Definition: QwTreeLine.h:214
EQwRegionID GetRegion() const
Get the region.
int GetPlane() const
Get the plane number.
int b_end
bin in last layer
Definition: QwTreeLine.h:219
bool IsVoid() const
Is this tree line void?
Definition: QwTreeLine.h:87
int a_end
bin in first layer
Definition: QwTreeLine.h:218
EQwDirectionID GetDirection() const
Get the direction.
EQwDetectorPackage GetPackage() const
Get the package.
static const double cm
Length units: base unit is mm.
Definition: QwUnits.h:61

Field Documentation

int QwTreeLine::a_end
int QwTreeLine::b_end
double QwTreeLine::fAverageResidual
private

///< link to next list element

average residual over all used hits

Definition at line 235 of file QwTreeLine.h.

Referenced by CalculateAverageResidual(), GetAverageResidual(), Initialize(), operator<<(), operator=(), and SetAverageResidual().

double QwTreeLine::fCov[3]

covariance matrix of offset and slope

Definition at line 216 of file QwTreeLine.h.

Referenced by GetCov(), Initialize(), operator=(), and SetCov().

int QwTreeLine::fHashArray[2 *MAX_LAYERS]

///< all hits that satisfy road requirement

Definition at line 226 of file QwTreeLine.h.

Referenced by QwTrackingTreeSearch::_SearchTreeLines(), QwTrackingTreeSearch::exists(), Initialize(), and operator=().

bool QwTreeLine::fIsUsed
private

has been used (part of parttrack)

Definition at line 207 of file QwTreeLine.h.

Referenced by Initialize(), IsNotUsed(), IsUsed(), SetNotUsed(), and SetUsed().

bool QwTreeLine::fIsVoid
private

has been found void

Definition at line 206 of file QwTreeLine.h.

Referenced by Initialize(), IsNotVoid(), IsValid(), IsVoid(), SetNotVoid(), SetValid(), and SetVoid().

std::vector<int> QwTreeLine::fMatchingPattern
Int_t QwTreeLine::fNQwHits
private

Number of hits in this tree line.

Definition at line 56 of file QwTreeLine.h.

Referenced by AddHit(), ClearHits(), DeleteHit(), GetHit(), and GetNumberOfHits().

std::vector<QwHit*> QwTreeLine::fQwHits
private

List of hits in this tree line.

Definition at line 58 of file QwTreeLine.h.

Referenced by AddHit(), ClearHits(), DeleteHit(), DeleteHits(), GetHit(), GetListOfHits(), operator<<(), and operator=().

int QwTreeLine::fR3LastWire
int QwTreeLine::fR3Offset

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