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