All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlashHypothesisAna_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: FlashHypothesisAna
3 // Module Type: analyzer
4 // File: FlashHypothesisAna_module.cc
5 //
6 // Generated at Mon Jan 19 18:46:10 2015 by Wesley Ketchum using artmod
7 // from cetpkgsupport v1_08_02.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include "art/Framework/Core/EDAnalyzer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "fhiclcpp/ParameterSet.h"
15 
16 #include "art_root_io/TFileService.h"
17 
18 #include "FlashHypothesisAnaAlg.h"
19 
22 #include "lardata/DetectorInfoServices/ServicePack.h" // lar::extractProviders()
24 
25 #include "TH1F.h"
26 #include "TTree.h"
27 
28 namespace opdet{
29  class FlashHypothesisAna;
30 }
31 
32 namespace opdet{
33 
34  class FlashHypothesisAna : public art::EDAnalyzer {
35  public:
36  explicit FlashHypothesisAna(fhicl::ParameterSet const & p);
37  // The destructor generated by the compiler is fine for classes
38  // without bare pointers or other resource use.
39 
40  // Plugins should not be copied or assigned.
41  FlashHypothesisAna(FlashHypothesisAna const &) = delete;
45 
46  // Required functions.
47  void analyze(art::Event const & e) override;
48 
49  // Selected optional functions.
50  void beginJob() override;
51 
52  private:
53 
54  std::string fMCTrackLabel;
55  std::string fMCSimPhotonsLabel;
56 
58 
59  };
60 
61 
62  FlashHypothesisAna::FlashHypothesisAna(fhicl::ParameterSet const & p)
63  :
64  EDAnalyzer(p),
65  fMCTrackLabel(p.get<std::string>("MCTrackLabel")),
66  fMCSimPhotonsLabel(p.get<std::string>("MCSimPhotonsLabel")),
67  fAlg(p.get<fhicl::ParameterSet>("FlashHypothesisAnaAlgParams"))
68  {}
69 
70  void FlashHypothesisAna::analyze(art::Event const & e)
71  {
72 
73  art::Handle< std::vector<sim::MCTrack> > mctrackHandle;
74  e.getByLabel(fMCTrackLabel,mctrackHandle);
75  std::vector<sim::MCTrack> const& mctrackVec(*mctrackHandle);
76 
77  art::Handle< std::vector<sim::SimPhotons> > simPhotonsHandle;
78  e.getByLabel(fMCSimPhotonsLabel,simPhotonsHandle);
79  std::vector<sim::SimPhotons> const& simPhotonsVec(*simPhotonsHandle);
80 
81 
82  art::ServiceHandle<opdet::OpDigiProperties const> opdigiHandle;
83  art::ServiceHandle<phot::PhotonVisibilityService const> pvsHandle;
84 
85  opdet::OpDigiProperties const& opdigi(*opdigiHandle);
86  phot::PhotonVisibilityService const& pvs(*pvsHandle);
87 
88  fAlg.RunComparison((unsigned int)e.run(),(unsigned int)e.id().event(),
89  mctrackVec,simPhotonsVec,
90  lar::extractProviders<geo::Geometry, detinfo::LArPropertiesService>(),
91  opdigi,pvs);
92 
93  }
94 
96  {
97  art::ServiceHandle<geo::Geometry const> geoHandle;
98  geo::Geometry const& geo(*geoHandle);
99 
100  art::ServiceHandle<art::TFileService const> tfs;
101 
102  fAlg.SetOutputObjects(tfs->make<TTree>("ctree","FlashHypothesisAnaTree"),
103  tfs->make<TH1F>(), tfs->make<TH1F>(), tfs->make<TH1F>(),
104  tfs->make<TH1F>(), tfs->make<TH1F>(), tfs->make<TH1F>(),
105  tfs->make<TH1F>(), tfs->make<TH1F>(), tfs->make<TH1F>(),
106  geo);
108  }
109 
110 }
111 
112 DEFINE_ART_MODULE(opdet::FlashHypothesisAna)
Utilities to manage ProviderPack objects with art.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
void RunComparison(const unsigned int run, const unsigned int event, std::vector< sim::MCTrack > const &, std::vector< sim::SimPhotons > const &, Providers_t providers, opdet::OpDigiProperties const &opdigip, phot::PhotonVisibilityService const &pvs)
pdgs p
Definition: selectors.fcl:22
process_name opdigi
void SetOutputObjects(TTree *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, TH1F *, geo::Geometry const &)
FlashHypothesisAna & operator=(FlashHypothesisAna const &)=delete
The geometry of one entire detector, as served by art.
Definition: Geometry.h:181
do i e
FlashHypothesisAna(fhicl::ParameterSet const &p)
art::ServiceHandle< art::TFileService > tfs
void FillOpDetPositions(geo::Geometry const &)
void analyze(art::Event const &e) override