All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CFAlgoQRatio.cxx
Go to the documentation of this file.
2 
3 namespace cmtool {
4 
5  //-------------------------------------------------------
7  //-------------------------------------------------------
8  {
9  _qratio_cut = 0.1; // Preliminary cuts
10  }
11 
12  //-----------------------------
13  void
15  //-----------------------------
16  {}
17 
18  //-----------------------------------------------------------------------------------------
19  float
21  const std::vector<const cluster::ClusterParamsAlg*>& clusters)
22  //-----------------------------------------------------------------------------------------
23  {
24 
25  // Code-block by Kazu starts
26  // This ensures the algorithm works only if # clusters is > 2 (and not =2)
27  // You may take out this block if you want to allow matching using clusters from only 2 planes.
28  if (clusters.size() == 2) return -1;
29  // Code-block by Kazu ends
30 
31  double q_max = -1;
32  float ratio = 1;
33 
34  // Search for max charge & return if any cluster has negative charge
35  for (auto const& c : clusters) {
36 
37  //Ignore all clusters with less than 40 hits
38 
39  if (c->GetParams().sum_charge < 0) {
40  if (_verbose)
41  std::cout << "\033[00m Found a cluster with negative charge!\033[00m ... aborting "
42  << __FUNCTION__ << std::endl;
43  return -1;
44  }
45 
46  if (q_max < c->GetParams().sum_charge) q_max = c->GetParams().sum_charge;
47  }
48 
49  // Compute ratio
50  for (auto const& c : clusters) {
51  ratio *= c->GetParams().sum_charge / q_max;
52 
53  if (_verbose) {
54  std::cout << "Sum Charge: " << c->GetParams().sum_charge;
55  std::cout << "Q max : " << q_max << std::endl;
56  std::cout << "Ratio is: " << ratio << std::endl;
57  }
58  }
59 
60  if (_verbose) {
61  if (ratio > _qratio_cut)
62  std::cout << " ... pass!" << std::endl;
63  else
64  std::cout << " ... below cut value: " << _qratio_cut << std::endl;
65  }
66 
67  return (ratio > _qratio_cut ? ratio : -1);
68  }
69 
70  //------------------------------
71  void
73  //------------------------------
74  {}
75 
76 }
void Report() override
CFAlgoQRatio()
Default constructor.
Definition: CFAlgoQRatio.cxx:6
Class def header for a class CFAlgoQRatio.
float Float(util::GeometryUtilities const &, const std::vector< const cluster::ClusterParamsAlg * > &clusters) override
void Reset() override
Function to reset the algorithm instance, called together with manager&#39;s Reset()
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is &gt;= kPer...
Definition: CMAlgoBase.h:102
BEGIN_PROLOG could also be cout