All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
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 "canvas/Persistency/Common/FindManyP.h"
15 #include "fhiclcpp/ParameterSet.h"
16 
19 
20 namespace calo{
21  class PrintCalorimetry;
22 }
23 
24 class calo::PrintCalorimetry : public art::EDAnalyzer {
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 
41  std::string fTrackModuleLabel;
42  std::vector<std::string> fCaloModuleLabels;
43 
44 };
45 
46 
47 calo::PrintCalorimetry::PrintCalorimetry(fhicl::ParameterSet const & p)
48  :
49  EDAnalyzer(p),
50  fTrackModuleLabel(p.get<std::string>("TrackModuleLabel")),
51  fCaloModuleLabels(p.get< std::vector<std::string> >("CaloModuleLabels"))
52 {}
53 
54 void calo::PrintCalorimetry::analyze(art::Event const & e)
55 {
56  art::Handle< std::vector<recob::Track> > trackHandle;
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 
78 DEFINE_ART_MODULE(calo::PrintCalorimetry)
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
pdgs p
Definition: selectors.fcl:22
process_name can override from command line with o or output calo
Definition: pid.fcl:40
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Provides recob::Track data product.
void analyze(art::Event const &e) override
PrintCalorimetry(fhicl::ParameterSet const &p)
std::vector< std::string > fCaloModuleLabels
PrintCalorimetry & operator=(PrintCalorimetry const &)=delete
do i e
BEGIN_PROLOG could also be cout