All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StubMergeAlgorithms.h
Go to the documentation of this file.
1 #ifndef StubMergeAlgorithms_HH
2 #define StubMergeAlgorithms_HH
3 
4 #include "canvas/Persistency/Common/Ptr.h"
5 
10 
12 
18 
19 // Helper algorithms/utilities useful for merging stubs
20 
21 namespace sbn {
22 
23 /// Internal struct: contains information on stub and other associated data products
24 struct StubInfo {
26  art::Ptr<recob::PFParticle> pfp;
27  std::vector<art::Ptr<recob::Hit>> hits;
28  art::Ptr<sbn::VertexHit> vhit;
29  art::Ptr<recob::Hit> vhit_hit;
30 };
31 
32 /**
33  * @brief Computes the track-pitch on a plane given an input direction and location.
34  * @param loc location in world coordinate system [cm]
35  * @param dir direction in world coordinate system (assumed to be unit vector)
36  * @param view the view to project the direction onto
37  * @param tpc ID of the TPC the selected `view` belongs to
38  * @param correct_sce whether to apply space charge correction
39  * @param track_is_sce_corrected whether location `loc` is already corrected for
40  * spacecharge effects
41  * @param xsign factor for the _x_ (drift) coordinate (`-1` flips it)
42  * @return the pitch along direction `dir` [cm]
43  *
44  * Is able to handle the presence of space charge (through the `SpaceCharge` service)
45  * and whether or not the input location/direction are already corrected for SCE.
46  */
47 double GetPitch(
48  const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce,
50  geo::View_t view, geo::TPCID tpc,
51  bool correct_sce, bool track_is_sce_corrected, float xsign=1.);
52 
53 /// Get the location in the presence of space charge
55 
56 /// Get the E-Field in the presence of space charge
57 double GetEfield(const detinfo::DetectorPropertiesData &dprop, const spacecharge::SpaceCharge *sce, geo::Point_t loc, geo::TPCID TPC, bool correct_loc_sce, float xsign=1.);
58 
59 /// Get the SCE-distorted location (i.e. the location "seen" by the wireplanes)
61 
62 /// Returns whether stub `A` contains stub `B`.
63 bool StubContains(const sbn::StubInfo &A, const sbn::StubInfo &B);
64 
65 /// Computes the dot product of two stubs
66 float StubDirectionDot(const sbn::StubInfo &A, const sbn::StubInfo &B,
67  const geo::GeometryCore *geo,
68  const detinfo::DetectorPropertiesData &dprop);
69 
70 // For matching stubs across planes
71 float StubTimeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B,
72  const detinfo::DetectorClocksData &dclock,
73  const detinfo::DetectorPropertiesData &dprop);
74 
75 /// Returns an updated end position of a stub after merging across two planes
77  const geo::GeometryCore *geo,
78  const spacecharge::SpaceCharge *sce,
79  const detinfo::DetectorPropertiesData &dprop);
80 
81 /// Difference of the total charge between two stubs
82 float StubChargeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B);
83 
84 /// Difference of the endpoint charge between two stubs
85 float StubPeakChargeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B);
86 
87 /// Difference of the endpoint dQ/dx between two stubs
88 float StubPeakdQdxOffset(const sbn::StubInfo &A, const sbn::StubInfo &B,
89  const geo::GeometryCore *geo,
90  const spacecharge::SpaceCharge *sce,
91  const detinfo::DetectorPropertiesData &dprop);
92 
93 } // end namespace sbn
94 #endif
float StubChargeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B)
Difference of the total charge between two stubs.
float StubTimeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B, const detinfo::DetectorClocksData &dclock, const detinfo::DetectorPropertiesData &dprop)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
float StubPeakdQdxOffset(const sbn::StubInfo &A, const sbn::StubInfo &B, const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, const detinfo::DetectorPropertiesData &dprop)
Difference of the endpoint dQ/dx between two stubs.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Declaration of signal hit object.
float StubDirectionDot(const sbn::StubInfo &A, const sbn::StubInfo &B, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
Computes the dot product of two stubs.
geo::Point_t GetLocation(const spacecharge::SpaceCharge *sce, geo::Point_t loc_w, geo::TPCID TPC, float xsign=1.)
Get the location in the presence of space charge.
Internal struct: contains information on stub and other associated data products. ...
BEGIN_PROLOG TPC
geo::Point_t GetLocationAtWires(const spacecharge::SpaceCharge *sce, const geo::GeometryCore *geo, geo::Point_t loc, geo::TPCID TPC, float xsign=1.)
Get the SCE-distorted location (i.e. the location &quot;seen&quot; by the wireplanes)
std::vector< art::Ptr< recob::Hit > > hits
Access the description of detector geometry.
bool StubContains(const sbn::StubInfo &A, const sbn::StubInfo &B)
Returns whether stub A contains stub B.
art::Ptr< recob::Hit > vhit_hit
double GetPitch(const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, geo::Point_t loc, geo::Vector_t dir, geo::View_t view, geo::TPCID tpc, bool correct_sce, bool track_is_sce_corrected, float xsign=1.)
Computes the track-pitch on a plane given an input direction and location.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
Description of geometry of one entire detector.
tuple dir
Definition: dropbox.py:28
art::Ptr< sbn::VertexHit > vhit
Contains all timing reference information for the detector.
geo::Point_t TwoStubEndPosition(const sbn::StubInfo &A, const sbn::StubInfo &B, const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, const detinfo::DetectorPropertiesData &dprop)
Returns an updated end position of a stub after merging across two planes.
double GetEfield(const detinfo::DetectorPropertiesData &dprop, const spacecharge::SpaceCharge *sce, geo::Point_t loc, geo::TPCID TPC, bool correct_loc_sce, float xsign=1.)
Get the E-Field in the presence of space charge.
float StubPeakChargeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B)
Difference of the endpoint charge between two stubs.
Definition: Stub.h:16
float A
Definition: dedx.py:137
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
art::Ptr< recob::PFParticle > pfp