LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
MVAPID_module.cc
Go to the documentation of this file.
1 //
3 // \file MVAPID_module.cc
4 //
5 // m.haigh@warwick.ac.uk
6 //
8 
9 #ifndef MVAPID_H
10 #define MVAPID_H
11 
12 // ### Generic C++ includes ###
13 #include <iostream>
14 
15 // ### Framework includes ###
19 #include "fhiclcpp/ParameterSet.h"
22 #include "TTree.h"
23 
24 #include "MVAAlg.h"
28 
29 namespace mvapid {
30 
31  class MVAPID : public art::EDProducer {
32 
33  public:
34 
35  explicit MVAPID(fhicl::ParameterSet const& pset);
36  virtual ~MVAPID();
37  void beginJob();
38  void beginRun(art::Run& run);
39  void reconfigure(fhicl::ParameterSet const& pset);
40  void produce(art::Event& evt);
41 
42 
43  private:
44 
46  std::vector<anab::MVAPIDResult>* fResult;
47  unsigned int fRun,fSubrun,fEvent;
48  TTree* fTree;
49 
50  }; // class MVAPID
51 
52 
53 
54 //------------------------------------------------------------------------------
55  MVAPID::MVAPID(fhicl::ParameterSet const& pset): fAlg(pset,this)
56 {
57  this->reconfigure(pset);
58  produces< std::vector<anab::MVAPIDResult> >();
59  produces< art::Assns<recob::Track, anab::MVAPIDResult, void> >();
60  produces< art::Assns<recob::Shower, anab::MVAPIDResult, void> >();
61  fResult=new std::vector<anab::MVAPIDResult>;
62 }
63 
64 //------------------------------------------------------------------------------
66 {
67  return;
68 }
69 
70 //------------------------------------------------------------------------------
72 {
73 }
74 
75 // ***************** //
77 {
79  fTree =tfs->make<TTree>("MVAPID","Results");
80  fTree->Branch("run",&fRun,"run/I");
81  fTree->Branch("subrun",&fSubrun,"subrun/I");
82  fTree->Branch("event",&fEvent,"event/I");
83  fTree->Branch("MVAResult",&fResult);
86 }
87 
88 
90 {
91 
92 }
93 
94 // ***************** //
96 {
97  std::unique_ptr<std::vector<anab::MVAPIDResult> > result(new std::vector<anab::MVAPIDResult>);
98  std::unique_ptr< art::Assns<recob::Track, anab::MVAPIDResult> > trackAssns(new art::Assns<recob::Track, anab::MVAPIDResult>);
99  std::unique_ptr< art::Assns<recob::Shower, anab::MVAPIDResult> > showerAssns(new art::Assns<recob::Shower, anab::MVAPIDResult>);
100  fRun = evt.id().run();
101  fSubrun = evt.id().subRun();
102  fEvent = evt.id().event();
103  fAlg.RunPID(evt,*result,*trackAssns,*showerAssns);
104  *fResult=*result;
105  fTree->Fill();
106  evt.put(std::move(result));
107  evt.put(std::move(trackAssns));
108  evt.put(std::move(showerAssns));
109 }
110 
112 
113 
114 } //namespace mvapid
115 
116 #endif // MVAPID_H
MVAPID(fhicl::ParameterSet const &pset)
unsigned int fSubrun
void reconfigure(fhicl::ParameterSet const &pset)
void RunPID(art::Event &evt, std::vector< anab::MVAPIDResult > &result, art::Assns< recob::Track, anab::MVAPIDResult, void > &trackAssns, art::Assns< recob::Shower, anab::MVAPIDResult, void > &showerAssns)
Definition: MVAAlg.cxx:148
RunNumber_t run() const
Definition: EventID.h:99
Definition: Run.h:30
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
Definition: MVAAlg.h:42
unsigned int fRun
void GetDetectorEdges()
Definition: MVAAlg.cxx:89
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
void GetWireNormals()
Definition: MVAAlg.cxx:118
Provides recob::Track data product.
unsigned int fEvent
T * make(ARGS...args) const
Utility object to perform functions of association.
virtual ~MVAPID()
EventNumber_t event() const
Definition: EventID.h:117
void produce(art::Event &evt)
std::vector< anab::MVAPIDResult > * fResult
SubRunNumber_t subRun() const
Definition: EventID.h:111
EventID id() const
Definition: Event.h:56
void beginRun(art::Run &run)