Classes | Public Types | Public Member Functions | Private Attributes | List of all members
lar::test::TrackProxyTrackMaker Class Reference

Creates some dummy hits. More...

Inheritance diagram for lar::test::TrackProxyTrackMaker:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 
- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 

Public Member Functions

 TrackProxyTrackMaker (Parameters const &config)
 
virtual void produce (art::Event &event) override
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

art::InputTag hitsTag
 Input hit collection label. More...
 
std::vector< unsigned int > hitsPerTrack
 Hits per produced track. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Creates some dummy hits.

The produced tracks have completely dummy content.

Configuration parameters

Definition at line 58 of file TrackProxyTrackMaker_module.cc.

Member Typedef Documentation

Definition at line 77 of file TrackProxyTrackMaker_module.cc.

Constructor & Destructor Documentation

lar::test::TrackProxyTrackMaker::TrackProxyTrackMaker ( Parameters const &  config)
inlineexplicit

Definition at line 79 of file TrackProxyTrackMaker_module.cc.

81  , hitsTag(config().hitsTag())
83  {
84  produces<std::vector<recob::TrackTrajectory>>();
85  produces<art::Assns<recob::TrackTrajectory, recob::Hit>>();
86  produces<std::vector<recob::Track>>();
87  produces<std::vector<std::vector<recob::TrackFitHitInfo>>>();
88  produces<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>();
89  produces<art::Assns<recob::Track, recob::TrackTrajectory>>();
90  }
std::vector< unsigned int > hitsPerTrack
Hits per produced track.
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
static Config * config
Definition: config.cpp:1054
art::InputTag hitsTag
Input hit collection label.

Member Function Documentation

void lar::test::TrackProxyTrackMaker::produce ( art::Event event)
overridevirtual

Implements art::EDProducer.

Definition at line 108 of file TrackProxyTrackMaker_module.cc.

