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

Public Member Functions

 TrackStoppingChi2Fitter (fhicl::ParameterSet const &p)
 
 TrackStoppingChi2Fitter (TrackStoppingChi2Fitter const &)=delete
 
 TrackStoppingChi2Fitter (TrackStoppingChi2Fitter &&)=delete
 
TrackStoppingChi2Fitteroperator= (TrackStoppingChi2Fitter const &)=delete
 
TrackStoppingChi2Fitteroperator= (TrackStoppingChi2Fitter &&)=delete
 
void produce (art::Event &e) override
 

Private Attributes

const art::InputTag fTrackLabel
 
const art::InputTag fCaloLabel
 
const float fMinTrackLength
 
sbn::TrackStoppingChi2Alg fTrackStoppingChi2Alg
 

Detailed Description

Definition at line 30 of file TrackStoppingChi2Fitter_module.cc.

Constructor & Destructor Documentation

sbn::TrackStoppingChi2Fitter::TrackStoppingChi2Fitter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 53 of file TrackStoppingChi2Fitter_module.cc.

54  : EDProducer { p }
55  , fTrackLabel(p.get<std::string>("TrackLabel"))
56  , fCaloLabel(p.get<std::string>("CaloLabel"))
57  , fMinTrackLength(p.get<float>("MinTrackLength"))
59 {
60  produces<std::vector<StoppingChi2Fit>>();
61  produces<art::Assns<recob::Track, StoppingChi2Fit>>();
62  produces<art::Assns<anab::Calorimetry, StoppingChi2Fit>>();
63 }
pdgs p
Definition: selectors.fcl:22
sbn::TrackStoppingChi2Alg fTrackStoppingChi2Alg
sbn::TrackStoppingChi2Fitter::TrackStoppingChi2Fitter ( TrackStoppingChi2Fitter const &  )
delete
sbn::TrackStoppingChi2Fitter::TrackStoppingChi2Fitter ( TrackStoppingChi2Fitter &&  )
delete

Member Function Documentation

TrackStoppingChi2Fitter& sbn::TrackStoppingChi2Fitter::operator= ( TrackStoppingChi2Fitter const &  )
delete
TrackStoppingChi2Fitter& sbn::TrackStoppingChi2Fitter::operator= ( TrackStoppingChi2Fitter &&  )
delete
void sbn::TrackStoppingChi2Fitter::produce ( art::Event &  e)
override

Definition at line 65 of file TrackStoppingChi2Fitter_module.cc.

66 {
67  // Implementation of required member function here.
68  auto const trackHandle(e.getValidHandle<std::vector<recob::Track>>(fTrackLabel));
69 
70  std::vector<art::Ptr<recob::Track>> tracks;
71  art::fill_ptr_vector(tracks, trackHandle);
72 
73  art::FindManyP<anab::Calorimetry> fmTrackCalo(trackHandle, e, fCaloLabel);
74 
75  auto fitVec = std::make_unique<std::vector<StoppingChi2Fit>>();
76  auto trackAssns = std::make_unique<art::Assns<recob::Track, StoppingChi2Fit>>();
77  auto caloAssns = std::make_unique<art::Assns<anab::Calorimetry, StoppingChi2Fit>>();
78 
79  for (auto const& track : tracks) {
80 
81  if (track->Length() < fMinTrackLength)
82  continue;
83 
84  const std::vector<art::Ptr<anab::Calorimetry>> caloVec(fmTrackCalo.at(track.key()));
85 
86  if (caloVec.size() != 3)
87  continue;
88 
89  // Find the plane with the most hits: prefer collection > 1st induction > 2nd induction if multiple planes have the same number
90  const unsigned int maxHits(std::max({ caloVec[0]->dEdx().size(), caloVec[1]->dEdx().size(), caloVec[2]->dEdx().size() }));
91  const int bestPlane((caloVec[2]->dEdx().size() == maxHits) ? 2 : (caloVec[0]->dEdx().size() == maxHits) ? 0 : (caloVec[1]->dEdx().size() == maxHits) ? 1 : -1);
92 
93  if (bestPlane == -1)
94  continue;
95 
96  StoppingChi2Fit thisFit(fTrackStoppingChi2Alg.RunFit(*caloVec.at(bestPlane)));
97 
98  if (thisFit.pol0Chi2 < 0.f || thisFit.expChi2 < 0.f)
99  continue;
100 
101  fitVec->push_back(thisFit);
102  util::CreateAssn(*this, e, *fitVec, track, *trackAssns);
103  util::CreateAssn(*this, e, *fitVec, caloVec[bestPlane], *caloAssns);
104  }
105 
106  e.put(std::move(fitVec));
107  e.put(std::move(trackAssns));
108  e.put(std::move(caloAssns));
109 }
ClusterModuleLabel join with tracks
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
process_name use argoneut_mc_hitfinder track
sbn::TrackStoppingChi2Alg fTrackStoppingChi2Alg
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
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.
do i e
StoppingChi2Fit RunFit(const std::vector< float > &dEdxVec, const std::vector< float > &resRangeVec) const

Member Data Documentation

const art::InputTag sbn::TrackStoppingChi2Fitter::fCaloLabel
private

Definition at line 47 of file TrackStoppingChi2Fitter_module.cc.

const float sbn::TrackStoppingChi2Fitter::fMinTrackLength
private

Definition at line 48 of file TrackStoppingChi2Fitter_module.cc.

const art::InputTag sbn::TrackStoppingChi2Fitter::fTrackLabel
private

Definition at line 47 of file TrackStoppingChi2Fitter_module.cc.

sbn::TrackStoppingChi2Alg sbn::TrackStoppingChi2Fitter::fTrackStoppingChi2Alg
private

Definition at line 50 of file TrackStoppingChi2Fitter_module.cc.


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