All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
icaruscode/icaruscode/CRT/CRTUtils/CRTTrackRecoAlg.h
Go to the documentation of this file.
1 #ifndef CRTTRACKRECOALG_H_SEEN
2 #define CRTTRACKRECOALG_H_SEEN
3 
4 //////////////////////////////////////////////////////////////////////////////////
5 // CRTTrackRecoAlg.h
6 //
7 // Functions for CRT track reconstruction
8 // written by T Brooks (tbrooks@fnal.gov), November 2018
9 // ported to and modified for use with icaruscode by Chris.Hilgenberg@colostate.edu
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 "art_root_io/TFileService.h"
21 #include "art_root_io/TFileDirectory.h"
22 #include "messagefacility/MessageLogger/MessageLogger.h"
23 #include "canvas/Persistency/Common/FindManyP.h"
24 
25 // LArSoft
30 
31 // Utility libraries
32 #include "messagefacility/MessageLogger/MessageLogger.h"
33 #include "fhiclcpp/ParameterSet.h"
34 #include "fhiclcpp/types/Table.h"
35 #include "fhiclcpp/types/Atom.h"
36 #include "cetlib/pow.h" // cet::sum_of_squares()
40 
41 // c++
42 #include <iostream>
43 #include <stdio.h>
44 #include <sstream>
45 #include <vector>
46 #include <map>
47 #include <utility>
48 #include <cmath>
49 #include <memory>
50 
51 // ROOT
52 #include "TVector3.h"
53 #include "TGeoManager.h"
54 
55 using std::vector;
56 using std::pair;
57 using std::map;
58 
59 namespace icarus{
60 namespace crt{
61 
63  public:
64 
65  struct Config {
66  using Name = fhicl::Name;
67  using Comment = fhicl::Comment;
68 
69  fhicl::Atom<double> TimeLimit {
70  Name("TimeLimit"),
71  Comment("")
72  };
73 
74  fhicl::Atom<double> AverageHitDistance {
75  Name("AverageHitDistance"),
76  Comment("Distance to average hits over on same plane")
77  };
78 
79  fhicl::Atom<double> DistanceLimit {
80  Name("DistanceLimit"),
81  Comment("Distance to combine CRT hits into track")
82  };
83 
84  };
85 
86  CRTTrackRecoAlg(const Config& config);
87 
88  CRTTrackRecoAlg(const fhicl::ParameterSet& pset) :
89  CRTTrackRecoAlg(fhicl::Table<Config>(pset, {})()) {}
90 
91  CRTTrackRecoAlg(double aveHitDist, double distLim);
92 
94 
95  void reconfigure(const Config& config);
96 
97  vector<vector<art::Ptr<sbn::crt::CRTHit>>> CreateCRTTzeros(vector<art::Ptr<sbn::crt::CRTHit>>);
98 
99  // Function to make creating CRTTracks easier
101 
102  // Function to average hits within a certain distance of each other
103  vector<pair<sbn::crt::CRTHit, vector<int>>> AverageHits(vector<art::Ptr<sbn::crt::CRTHit>> hits, map<art::Ptr<sbn::crt::CRTHit>, int> hitIds);
104  vector<sbn::crt::CRTHit> AverageHits(vector<art::Ptr<sbn::crt::CRTHit>> hits);
105 
106  // Take a list of hits and find average parameters
107  sbn::crt::CRTHit DoAverage(vector<art::Ptr<sbn::crt::CRTHit>> hits);
108 
109  // Create CRTTracks from list of hits
110  vector<pair<sbn::crt::CRTTrack, vector<int>>> CreateTracks(vector<pair<sbn::crt::CRTHit, vector<int>>> hits);
111  vector<sbn::crt::CRTTrack> CreateTracks(vector<sbn::crt::CRTHit> hits);
112 
113  // Calculate the tagger crossing point of CRTTrack candidate
114  TVector3 CrossPoint(sbn::crt::CRTHit hit, TVector3 start, TVector3 diff);
115 
116  private:
117 
119 
120  double fTimeLimit;
123 
125 
126  };
127 
128 }//namespace crt
129 }//namespace icarus
130 
131 #endif
sbn::crt::CRTHit DoAverage(vector< art::Ptr< sbn::crt::CRTHit >> hits)
TVector3 CrossPoint(sbn::crt::CRTHit hit, TVector3 start, TVector3 diff)
process_name hit
Definition: cheaterreco.fcl:51
vector< vector< art::Ptr< sbn::crt::CRTHit > > > CreateCRTTzeros(vector< art::Ptr< sbn::crt::CRTHit >>)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Access the description of detector geometry.
sbn::crt::CRTTrack FillCrtTrack(sbn::crt::CRTHit hit1, sbn::crt::CRTHit hit2, bool complete)
BEGIN_PROLOG vertical distance to the surface Name
vector< pair< sbn::crt::CRTHit, vector< int > > > AverageHits(vector< art::Ptr< sbn::crt::CRTHit >> hits, map< art::Ptr< sbn::crt::CRTHit >, int > hitIds)
Description of geometry of one entire detector.
vector< pair< sbn::crt::CRTTrack, vector< int > > > CreateTracks(vector< pair< sbn::crt::CRTHit, vector< int >>> hits)
process_name crt
art framework interface to geometry description