PandaRoot
PndCANPlets.h
Go to the documentation of this file.
1 //-*- Mode: C++ -*-
2 // *****************************************************************************
3 // *
4 // @Autors: I.Kulakov; M.Zyzak; I.Kisel *
5 // @e-mail: I.Kulakov@gsi.de; M.Zyzak@gsi.de; I.Kisel@compeng.uni-frankfurt.de *
6 // *
7 // *****************************************************************************
8 
9 #ifndef PNDCANPLETS_H
10 #define PNDCANPLETS_H
11 
12 #include <vector>
13 using std::pair;
14 using std::vector;
15 #include "PndCATrackParam.h"
16 #include "PndCAStationArray.h"
17 #include "PndCANPletsV.h"
18 
19 class PndCANPlet {
20  public:
21  PndCANPlet() : fParam(), fLevel(-1), fChi2Level(0), fNeighbours() {}
22  PndCANPlet(const PndCATrackParam &param) : fParam(param), fLevel(0), fChi2Level(0), fNeighbours() {}
23  PndCANPlet(const vector<PndCATESV> &ih, const int iV, const PndCATrackParam &param) : fParam(param), fLevel(0), fChi2Level(0), fNeighbours()
24  {
25  fIHit.resize(ih.size());
26 
27  for (int i = 0; i < N(); i++)
28  fIHit[i] = ih[i][iV];
29  }
30 
31  int N() const { return fIHit.size(); }
32 
33  const PndCATES &IHit(int IH) const { return fIHit[IH]; }
34  int ISta(int IH) const { return fIHit[IH].s; }
35 
36  const PndCATrackParam &Param() const { return fParam; }
37  // PndCATrackParam& Param() { return fParam; }
38 
39  float QMomentum() const { return fParam.QMomentum(); }
40  float QMomentumErr() const { return sqrt(fParam.Err2QMomentum()); } // qp err
41  float QMomentumErr2() const { return fParam.Err2QMomentum(); } // qp err^2
42 
43  char &Level() { return fLevel; };
44  const char &Level() const { return fLevel; };
45 
46  float &Chi2Level() { return fChi2Level; };
47  const float &Chi2Level() const { return fChi2Level; };
48 
49  const unsigned int &INeighbours(int i) const { return fNeighbours[i].second; };
50  const float &Chi2Neighbours(int i) const { return fNeighbours[i].first; };
51  unsigned int NNeighbours() const { return fNeighbours.size(); };
52  vector<pair<float, unsigned int>> &Neighbours() { return fNeighbours; }
53 
54  // check wether a is neighbour from the right to this
55  bool IsRightNeighbour(float pick, const PndCANPlet &a, float &chi2)
56  {
57  int start = (N() - a.N() < 0) ? 0 : N() - a.N();
58  for (int i = start; i < N() - 1; i++)
59  if (IHit(i + 1) != a.IHit(i))
60  return false;
61  chi2 = fabs(QMomentum() - a.QMomentum()) / sqrt(QMomentumErr2() + a.QMomentumErr2());
62  if (chi2 > pick)
63  return false; // neighbours must have same qp
64  chi2 *= chi2;
65  return true;
66  }
67 
68  static bool compare(const PndCANPlet &i, const PndCANPlet &j) { return (i.Level() > j.Level()) || (i.Level() == j.Level() && i.Chi2Level() < j.Chi2Level()); }
69 
70  vector<PndCATES> fIHit; // index of hit on station
71 
72  private:
73  PndCATrackParam fParam;
74 
75  char fLevel;
76  float fChi2Level;
77  vector<pair<float, unsigned int>> fNeighbours; // index of neighbour triplets on their station
78 };
79 
80 class PndCANPlets : public PndCAStationArray<PndCANPlet> {
81  public:
82  PndCANPlets(int nSta, const PndCAHits *hits) : PndCAStationArray<PndCANPlet>(nSta, hits){};
83 
84  PndCANPlets(const PndCANPletsV &p);
85 };
86 
87 #endif
unsigned int NNeighbours() const
Definition: PndCANPlets.h:51
vector< pair< float, unsigned int > > & Neighbours()
Definition: PndCANPlets.h:52
PndCANPlet(const vector< PndCATESV > &ih, const int iV, const PndCATrackParam &param)
Definition: PndCANPlets.h:23
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:28
const unsigned int & INeighbours(int i) const
Definition: PndCANPlets.h:49
float QMomentum() const
Definition: PndCANPlets.h:39
unsigned int i
Definition: P4_F32vec4.h:21
int N() const
Definition: PndCANPlets.h:31
bool IsRightNeighbour(float pick, const PndCANPlet &a, float &chi2)
Definition: PndCANPlets.h:55
PndCANPlets(int nSta, const PndCAHits *hits)
Definition: PndCANPlets.h:82
int ISta(int IH) const
Definition: PndCANPlets.h:34
float QMomentumErr2() const
Definition: PndCANPlets.h:41
vector< PndCATES > fIHit
Definition: PndCANPlets.h:70
const float & Chi2Level() const
Definition: PndCANPlets.h:47
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:46
float QMomentumErr() const
Definition: PndCANPlets.h:40
float Err2QMomentum() const
char & Level()
Definition: PndCANPlets.h:43
PndCANPlet(const PndCATrackParam &param)
Definition: PndCANPlets.h:22
const PndCATES & IHit(int IH) const
Definition: PndCANPlets.h:33
float & Chi2Level()
Definition: PndCANPlets.h:46
const PndCATrackParam & Param() const
Definition: PndCANPlets.h:36
static bool compare(const PndCANPlet &i, const PndCANPlet &j)
Definition: PndCANPlets.h:68
const char & Level() const
Definition: PndCANPlets.h:44
float QMomentum() const
const float & Chi2Neighbours(int i) const
Definition: PndCANPlets.h:50