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