All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sppt::TTSpacePointFinder Class Reference
Inheritance diagram for sppt::TTSpacePointFinder:

Public Member Functions

 TTSpacePointFinder (fhicl::ParameterSet const &pset)
 

Private Member Functions

void produce (art::Event &evt)
 
void beginRun (art::Run &run)
 

Private Attributes

std::string fHitModuleLabel
 
std::string fUHitsInstanceLabel
 Input hit module name. More...
 
std::string fVHitsInstanceLabel
 Input U hits instance name. More...
 
std::string fYHitsInstanceLabel
 Input V hits instance name. More...
 
SpacePointAlg_TimeSort fSpptAlg
 Input Y hits instance name. More...
 

Detailed Description

Definition at line 38 of file TTSpacePointFinder_module.cc.

Constructor & Destructor Documentation

sppt::TTSpacePointFinder::TTSpacePointFinder ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 55 of file TTSpacePointFinder_module.cc.

56  : EDProducer{pset}, fSpptAlg(pset.get<fhicl::ParameterSet>("SpacePointAlgParams"))
57  {
58  fHitModuleLabel = pset.get<std::string>("HitModuleLabel", "tthit");
59  fUHitsInstanceLabel = pset.get<std::string>("UHitsInstaceLabel", "uhits");
60  fVHitsInstanceLabel = pset.get<std::string>("VHitsInstaceLabel", "vhits");
61  fYHitsInstanceLabel = pset.get<std::string>("YHitsInstaceLabel", "yhits");
62 
63  produces<std::vector<recob::SpacePoint>>();
64  produces<art::Assns<recob::SpacePoint, recob::Hit>>();
65  }
std::string fYHitsInstanceLabel
Input V hits instance name.
std::string fVHitsInstanceLabel
Input U hits instance name.
std::string fUHitsInstanceLabel
Input hit module name.
SpacePointAlg_TimeSort fSpptAlg
Input Y hits instance name.

Member Function Documentation

void sppt::TTSpacePointFinder::beginRun ( art::Run &  run)
private

Definition at line 69 of file TTSpacePointFinder_module.cc.

70  {
71  auto const detProp =
72  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob();
75  }
void setTimeOffsets(detinfo::DetectorPropertiesData const &detProp)
SpacePointAlg_TimeSort fSpptAlg
Input Y hits instance name.
auto const detProp
void sppt::TTSpacePointFinder::produce ( art::Event &  evt)
private

Definition at line 79 of file TTSpacePointFinder_module.cc.

80  {
81  //initialize our spacepoint collection
82  auto spptCollection = std::make_unique<std::vector<recob::SpacePoint>>();
83  auto spptAssociatedHits = std::make_unique<std::vector<std::vector<art::Ptr<recob::Hit>>>>();
84 
85  // Read in the hits. Note, we will reorder hit vector, so we do in fact need a copy.
86  art::Handle<std::vector<recob::Hit>> hitHandle_U;
87  evt.getByLabel(fHitModuleLabel, fUHitsInstanceLabel, hitHandle_U);
88  std::vector<art::Ptr<recob::Hit>> hitVec_U;
89  art::fill_ptr_vector(hitVec_U, hitHandle_U);
90 
91  art::Handle<std::vector<recob::Hit>> hitHandle_V;
92  evt.getByLabel(fHitModuleLabel, fVHitsInstanceLabel, hitHandle_V);
93  std::vector<art::Ptr<recob::Hit>> hitVec_V;
94  art::fill_ptr_vector(hitVec_V, hitHandle_V);
95 
96  art::Handle<std::vector<recob::Hit>> hitHandle_Y;
97  evt.getByLabel(fHitModuleLabel, fYHitsInstanceLabel, hitHandle_Y);
98  std::vector<art::Ptr<recob::Hit>> hitVec_Y;
99  art::fill_ptr_vector(hitVec_Y, hitHandle_Y);
100 
101  MF_LOG_DEBUG("TTSpacePointFinder") << "Got handles to hits:\n"
102  << hitVec_U.size() << " u hits, " << hitVec_V.size()
103  << " v hits, " << hitVec_Y.size() << " y hits.";
104 
105  auto const detProp =
106  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt);
108  detProp, hitVec_U, hitVec_V, hitVec_Y, spptCollection, spptAssociatedHits);
109 
110  mf::LogInfo("TTSpacePointFinder")
111  << "Finished spacepoint alg. Created " << spptCollection->size() << " spacepoints.";
112 
113  //check that spptCollection and spptAssociatedHits have same size
114  if (spptCollection->size() != spptAssociatedHits->size()) {
115  mf::LogError("TTSpacePointFinder")
116  << "ERROR in space point alg.\n"
117  << "Spacepoint and associated hit collections have different sizes!\n"
118  << spptCollection->size() << " != " << spptAssociatedHits->size()
119  << "\nWill return with no space points put on event.";
120  return;
121  }
122 
123  //Now, need to fill in the sppt<-->hit associations
124  std::unique_ptr<art::Assns<recob::SpacePoint, recob::Hit>> spptAssns(
125  new art::Assns<recob::SpacePoint, recob::Hit>);
126  for (unsigned int isppt = 0; isppt < spptCollection->size(); isppt++) {
127  util::CreateAssn(evt, *spptCollection, spptAssociatedHits->at(isppt), *spptAssns, isppt);
128  }
129 
130  //finally, put things on the event
131  evt.put(std::move(spptCollection));
132  evt.put(std::move(spptAssns));
133 
134  } // End of produce()
std::string fYHitsInstanceLabel
Input V hits instance name.
std::string fVHitsInstanceLabel
Input U hits instance name.
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
std::string fUHitsInstanceLabel
Input hit module name.
void createSpacePoints(detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> &hitVec_U, std::vector< art::Ptr< recob::Hit >> &hitVec_V, std::vector< art::Ptr< recob::Hit >> &hitVec_Y, std::unique_ptr< std::vector< recob::SpacePoint >> &spptCollection, std::unique_ptr< std::vector< std::vector< art::Ptr< recob::Hit >>>> &spptAssociatedHits)
SpacePointAlg_TimeSort fSpptAlg
Input Y hits instance name.
TCEvent evt
Definition: DataStructs.cxx:8
auto const detProp

Member Data Documentation

std::string sppt::TTSpacePointFinder::fHitModuleLabel
private

Definition at line 46 of file TTSpacePointFinder_module.cc.

SpacePointAlg_TimeSort sppt::TTSpacePointFinder::fSpptAlg
private

Input Y hits instance name.

Definition at line 51 of file TTSpacePointFinder_module.cc.

std::string sppt::TTSpacePointFinder::fUHitsInstanceLabel
private

Input hit module name.

Definition at line 47 of file TTSpacePointFinder_module.cc.

std::string sppt::TTSpacePointFinder::fVHitsInstanceLabel
private

Input U hits instance name.

Definition at line 48 of file TTSpacePointFinder_module.cc.

std::string sppt::TTSpacePointFinder::fYHitsInstanceLabel
private

Input V hits instance name.

Definition at line 49 of file TTSpacePointFinder_module.cc.


The documentation for this class was generated from the following file: