LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PrintCalorimetry_module.cc
Go to the documentation of this file.
1 // Class: PrintCalorimetry
3 // Module Type: analyzer
4 // File: PrintCalorimetry_module.cc
5 //
6 // Generated at Wed Oct 29 10:26:38 2014 by Wesley Ketchum using artmod
7 // from cetpkgsupport v1_07_01.
9 
18 #include "fhiclcpp/ParameterSet.h"
20 
23 
24 namespace calo{
25  class PrintCalorimetry;
26 }
27 
29 public:
30  explicit PrintCalorimetry(fhicl::ParameterSet const & p);
31  // The destructor generated by the compiler is fine for classes
32  // without bare pointers or other resource use.
33 
34  // Plugins should not be copied or assigned.
35  PrintCalorimetry(PrintCalorimetry const &) = delete;
37  PrintCalorimetry & operator = (PrintCalorimetry const &) = delete;
39 
40  // Required functions.
41  void analyze(art::Event const & e) override;
42 
43  // Selected optional functions.
44  void reconfigure(fhicl::ParameterSet const & p) ;
45 
46 private:
47 
48  std::string fTrackModuleLabel;
49  std::vector<std::string> fCaloModuleLabels;
50 
51 };
52 
53 
55  :
56  EDAnalyzer(p),
57  fTrackModuleLabel(p.get<std::string>("TrackModuleLabel")),
58  fCaloModuleLabels(p.get< std::vector<std::string> >("CaloModuleLabels"))
59 {}
60 
62 {
64  e.getByLabel(fTrackModuleLabel,trackHandle);
65 
66  std::vector< art::FindManyP<anab::Calorimetry> > caloAssnVector;//(fCaloModuleLabels.size());
67 
68  for(size_t i_cm=0; i_cm<fCaloModuleLabels.size(); i_cm++)
69  caloAssnVector.emplace_back(trackHandle,e,fCaloModuleLabels[i_cm]);
70 
71  for(size_t i_trk=0; i_trk<trackHandle->size(); i_trk++){
72  std::cout << "(Run,Event,Track) = (" << e.run() << "," << e.event() << "," << i_trk << ")" << std::endl;
73  std::cout << "-------------------" << std::endl;
74 
75  for(size_t i_cm=0; i_cm<caloAssnVector.size(); i_cm++){
76  std::cout << "Calorimetry module " << i_cm << std::endl;
77  for(auto const& caloptr : caloAssnVector[i_cm].at(i_trk))
78  std::cout << *caloptr << std::endl;
79  }
80 
81  }
82 
83 }
84 
86 {
87  fTrackModuleLabel = p.get<std::string>("TrackModuleLabel");
88  fCaloModuleLabels = p.get< std::vector<std::string> >("CaloModuleLabels");
89 }
90 
STL namespace.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
Provides recob::Track data product.
T get(std::string const &key) const
Definition: ParameterSet.h:231
EventNumber_t event() const
Definition: Event.h:67
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
void analyze(art::Event const &e) override
void reconfigure(fhicl::ParameterSet const &p)
PrintCalorimetry(fhicl::ParameterSet const &p)
std::vector< std::string > fCaloModuleLabels
PrintCalorimetry & operator=(PrintCalorimetry const &)=delete
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Float_t e
Definition: plot.C:34
RunNumber_t run() const
Definition: Event.h:77
calorimetry