LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cosmic::CosmicTrackTagger Class Reference
Inheritance diagram for cosmic::CosmicTrackTagger:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 CosmicTrackTagger (fhicl::ParameterSet const &p)
 
void produce (art::Event &e) override
 
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)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
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)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
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 ()
 

Private Attributes

std::string fTrackModuleLabel
 
int fEndTickPadding
 
int fDetectorWidthTicks
 
float fTPCXBoundary
 
float fTPCYBoundary
 
float fTPCZBoundary
 
float fDetHalfHeight
 
float fDetWidth
 
float fDetLength
 
int fMinTickDrift
 
int fMaxTickDrift
 

Detailed Description

Definition at line 35 of file CosmicTrackTagger_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

cosmic::CosmicTrackTagger::CosmicTrackTagger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 50 of file CosmicTrackTagger_module.cc.

References fDetectorWidthTicks, fDetHalfHeight, fDetLength, fDetWidth, fEndTickPadding, fMaxTickDrift, fMinTickDrift, fTPCXBoundary, fTPCYBoundary, fTPCZBoundary, fTrackModuleLabel, and detinfo::sampling_rate().

50  : EDProducer{p}
51 {
52  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
53  auto const detp =
55  auto const* geo = lar::providerFrom<geo::Geometry>();
56 
57  fDetHalfHeight = geo->DetHalfHeight();
58  fDetWidth = 2. * geo->DetHalfWidth();
59  fDetLength = geo->DetLength();
60 
61  float fSamplingRate = sampling_rate(clock_data);
62 
63  fTrackModuleLabel = p.get<std::string>("TrackModuleLabel", "track");
64  fEndTickPadding = p.get<int>("EndTickPadding", 50);
65 
66  fTPCXBoundary = p.get<float>("TPCXBoundary", 5);
67  fTPCYBoundary = p.get<float>("TPCYBoundary", 5);
68  fTPCZBoundary = p.get<float>("TPCZBoundary", 5);
69 
70  const double driftVelocity = detp.DriftVelocity(detp.Efield(), detp.Temperature()); // cm/us
71 
73  2 * geo->DetHalfWidth() / (driftVelocity * fSamplingRate / 1000); // ~3200 for uB
74  fMinTickDrift = clock_data.Time2Tick(clock_data.TriggerTime());
76 
77  produces<std::vector<anab::CosmicTag>>();
78  produces<art::Assns<recob::Track, anab::CosmicTag>>();
79 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
Namespace collecting geometry-related classes utilities.

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::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 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void cosmic::CosmicTrackTagger::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 81 of file CosmicTrackTagger_module.cc.

References util::CreateAssn(), DEFINE_ART_MODULE, recob::Track::End(), fDetHalfHeight, fDetLength, fDetWidth, art::fill_ptr_vector(), fMaxTickDrift, fTPCXBoundary, fTPCYBoundary, fTPCZBoundary, fTrackModuleLabel, art::ProductRetriever::getByLabel(), art::detail::getType(), recob::Track::ID(), art::Ptr< T >::key(), anab::kGeometry_XX, anab::kGeometry_Y, anab::kGeometry_YY, anab::kGeometry_YZ, anab::kGeometry_Z, anab::kGeometry_ZZ, anab::kNotTagged, anab::kOutsideDrift_Partial, recob::Track::Length(), recob::Track::NumberTrajectoryPoints(), art::Event::put(), and recob::Track::Vertex().

82 {
83  // Implementation of required member function here.
84 
85  std::unique_ptr<std::vector<anab::CosmicTag>> cosmicTagTrackVector(
86  new std::vector<anab::CosmicTag>);
87  std::unique_ptr<art::Assns<recob::Track, anab::CosmicTag>> assnOutCosmicTagTrack(
89 
90  TStopwatch ts;
91 
93  e.getByLabel(fTrackModuleLabel, Trk_h);
94  std::vector<art::Ptr<recob::Track>> TrkVec;
95  art::fill_ptr_vector(TrkVec, Trk_h);
96 
98  // LOOPING OVER INSPILL TRACKS
100 
101  art::FindManyP<recob::Hit> hitsSpill(Trk_h, e, fTrackModuleLabel);
102 
103  for (unsigned int iTrack = 0; iTrack < Trk_h->size(); iTrack++) {
104 
105  int isCosmic = 0;
107 
108  art::Ptr<recob::Track> tTrack = TrkVec.at(iTrack);
109  std::vector<art::Ptr<recob::Hit>> HitVec = hitsSpill.at(iTrack);
110 
111  if (iTrack != tTrack.key()) { std::cout << "Mismatch in track index/key" << std::endl; }
112 
113  // A BETTER WAY OF FINDING END POINTS:
114  auto tVector1 = tTrack->Vertex();
115  auto tVector2 = tTrack->End();
116 
117  float trackEndPt1_X = tVector1.X();
118  float trackEndPt1_Y = tVector1.Y();
119  float trackEndPt1_Z = tVector1.Z();
120  float trackEndPt2_X = tVector2.X();
121  float trackEndPt2_Y = tVector2.Y();
122  float trackEndPt2_Z = tVector2.Z();
123 
124  if (trackEndPt1_X != trackEndPt1_X || trackEndPt1_Y != trackEndPt1_Y ||
125  trackEndPt1_Z != trackEndPt1_Z || trackEndPt2_X != trackEndPt2_X ||
126  trackEndPt2_Y != trackEndPt2_Y || trackEndPt2_Z != trackEndPt2_Z) {
127  std::cerr << "!!! FOUND A PROBLEM... the length is: " << tTrack->Length()
128  << " np: " << tTrack->NumberTrajectoryPoints() << " id: " << tTrack->ID() << " "
129  << tTrack << std::endl;
130  std::vector<float> tempPt1, tempPt2;
131  tempPt1.push_back(-999);
132  tempPt1.push_back(-999);
133  tempPt1.push_back(-999);
134  tempPt2.push_back(-999);
135  tempPt2.push_back(-999);
136  tempPt2.push_back(-999);
137  cosmicTagTrackVector->emplace_back(tempPt1, tempPt2, -999, tag_id);
138  util::CreateAssn(e, *cosmicTagTrackVector, tTrack, *assnOutCosmicTagTrack);
139  continue; // I don't want to deal with these "tracks"
140  }
141 
143  // Getting first and last ticks
145  float tick1 = 9999;
146  float tick2 = -9999;
147  bool dumpMe(false);
148 
149  for (unsigned int p = 0; p < HitVec.size(); p++) {
150  if (dumpMe) {
151  std::cout << "###>> Hit key: " << HitVec[p].key()
152  << ", peak - RMS: " << HitVec[p]->PeakTimeMinusRMS()
153  << ", peak + RMS: " << HitVec[p]->PeakTimePlusRMS() << std::endl;
154  }
155  if (HitVec[p]->PeakTimeMinusRMS() < tick1) tick1 = HitVec[p]->PeakTimeMinusRMS();
156  if (HitVec[p]->PeakTimePlusRMS() > tick2) tick2 = HitVec[p]->PeakTimePlusRMS();
157  }
158 
160  // Are any of the ticks outside of the ReadOutWindow ?
162  if (tick1 < fMinTickDrift || tick2 > fMaxTickDrift) {
163  isCosmic = 1;
165  }
166 
168  // Now check Y & Z boundaries:
170  int nBdY = 0, nBdZ = 0;
171  if (isCosmic == 0) {
172 
173  // Checking lower side of TPC
174  if (fabs(fDetHalfHeight + trackEndPt1_Y) < fTPCYBoundary ||
175  fabs(fDetHalfHeight + trackEndPt2_Y) < fTPCYBoundary || trackEndPt1_Y < -fDetHalfHeight ||
176  trackEndPt2_Y < -fDetHalfHeight)
177  nBdY++;
178 
179  // Checking upper side of TPC
180  if (fabs(fDetHalfHeight - trackEndPt1_Y) < fTPCYBoundary ||
181  fabs(fDetHalfHeight - trackEndPt2_Y) < fTPCYBoundary || trackEndPt1_Y > fDetHalfHeight ||
182  trackEndPt2_Y > fDetHalfHeight)
183  nBdY++;
184 
185  if (fabs(trackEndPt1_Z - fDetLength) < fTPCZBoundary ||
186  fabs(trackEndPt2_Z - fDetLength) < fTPCZBoundary)
187  nBdZ++;
188  if (fabs(trackEndPt1_Z) < fTPCZBoundary || fabs(trackEndPt2_Z) < fTPCZBoundary) nBdZ++;
189  if ((nBdY + nBdZ) > 1) {
190  isCosmic = 2;
191  if (nBdY > 1)
193  else if (nBdZ > 1)
195  else
197  }
198  else if ((nBdY + nBdZ) == 1) {
199  isCosmic = 3;
200  if (nBdY == 1)
202  else if (nBdZ == 1)
204  }
205  }
206 
207  std::vector<float> endPt1;
208  std::vector<float> endPt2;
209  endPt1.push_back(trackEndPt1_X);
210  endPt1.push_back(trackEndPt1_Y);
211  endPt1.push_back(trackEndPt1_Z);
212  endPt2.push_back(trackEndPt2_X);
213  endPt2.push_back(trackEndPt2_Y);
214  endPt2.push_back(trackEndPt2_Z);
215 
216  float cosmicScore = isCosmic > 0 ? 1 : 0;
217  if (isCosmic == 3) cosmicScore = 0.5;
218 
220  // Doing a very basic check on X boundaries
221  // this gets the types of tracks that go through both X boundaries of the detector
222  if (fabs(trackEndPt1_X - trackEndPt2_X) > fDetWidth - fTPCXBoundary) {
223  cosmicScore = 1;
224  isCosmic = 4;
226  }
227 
228  cosmicTagTrackVector->emplace_back(endPt1, endPt2, cosmicScore, tag_id);
229 
230  util::CreateAssn(e, *cosmicTagTrackVector, tTrack, *assnOutCosmicTagTrack);
231  }
232  // END OF LOOPING OVER INSPILL TRACKS
233 
237  float dE = 0, dS = 0, temp = 0, IScore = 0;
238  unsigned int IndexE = 0, iTrk1 = 0, iTrk = 0;
240 
241  for (iTrk = 0; iTrk < Trk_h->size(); iTrk++) {
242  art::Ptr<recob::Track> tTrk = TrkVec.at(iTrk);
243  if ((*cosmicTagTrackVector)[iTrk].CosmicScore() == 0) {
244  auto tStart = tTrk->Vertex();
245  auto tEnd = tTrk->End();
246  unsigned int l = 0;
247  for (iTrk1 = 0; iTrk1 < Trk_h->size(); iTrk1++) {
248  art::Ptr<recob::Track> tTrk1 = TrkVec.at(iTrk1);
249  float getScore = (*cosmicTagTrackVector)[iTrk1].CosmicScore();
250  if (getScore == 1 || getScore == 0.5) {
251  anab::CosmicTagID_t getType = (*cosmicTagTrackVector)[iTrk1].CosmicType();
252  auto tStart1 = tTrk1->Vertex();
253  auto tEnd1 = tTrk1->End();
254  auto NumE = (tEnd - tStart1).Cross(tEnd - tEnd1);
255  auto DenE = tEnd1 - tStart1;
256  dE = NumE.R() / DenE.R();
257  if (l == 0) {
258  temp = dE;
259  IndexE = iTrk1;
260  IScore = getScore;
261  IType = getType;
262  }
263  if (dE < temp) {
264  temp = dE;
265  IndexE = iTrk1;
266  IScore = getScore;
267  IType = getType;
268  }
269  l++;
270  }
271  } //End Trk1 loop
272  art::Ptr<recob::Track> tTrkI = TrkVec.at(IndexE);
273  auto tStartI = tTrkI->Vertex();
274  auto tEndI = tTrkI->End();
275  auto NumS = (tStart - tStartI).Cross(tStart - tEndI);
276  auto DenS = tEndI - tStartI;
277  dS = NumS.R() / DenS.R();
278  if (((dS < 5 && temp < 5) || (dS < temp && dS < 5)) && (tTrk->Length() < 60)) {
279  (*cosmicTagTrackVector)[iTrk].CosmicScore() = IScore - 0.05;
280  (*cosmicTagTrackVector)[iTrk].CosmicType() = IType;
281  }
282  } // end cosmicScore==0 loop
283  } // end iTrk loop
284 
285  e.put(std::move(cosmicTagTrackVector));
286  e.put(std::move(assnOutCosmicTagTrack));
287 
288  TrkVec.clear();
289 
290 } // end of produce
std::string getType(cet::LibraryManager const &lm, std::string const &fullSpec)
enum anab::cosmic_tag_id CosmicTagID_t
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:136
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:207
key_type key() const noexcept
Definition: Ptr.h:166
Point_t const & Vertex() const
Access to track position at different points.
Definition: Track.h:158
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.
int ID() const
Definition: Track.h:244
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Point_t const & End() const
Access to track position at different points.
Definition: Track.h:159
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

int cosmic::CosmicTrackTagger::fDetectorWidthTicks
private

Definition at line 44 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger().

float cosmic::CosmicTrackTagger::fDetHalfHeight
private

Definition at line 46 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

float cosmic::CosmicTrackTagger::fDetLength
private

Definition at line 46 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

float cosmic::CosmicTrackTagger::fDetWidth
private

Definition at line 46 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

int cosmic::CosmicTrackTagger::fEndTickPadding
private

Definition at line 43 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger().

int cosmic::CosmicTrackTagger::fMaxTickDrift
private

Definition at line 47 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

int cosmic::CosmicTrackTagger::fMinTickDrift
private

Definition at line 47 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger().

float cosmic::CosmicTrackTagger::fTPCXBoundary
private

Definition at line 45 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

float cosmic::CosmicTrackTagger::fTPCYBoundary
private

Definition at line 45 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

float cosmic::CosmicTrackTagger::fTPCZBoundary
private

Definition at line 45 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().

std::string cosmic::CosmicTrackTagger::fTrackModuleLabel
private

Definition at line 42 of file CosmicTrackTagger_module.cc.

Referenced by CosmicTrackTagger(), and produce().


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