LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::Track3DKalmanSPS Class Reference
Inheritance diagram for trkf::Track3DKalmanSPS:
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

 Track3DKalmanSPS (fhicl::ParameterSet const &pset)
 
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 Member Functions

void produce (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
double energyLossBetheBloch (const double &mass, const double p)
 
void rotationCov (TMatrixT< Double_t > &cov, const TVector3 &u, const TVector3 &v)
 
std::vector< double > dQdxCalc (const art::FindManyP< recob::Hit > &h, const art::PtrVector< recob::SpacePoint > &s, const TVector3 &p, const TVector3 &d)
 

Private Attributes

std::string fClusterModuleLabel
 
std::string fSpptModuleLabel
 
std::string fGenieGenModuleLabel
 
std::string fG4ModuleLabel
 
std::string fSortDim
 
TTree * tree
 
TMatrixT< Double_t > * stMCT
 
TMatrixT< Double_t > * covMCT
 
TMatrixT< Double_t > * stREC
 
TMatrixT< Double_t > * covREC
 
Float_t chi2
 
Float_t chi2ndf
 
int fcont
 
Float_t * fpRECL
 
Float_t * fpREC
 
Float_t * fpMCMom
 
Float_t * fpMCPos
 
Float_t * fState0
 
Float_t * fCov0
 
int nfail
 
int ndf
 
int nchi2rePass
 
int ispptvec
 
int nspptvec
 
unsigned int evtt
 
unsigned int nTrks
 
unsigned int fptsNo
 
Float_t * fshx
 
Float_t * fshy
 
Float_t * fshz
 
Float_t * feshx
 
Float_t * feshy
 
Float_t * feshz
 
Float_t * feshyz
 
Float_t * fupdate
 
Float_t * fchi2hit
 
Float_t * fth
 
Float_t * feth
 
Float_t * fedudw
 
Float_t * fedvdw
 
Float_t * feu
 
Float_t * fev
 
Float_t * fsep
 
Float_t * fdQdx
 
unsigned int fDimSize
 
Float_t * fPCmeans
 
Float_t * fPCevals
 
Float_t * fPCsigmas
 
Float_t * fPC1
 
Float_t * fPC2
 
Float_t * fPC3
 
std::vector< double > fPosErr
 
std::vector< double > fMomErr
 
std::vector< double > fMomStart
 
double fPerpLim
 
bool fDoFit
 
int fNumIt
 
uint16_t fMinNumSppts
 
double fErrScaleS
 
double fErrScaleM
 
int fDecimate
 
double fMaxUpdate
 
int fDecimateU
 
double fDistanceU
 
double fMaxUpdateU
 
double fMomLow
 
double fMomHigh
 
int fPdg
 
double fChi2Thresh
 
int fMaxPass
 
genf::GFAbsTrackReprepMC
 
genf::GFAbsTrackReprep
 

Detailed Description

Definition at line 95 of file Track3DKalmanSPS_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

trkf::Track3DKalmanSPS::Track3DKalmanSPS ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 197 of file Track3DKalmanSPS_module.cc.

References fChi2Thresh, fClusterModuleLabel, fDecimate, fDecimateU, fDistanceU, fDoFit, fErrScaleM, fErrScaleS, fG4ModuleLabel, fGenieGenModuleLabel, fMaxPass, fMaxUpdate, fMaxUpdateU, fMinNumSppts, fMomErr, fMomHigh, fMomLow, fMomStart, fNumIt, fPdg, fPerpLim, fPosErr, fSortDim, fSpptModuleLabel, and MF_LOG_WARNING.

198  : EDProducer{pset}
199  , fDoFit(true)
200  , fNumIt(5)
201  , fMinNumSppts(5)
202  , fErrScaleS(1.0)
203  , fErrScaleM(1.0)
204  , fDecimate(1)
205  , fMaxUpdate(0.10)
206  , fDecimateU(1)
207  , fDistanceU(1.)
208  , fMaxUpdateU(0.10)
209  , fMomLow(0.001)
210  , fMomHigh(100.)
211  , fPdg(-13)
212  , fChi2Thresh(12.0E12)
213  , fMaxPass(1)
214  {
215  fClusterModuleLabel = pset.get<std::string>("ClusterModuleLabel");
216  fSpptModuleLabel = pset.get<std::string>("SpptModuleLabel");
217  fGenieGenModuleLabel = pset.get<std::string>("GenieGenModuleLabel");
218  fG4ModuleLabel = pset.get<std::string>("G4ModuleLabel");
219  fPosErr = pset.get<std::vector<double>>("PosErr3"); // resolution. cm
220  fMomErr = pset.get<std::vector<double>>("MomErr3"); // GeV
221  fMomStart = pset.get<std::vector<double>>("MomStart3"); //
222  fPerpLim = pset.get<double>("PerpLimit", 1.e6); // PCA cut.
223  fDoFit = pset.get<bool>("DoFit", true); // Der.
224  fNumIt = pset.get<int>("NumIt", 5); // Number x2 passes per fit.
225  fMinNumSppts =
226  pset.get<int>("MinNumSppts", 5); // Min number of sppts in vector to bother fitting
227  fErrScaleS = pset.get<double>("ErrScaleSim", 1.0); // error scale.
228  fErrScaleM = pset.get<double>("ErrScaleMeas", 1.0); // error scale.
229  fDecimate = pset.get<int>("DecimateC", 40); // Sparsify data.
230  fMaxUpdate = pset.get<double>("MaxUpdateC", 0.1); // 0-out.
231  fDecimateU = pset.get<int>("DecimateU", 100); // Sparsify data.
232  fDistanceU =
233  pset.get<double>("DistanceU", 10.0); // Require this separation on uncontained 2nd pass.
234  fMaxUpdateU = pset.get<double>("MaxUpdateU", 0.02); // 0-out.
235  fMomLow = pset.get<double>("MomLow", 0.01); // Fit Range.
236  fMomHigh = pset.get<double>("MomHigh", 20.); // Fit Range.
237  fPdg = pset.get<int>("PdgCode", -13); // mu+ Hypothesis.
238  fChi2Thresh = pset.get<double>("Chi2HitThresh", 12.0E12); //For Re-pass.
239  fSortDim = pset.get<std::string>("SortDirection", "z"); // case sensitive
240  fMaxPass = pset.get<int>("MaxPass", 2); // mu+ Hypothesis.
241  bool fGenfPRINT;
242  if (pset.get_if_present("GenfPRINT", fGenfPRINT)) {
243  MF_LOG_WARNING("Track3DKalmanSPS_GenFit")
244  << "Parameter 'GenfPRINT' has been deprecated.\n"
245  "Please use the standard message facility to enable GenFit debug output.";
246  // A way to enable debug output is all of the following:
247  // - compile in debug mode (no optimization, no profiling)
248  // - if that makes everything too noisy, add to have everything else quiet
249  // services.message.debugModules: [ "Track3DKalmanSPS" ]
250  // - to print all the GenFit debug messages, set
251  // services.message.destinations.LogDebugFile.categories.Track3DKalmanSPS_GenFit.limit: -1
252  // (assuming there is a LogDebugFile destination already; for example
253  // see the settings in uboonecode/uboone/Utilities/services_microboone.fcl )
254  }
255 
256  produces<std::vector<recob::Track>>();
257  produces<art::Assns<recob::Track, recob::Cluster>>();
258  produces<art::Assns<recob::Track, recob::SpacePoint>>();
259  produces<art::Assns<recob::Track, recob::Hit>>();
260  }
std::vector< double > fMomErr
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::vector< double > fPosErr
std::vector< double > fMomStart
#define MF_LOG_WARNING(category)

Member Function Documentation

void trkf::Track3DKalmanSPS::beginJob ( )
privatevirtual

Reimplemented from art::EDProducer.

Definition at line 385 of file Track3DKalmanSPS_module.cc.

References chi2, chi2ndf, covMCT, covREC, evtt, fchi2hit, fcont, fCov0, fDimSize, fdQdx, fedudw, fedvdw, feshx, feshy, feshyz, feshz, feth, feu, fev, fPC1, fPC2, fPC3, fPCevals, fPCmeans, fPCsigmas, fpMCMom, fpMCPos, fpREC, fpRECL, fptsNo, fsep, fshx, fshy, fshz, fState0, fth, fupdate, ispptvec, nchi2rePass, ndf, nfail, nspptvec, nTrks, stMCT, stREC, and tree.

386  {
387 
389 
390  stMCT = new TMatrixT<Double_t>(5, 1);
391  covMCT = new TMatrixT<Double_t>(5, 5);
392  stREC = new TMatrixT<Double_t>(5, 1);
393  covREC = new TMatrixT<Double_t>(5, 5);
394 
395  fpMCMom = new Float_t[4];
396  fpMCPos = new Float_t[4];
397  fpREC = new Float_t[4];
398  fpRECL = new Float_t[4];
399  fState0 = new Float_t[5];
400  fCov0 = new Float_t[25];
401  fDimSize = 20000; // if necessary will get this from pset in constructor.
402 
403  fshx = new Float_t[fDimSize];
404  fshy = new Float_t[fDimSize];
405  fshz = new Float_t[fDimSize];
406  feshx = new Float_t[fDimSize];
407  feshy = new Float_t[fDimSize];
408  feshz = new Float_t[fDimSize];
409  feshyz = new Float_t[fDimSize];
410  fupdate = new Float_t[fDimSize];
411  fchi2hit = new Float_t[fDimSize];
412  fth = new Float_t[fDimSize];
413  feth = new Float_t[fDimSize];
414  fedudw = new Float_t[fDimSize];
415  fedvdw = new Float_t[fDimSize];
416  feu = new Float_t[fDimSize];
417  fev = new Float_t[fDimSize];
418  fsep = new Float_t[fDimSize];
419  fdQdx = new Float_t[fDimSize];
420 
421  fPC1 = new Float_t[3];
422  fPC2 = new Float_t[3];
423  fPC3 = new Float_t[3];
424  fPCmeans = new Float_t[3];
425  fPCsigmas = new Float_t[3];
426  fPCevals = new Float_t[3];
427 
428  // //TFile fileGENFIT("GENFITout.root","RECREATE");
429 
430  tree = tfs->make<TTree>("GENFITttree", "GENFITttree");
431  //tree->Branch("stMCT",&stMCT,"stMCT[5]/F"); // "TMatrixT<Double_t>"
432 
433  //tree->Branch("stMCT","TMatrixD",&stMCT,64000,0);
434  //tree->Branch("covMCT",covMCT,"covMCT[25]/F");
435  tree->Branch("covMCT", "TMatrixD", &covMCT, 64000, 0);
436  tree->Branch("stREC", fState0, "stREC[5]/F");
437  //tree->Branch("stREC","TMatrixD",&stREC,64000,0);
438  tree->Branch("covREC", fCov0, "covREC[25]/F");
439  //tree->Branch("covREC","TMatrixD",&covREC,64000,0);
440 
441  tree->Branch("nchi2rePass", &nchi2rePass, "nchi2rePass/I");
442  tree->Branch("ispptvec", &ispptvec, "ispptvec/I");
443  tree->Branch("chi2", &chi2, "chi2/F");
444  tree->Branch("nfail", &nfail, "nfail/I");
445  tree->Branch("ndf", &ndf, "ndf/I");
446  tree->Branch("evtNo", &evtt, "evtNo/I");
447  tree->Branch("nspptvec", &nspptvec, "nspptvec/I");
448  tree->Branch("chi2ndf", &chi2ndf, "chi2ndf/F");
449 
450  tree->Branch("trkNo", &nTrks, "trkNo/I");
451  tree->Branch("ptsNo", &fptsNo, "ptsNo/I");
452  tree->Branch("cont", &fcont, "cont/I"); //O? Yes, O. Not 0, not L, ...
453  tree->Branch("shx", fshx, "shx[ptsNo]/F");
454  tree->Branch("shy", fshy, "shy[ptsNo]/F");
455  tree->Branch("shz", fshz, "shz[ptsNo]/F");
456  tree->Branch("sep", fsep, "sep[ptsNo]/F");
457  tree->Branch("dQdx", fdQdx, "dQdx[ptsNo]/F");
458  tree->Branch("eshx", feshx, "eshx[ptsNo]/F");
459  tree->Branch("eshy", feshy, "eshy[ptsNo]/F");
460  tree->Branch("eshz", feshz, "eshz[ptsNo]/F");
461  tree->Branch("eshyz", feshyz, "eshyz[ptsNo]/F");
462  tree->Branch("update", fupdate, "update[ptsNo]/F");
463  tree->Branch("chi2hit", fchi2hit, "chi2hit[ptsNo]/F");
464  tree->Branch("th", fth, "th[ptsNo]/F");
465  tree->Branch("eth", feth, "eth[ptsNo]/F");
466  tree->Branch("edudw", fedudw, "edudw[ptsNo]/F");
467  tree->Branch("edvdw", fedvdw, "edvdw[ptsNo]/F");
468  tree->Branch("eu", feu, "eu[ptsNo]/F");
469  tree->Branch("ev", fev, "ev[ptsNo]/F");
470 
471  tree->Branch("pcMeans", fPCmeans, "pcMeans[3]/F");
472  tree->Branch("pcSigmas", fPCsigmas, "pcSigmas[3]/F");
473  tree->Branch("pcEvals", fPCevals, "pcEvals[3]/F");
474  tree->Branch("pcEvec1", fPC1, "pcEvec1[3]/F");
475  tree->Branch("pcEvec2", fPC2, "pcEvec2[3]/F");
476  tree->Branch("pcEvec3", fPC3, "pcEvec3[3]/F");
477 
478  tree->Branch("pMCMom", fpMCMom, "pMCMom[4]/F");
479  tree->Branch("pMCPos", fpMCPos, "pMCPos[4]/F");
480  tree->Branch("pRECKalF", fpREC, "pRECKalF[4]/F");
481  tree->Branch("pRECKalL", fpRECL, "pRECKalL[4]/F");
482 
483  //TGeoManager* geomGENFIT = new TGeoManager("Geometry", "Geane geometry");
484  //TGeoManager::Import("config/genfitGeom.root");
485  // gROOT->Macro("config/Geane.C");
486  }
TMatrixT< Double_t > * stREC
TMatrixT< Double_t > * stMCT
TMatrixT< Double_t > * covREC
TMatrixT< Double_t > * covMCT
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")
std::vector< double > trkf::Track3DKalmanSPS::dQdxCalc ( const art::FindManyP< recob::Hit > &  h,
const art::PtrVector< recob::SpacePoint > &  s,
const TVector3 &  p,
const TVector3 &  d 
)
private

Definition at line 325 of file Track3DKalmanSPS_module.cc.

References geo::PlaneID::asPlaneID(), art::PtrVector< T >::begin(), larg4::dist(), art::PtrVector< T >::end(), recob::Hit::Integral(), geo::kCollection, geo::GeometryCore::Plane(), recob::Hit::SignalType(), geo::WireGeo::ThetaZ(), lar::dump::vector(), geo::PlaneGeo::Wire(), recob::Hit::WireID(), and geo::GeometryCore::WirePitch().

Referenced by produce().

329  {
330  // For now just Collection plane.
331  // We should loop over all views, more generally.
335  // art::PtrVector<recob::SpacePoint>::const_iterator sppt = sstart;
337  std::vector<double> v;
338 
339  double mindist(100.0); // cm
340  auto spptminIt(sppt);
341  while (sppt != s.end()) {
342  if (((**sppt).XYZ() - loc).Mag() < mindist) {
343  double dist = ((**sppt).XYZ() - loc).Mag();
344 
345  // Jump out if we're as close as 0.1 mm away.
346  if (dist < mindist) {
347  mindist = dist;
348  spptminIt = sppt;
349  if (mindist < 0.01) break;
350  }
351  }
352  sppt++;
353  }
354  sstart = spptminIt; // for next time.
355  unsigned int ind(std::distance(s.begin(), spptminIt));
356 
357  std::vector<art::Ptr<recob::Hit>> hitlist = h.at(ind);
358 
359  double wirePitch = 0.;
360  double angleToVert = 0;
361  double charge = 0.;
362 
363  // FIXME: Currently the last iteration sets the charge, wirePitch, and angleToVert variables.
364  // Is this expected?
365  for (std::vector<art::Ptr<recob::Hit>>::const_iterator ihit = hitlist.begin();
366  ihit != hitlist.end();
367  ++ihit) {
368  const recob::Hit& hit1 = **ihit;
369  if (hit1.SignalType() != sig) continue;
370  geo::PlaneID const& hit1PlaneID = hit1.WireID().asPlaneID();
371  charge = hit1.Integral();
372  wirePitch = geom->WirePitch(hit1PlaneID);
373  angleToVert = geom->Plane(hit1PlaneID).Wire(0).ThetaZ(false) - 0.5 * TMath::Pi();
374  }
375 
376  double cosgamma =
377  TMath::Abs(TMath::Sin(angleToVert) * dir.Y() + TMath::Cos(angleToVert) * dir.Z());
378 
379  v.push_back(charge / wirePitch / cosgamma);
380 
381  return v;
382  }
geo::SigType_t SignalType() const
Signal type for the plane of the hit.
Definition: Hit.h:272
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:465
iterator begin()
Definition: PtrVector.h:217
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:244
geo::WireID const & WireID() const
Initial tdc tick for hit.
Definition: Hit.h:280
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:248
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
PlaneGeo const & Plane(PlaneID const &planeid) const
Returns the specified wire.
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
iterator end()
Definition: PtrVector.h:231
constexpr PlaneID const & asPlaneID() const
Conversion to PlaneID (for convenience of notation).
Definition: geo_types.h:520
TDirectory * dir
Definition: macro.C:5
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
Length_t WirePitch(PlaneID const &planeid=plane_zero) const
Returns the distance between two consecutive wires.
Signal from collection planes.
Definition: geo_types.h:152
void trkf::Track3DKalmanSPS::endJob ( )
privatevirtual

Reimplemented from art::EDProducer.

Definition at line 489 of file Track3DKalmanSPS_module.cc.

References fchi2hit, fCov0, fdQdx, fedudw, fedvdw, feshx, feshy, feshyz, feshz, feth, feu, fev, fPC1, fPC2, fPC3, fPCevals, fPCmeans, fPCsigmas, fpREC, fpRECL, fsep, fshx, fshy, fshz, fState0, fth, fupdate, rep, and repMC.

490  {
491  if (!rep) delete rep;
492  if (!repMC) delete repMC;
493 
494  /*
495  // not sure why I can't do these, but at least some cause seg faults.
496  delete[] stMCT;
497  delete[] covMCT;
498  delete[] stREC;
499  delete[] covREC;
500  */
501 
502  delete[] fpREC;
503  delete[] fpRECL;
504  delete[] fState0;
505  delete[] fCov0;
506 
507  delete[] fshx;
508  delete[] fshy;
509  delete[] fshz;
510  delete[] feshx;
511  delete[] feshy;
512  delete[] feshyz;
513  delete[] feshz;
514  delete[] fupdate;
515  delete[] fchi2hit;
516  delete[] fth;
517  delete[] feth;
518  delete[] fedudw;
519  delete[] fedvdw;
520  delete[] feu;
521  delete[] fev;
522  delete[] fsep;
523  delete[] fdQdx;
524 
525  delete[] fPCmeans;
526  delete[] fPCsigmas;
527  delete[] fPCevals;
528  delete[] fPC1;
529  delete[] fPC2;
530  delete[] fPC3;
531  }
double trkf::Track3DKalmanSPS::energyLossBetheBloch ( const double &  mass,
const double  p = 1.5 
)
private

Definition at line 264 of file Track3DKalmanSPS_module.cc.

Referenced by produce().

265  {
266  const double charge(1.0);
267  const double mEE(188.); // eV
268  const double matZ(18.);
269  const double matA(40.);
270  const double matDensity(1.4);
271  const double me(0.000511);
272 
273  double beta = p / std::sqrt(mass * mass + p * p);
274  double gammaSquare = 1. / (1.0 - beta * beta);
275  // 4pi.r_e^2.N.me = 0.307075, I think.
276  double dedx = 0.307075 * matDensity * matZ / matA / (beta * beta) * charge * charge;
277  double massRatio = me / mass;
278  // me=0.000511 here is in GeV. So mEE comes in here in eV.
279  double argument = gammaSquare * beta * beta * me * 1.E3 * 2. /
280  ((1.E-6 * mEE) * std::sqrt(1 + 2 * std::sqrt(gammaSquare) * massRatio +
281  massRatio * massRatio));
282 
283  if (mass == 0.0) return (0.0);
284  if (argument <= exp(beta * beta)) { dedx = 0.; }
285  else {
286  dedx *= (log(argument) - beta * beta); // Bethe-Bloch [MeV/cm]
287  dedx *= 1.E-3; // in GeV/cm, hence 1.e-3
288  if (dedx < 0.) dedx = 0.;
289  }
290  return dedx;
291  }
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 trkf::Track3DKalmanSPS::produce ( art::Event evt)
privatevirtual
Todo:
Should never test whether the event is real data in reconstruction algorithms
Todo:
as that introduces potential data/MC differences that are very hard to track down
Todo:
Remove this test as soon as possible please
Todo:
Should never test whether the event is real data in reconstruction algorithms
Todo:
as that introduces potential data/MC differences that are very hard to track down
Todo:
Remove this test as soon as possible please

Implements art::EDProducer.

Definition at line 534 of file Track3DKalmanSPS_module.cc.

References util::abs(), genf::GFTrack::addHit(), art::PtrVector< T >::begin(), chi2, chi2ndf, close(), recob::tracking::convertCollToPoint(), recob::tracking::convertCollToVector(), covMCT, covREC, util::CreateAssn(), tca::dEdx(), DEFINE_ART_MODULE, geo::GeometryCore::DetHalfHeight(), geo::GeometryCore::DetHalfWidth(), geo::GeometryCore::DetLength(), dQdxCalc(), e, art::PtrVector< T >::end(), energyLossBetheBloch(), art::PtrVector< T >::erase(), art::EventID::event(), evtt, fchi2hit, fChi2Thresh, fClusterModuleLabel, fcont, fCov0, fDecimate, fDecimateU, fDimSize, fDistanceU, fDoFit, fdQdx, fedudw, fedvdw, fErrScaleM, fErrScaleS, feshx, feshy, feshyz, feshz, feth, feu, fev, fGenieGenModuleLabel, fMaxPass, fMaxUpdate, fMaxUpdateU, fMinNumSppts, fMomErr, fMomHigh, fMomLow, fMomStart, fNumIt, fPC1, fPC2, fPC3, fPCevals, fPCmeans, fPCsigmas, fPdg, fPerpLim, fpMCMom, fpMCPos, fPosErr, fpREC, fpRECL, fptsNo, fsep, fshx, fshy, fshz, fSortDim, fSpptModuleLabel, fState0, fth, fupdate, art::ProductRetriever::getByLabel(), genf::GFAbsTrackRep::getChiSqu(), genf::GFAbsTrackRep::getCov(), genf::GFTrack::getFailedHits(), genf::GFTrack::getHitChi2(), genf::GFTrack::getHitCov(), genf::GFTrack::getHitCov7x7(), genf::GFTrack::getHitMeasuredCov(), genf::GFTrack::getHitPlaneU(), genf::GFTrack::getHitPlaneUxUyUz(), genf::GFTrack::getHitPlaneV(), genf::GFTrack::getHitPlaneXYZ(), genf::GFTrack::getHitState(), genf::GFTrack::getHitUpdate(), genf::GFFieldManager::getInstance(), geo::GeometryCore::GetLArTPCVolumeName(), genf::GFAbsTrackRep::getLastPlane(), genf::GFAbsTrackRep::getMom(), genf::GFAbsTrackRep::getNDF(), simb::MCTruth::GetParticle(), genf::GFAbsTrackRep::getReferencePlane(), genf::GFAbsTrackRep::getState(), genf::GFAbsTrackRep::getStatusFlag(), hits(), art::Event::id(), genf::GFFieldManager::init(), art::PtrVector< T >::insert(), mf::isDebugEnabled(), ispptvec, art::Event::isRealData(), MF_LOG_DEBUG, MF_LOG_ERROR, nchi2rePass, ndf, nfail, simb::MCTruth::NParticles(), nspptvec, nTrks, part, genf::GFDetPlane::Print(), genf::GFKalman::processTrack(), art::PtrVector< T >::push_back(), art::Event::put(), rep, repMC, genf::ROOTobjectToString(), rotationCov(), art::Event::run(), genf::GFKalman::setBlowUpFactor(), genf::GFKalman::setErrorScaleMTh(), genf::GFKalman::setErrorScaleSTh(), genf::GFKalman::setInitialDirection(), genf::GFKalman::setMaxUpdate(), genf::GFKalman::setMomHigh(), genf::GFKalman::setMomLow(), genf::GFKalman::setNumIterations(), genf::GFTrack::setPDG(), art::PtrVector< T >::size(), sp_sort_3dx(), sp_sort_3dy(), sp_sort_3dz(), sp_sort_nsppts(), stMCT, stREC, tmp, tree, and w.

535  {
536 
537  rep = 0;
538  repMC = 0;
539  // get services
541 
543  // Make a std::unique_ptr<> for the thing you want to put into the event
544  // because that handles the memory management for you
546  std::unique_ptr<std::vector<recob::Track>> tcol(new std::vector<recob::Track>);
547  std::unique_ptr<art::Assns<recob::Track, recob::SpacePoint>> tspassn(
549  std::unique_ptr<art::Assns<recob::Track, recob::Hit>> thassn(
551 
552  unsigned int tcnt = 0;
553 
554  // define TPC parameters
555  TString tpcName = geom->GetLArTPCVolumeName();
556 
557  // get input Hit object(s).
558  art::Handle<std::vector<recob::Cluster>> clusterListHandle;
559  evt.getByLabel(fClusterModuleLabel, clusterListHandle);
560 
562  evt.getByLabel(fSpptModuleLabel, spptListHandle);
563 
565 
569  if (!evt.isRealData()) {
570 
571  art::Handle<std::vector<simb::MCTruth>> mctruthListHandle;
572  evt.getByLabel(fGenieGenModuleLabel, mctruthListHandle);
573 
574  for (unsigned int ii = 0; ii < mctruthListHandle->size(); ++ii) {
575  art::Ptr<simb::MCTruth> mctparticle(mctruthListHandle, ii);
576  mclist.push_back(mctparticle);
577  }
578  }
579 
580  std::vector<art::PtrVector<recob::SpacePoint>> spptIn(spptListHandle->begin(),
581  spptListHandle->end());
582  // Get the spptvectors that are largest to be first, and smallest last.
583  std::sort(spptIn.begin(), spptIn.end(), sp_sort_nsppts);
584 
585  std::vector<art::PtrVector<recob::SpacePoint>>::const_iterator sppt = spptIn.begin();
586  auto spptB = sppt;
587 
588  TVector3 MCOrigin;
589  TVector3 MCMomentum;
590  // TVector3 posErr(.05,.05,.05); // resolution. 0.5mm
591  // TVector3 momErr(.1,.1,0.2); // GeV
592  TVector3 posErr(fPosErr[0], fPosErr[1], fPosErr[2]); // resolution. 0.5mm
593  TVector3 momErr(fMomErr[0], fMomErr[1], fMomErr[2]); // GeV
594  TVector3 momErrFit(fMomErr[0], fMomErr[1], fMomErr[2]); // GeV
595 
596  // This is strictly for MC
600  if (!evt.isRealData()) {
601  // Below breaks are stupid, I realize. But rather than keep all the MC
602  // particles I just take the first primary, e.g., muon and only keep its
603  // info in the branches of the Ttree. I could generalize later, ...
604  for (unsigned int ii = 0; ii < mclist.size(); ++ii) {
605  art::Ptr<simb::MCTruth> mc(mclist[ii]);
606  for (int jj = 0; jj < mc->NParticles(); ++jj) {
607  simb::MCParticle part(mc->GetParticle(jj));
608  MCOrigin.SetXYZ(part.Vx(), part.Vy(), part.Vz()); // V for Vertex
609  MCMomentum.SetXYZ(part.Px(), part.Py(), part.Pz());
610  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
611  << "FROM MC TRUTH, the particle's pdg code is: " << part.PdgCode()
612  << " with energy = " << part.E() << ", with energy = " << part.E()
613  << "\n vtx: " << genf::ROOTobjectToString(MCOrigin)
614  << "\n momentum: " << genf::ROOTobjectToString(MCMomentum)
615  << "\n (both in Global (not volTPC) coords)";
616 
617  repMC = new genf::RKTrackRep(MCOrigin, MCMomentum, posErr, momErr, part.PdgCode());
618  break;
619  }
620  break;
621  }
622  //for saving of MC truth
623  stMCT->ResizeTo(repMC->getState());
624  *stMCT = repMC->getState();
625  covMCT->ResizeTo(repMC->getCov());
626  *covMCT = repMC->getCov();
627  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
628  << " repMC, covMC are ... \n"
630 
631  } // !isRealData
632  nTrks = 0;
633  TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(fPdg);
634  Double_t mass = part->Mass();
635 
636  size_t cntp(0);
637  while (sppt != spptIn.end()) {
638 
639  const art::PtrVector<recob::SpacePoint>& spacepoints = *sppt;
640 
641  double fMaxUpdateHere(fMaxUpdateU);
642  int fDecimateHere(fDecimateU);
643  double fErrScaleSHere(fErrScaleS);
644  double fErrScaleMHere(fErrScaleM);
645  int rePass0(1);
646  unsigned int nTailPoints = 0; // 100;
647  if (spacepoints.size() < 5) {
648  sppt++;
649  rePass0 = 3;
650  continue;
651  } // for now...
652 
653  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
654  << "\n\t found " << spacepoints.size()
655  << " 3D spacepoint(s) for this element of std::vector<art:PtrVector> spacepoints. \n";
656 
657  // Let's find track's principle components.
658  // We will sort along that direction, rather than z.
659  // Further, we will skip outliers away from main axis.
660 
661  TPrincipal* principal = new TPrincipal(3, "ND");
662 
663  // I need to shuffle these around, so use copy constructor
664  // to make non-const version spacepointss.
665  art::PtrVector<recob::SpacePoint> spacepointss(spacepoints);
666 
667  // What I need is a nearest neighbor sorting.
668  if (fSortDim.compare("y") && fSortDim.compare("x"))
669  std::sort(spacepointss.begin(), spacepointss.end(), sp_sort_3dz);
670  if (!fSortDim.compare("y")) std::sort(spacepointss.begin(), spacepointss.end(), sp_sort_3dy);
671  if (!fSortDim.compare("x")) std::sort(spacepointss.begin(), spacepointss.end(), sp_sort_3dx);
672 
673  for (unsigned int point = 0; point < spacepointss.size(); ++point) {
674  if (point < (spacepointss.size() - nTailPoints)) {
675  principal->AddRow(spacepointss[point]->XYZ());
676  }
677  }
678  principal->MakePrincipals();
679 
680  const TVectorD* evals = principal->GetEigenValues();
681  const TMatrixD* evecs = principal->GetEigenVectors();
682  const TVectorD* means = principal->GetMeanValues();
683  const TVectorD* sigmas = principal->GetSigmas();
684 
685  Double_t tmp[3], tmp2[3];
686  principal->X2P((Double_t*)(means->GetMatrixArray()), tmp);
687  principal->X2P((Double_t*)(sigmas->GetMatrixArray()), tmp2);
688  for (unsigned int ii = 0; ii < 3; ++ii) {
689  fPCmeans[ii] = (Float_t)(tmp[ii]);
690  fPCsigmas[ii] = (Float_t)(tmp2[ii]);
691  fPCevals[ii] = (Float_t)(evals->GetMatrixArray())[ii];
692  // This method requires apparently pulling all 9
693  // elements. Maybe 3 works.
694  // Certainly, w can't be a scalar, I discovered.
695  double w[9];
696  evecs->ExtractRow(ii, 0, w);
697  fPC1[ii] = w[0];
698  fPC2[ii] = w[1];
699  fPC3[ii] = w[2];
700  }
701  Double_t tmp3[3], tmp4[3], tmp5[3];
702  principal->X2P((Double_t*)fPC1, tmp3);
703  principal->X2P((Double_t*)fPC2, tmp4);
704  principal->X2P((Double_t*)fPC3, tmp5);
705 
706  // Use a mip approximation assuming straight lines
707  // and a small angle wrt beam.
708  fMomStart[0] = spacepointss[spacepointss.size() - 1]->XYZ()[0] - spacepointss[0]->XYZ()[0];
709  fMomStart[1] = spacepointss[spacepointss.size() - 1]->XYZ()[1] - spacepointss[0]->XYZ()[1];
710  fMomStart[2] = spacepointss[spacepointss.size() - 1]->XYZ()[2] - spacepointss[0]->XYZ()[2];
711  // This presumes a 0.8 GeV/c particle
712  double dEdx = energyLossBetheBloch(mass, 1.0);
713  // mom is really KE.
714  TVector3 mom(dEdx * fMomStart[0], dEdx * fMomStart[1], dEdx * fMomStart[2]);
715  double pmag2 = pow(mom.Mag() + mass, 2. - mass * mass);
716  mom.SetMag(std::sqrt(pmag2));
717  // Over-estimate by just enough for contained particles (5%).
718  mom.SetMag(1.0 * mom.Mag());
719  // If 1st/last point is close to edge of TPC, this track is
720  // uncontained.Give higher momentum starting value in
721  // that case.
722  bool uncontained(false);
723  double close(5.); // cm.
724  double epsMag(0.001); // cm.
725  double epsX(250.0); // cm.
726  double epsZ(0.001); // cm.
727 
728  if (spacepointss[spacepointss.size() - 1]->XYZ()[0] > (2. * geom->DetHalfWidth() - close) ||
729  spacepointss[spacepointss.size() - 1]->XYZ()[0] < close ||
730  spacepointss[0]->XYZ()[0] > (2. * geom->DetHalfWidth() - close) ||
731  spacepointss[0]->XYZ()[0] < close ||
732  spacepointss[spacepointss.size() - 1]->XYZ()[1] > (1. * geom->DetHalfHeight() - close) ||
733  (spacepointss[spacepointss.size() - 1]->XYZ()[1] < -1. * geom->DetHalfHeight() + close) ||
734  spacepointss[0]->XYZ()[1] > (1. * geom->DetHalfHeight() - close) ||
735  spacepointss[0]->XYZ()[1] < (-1. * geom->DetHalfHeight() + close) ||
736  spacepointss[spacepointss.size() - 1]->XYZ()[2] > (geom->DetLength() - close) ||
737  spacepointss[spacepointss.size() - 1]->XYZ()[2] < close ||
738  spacepointss[0]->XYZ()[2] > (geom->DetLength() - close) ||
739  spacepointss[0]->XYZ()[2] < close)
740  uncontained = true;
741  fErrScaleSHere = fErrScaleS;
742  fErrScaleMHere = fErrScaleM;
743 
744  if (uncontained) {
745  // Big enough to not run out of gas right at end of
746  // track and give large angular deviations which
747  // will kill the fit.
748  mom.SetMag(2.0 * mom.Mag());
749  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit") << "Uncontained track ... ";
750  fDecimateHere = fDecimateU;
751  fMaxUpdateHere = fMaxUpdateU;
752  }
753  else {
754  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
755  << "Contained track ... Run " << evt.run() << " Event " << evt.id().event();
756  // Don't decimate contained tracks as drastically,
757  // and omit only very large corrections ...
758  // which hurt only high momentum tracks.
759  fDecimateHere = fDecimate;
760  fMaxUpdateHere = fMaxUpdate;
761  }
762  fcont = (int)(!uncontained);
763 
764  // This seems like best place to jump back to for a re-pass.
765  unsigned short rePass = rePass0; // 1 by default;
766  unsigned short maxPass(fMaxPass);
767  unsigned short tcnt1(0);
768  while (rePass <= maxPass) {
769 
770  TVector3 momM(mom);
771  TVector3 momErrFit(momM[0] / 3.0, momM[1] / 3.0,
772  momM[2] / 3.0); // GeV
773 
775  genf::GFDetPlane planeG((TVector3)(spacepointss[0]->XYZ()), momM);
776 
777  // Initialize with 1st spacepoint location and ...
778  rep = new genf::RKTrackRep((TVector3)(spacepointss[0]->XYZ()),
779  momM,
780  posErr,
781  momErrFit,
782  fPdg); // mu+ hypothesis
783 
784  genf::GFTrack fitTrack(rep); //initialized with smeared rep
785  fitTrack.setPDG(fPdg);
786  // Gonna sort in z cuz I want to essentially transform here to volTPC coords.
787  // volTPC coords, cuz that's what the Geant3/Geane stepper wants, as that's its understanding
788  // from the Geant4 geometry, which it'll use. EC, 7-Jan-2011.
789  int ihit = 0;
790  fptsNo = 0;
791  std::vector<unsigned int> spptSurvivedIndex;
792  std::vector<unsigned int> spptSkippedIndex;
793  unsigned int ppoint(0);
794  for (unsigned int point = 0; point < spacepointss.size(); ++point) {
795  double sep;
796  // Calculate the distance in 2nd and 3rd PCs and
797  // reject spt if it's too far out. Remember, the
798  // sigmas are std::sqrt(eigenvals).
799  double tmp[3];
800  principal->X2P((Double_t*)(spacepointss[point]->XYZ()), tmp);
801  sep = std::sqrt(tmp[1] * tmp[1] / fPCevals[1] + tmp[2] * tmp[2] / fPCevals[2]);
802  if ((std::abs(sep) > fPerpLim) && (point < (spacepointss.size() - nTailPoints)) &&
803  rePass <= 1) {
804  spptSkippedIndex.push_back(point);
805  continue;
806  }
807  // If point is too close in Mag or Z or too far in X from last kept point drop it.
808  // I think this is largely redundant with PCA cut.
809  TVector3 one(spacepointss[point]->XYZ());
810  TVector3 two(spacepointss[ppoint]->XYZ());
811  if (rePass == 2 && uncontained) {
812  epsMag = fDistanceU; // cm
813  fNumIt = 4;
814  fErrScaleMHere = 0.1;
815  // Above allows us to pretend as though measurements
816  // are perfect, which we can ostensibly do now with
817  // clean set of sppts. This creates larger gains, bigger
818  // updates: bigger sensitivity to multiple scattering.
819  }
820  else if (rePass == 2 && !uncontained) {}
821  if (point > 0 &&
822  ((one - two).Mag() < epsMag || // too close
823  ((one - two).Mag() > 8.0 && rePass == 1) || // too far
824  std::abs(spacepointss[point]->XYZ()[2] - spacepointss[ppoint]->XYZ()[2]) < epsZ ||
825  std::abs(spacepointss[point]->XYZ()[0] - spacepointss[ppoint]->XYZ()[0]) > epsX)) {
826  spptSkippedIndex.push_back(point);
827  continue;
828  }
829 
830  if (
831  point % fDecimateHere &&
832  rePass <=
833  1) // Jump out of loop except on every fDecimate^th pt. fDecimate==1 never sees continue.
834  {
835  /* Replace continue with a counter that will be used to index into vector of GFKalman fits. */
836  continue;
837  }
838 
839  ppoint = point;
840  TVector3 spt3 = (TVector3)(spacepointss[point]->XYZ());
841  std::vector<double> err3;
842  err3.push_back(spacepointss[point]->ErrXYZ()[0]);
843  err3.push_back(spacepointss[point]->ErrXYZ()[2]);
844  err3.push_back(spacepointss[point]->ErrXYZ()[4]);
845  err3.push_back(spacepointss[point]->ErrXYZ()[5]); // lower triangle diags.
846  if (fptsNo < fDimSize) {
847  fshx[fptsNo] = spt3[0];
848  fshy[fptsNo] = spt3[1];
849  fshz[fptsNo] = spt3[2];
850  feshx[fptsNo] = err3[0];
851  feshy[fptsNo] = err3[1];
852  feshz[fptsNo] = err3[3];
853  feshyz[fptsNo] = err3[2];
854  fsep[fptsNo] = sep;
855 
856  if (fptsNo > 1) {
857  TVector3 pointer(fshx[fptsNo] - fshx[fptsNo - 1],
858  fshy[fptsNo] - fshy[fptsNo - 1],
859  fshz[fptsNo] - fshz[fptsNo - 1]);
860  TVector3 pointerPrev(fshx[fptsNo - 1] - fshx[fptsNo - 2],
861  fshy[fptsNo - 1] - fshy[fptsNo - 2],
862  fshz[fptsNo - 1] - fshz[fptsNo - 2]);
863  fth[fptsNo] = (pointer.Unit()).Angle(pointerPrev.Unit());
864  }
865  feth[fptsNo] = 0.0;
866  fedudw[fptsNo] = 0.0;
867  fedvdw[fptsNo] = 0.0;
868  feu[fptsNo] = 0.0;
869  fev[fptsNo] = 0.0;
870  fupdate[fptsNo] = 0.0;
871  }
872 
873  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
874  << "ihit xyz..." << spt3[0] << "," << spt3[1] << "," << spt3[2];
875 
876  fitTrack.addHit(new genf::PointHit(spt3, err3),
877  1, //dummy detector id
878  ihit++);
879  spptSurvivedIndex.push_back(point);
880  fptsNo++;
881  } // end loop over spacepoints.
882 
883  if (fptsNo <=
884  fMinNumSppts) // Cuz 1st 2 in each direction don't count. Should have, say, 3 more.
885  {
886  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
887  << "Bailing cuz only " << fptsNo << " spacepoints.";
888  rePass++;
889  continue;
890  }
891  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit") << "Fitting on " << fptsNo << " spacepoints.";
892 
893  genf::GFKalman k;
894  k.setBlowUpFactor(5); // 500 out of box. EC, 6-Jan-2011.
895  k.setMomHigh(fMomHigh); // Don't fit above this many GeV.
896  k.setMomLow(fMomLow); // Don't fit below this many GeV.
897 
898  k.setInitialDirection(+1); // Instead of 1 out of box. EC, 6-Jan-2011.
900  k.setMaxUpdate(fMaxUpdateHere); // 0 out abs(update) bigger than this.
901  k.setErrorScaleSTh(fErrScaleSHere);
902  k.setErrorScaleMTh(fErrScaleMHere);
903 
904  bool skipFill = false;
905  std::vector<TMatrixT<double>> hitMeasCov;
906  std::vector<TMatrixT<double>> hitUpdate;
907  std::vector<TMatrixT<double>> hitCov;
908  std::vector<TMatrixT<double>> hitCov7x7;
909  std::vector<TMatrixT<double>> hitState;
910  std::vector<double> hitChi2;
911  std::vector<TVector3> hitPlaneXYZ;
912  std::vector<TVector3> hitPlaneUxUyUz;
913  std::vector<TVector3> hitPlaneU;
914  std::vector<TVector3> hitPlaneV;
915 
916  try {
917  if (fDoFit) k.processTrack(&fitTrack);
918  }
919  catch (cet::exception& e) {
920  MF_LOG_ERROR("Track3DKalmanSPS")
921  << "just caught a cet::exception: " << e.what()
922  << "\nExceptions won't be further handled; skip filling big chunks of the TTree.";
923  skipFill = true;
924  }
925 
926  if (rep->getStatusFlag() == 0) // 0 is successful completion
927  {
928  if (mf::isDebugEnabled()) {
929 
930  std::ostringstream dbgmsg;
931  dbgmsg << "Original plane:";
932  planeG.Print(dbgmsg);
933 
934  dbgmsg << "Current (fit) reference Plane:";
935  rep->getReferencePlane().Print(dbgmsg);
936 
937  dbgmsg << "Last reference Plane:";
938  rep->getLastPlane().Print(dbgmsg);
939 
940  if (planeG != rep->getReferencePlane())
941  dbgmsg << " => original hit plane (not surprisingly) not current reference Plane!";
942 
943  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit") << dbgmsg.str();
944  }
945  if (!skipFill) {
946  hitMeasCov = fitTrack.getHitMeasuredCov();
947  hitUpdate = fitTrack.getHitUpdate();
948  hitCov = fitTrack.getHitCov();
949  hitCov7x7 = fitTrack.getHitCov7x7();
950  hitState = fitTrack.getHitState();
951  hitChi2 = fitTrack.getHitChi2();
952  hitPlaneXYZ = fitTrack.getHitPlaneXYZ();
953  hitPlaneUxUyUz = fitTrack.getHitPlaneUxUyUz();
954  hitPlaneU = fitTrack.getHitPlaneU();
955  hitPlaneV = fitTrack.getHitPlaneV();
956  unsigned int totHits = hitState.size();
957 
958  // Pick up info from last fwd Kalman pass.
959  unsigned int jhit = 0;
960  for (unsigned int ihit = totHits - 2 * totHits / (2 * fNumIt);
961  ihit < (totHits - totHits / (2 * fNumIt));
962  ihit++) // was ihit<ihit<(totHits-fptsNo)<7
963  {
964  feth[jhit] = (Float_t)(hitMeasCov.at(ihit)[0][0]); // eth
965  fedudw[jhit] = (Float_t)(hitMeasCov.at(ihit)[1][1]);
966  fedvdw[jhit] = (Float_t)(hitMeasCov.at(ihit)[2][2]);
967  feu[jhit] = (Float_t)(hitMeasCov.at(ihit)[3][3]);
968  fev[jhit] = (Float_t)(hitMeasCov.at(ihit)[4][4]);
969  fupdate[jhit] = (Float_t)(hitUpdate.at(ihit)[0][0]);
970  fchi2hit[jhit] = (Float_t)(hitChi2.at(ihit));
971  jhit++;
972  }
973 
974  stREC->ResizeTo(rep->getState());
975  *stREC = rep->getState();
976  covREC->ResizeTo(rep->getCov());
977  *covREC = rep->getCov();
978  double dum[5];
979  double dum2[5];
980  for (unsigned int ii = 0; ii < 5; ii++) {
981  stREC->ExtractRow(ii, 0, dum);
982  fState0[ii] = dum[0];
983  covREC->ExtractRow(ii, 0, dum2);
984  for (unsigned int jj = 0; jj < 5; jj++) {
985  fCov0[ii * 5 + jj] = dum2[jj];
986  }
987  }
988  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
989  << " First State and Cov:" << genf::ROOTobjectToString(*stREC)
991  chi2 = (Float_t)(rep->getChiSqu());
992  ndf = rep->getNDF();
993  nfail = fitTrack.getFailedHits();
994  nchi2rePass = (int)rePass;
995  ispptvec = 1 + std::distance(spptB, sppt);
996  chi2ndf = (Float_t)(chi2 / ndf);
997 
998  nTrks++;
999  MF_LOG_DEBUG("Track3DKalmanSPS_GenFit")
1000  << "Track3DKalmanSPS about to do tree->Fill(). Chi2/ndf is " << chi2 / ndf << ".";
1001  fpMCMom[3] = MCMomentum.Mag();
1002  for (int ii = 0; ii < 3; ++ii) {
1003  fpMCMom[ii] = MCMomentum[ii];
1004  fpMCPos[ii] = MCOrigin[ii];
1005  fpREC[ii] = hitPlaneUxUyUz.at(totHits - 2 * totHits / (2 * fNumIt))[ii];
1006  fpRECL[ii] = hitPlaneUxUyUz.at(totHits - totHits / (2 * fNumIt) - 1)[ii];
1007  }
1008 
1009  evtt = (unsigned int)evt.id().event();
1010  nspptvec = (unsigned int)spptListHandle->size();
1011 
1012  cntp++;
1013  std::vector<std::vector<double>> dQdx;
1014  // Calculate LastFwdPass quantities.
1015  std::vector<TMatrixT<double>> hitCovLFP;
1016  std::vector<TVector3> hitPlaneXYZLFP;
1017  std::vector<TVector3> hitPlaneUxUyUzLFP;
1018  std::vector<TVector3> hitPlanePxPyPzLFP;
1019  std::vector<TVector3> hitPlaneULFP;
1020  std::vector<TVector3> hitPlaneVLFP;
1021  std::vector<double> pLFP;
1022  std::vector<TMatrixT<double>> c7x7LFP;
1023 
1024  art::FindManyP<recob::Hit> hitAssns(spacepointss, evt, fSpptModuleLabel);
1025  for (unsigned int ii = 0; ii < totHits / (2 * fNumIt); ii++) {
1026  pLFP.push_back(1. / hitState.at(totHits - 2 * totHits / (2 * fNumIt) + ii)[0][0]);
1027  // hitCov -> hitCov7x7 !! EC, 11-May-2012.
1028  c7x7LFP.push_back(hitCov7x7.at(totHits - 2 * totHits / (2 * fNumIt) + ii));
1029  hitCovLFP.push_back(hitCov.at(totHits - 2 * totHits / (2 * fNumIt) + ii));
1030  hitPlaneXYZLFP.push_back(hitPlaneXYZ.at(totHits - 2 * totHits / (2 * fNumIt) + ii));
1031  hitPlaneUxUyUzLFP.push_back(
1032  hitPlaneUxUyUz.at(totHits - 2 * totHits / (2 * fNumIt) + ii));
1033  hitPlanePxPyPzLFP.push_back(hitPlaneUxUyUzLFP.back() * pLFP.back());
1034  hitPlaneULFP.push_back(hitPlaneU.at(totHits - 2 * totHits / (2 * fNumIt) + ii));
1035  hitPlaneVLFP.push_back(hitPlaneV.at(totHits - 2 * totHits / (2 * fNumIt) + ii));
1036  // Transform cov appropriate for track rotated
1037  // about w, forcing
1038  // v to be in y-z plane and u pointing in
1039  // +-ive x direction, per TrackAna convention.
1040 
1041  rotationCov(hitCovLFP.back(), hitPlaneULFP.back(), hitPlaneVLFP.back());
1042  dQdx.push_back(
1043  dQdxCalc(hitAssns, spacepointss, hitPlaneUxUyUzLFP.back(), hitPlaneXYZLFP.back()));
1044  fdQdx[ii] = dQdx.back().back();
1045  }
1046  fpREC[3] = rep->getMom(rep->getReferencePlane()).Mag();
1047  fpRECL[3] = pLFP[1];
1048 
1049  tree->Fill();
1050 
1051  // Put newest track on stack for this set of sppts,
1052  // remove previous one.
1053  recob::tracking::SMatrixSym55 covVtx, covEnd;
1054  for (unsigned int i = 0; i < 5; i++) {
1055  for (unsigned int j = i; j < 5; j++) {
1056  covVtx(i, j) = hitCovLFP.front()(i, j);
1057  covEnd(i, j) = hitCovLFP.back()(i, j);
1058  }
1059  }
1060  recob::Track the3DTrack(
1062  recob::tracking::convertCollToVector(hitPlanePxPyPzLFP),
1063  recob::Track::Flags_t(hitPlaneXYZLFP.size()),
1064  true),
1065  0,
1066  -1.,
1067  0,
1068  covVtx,
1069  covEnd,
1070  tcnt++);
1071  if (rePass == 1) tcnt1++; // won't get here if Trackfit failed.
1072  if (rePass != 1 && tcnt1) tcol->pop_back();
1073  tcol->push_back(the3DTrack);
1074  util::CreateAssn(evt, *tcol, spacepointss, *tspassn);
1075  art::PtrVector<recob::Hit> hits; // = hitAssns;
1076  for (unsigned int ii = 0; ii < spacepointss.size(); ++ii) {
1077  hits.insert(hits.end(), hitAssns.at(ii).begin(), hitAssns.at(ii).end());
1078  }
1079  util::CreateAssn(evt, *tcol, hits, *thassn, tcol->size() - 1);
1080  } // end !skipFill
1081  } // getStatusFlag
1082 
1083  if (!rep) delete rep;
1084  rePass++;
1085  // need to first excise bad spacepoints.
1086  // Grab up large Chi2hits first.
1087  art::PtrVector<recob::SpacePoint> spacepointssExcise;
1088  for (unsigned int ind = 0; ind < spptSurvivedIndex.size(); ++ind) {
1089  // Stricter to chuck sppts from uncontained then contained trks.
1090  if ((uncontained && fchi2hit[ind] > fChi2Thresh) ||
1091  (!uncontained && fchi2hit[ind] > 1.e9) || fchi2hit[ind] < 0.0
1092  // =0 eliminates ruled-out large updates. Not obviously
1093  // helpful.
1094  // add a restriction on dQdx here ...
1095  ) {
1097  spacepointss.begin() + spptSurvivedIndex[ind];
1098  spacepointssExcise.push_back(*spptIt);
1099  }
1100  }
1101  // Now grab up those sppts which we skipped and don't want
1102  // to reconsider cuz they're too close to each other or
1103  // cuz they're too far in x, e.g.
1104  for (unsigned int ind = 0; ind < spptSkippedIndex.size(); ++ind) {
1106  spacepointss.begin() + spptSkippedIndex[ind];
1107  spacepointssExcise.push_back(*spptIt);
1108  }
1109  // Get rid of redundantly Excised sppts before proceeding.
1110  std::stable_sort(spacepointss.begin(), spacepointss.end());
1111  std::stable_sort(spacepointssExcise.begin(), spacepointssExcise.end());
1112  std::set_union(spacepointssExcise.begin(),
1113  spacepointssExcise.end(),
1114  spacepointssExcise.begin(),
1115  spacepointssExcise.end(),
1116  spacepointssExcise.begin());
1117  // Now excise. New spacepointss will be smaller for second pass.
1119  std::set_difference(spacepointss.begin(),
1120  spacepointss.end(),
1121  spacepointssExcise.begin(),
1122  spacepointssExcise.end(),
1123  spacepointss.begin());
1124  spacepointss.erase(diffSpptIt, spacepointss.end());
1125 
1126  // calculate new seed momentum, and errors as merited
1127  if (rePass == 2 /* && uncontained */) {
1128  if (fpREC[3] < fMomHigh && fpREC[3] > fMomLow) {
1129  double kick(0.9); //Try to get away with a smaller start
1130  // for contained tracks. While for uncontained tracks
1131  // let's start up at a higher momentum and come down.
1132  // Though, 2 (1) GeV/c tracks are too low (high), so
1133  // instead let's actually lower starting value on
1134  // this second pass. -- EC 7-Mar-2013
1135  if (uncontained) kick = 0.5;
1136  for (int ii = 0; ii < 3; ++ii) {
1137  mom[ii] = momM[ii] * kick;
1138  }
1139  }
1140  else if (uncontained) {
1141  double unstick(1.0);
1142  if (fpREC[3] >= fMomHigh) unstick = 0.3;
1143  for (int ii = 0; ii < 3; ++ii) {
1144  mom[ii] = momM[ii] * unstick;
1145  }
1146  }
1147  else
1148  for (int ii = 0; ii < 3; ++ii) {
1149  mom[ii] = 1.1 * momM[ii];
1150  }
1151  }
1152 
1153  } // end while rePass<=maxPass
1154 
1155  sppt++;
1156 
1157  } // end while on elements of std::vector of art::PtrVectors of SpPts.
1158 
1159  if (!repMC) delete repMC;
1160 
1161  evt.put(std::move(tcol));
1162  // and now the spacepoints
1163  evt.put(std::move(tspassn));
1164  // and the hits. Note that these are all the hits from all the spacepoints considered,
1165  // even though they're not all contributing to the tracks.
1166  evt.put(std::move(thassn));
1167  }
TMatrixT< Double_t > * stREC
unsigned int getNDF() const
std::vector< double > fMomErr
void setMomLow(Double_t f)
Definition: GFKalman.h:117
std::string GetLArTPCVolumeName(TPCID const &tpcid=tpc_zero) const
Return the name of specified LAr TPC volume.
void setMaxUpdate(Double_t f)
Definition: GFKalman.h:119
TMatrixT< Double_t > * stMCT
static bool sp_sort_3dz(const art::Ptr< recob::SpacePoint > &h1, const art::Ptr< recob::SpacePoint > &h2)
typename data_t::iterator iterator
Definition: PtrVector.h:54
const GFDetPlane & getReferencePlane() const
GFDetPlane getLastPlane() const
void rotationCov(TMatrixT< Double_t > &cov, const TVector3 &u, const TVector3 &v)
std::vector< Vector_t > convertCollToVector(std::vector< Vector > const &coll)
Definition: TrackingTypes.h:78
iterator begin()
Definition: PtrVector.h:217
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
void setMomHigh(Double_t f)
Definition: GFKalman.h:118
TrackTrajectory::Flags_t Flags_t
Definition: Track.h:67
constexpr auto abs(T v)
Returns the absolute value of the argument.
#define MF_LOG_ERROR(category)
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 >> SMatrixSym55
Float_t tmp
Definition: plot.C:35
std::vector< double > fPosErr
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:228
const TMatrixT< Double_t > & getState() const
bool isRealData() const
Definition: Event.cc:53
static bool sp_sort_3dy(const art::Ptr< recob::SpacePoint > &h1, const art::Ptr< recob::SpacePoint > &h2)
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
TString part[npart]
Definition: Style.C:32
void hits()
Definition: readHits.C:15
std::vector< double > fMomStart
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
virtual TVector3 getMom(const GFDetPlane &pl)=0
static bool sp_sort_3dx(const art::Ptr< recob::SpacePoint > &h1, const art::Ptr< recob::SpacePoint > &h2)
A trajectory in space reconstructed from hits.
void setBlowUpFactor(double f)
Set the blowup factor (see blowUpCovs() )
Definition: GFKalman.h:116
static bool sp_sort_nsppts(const art::PtrVector< recob::SpacePoint > &h1, const art::PtrVector< recob::SpacePoint > &h2)
iterator end()
Definition: PtrVector.h:231
double energyLossBetheBloch(const double &mass, const double p)
void setNumIterations(Int_t i)
Set number of iterations for Kalman Filter.
Definition: GFKalman.h:91
TMatrixT< Double_t > * covREC
void processTrack(GFTrack *)
Performs fit on a GFTrack.
Definition: GFKalman.cxx:57
static GFFieldManager * getInstance()
TMatrixT< Double_t > * covMCT
bool isDebugEnabled()
std::vector< Point_t > convertCollToPoint(std::vector< Point > const &coll)
Definition: TrackingTypes.h:68
const TMatrixT< Double_t > & getCov() const
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2675
std::string ROOTobjectToString(const ROOTOBJ &obj)
Shortcut to write one ROOT object into a string.
Definition: GFException.h:114
size_type size() const
Definition: PtrVector.h:302
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.
iterator insert(iterator position, Ptr< U > const &p)
std::vector< double > dQdxCalc(const art::FindManyP< recob::Hit > &h, const art::PtrVector< recob::SpacePoint > &s, const TVector3 &p, const TVector3 &d)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
in close()
void setInitialDirection(int d)
Sets the inital direction of the track fit (1 for inner to outer, or -1 for outer to inner)...
Definition: GFKalman.h:112
#define MF_LOG_DEBUG(id)
void init(GFAbsBField *b)
set the magntic field here. Magnetic field classes must be derived from GFAbsBField ...
EventNumber_t event() const
Definition: EventID.h:116
Length_t DetHalfHeight(TPCID const &tpcid=tpc_zero) const
Returns the half height of the active volume of the specified TPC.
void setErrorScaleSTh(Double_t f)
Definition: GFKalman.h:120
double getChiSqu() const
Float_t e
Definition: plot.C:35
RunNumber_t run() const
Definition: Event.cc:29
Float_t w
Definition: plot.C:20
EventID id() const
Definition: Event.cc:23
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
void setErrorScaleMTh(Double_t f)
Definition: GFKalman.h:121
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
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 trkf::Track3DKalmanSPS::rotationCov ( TMatrixT< Double_t > &  cov,
const TVector3 &  u,
const TVector3 &  v 
)
private

Definition at line 293 of file Track3DKalmanSPS_module.cc.

References w.

Referenced by produce().

294  {
295  TVector3 xhat(1.0, 0.0, 0.0);
296  TVector3 yhat(0.0, 1.0, 0.0);
297  TVector3 zhat(0.0, 0.0, 1.0);
298  TVector3 w(u.Cross(v));
299  TVector3 uprime(u);
300  TVector3 vprime(w.Cross(xhat)); // vprime now lies in yz plane
301  Double_t angle(v.Angle(vprime)); /* This is the angle through which v
302  must rotate. */
303  uprime.Rotate(angle, w); // u now is rotated the same amount
304  if (uprime * xhat < 0) {
305  uprime.Rotate(TMath::Pi(), w);
306  vprime.Rotate(TMath::Pi(), w);
307  angle += TMath::Pi();
308  }
309  // Build the block-diagonal 5x5 matrix
310  double c = TMath::Cos(angle), s = TMath::Sin(angle);
311  TMatrixT<Double_t> rot(5, 5);
312  rot[0][0] = 1.0;
313  rot[1][1] = c;
314  rot[1][2] = s;
315  rot[2][1] = -s;
316  rot[2][2] = c;
317  rot[3][3] = c;
318  rot[3][4] = s;
319  rot[4][3] = -s;
320  rot[4][4] = c;
321 
322  cov = rot * cov;
323  }
Float_t w
Definition: plot.C:20
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

Float_t trkf::Track3DKalmanSPS::chi2
private

Definition at line 124 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

Float_t trkf::Track3DKalmanSPS::chi2ndf
private

Definition at line 125 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

TMatrixT<Double_t>* trkf::Track3DKalmanSPS::covMCT
private

Definition at line 121 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

TMatrixT<Double_t>* trkf::Track3DKalmanSPS::covREC
private

Definition at line 123 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

unsigned int trkf::Track3DKalmanSPS::evtt
private

Definition at line 139 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fchi2hit
private

Definition at line 150 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

double trkf::Track3DKalmanSPS::fChi2Thresh
private

Definition at line 184 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

std::string trkf::Track3DKalmanSPS::fClusterModuleLabel
private

Definition at line 111 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

int trkf::Track3DKalmanSPS::fcont
private

Definition at line 126 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fCov0
private

Definition at line 133 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

int trkf::Track3DKalmanSPS::fDecimate
private

Definition at line 176 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

int trkf::Track3DKalmanSPS::fDecimateU
private

Definition at line 178 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

unsigned int trkf::Track3DKalmanSPS::fDimSize
private

Definition at line 159 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

double trkf::Track3DKalmanSPS::fDistanceU
private

Definition at line 179 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

bool trkf::Track3DKalmanSPS::fDoFit
private

Definition at line 171 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

Float_t* trkf::Track3DKalmanSPS::fdQdx
private

Definition at line 158 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fedudw
private

Definition at line 153 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fedvdw
private

Definition at line 154 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

double trkf::Track3DKalmanSPS::fErrScaleM
private

Definition at line 175 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

double trkf::Track3DKalmanSPS::fErrScaleS
private

Definition at line 174 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

Float_t* trkf::Track3DKalmanSPS::feshx
private

Definition at line 145 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::feshy
private

Definition at line 146 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::feshyz
private

Definition at line 148 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::feshz
private

Definition at line 147 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::feth
private

Definition at line 152 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::feu
private

Definition at line 155 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fev
private

Definition at line 156 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

std::string trkf::Track3DKalmanSPS::fG4ModuleLabel
private

Definition at line 114 of file Track3DKalmanSPS_module.cc.

Referenced by Track3DKalmanSPS().

std::string trkf::Track3DKalmanSPS::fGenieGenModuleLabel
private

Definition at line 113 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

int trkf::Track3DKalmanSPS::fMaxPass
private

Definition at line 185 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

double trkf::Track3DKalmanSPS::fMaxUpdate
private

Definition at line 177 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

double trkf::Track3DKalmanSPS::fMaxUpdateU
private

Definition at line 180 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

uint16_t trkf::Track3DKalmanSPS::fMinNumSppts
private

Definition at line 173 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

std::vector<double> trkf::Track3DKalmanSPS::fMomErr
private

Definition at line 168 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

double trkf::Track3DKalmanSPS::fMomHigh
private

Definition at line 182 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

double trkf::Track3DKalmanSPS::fMomLow
private

Definition at line 181 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

std::vector<double> trkf::Track3DKalmanSPS::fMomStart
private

Definition at line 169 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

int trkf::Track3DKalmanSPS::fNumIt
private

Definition at line 172 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

Float_t* trkf::Track3DKalmanSPS::fPC1
private

Definition at line 163 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fPC2
private

Definition at line 164 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fPC3
private

Definition at line 165 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fPCevals
private

Definition at line 161 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fPCmeans
private

Definition at line 160 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fPCsigmas
private

Definition at line 162 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

int trkf::Track3DKalmanSPS::fPdg
private

Definition at line 183 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

double trkf::Track3DKalmanSPS::fPerpLim
private

Definition at line 170 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

Float_t* trkf::Track3DKalmanSPS::fpMCMom
private

Definition at line 130 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fpMCPos
private

Definition at line 131 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

std::vector<double> trkf::Track3DKalmanSPS::fPosErr
private

Definition at line 167 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

Float_t* trkf::Track3DKalmanSPS::fpREC
private

Definition at line 129 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fpRECL
private

Definition at line 128 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

unsigned int trkf::Track3DKalmanSPS::fptsNo
private

Definition at line 141 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fsep
private

Definition at line 157 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fshx
private

Definition at line 142 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fshy
private

Definition at line 143 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fshz
private

Definition at line 144 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

std::string trkf::Track3DKalmanSPS::fSortDim
private

Definition at line 115 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

std::string trkf::Track3DKalmanSPS::fSpptModuleLabel
private

Definition at line 112 of file Track3DKalmanSPS_module.cc.

Referenced by produce(), and Track3DKalmanSPS().

Float_t* trkf::Track3DKalmanSPS::fState0
private

Definition at line 132 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fth
private

Definition at line 151 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

Float_t* trkf::Track3DKalmanSPS::fupdate
private

Definition at line 149 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), endJob(), and produce().

int trkf::Track3DKalmanSPS::ispptvec
private

Definition at line 137 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

int trkf::Track3DKalmanSPS::nchi2rePass
private

Definition at line 136 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

int trkf::Track3DKalmanSPS::ndf
private

Definition at line 135 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

int trkf::Track3DKalmanSPS::nfail
private

Definition at line 134 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

int trkf::Track3DKalmanSPS::nspptvec
private

Definition at line 138 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

unsigned int trkf::Track3DKalmanSPS::nTrks
private

Definition at line 140 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

genf::GFAbsTrackRep* trkf::Track3DKalmanSPS::rep
private

Definition at line 188 of file Track3DKalmanSPS_module.cc.

Referenced by endJob(), and produce().

genf::GFAbsTrackRep* trkf::Track3DKalmanSPS::repMC
private

Definition at line 187 of file Track3DKalmanSPS_module.cc.

Referenced by endJob(), and produce().

TMatrixT<Double_t>* trkf::Track3DKalmanSPS::stMCT
private

Definition at line 120 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

TMatrixT<Double_t>* trkf::Track3DKalmanSPS::stREC
private

Definition at line 122 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().

TTree* trkf::Track3DKalmanSPS::tree
private

Definition at line 118 of file Track3DKalmanSPS_module.cc.

Referenced by beginJob(), and produce().


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