PandaRoot
PndSdsStripCorrelator.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------
2 //---------------- PndSdsStripCorrelator.h -------------------------
3 // Class to correlate top and bottom clusters on double sided strip sensors
4 //
5 // Authors: R. Kliemt (Uni Bonn)
6 // H.G. Zaunick (Uni Bonn)
7 // Date: June 2012
8 //
9 //------------------------------------------------------------------------------------
10 
11 #ifndef PNDSDSSTRIPCLUSTECORRELATOR_H
12 #define PNDSDSSTRIPCLUSTECORRELATOR_H 1
13 
14 #include <map>
15 #include <vector>
16 #include <utility>
17 #include <iostream>
18 
19 using namespace std;
20 
21 // Data types
22 
24  PndSdsStripCorrelatorCand() : top(), bot(), q_top(), q_bot(), prob(1.) {}
25  PndSdsStripCorrelatorCand(int t, int b, double qt, double qb, double p) : top(t), bot(b), q_top(qt), q_bot(qb), prob(p) {}
26  int top, bot;
27  double q_top, q_bot;
28  double prob;
29 };
30 
32  public:
33  PndSdsStripCorrelatorCombi() : pairlist(), prob(1.) {}
34  PndSdsStripCorrelatorCombi(const std::vector<PndSdsStripCorrelatorCand> &list, double p) : pairlist(), prob(p) { pairlist.insert(pairlist.end(), list.begin(), list.end()); }
35  PndSdsStripCorrelatorCombi(const PndSdsStripCorrelatorCombi &a_combi) : pairlist(), prob(a_combi.prob)
36  {
37  pairlist.insert(pairlist.end(), a_combi.pairlist.begin(), a_combi.pairlist.end());
38  }
39  std::vector<PndSdsStripCorrelatorCand> pairlist;
40  double prob;
41 };
42 
43 // Now the "real" class
44 
46 
47  public:
48  PndSdsStripCorrelator(int mode = 0, double cut = 0., double noise = 0., double threshold = 0.);
50 
51  void Reset();
52 
53  void Setup(int mode = 0, double cut = 0., double noise = 0., double threshold = 0.);
54 
55  void AddCluster(int moduleId, int side, int clusterIndex, double charge);
56 
57  vector<pair<int, int>> GetCorrelationList();
58 
59  vector<double> GetProbList();
60  vector<double> GetSecondProbList();
61  vector<int> GetMultProbList();
62 
63  private:
64  void CalcChargeDifferenceCut();
65  void CalcLikelihoodAlgo();
66  void CalcAll();
67  std::vector<PndSdsStripCorrelatorCombi> getCombinations(std::map<int, std::map<int, PndSdsStripCorrelatorCand>> matrix, int cols, int rows);
68  std::map<int, std::map<int, PndSdsStripCorrelatorCand>>
69  getSubMatrix(std::map<int, std::map<int, PndSdsStripCorrelatorCand>> matrix, int cols, int rows, int pivotCol, int pivotRow);
70 
71  // Module Side clusterindex charge
72  map<int, map<int, vector<pair<int, double>>>> fClusterList; // List of the cluster indices and their charges
73  vector<pair<int, int>> fCorrelationList; // List of matching top/bottom clusters
74  vector<double> fCorrelationProbList; // List of associated prob values for each module
75  vector<double> fSecondProbList; // List of the second prob values for each module
76  vector<int> fMultProbList; // List of number of correlations
77 
78  double fCut; // Cut parameter: ChargeDifference or minimum Likelihood
79  double fNoise; // Noise sigma[e-]
80  double fThreshold; // Discrimination threshold [e-]
81  int fMode; // which mode to use 0:ChargeDifferenceCut 1:Liklelihood
82  bool fCalculated; // flag for automatic calculation calls
83 };
84 
85 #endif
PndSdsStripCorrelatorCombi(const std::vector< PndSdsStripCorrelatorCand > &list, double p)
STL namespace.
PndSdsStripCorrelatorCombi(const PndSdsStripCorrelatorCombi &a_combi)
std::vector< PndSdsStripCorrelatorCand > pairlist
PndSdsStripCorrelatorCand(int t, int b, double qt, double qb, double p)