Public Member Functions | Protected Attributes | List of all members
cmtool::CFAlgoQRatio Class Reference

#include <CFAlgoQRatio.h>

Inheritance diagram for cmtool::CFAlgoQRatio:
cmtool::CFloatAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CFAlgoQRatio ()
 Default constructor. More...
 
float Float (util::GeometryUtilities const &, const std::vector< const cluster::ClusterParamsAlg * > &clusters) override
 
void Report () override
 
void Reset () override
 Function to reset the algorithm instance, called together with manager's Reset() More...
 
void SetQRatioCut (float cut)
 Setter for the minimum value for charge ratio (below this value Float() returns -1) More...
 
- Public Member Functions inherited from cmtool::CMAlgoBase
 CMAlgoBase ()
 
virtual ~CMAlgoBase ()=default
 
virtual void EventBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void EventEnd ()
 
virtual void IterationBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void IterationEnd ()
 
void SetAnaFile (TFile *fout)
 Setter function for an output plot TFile pointer. More...
 
virtual void SetVerbose (bool doit=true)
 Setter function for verbosity. More...
 

Protected Attributes

float _qratio_cut
 
- Protected Attributes inherited from cmtool::CMAlgoBase
TFile * _fout
 TFile pointer to an output file. More...
 
bool _verbose
 Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager's verbosity level is >= kPerMerging. More...
 

Detailed Description

User implementation for CFloatAlgoBase class This algorithm compares charge ratio of clusters to find a match

Definition at line 25 of file CFAlgoQRatio.h.

Constructor & Destructor Documentation

cmtool::CFAlgoQRatio::CFAlgoQRatio ( )

Default constructor.

Definition at line 6 of file CFAlgoQRatio.cxx.

6  : CFloatAlgoBase()
7  //-------------------------------------------------------
8  {
9  _qratio_cut = 0.1; // Preliminary cuts
10  }

Member Function Documentation

float cmtool::CFAlgoQRatio::Float ( util::GeometryUtilities const &  ,
const std::vector< const cluster::ClusterParamsAlg * > &  clusters 
)
overridevirtual

Core function: given a set of CPANs, return a float which indicates the compatibility the cluster combination.

Reimplemented from cmtool::CFloatAlgoBase.

Definition at line 20 of file CFAlgoQRatio.cxx.

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  }
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:102
QTextStream & endl(QTextStream &s)
void cmtool::CFAlgoQRatio::Report ( )
overridevirtual

Optional function: called after each iterative approach if a manager class is run with verbosity level <= kPerIteration. Maybe useful for debugging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 72 of file CFAlgoQRatio.cxx.

74  {}
void cmtool::CFAlgoQRatio::Reset ( void  )
overridevirtual

Function to reset the algorithm instance, called together with manager's Reset()

Reimplemented from cmtool::CMAlgoBase.

Definition at line 14 of file CFAlgoQRatio.cxx.

16  {}
void cmtool::CFAlgoQRatio::SetQRatioCut ( float  cut)
inline

Setter for the minimum value for charge ratio (below this value Float() returns -1)

Definition at line 55 of file CFAlgoQRatio.h.

56  {
57  _qratio_cut = cut;
58  }

Member Data Documentation

float cmtool::CFAlgoQRatio::_qratio_cut
protected

Definition at line 61 of file CFAlgoQRatio.h.


The documentation for this class was generated from the following files: