All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/CRT/CRTUtils/CRTTrackRecoAlg.h
Go to the documentation of this file.
1 #ifndef CRTTRACKRECOALG_H_SEEN
2 #define CRTTRACKRECOALG_H_SEEN
3 
4 
5 ///////////////////////////////////////////////
6 // CRTTrackRecoAlg.h
7 //
8 // Functions for CRT track reconstruction
9 // T Brooks (tbrooks@fnal.gov), November 2018
10 ///////////////////////////////////////////////
11 
12 // framework
13 #include "art/Framework/Principal/Event.h"
14 #include "art/Framework/Core/ModuleMacros.h"
15 #include "fhiclcpp/ParameterSet.h"
16 #include "art/Framework/Principal/Handle.h"
17 #include "canvas/Persistency/Common/Ptr.h"
18 #include "canvas/Persistency/Common/PtrVector.h"
19 #include "art/Framework/Services/Registry/ServiceHandle.h"
20 #include "messagefacility/MessageLogger/MessageLogger.h"
21 #include "canvas/Persistency/Common/FindManyP.h"
22 
23 // LArSoft
28 
29 // Utility libraries
30 #include "messagefacility/MessageLogger/MessageLogger.h"
31 #include "fhiclcpp/ParameterSet.h"
32 #include "fhiclcpp/types/Table.h"
33 #include "fhiclcpp/types/Atom.h"
34 #include "cetlib/pow.h" // cet::sum_of_squares()
35 
41 
42 // c++
43 #include <iostream>
44 #include <stdio.h>
45 #include <sstream>
46 #include <vector>
47 #include <map>
48 #include <utility>
49 #include <cmath>
50 #include <memory>
51 
52 // ROOT
53 #include "TVector3.h"
54 #include "TGeoManager.h"
55 
56 
57 namespace sbnd{
58 
60  public:
61 
62  struct Config {
63  using Name = fhicl::Name;
64  using Comment = fhicl::Comment;
65 
66  fhicl::Atom<double> TimeLimit {
67  Name("TimeLimit"),
68  Comment("")
69  };
70 
71  fhicl::Atom<double> AverageHitDistance {
72  Name("AverageHitDistance"),
73  Comment("Distance to average hits over on same plane")
74  };
75 
76  fhicl::Atom<double> DistanceLimit {
77  Name("DistanceLimit"),
78  Comment("Distance to combine CRT hits into track")
79  };
80 
81  };
82 
83  CRTTrackRecoAlg(const Config& config);
84 
85  CRTTrackRecoAlg(const fhicl::ParameterSet& pset) :
86  CRTTrackRecoAlg(fhicl::Table<Config>(pset, {})()) {}
87 
88  CRTTrackRecoAlg(double aveHitDist, double distLim);
89 
91 
92  void reconfigure(const Config& config);
93 
94  std::vector<std::vector<art::Ptr<sbn::crt::CRTHit>>> CreateCRTTzeros(std::vector<art::Ptr<sbn::crt::CRTHit>>);
95 
96  // Function to make creating CRTTracks easier
99 
100  // Function to average hits within a certain distance of each other
101  std::vector<std::pair<sbn::crt::CRTHit, std::vector<int>>> AverageHits(std::vector<art::Ptr<sbn::crt::CRTHit>> hits, std::map<art::Ptr<sbn::crt::CRTHit>, int> hitIds);
102  std::vector<sbn::crt::CRTHit> AverageHits(std::vector<art::Ptr<sbn::crt::CRTHit>> hits);
103 
104  // Take a list of hits and find average parameters
105  sbn::crt::CRTHit DoAverage(std::vector<art::Ptr<sbn::crt::CRTHit>> hits);
106 
107  // Create CRTTracks from list of hits
108  std::vector<std::pair<sbn::crt::CRTTrack, std::vector<int>>> CreateTracks(std::vector<std::pair<sbn::crt::CRTHit, std::vector<int>>> hits);
109  std::vector<sbn::crt::CRTTrack> CreateTracks(std::vector<sbn::crt::CRTHit> hits);
110 
111 
112  private:
113 
114  double fTimeLimit;
117 
120 
121  };
122 
123 }
124 
125 #endif
Declaration of signal hit object.
std::vector< std::pair< sbn::crt::CRTTrack, std::vector< int > > > CreateTracks(std::vector< std::pair< sbn::crt::CRTHit, std::vector< int >>> hits)
std::vector< std::pair< sbn::crt::CRTHit, std::vector< int > > > AverageHits(std::vector< art::Ptr< sbn::crt::CRTHit >> hits, std::map< art::Ptr< sbn::crt::CRTHit >, int > hitIds)
std::vector< std::vector< art::Ptr< sbn::crt::CRTHit > > > CreateCRTTzeros(std::vector< art::Ptr< sbn::crt::CRTHit >>)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
BEGIN_PROLOG vertical distance to the surface Name
sbn::crt::CRTHit DoAverage(std::vector< art::Ptr< sbn::crt::CRTHit >> hits)
Provides recob::Track data product.
sbn::crt::CRTTrack FillCrtTrack(sbn::crt::CRTHit hit1, sbn::crt::CRTHit hit2, bool complete)
stream1 can override from command line with o or output services user sbnd
CRTTrackRecoAlg(const fhicl::ParameterSet &pset)