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