BeamFlashTrackMatchTaggerAlg.h
Go to the documentation of this file.
1 #ifndef BEAMFLASHTRACKMATCHTAGGERALG_H
2 #define BEAMFLASHTRACKMATCHTAGGERALG_H
3 /*!
4  * Title: Beam Flash<-->Track Match Algorithim Class
5  * Author: Wes Ketchum (wketchum@lanl.gov), based on code from Ben Jones
6  *
7  * Description: Algorithm that compares all tracks to the flash during the
8  * beam gate, and determines if that track is consistent with
9  * having produced that flash.
10  * Input: recob::OpFlash, recob::Track
11  * Output: anab::CosmicTag (and Assn<anab::CosmicTag,recob::Track>)
12 */
13 #include <iostream>
14 
15 #include "fhiclcpp/fwd.h"
16 
20 
22 
28 
29 #include "TVector3.h"
30 class TH1F;
31 class TTree;
32 
33 namespace cosmic{
34  class BeamFlashTrackMatchTaggerAlg;
35 }
36 
37 
39  public:
40 
41  /// Pack of provider-interface supporting services we need
43 
45 
46  //how to run the algorithm
47  void RunCompatibilityCheck(std::vector<recob::OpFlash> const&,
48  std::vector<recob::Track> const&,
49  std::vector<anab::CosmicTag>&,
50  std::vector<size_t>&,
54 
55  void SetHypothesisComparisonTree(TTree*,TH1F*,TH1F*);
56 
57  void RunHypothesisComparison(unsigned int const,
58  unsigned int const,
59  std::vector<recob::OpFlash> const&,
60  std::vector<recob::Track> const&,
64 
65  void RunHypothesisComparison(unsigned int const,
66  unsigned int const,
67  std::vector<recob::OpFlash> const&,
68  std::vector<simb::MCParticle> const&,
72 
73  private:
74 
77  const bool DEBUG_FLAG;
78 
80  float fMinOpHitPE;
81  float fMIPdQdx;
85  unsigned int fCumulativeChannelCut;
86  float fIntegralCut;
87 
90 
91 
92  TTree* cTree;
93 
94  typedef struct FlashComparisonProperties{
95  unsigned int run;
96  unsigned int event;
97 
98  unsigned int flash_index;
100  float flash_y;
102  float flash_z;
104  unsigned int flash_nOpDet;
105 
106  unsigned int hyp_index;
107  float hyp_totalPE;
108  float hyp_y;
109  float hyp_sigmay;
110  float hyp_z;
111  float hyp_sigmaz;
112 
113  float trk_startx;
114  float trk_starty;
115  float trk_startz;
116 
117  float trk_endx;
118  float trk_endy;
119  float trk_endz;
120 
121  float chi2;
122 
125  leaf_structure("run/i:event/i:flash_index/i:flash_totalPE/F:flash_y/F:flash_sigmay/F:flash_z/F:flash_sigmaz/F:flash_nOpDet/i:hyp_index/i:hyp_totalPE/F:hyp_y/F:hyp_sigmay/F:hyp_z/F:hyp_sigmaz/F:trk_startx/F:trk_starty/F:trk_startz/F:trk_endx/F:trk_endy/F:trk_endz/F:chi2/F"){}
126 
128 
130  std::vector<float> cOpDetVector_flash;
131  std::vector<float> cOpDetVector_hyp;
134 
135 
142 
143  //core functions
144  std::vector<float> GetMIPHypotheses(recob::Track const& track,
145  Providers_t providers,
148  float XOffset=0);
149 
150  std::vector<float> GetMIPHypotheses(simb::MCParticle const& particle,
151  size_t start_i,
152  size_t end_i,
153  Providers_t providers,
156  float XOffset=0);
157 
158  void AddLightFromSegment(TVector3 const& pt1,
159  TVector3 const& pt2,
160  std::vector<float> & lightHypothesis,
161  float & totalHypothesisPE,
162  geo::GeometryCore const& geom,
164  float const& PromptMIPScintYield,
165  float XOffset);
166 
167  void NormalizeLightHypothesis(std::vector<float> & lightHypothesis,
168  float const& totalHypothesisPE,
169  geo::GeometryCore const& geom);
170 
171  CompatibilityResultType CheckCompatibility(std::vector<float> const& lightHypothesis,
172  const recob::OpFlash* flashPointer,
173  geo::GeometryCore const& geom);
174 
175  bool InDetector(TVector3 const&, geo::GeometryCore const&);
176  bool InDriftWindow(double, double, geo::GeometryCore const&);
177 
178  void FillFlashProperties(std::vector<float> const& opdetVector,
179  float&,
180  float&, float&,
181  float&, float&,
182  geo::GeometryCore const& geom);
183 
184  float CalculateChi2(std::vector<float> const&,std::vector<float> const&);
185 
186  //debugging functions
187  void PrintTrackProperties(recob::Track const&, std::ostream* output=&std::cout);
188  void PrintFlashProperties(recob::OpFlash const&, std::ostream* output=&std::cout);
189  void PrintHypothesisFlashComparison(std::vector<float> const&,
190  const recob::OpFlash*,
191  geo::GeometryCore const& geom,
192  CompatibilityResultType,
193  std::ostream* output=&std::cout);
194 
195 };
196 
197 #endif
CompatibilityResultType CheckCompatibility(std::vector< float > const &lightHypothesis, const recob::OpFlash *flashPointer, geo::GeometryCore const &geom)
BeamFlashTrackMatchTaggerAlg(fhicl::ParameterSet const &p)
std::string string
Definition: nybbler.cc:12
enum anab::cosmic_tag_id CosmicTagID_t
void RunHypothesisComparison(unsigned int const, unsigned int const, std::vector< recob::OpFlash > const &, std::vector< recob::Track > const &, Providers_t, phot::PhotonVisibilityService const &, opdet::OpDigiProperties const &)
float CalculateChi2(std::vector< float > const &, std::vector< float > const &)
Data structure containing constant pointers to classes.
struct cosmic::BeamFlashTrackMatchTaggerAlg::FlashComparisonProperties FlashComparisonProperties_t
Particle class.
void RunCompatibilityCheck(std::vector< recob::OpFlash > const &, std::vector< recob::Track > const &, std::vector< anab::CosmicTag > &, std::vector< size_t > &, Providers_t, phot::PhotonVisibilityService const &, opdet::OpDigiProperties const &)
art framework interface to geometry description
std::vector< float > GetMIPHypotheses(recob::Track const &track, Providers_t providers, phot::PhotonVisibilityService const &pvs, opdet::OpDigiProperties const &, float XOffset=0)
void NormalizeLightHypothesis(std::vector< float > &lightHypothesis, float const &totalHypothesisPE, geo::GeometryCore const &geom)
void AddLightFromSegment(TVector3 const &pt1, TVector3 const &pt2, std::vector< float > &lightHypothesis, float &totalHypothesisPE, geo::GeometryCore const &geom, phot::PhotonVisibilityService const &pvs, float const &PromptMIPScintYield, float XOffset)
void PrintTrackProperties(recob::Track const &, std::ostream *output=&std::cout)
p
Definition: test.py:223
Description of geometry of one entire detector.
void SetHypothesisComparisonTree(TTree *, TH1F *, TH1F *)
void PrintHypothesisFlashComparison(std::vector< float > const &, const recob::OpFlash *, geo::GeometryCore const &geom, CompatibilityResultType, std::ostream *output=&std::cout)
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
Provides recob::Track data product.
bool InDriftWindow(double, double, geo::GeometryCore const &)
void FillFlashProperties(std::vector< float > const &opdetVector, float &, float &, float &, float &, float &, geo::GeometryCore const &geom)
bool InDetector(TVector3 const &, geo::GeometryCore const &)
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 PrintFlashProperties(recob::OpFlash const &, std::ostream *output=&std::cout)