LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
TrackContainmentAnalyzer_module.cc
Go to the documentation of this file.
1 // 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.
9 
13 
18 #include "art_root_io/TFileService.h"
19 #include "fhiclcpp/ParameterSet.h"
20 
21 #include "TTree.h"
22 
23 namespace trk {
24  class TrackContainmentAnalyzer;
25 }
26 
28 public:
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  // Declare member data here.
45 
46  std::vector<std::string> fTrackModuleLabels;
47 };
48 
50  : EDAnalyzer(p)
51 {
52  fAlg.Configure(p.get<fhicl::ParameterSet>("TrackContainmentAlg"));
53  fTrackModuleLabels = p.get<std::vector<std::string>>("TrackModuleLabels");
56  fAlg.SetupOutputTree(tfs->make<TTree>("myanatree", "MyAnalysis Tree"));
57 }
58 
60 {
61 
62  fAlg.SetRunEvent(e.run(), e.event());
63 
64  std::vector<std::vector<recob::Track>> trackVectors;
65  for (size_t i_l = 0; i_l < fTrackModuleLabels.size(); ++i_l) {
67  e.getByLabel(fTrackModuleLabels[i_l], trackHandle);
68  trackVectors.push_back(*trackHandle);
69  }
70 
72 
73  fAlg.ProcessTracks(trackVectors, *geoHandle, art::ServiceHandle<geo::WireReadout>()->Get());
74 }
75 
void setFillOutputTree(bool flag=true)
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
TrackContainmentAnalyzer & operator=(TrackContainmentAnalyzer const &)=delete
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
T get(std::string const &key) const
Definition: ParameterSet.h:314
EventNumber_t event() const
Definition: Event.cc:41
void Configure(fhicl::ParameterSet const &)
void SetRunEvent(unsigned int const &, unsigned int const &)
void analyze(art::Event const &e) override
TrackContainmentAnalyzer(fhicl::ParameterSet const &p)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void ProcessTracks(std::vector< std::vector< recob::Track >> const &, geo::GeometryCore const &, geo::WireReadoutGeom const &)
Float_t e
Definition: plot.C:35
RunNumber_t run() const
Definition: Event.cc:29
art framework interface to geometry description