LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 
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;
35 
36 private:
37  // Required functions.
38  void analyze(art::Event const& e) override;
39 
40  std::string fTrackModuleLabel;
41  std::vector<std::string> fCaloModuleLabels;
42 };
43 
45  : EDAnalyzer(p)
46  , fTrackModuleLabel(p.get<std::string>("TrackModuleLabel"))
47  , fCaloModuleLabels(p.get<std::vector<std::string>>("CaloModuleLabels"))
48 {}
49 
51 {
53  e.getByLabel(fTrackModuleLabel, trackHandle);
54 
55  std::vector<art::FindManyP<anab::Calorimetry>> caloAssnVector; //(fCaloModuleLabels.size());
56 
57  for (size_t i_cm = 0; i_cm < fCaloModuleLabels.size(); i_cm++)
58  caloAssnVector.emplace_back(trackHandle, e, fCaloModuleLabels[i_cm]);
59 
60  for (size_t i_trk = 0; i_trk < trackHandle->size(); i_trk++) {
61  std::cout << "(Run,Event,Track) = (" << e.run() << "," << e.event() << "," << i_trk << ")"
62  << std::endl;
63  std::cout << "-------------------" << std::endl;
64 
65  for (size_t i_cm = 0; i_cm < caloAssnVector.size(); i_cm++) {
66  std::cout << "Calorimetry module " << i_cm << std::endl;
67  for (auto const& caloptr : caloAssnVector[i_cm].at(i_trk))
68  std::cout << *caloptr << std::endl;
69  }
70  }
71 }
72 
STL namespace.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
Provides recob::Track data product.
EventNumber_t event() const
Definition: Event.cc:41
void analyze(art::Event const &e) override
PrintCalorimetry(fhicl::ParameterSet const &p)
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:120
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::vector< std::string > fCaloModuleLabels
PrintCalorimetry & operator=(PrintCalorimetry const &)=delete
Float_t e
Definition: plot.C:35
RunNumber_t run() const
Definition: Event.cc:29
calorimetry