108  {
109 
110  auto trajectories = std::make_unique<std::vector<recob::TrackTrajectory>>();
111  auto tracks = std::make_unique<std::vector<recob::Track>>();
112  auto trackFitInfo
113  = std::make_unique<std::vector<std::vector<recob::TrackFitHitInfo>>>();
114  auto hitTrackAssn
115  = std::make_unique<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>();
116  auto hitTrajectoryAssn
117  = std::make_unique<art::Assns<recob::TrackTrajectory, recob::Hit>>();
118  auto trackTrajectoryAssn
119  = std::make_unique<art::Assns<recob::Track, recob::TrackTrajectory>>();
120 
121  auto hitHandle = event.getValidHandle<std::vector<recob::Hit>>(hitsTag);
122  auto const& hits = *hitHandle;
123 
124  art::PtrMaker<recob::TrackTrajectory> trajectoryPtrMaker(event);
125  art::PtrMaker<recob::Track> trackPtrMaker(event);
126  unsigned int iTrack = 0;
127  unsigned int usedHits = 0;
128  while (usedHits < hits.size()) {
129 
130  // how many hits for this track:
131  unsigned int const nTrackHits = (iTrack < hitsPerTrack.size())
132  ? std::min(hitsPerTrack[iTrack], (unsigned int)(hits.size() - usedHits))
133  : (hits.size() - usedHits)
134  ;
135 
136  //
137  // create the track trajectory and fit information
138  //
139  std::size_t const firstHit = usedHits;
143  std::vector<recob::TrackFitHitInfo> fitInfo;
144  for (unsigned int iPoint = 0; iPoint < nTrackHits; ++iPoint) {
145  //
146  // fill base track information
147  //
149  Mask_t pointFlags {
154  };
155 
156  // one point out of seven has no valid position at all
157  if (iPoint % 7 == 2) // make sure there are at least two valid points
159  // one point out of five was made ignoring the hit
160  if (iPoint % 5)
162  // one point out of three is suspicious
163  if (iPoint % 3)
165  // every other point has issues
166  if (iPoint % 2)
167  pointFlags.set(recob::TrajectoryPointFlags::flag::DetectorIssue);
168 
169  pos.emplace_back(iPoint, iPoint, iPoint);
170  mom.emplace_back(2.0, 1.0, 0.0);
171  flags.emplace_back(usedHits++, pointFlags);
172  //
173  // fill optional information
174  //
175  fitInfo.push_back({
176  double(iPoint) * 2.5, // aHitMeas
177  double(iPoint) * 1.5, // aHitMeasErr2
178  {}, // aTrackStatePar
179  { ROOT::Math::SMatrixIdentity{} }, // aTrackStateCov
180  hits[usedHits + iPoint].WireID() // aWireId
181  });
182  } // for
183 
184  // produce some "additional" trajectory (pretty much invalid)
185  trajectories->emplace_back();
186 
187  trajectories->emplace_back
188  (std::move(pos), std::move(mom), std::move(flags), true);
189 
190  //
191  // create the trajectory-hit associations
192  // (no hits for the invalid trajectory)
193  //
194  auto const trajPtr = trajectoryPtrMaker(trajectories->size() - 1U);
195  for (std::size_t iHit = firstHit; iHit < usedHits; ++iHit)
196  hitTrajectoryAssn->addSingle(trajPtr, { hitHandle, iHit });
197 
198  //
199  // create the track
200  //
201  recob::Track track
202  (trajectories->back(), 2112, 1.0, nTrackHits, {}, {}, iTrack);
203  tracks->push_back(std::move(track));
204 
205  //
206  // and the additional objects
207  //
208  trackFitInfo->push_back(std::move(fitInfo));
209 
210  //
211  // create the track-hit associations
212  //
213  auto const trackPtr = trackPtrMaker(iTrack);
214  for (std::size_t iHit = firstHit; iHit < usedHits; ++iHit) {
215 
216  auto const hitIndex = iHit - firstHit;
217  recob::TrackHitMeta const hitInfo(hitIndex, 2.0 * hitIndex);
218  hitTrackAssn->addSingle(trackPtr, { hitHandle, iHit }, hitInfo);
219 
220  } // for
221 
222  //
223  // create the track-trajectory associations
224  //
225  trackTrajectoryAssn->addSingle(trackPtr, trajPtr);
226 
227  mf::LogVerbatim("TrackProxyTrackMaker")
228  << "New track #" << tracks->back().ID()
229  << " with " << nTrackHits << " hits";
230 
231  //
232  // prepare for the next track
233  //
234  ++iTrack;
235 
236  } // while
237 
238  mf::LogInfo("TrackProxyTrackMaker")
239  << "Produced " << tracks->size() << " tracks from " << usedHits << " hits.";
240 
241  event.put(std::move(trajectories));
242  event.put(std::move(hitTrajectoryAssn));
243  event.put(std::move(tracks));
244  event.put(std::move(trackFitInfo));
245  event.put(std::move(hitTrackAssn));
246  event.put(std::move(trackTrajectoryAssn));
247 
248 } // lar::test::TrackProxyTrackMaker::produce()
std::vector< unsigned int > hitsPerTrack
Hits per produced track.
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
static constexpr Flag_t Suspicious
The point reconstruction is somehow questionable.
static constexpr Flag_t NoPoint
The trajectory point is not defined.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
tracking::Positions_t Positions_t
Type of trajectory point list.
Data related to recob::Hit associated with recob::Track.The purpose is to collect several variables t...
Definition: TrackHitMeta.h:43
tracking::Momenta_t Momenta_t
Type of momentum list.
def move(depos, offset)
Definition: depos.py:107
art::InputTag hitsTag
Input hit collection label.
static constexpr Flag_t HitIgnored
Hit was not included for the computation of the trajectory.
std::vector< PointFlags_t > Flags_t
Type of point flag list.
Flags_t::Mask_t Mask_t
Type of mask of bits.
Definition: tracks.py:1
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
static constexpr Flag_t DetectorIssue
The hit is associated to a problematic channel.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49

Member Data Documentation

std::vector<unsigned int> lar::test::TrackProxyTrackMaker::hitsPerTrack
private

Hits per produced track.

Definition at line 96 of file TrackProxyTrackMaker_module.cc.

art::InputTag lar::test::TrackProxyTrackMaker::hitsTag
private

Input hit collection label.

Definition at line 95 of file TrackProxyTrackMaker_module.cc.


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