~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

Viewing changes to src/map/MapCppGlobalPID/MapCppGlobalPID.hh

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

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
 
 
18
/** @class MapCppGlobalPID
 
19
 *  Perform PID on incoming global tracks.
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef _SRC_MAP_MAPCPPGLOBALPID_H_
 
24
#define _SRC_MAP_MAPCPPGLOBALPID_H_
 
25
// Python / C API
 
26
#include <Python.h>
 
27
 
 
28
// C headers
 
29
#include <assert.h>
 
30
#include <json/json.h>
 
31
 
 
32
// C++ headers
 
33
#include <cmath>
 
34
#include <iostream>
 
35
#include <string>
 
36
#include <sstream>
 
37
#include <vector>
 
38
 
 
39
// Other headers
 
40
#include "Interface/Squeak.hh"
 
41
#include "Config/MiceModule.hh"
 
42
#include "src/common_cpp/Utils/CppErrorHandler.hh"
 
43
#include "src/common_cpp/Utils/JsonWrapper.hh"
 
44
 
 
45
#include "src/common_cpp/DataStructure/Spill.hh"
 
46
#include "src/common_cpp/JsonCppProcessors/SpillProcessor.hh"
 
47
 
 
48
#include "DataStructure/Global/Track.hh"
 
49
 
 
50
#include "src/common_cpp/Recon/Global/PIDBase.hh"
 
51
#include "src/common_cpp/Recon/Global/PIDVarA.hh"
 
52
 
 
53
 
 
54
namespace MAUS {
 
55
 
 
56
  class MapCppGlobalPID {
 
57
  public:
 
58
    /** Constructor, setting the internal variable #_classname */
 
59
    MapCppGlobalPID();
 
60
 
 
61
    /** @brief Sets up the worker
 
62
     *
 
63
     *  @param argJsonConfigDocument a JSON document with
 
64
     *         the configuration.
 
65
     */
 
66
    bool birth(std::string argJsonConfigDocument);
 
67
 
 
68
    /** @brief Shutdowns the worker
 
69
     *
 
70
     *  This takes no arguments and does nothing
 
71
     */
 
72
    bool death();
 
73
 
 
74
    /** @brief process JSON document
 
75
     *
 
76
     *  Receive a document with global tracks, perform PID functons
 
77
     *  and return tracks with PID set
 
78
     * @param document a line/spill from the JSON input
 
79
     */
 
80
    std::string process(std::string) const;
 
81
 
 
82
 
 
83
  private:
 
84
    bool _configCheck;
 
85
    /// This will contain the configuration
 
86
    Json::Value _configJSON;
 
87
 
 
88
    ///  JsonCpp setup
 
89
    Json::Reader _reader;
 
90
 
 
91
    /// Mapper name, useful for tracking results...
 
92
    std::string _classname;
 
93
 
 
94
    /// PIDs to perform
 
95
    std::vector<MAUS::recon::global::PIDBase*> _pid_vars;
 
96
 
 
97
    /// Hypotheses to test PID variables against
 
98
    std::vector<std::string> _hypotheses;
 
99
 
 
100
    /// File that holds PDFs
 
101
    TFile* _histFile;
 
102
 
 
103
    /// The current spill
 
104
    Spill* _spill;
 
105
 
 
106
    /// File containing PDFs for use in PID
 
107
    std::string PDF_file;
 
108
  }; // Don't forget this trailing colon!!!!
 
109
} // ~MAUS
 
110
 
 
111
#endif