All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackContainmentAnalyzer_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: TrackContainmentAnalyzer
3 // Module Type: analyzer
4 // File: TrackContainmentAnalyzer_module.cc
5 //
6 // Generated at Tue Nov 10 13:06:09 2015 by Wesley Ketchum using artmod
7 // from cetpkgsupport v1_08_07.
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 "TTree.h"
19 
22 
23 namespace trk {
24  class TrackContainmentAnalyzer;
25 }
26 
27 class trk::TrackContainmentAnalyzer : public art::EDAnalyzer {
28 public:
29  explicit TrackContainmentAnalyzer(fhicl::ParameterSet const & p);
30  // The destructor generated by the compiler is fine for classes
31  // without bare pointers or other resource use.
32 
33  // Plugins should not be copied or assigned.
38 
39  // Required functions.
40  void analyze(art::Event const & e) override;
41 
42 private:
43 
44  // Declare member data here.
46 
47  std::vector<std::string> fTrackModuleLabels;
48 
49 };
50 
51 
53  :
54  EDAnalyzer(p) // ,
55  // More initializers here.
56 {
57  fAlg.Configure(p.get<fhicl::ParameterSet>("TrackContainmentAlg"));
58  fTrackModuleLabels = p.get< std::vector<std::string> >("TrackModuleLabels");
60  art::ServiceHandle<art::TFileService const> tfs;
61  fAlg.SetupOutputTree(tfs->make<TTree>("myanatree","MyAnalysis Tree"));
62 }
63 
64 void trk::TrackContainmentAnalyzer::analyze(art::Event const & e)
65 {
66 
67  fAlg.SetRunEvent(e.run(),e.event());
68 
69  std::vector< std::vector<recob::Track> > trackVectors;
70  for(size_t i_l=0; i_l<fTrackModuleLabels.size(); ++i_l){
71  art::Handle< std::vector<recob::Track> > trackHandle;
72  e.getByLabel(fTrackModuleLabels[i_l],trackHandle);
73  trackVectors.push_back(*trackHandle);
74  }
75 
76  art::ServiceHandle<geo::Geometry const> geoHandle;
77 
78  fAlg.ProcessTracks(trackVectors,*geoHandle);
79 
80 }
81 
82 DEFINE_ART_MODULE(trk::TrackContainmentAnalyzer)
void setFillOutputTree(bool flag=true)
pdgs p
Definition: selectors.fcl:22
TrackContainmentAnalyzer & operator=(TrackContainmentAnalyzer const &)=delete
void Configure(fhicl::ParameterSet const &)
void analyze(art::Event const &e) override
TrackContainmentAnalyzer(fhicl::ParameterSet const &p)
do i e
art::ServiceHandle< art::TFileService > tfs
art framework interface to geometry description