PrintCalorimetry_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // 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.
8 ////////////////////////////////////////////////////////////////////////
9 
14 #include "canvas/Persistency/Common/FindManyP.h"
15 #include "fhiclcpp/ParameterSet.h"
16 
19 
20 namespace calo{
21  class PrintCalorimetry;
22 }
23 
25 public:
26  explicit PrintCalorimetry(fhicl::ParameterSet const & p);
27  // The destructor generated by the compiler is fine for classes
28  // without bare pointers or other resource use.
29 
30  // Plugins should not be copied or assigned.
31  PrintCalorimetry(PrintCalorimetry const &) = delete;
33  PrintCalorimetry & operator = (PrintCalorimetry const &) = delete;
35 
36 private:
37 
38  // Required functions.
39  void analyze(art::Event const & e) override;
40 
42  std::vector<std::string> fCaloModuleLabels;
43 
44 };
45 
46 
48  :
49  EDAnalyzer(p),
50  fTrackModuleLabel(p.get<std::string>("TrackModuleLabel")),
51  fCaloModuleLabels(p.get< std::vector<std::string> >("CaloModuleLabels"))
52 {}
53 
55 {
57  e.getByLabel(fTrackModuleLabel,trackHandle);
58 
59  std::vector< art::FindManyP<anab::Calorimetry> > caloAssnVector;//(fCaloModuleLabels.size());
60 
61  for(size_t i_cm=0; i_cm<fCaloModuleLabels.size(); i_cm++)
62  caloAssnVector.emplace_back(trackHandle,e,fCaloModuleLabels[i_cm]);
63 
64  for(size_t i_trk=0; i_trk<trackHandle->size(); i_trk++){
65  std::cout << "(Run,Event,Track) = (" << e.run() << "," << e.event() << "," << i_trk << ")" << std::endl;
66  std::cout << "-------------------" << std::endl;
67 
68  for(size_t i_cm=0; i_cm<caloAssnVector.size(); i_cm++){
69  std::cout << "Calorimetry module " << i_cm << std::endl;
70  for(auto const& caloptr : caloAssnVector[i_cm].at(i_trk))
71  std::cout << *caloptr << std::endl;
72  }
73 
74  }
75 
76 }
77 
EventNumber_t event() const
Definition: DataViewImpl.cc:85
std::string string
Definition: nybbler.cc:12
STL namespace.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
p
Definition: test.py:223
RunNumber_t run() const
Definition: DataViewImpl.cc:71
void analyze(art::Event const &e) override
PrintCalorimetry(fhicl::ParameterSet const &p)
std::vector< std::string > fCaloModuleLabels
PrintCalorimetry & operator=(PrintCalorimetry const &)=delete
Provides recob::Track data product.
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
calorimetry
QTextStream & endl(QTextStream &s)