~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/common_cpp/Recon/Global/ComPIDVarF.cc

merging in changes in merge branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of MAUS: http://  micewww.pp.rl.ac.uk:8080/projects/maus
 
2
 * 
 
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.
 
7
 * 
 
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.
 
12
 * 
 
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/>.
 
15
 */
 
16
 
 
17
#include <string>
 
18
#include <vector>
 
19
#include "Recon/Global/ComPIDVarF.hh"
 
20
#include "Utils/Exception.hh"
 
21
 
 
22
namespace MAUS {
 
23
namespace recon {
 
24
namespace global {
 
25
 
 
26
  const std::string ComPIDVarF::VARIABLE = "CommissioningEMRPlaneDensity";
 
27
 
 
28
  ComPIDVarF::ComPIDVarF(std::string hypothesis, std::string unique_identifier)
 
29
    : PIDBase1D(VARIABLE, hypothesis, unique_identifier, minBinComF, maxBinComF,
 
30
                numBins) {
 
31
    _nonZeroHistEntries = true;
 
32
  }
 
33
 
 
34
  ComPIDVarF::ComPIDVarF(TFile* file, std::string hypothesis, int minComF,
 
35
                         int maxComF)
 
36
    : PIDBase1D(file, VARIABLE, hypothesis, minComF, maxComF, minBinComF,
 
37
                maxBinComF) {
 
38
  }
 
39
 
 
40
  ComPIDVarF::~ComPIDVarF() {}
 
41
 
 
42
  std::pair<double, double> ComPIDVarF::Calc_Var(MAUS::DataStructure::Global::Track* track) {
 
43
    EMR_density = track->get_emr_plane_density();
 
44
    if (EMR_density == -1) {
 
45
      Squeak::mout(Squeak::debug) << "Global track was passed an EMR event " <<
 
46
        " with plane density -1,Recon::Global::ComPIDVarF::Calc_Var()" << std::endl;
 
47
      return std::make_pair(-1, 0);
 
48
    } else if ( minBinComF > EMR_density || EMR_density > maxBinComF ) {
 
49
      Squeak::mout(Squeak::debug) << "Plane density in EMR " <<
 
50
        "outside of PDF range, Recon::Global::ComPIDVarF::Calc_Var()" <<
 
51
        std::endl;
 
52
      return std::make_pair(-1, 0);
 
53
    } else {
 
54
      return std::make_pair(EMR_density, 0);
 
55
    }
 
56
  }
 
57
}
 
58
}
 
59
}
 
60
 
 
61