Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larreco
larreco
RecoAlg
CMTool
CMTAlgMatch
CFAlgoQRatio.cxx
Go to the documentation of this file.
1
#include "
CFAlgoQRatio.h
"
2
3
namespace
cmtool
{
4
5
//-------------------------------------------------------
6
CFAlgoQRatio::CFAlgoQRatio
() :
CFloatAlgoBase
()
7
//-------------------------------------------------------
8
{
9
_qratio_cut
= 0.1;
// Preliminary cuts
10
}
11
12
//-----------------------------
13
void
14
CFAlgoQRatio::Reset
()
15
//-----------------------------
16
{}
17
18
//-----------------------------------------------------------------------------------------
19
float
20
CFAlgoQRatio::Float
(
util::GeometryUtilities
const
&,
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
72
CFAlgoQRatio::Report
()
73
//------------------------------
74
{}
75
76
}
util::GeometryUtilities
Definition:
GeometryUtilities.h:35
cmtool::CFAlgoQRatio::Report
void Report() override
Definition:
CFAlgoQRatio.cxx:72
cmtool::CFAlgoQRatio::CFAlgoQRatio
CFAlgoQRatio()
Default constructor.
Definition:
CFAlgoQRatio.cxx:6
CFAlgoQRatio.h
Class def header for a class CFAlgoQRatio.
cmtool::CFAlgoQRatio::_qratio_cut
float _qratio_cut
Definition:
CFAlgoQRatio.h:61
ValidateOpDetReco.ratio
ratio
Definition:
ValidateOpDetReco.py:614
ValidateOpDetSimulation.c
dictionary c
Definition:
ValidateOpDetSimulation.py:57
cmtool::CFAlgoQRatio::Float
float Float(util::GeometryUtilities const &, const std::vector< const cluster::ClusterParamsAlg * > &clusters) override
Definition:
CFAlgoQRatio.cxx:20
cmtool::CFloatAlgoBase
Definition:
CFloatAlgoBase.h:30
cmtool::CFAlgoQRatio::Reset
void Reset() override
Function to reset the algorithm instance, called together with manager's Reset()
Definition:
CFAlgoQRatio.cxx:14
cmtool
Definition:
CFAlgoQRatio.cxx:3
cmtool::CMAlgoBase::_verbose
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager's verbosity level is >= kPer...
Definition:
CMAlgoBase.h:102
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11