LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
BezierCalorimetry_module.cc
Go to the documentation of this file.
1 //
3 // BezierCalorimetry produces a calo object based on
4 // a bezier trajectory and associated hit information
5 //
6 // bjpjones@mit.edu, June 2013
8 extern "C" {
9 #include <sys/types.h>
10 #include <sys/stat.h>
11 }
12 #include <vector>
13 #include <string>
14 #include <algorithm>
15 
26 
27 // Framework includes
32 #include "fhiclcpp/ParameterSet.h"
40 
42 namespace calo {
43 
45 
46  public:
47 
48  explicit BezierCalorimetry(fhicl::ParameterSet const& pset);
49  virtual ~BezierCalorimetry();
50 
51  void reconfigure(fhicl::ParameterSet const& pset);
52  void produce(art::Event& evt);
53 
54  private:
55 
56  std::string fBTrackModuleLabel;
58 
60 
61 
62  }; // class BezierCalorimetry
63 
64 }
65 
66 //-------------------------------------------------
68  caloAlg(pset.get< fhicl::ParameterSet >("CaloAlg"))
69 {
70 
71  this->reconfigure(pset);
72 
73  produces< std::vector<anab::Calorimetry> >();
74  produces< art::Assns<recob::Track, anab::Calorimetry> >();
75 }
76 
77 //-------------------------------------------------
79 {
80 
81 }
82 
83 //------------------------------------------------------------------------------------//
85 {
86  fBTrackModuleLabel = pset.get< std::string >("BTrackModuleLabel");
87  return;
88 }
89 
90 //------------------------------------------------------------------------------------//
92 {
94  evt.getByLabel(fBTrackModuleLabel, "bezierformat", trackHandle);
95  std::vector< art::Ptr<recob::Track> > tracks;
96  art::fill_ptr_vector(tracks, trackHandle);
97 
98  //create anab::Calorimetry objects and make association with recob::Track
99  std::unique_ptr< std::vector<anab::Calorimetry> > calorimetrycol(new std::vector<anab::Calorimetry>);
100  std::unique_ptr< art::Assns<recob::Track, anab::Calorimetry> > assn(new art::Assns<recob::Track, anab::Calorimetry>);
101 
102  art::FindManyP<recob::Hit> fmht(trackHandle, evt, fBTrackModuleLabel);
103 
104 
105  // loop over the tracks
106  for(size_t t = 0; t < tracks.size(); ++t)
107  {
108 
109  std::vector<art::Ptr<recob::Hit> > hits = fmht.at(t);
110 
111  art::Ptr<recob::Track> trk = tracks.at(t);
112  trkf::BezierTrack BTrack(*trk);
113 
114  calorimetrycol->push_back(BTrack.GetCalorimetryObject(hits, geo::kCollection, caloAlg));
115  util::CreateAssn(*this, evt, *calorimetrycol, trk, *assn);
116  }
117 
118 
119  if (calorimetrycol->size()>0){
120  evt.put(std::move(calorimetrycol));
121  evt.put(std::move(assn));
122  }
123 
124  return;
125 }
126 
127 namespace calo{
128 
130 
131 } // end namespace
132 
void reconfigure(fhicl::ParameterSet const &pset)
Declaration of signal hit object.
std::string fBTrackModuleLabel
module creating the track objects and assns to hits
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
Provides recob::Track data product.
parameter set interface
T get(std::string const &key) const
Definition: ParameterSet.h:231
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
anab::Calorimetry GetCalorimetryObject(std::vector< art::Ptr< recob::Hit > > const &Hits, geo::SigType_t sigtype, calo::CalorimetryAlg const &)
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
TCEvent evt
Definition: DataStructs.cxx:5
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
BezierCalorimetry(fhicl::ParameterSet const &pset)
art framework interface to geometry description
calorimetry
Encapsulate the construction of a single detector plane.
Signal from collection planes.
Definition: geo_types.h:93
art::ServiceHandle< geo::Geometry > fGeo