1
/* This file is part of MAUS: http:// micewww.pp.rl.ac.uk:8080/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http:// www.gnu.org/licenses/>.
19
#include "Recon/Global/PIDVarD.hh"
20
#include "Utils/Exception.hh"
26
const std::string PIDVarD::VARIABLE = "KLADCChargeProduct";
28
PIDVarD::PIDVarD(std::string hypothesis, std::string unique_identifier)
29
: PIDBase1D(VARIABLE, hypothesis, unique_identifier, minBinD, maxBinD,
31
_nonZeroHistEntries = true;
34
PIDVarD::PIDVarD(TFile* file, std::string hypothesis, int minD, int maxD)
35
: PIDBase1D(file, VARIABLE, hypothesis, minD, maxD, minBinD, maxBinD) {
38
PIDVarD::~PIDVarD() {}
40
std::pair<double, double> PIDVarD::Calc_Var(MAUS::DataStructure::Global::Track* track) {
41
int total_ADC_charge_product = 0;
42
MAUS::DataStructure::Global::DetectorPoint KL_DP =
43
MAUS::DataStructure::Global::kCalorimeter;
44
// Get trackpoint array from track
45
global_track_points = track->GetTrackPoints();
46
std::vector<const MAUS::DataStructure::Global::TrackPoint*>
48
for (eachTP = global_track_points.begin();
49
eachTP != global_track_points.end(); ++eachTP) {
50
if (!(*eachTP)) continue;
51
if ((*eachTP)->get_mapper_name() == "MapCppGlobalTrackMatching-Through") {
52
if ((*eachTP)->get_detector() == KL_DP) {
53
kl_track_points.push_back(*eachTP);
59
if (kl_track_points.size() < 1) {
60
Squeak::mout(Squeak::debug) << "Global track contained no KL" <<
61
" trackpoints, Recon::Global::PIDVarD::Calc_Var()" << std::endl;
62
kl_track_points.clear();
63
return std::make_pair(-1, 0);
65
for (size_t i = 0; i < kl_track_points.size(); i++) {
66
total_ADC_charge_product += kl_track_points[i]->get_ADC_charge_product();
68
kl_track_points.clear();
69
if ( minBinD > (total_ADC_charge_product) || (total_ADC_charge_product) > maxBinD ) {
70
Squeak::mout(Squeak::debug) << "KL ADC charge product " <<
71
"outside of PDF range, Recon::Global::PIDVarD::Calc_Var()" <<
73
return std::make_pair(total_ADC_charge_product, 0);
75
return std::make_pair(total_ADC_charge_product, 0);