All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataStructs.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 //
4 // TCAlg data structs
5 //
6 // Bruce Baller
7 //
8 ///////////////////////////////////////////////////////////////////////
9 #ifndef TRAJCLUSTERALGDATASTRUCT_H
10 #define TRAJCLUSTERALGDATASTRUCT_H
11 
12 // C/C++ standard libraries
13 #include <array>
14 #include <bitset>
15 #include <vector>
16 
17 // LArSoft libraries
21 
22 namespace TMVA {
23  class Reader;
24 }
25 namespace calo {
26  class CalorimetryAlg;
27 }
28 namespace geo {
29  class GeometryCore;
30 }
31 
32 namespace tca {
33 
34  namespace detail {
35  struct SortEntry {
36  unsigned int index;
37  float val;
38  };
39  }
40 
41  using Point3_t = std::array<double, 3>;
42  using Vector3_t = std::array<double, 3>;
43  using Point2_t = std::array<float, 2>;
44  using Vector2_t = std::array<double, 2>;
45 
46  // some functions to handle the CTP_t type
47  typedef unsigned int CTP_t;
48  constexpr unsigned int Tpad = 10; // alignment for CTP sub-items - TPC
49  constexpr unsigned int Cpad = 10000; // alignment for CTP sub-items - Cryostat
50 
51  inline CTP_t
52  EncodeCTP(unsigned int cryo, unsigned int tpc, unsigned int plane)
53  {
54  return cryo * Cpad + tpc * Tpad + plane;
55  }
56  inline CTP_t
57  EncodeCTP(const geo::PlaneID& planeID)
58  {
59  return EncodeCTP(planeID.Cryostat, planeID.TPC, planeID.Plane);
60  }
61  inline CTP_t
62  EncodeCTP(const geo::WireID& wireID)
63  {
64  return EncodeCTP(wireID.Cryostat, wireID.TPC, wireID.Plane);
65  }
67 
68  /// @{
69  /// @name Data structures for the reconstruction results
70 
71  /// struct of temporary 2D vertices (end points)
72  struct VtxStore {
73  Point2_t Pos{{0, 0}};
74  Point2_t PosErr{{2, 1}};
75  unsigned short NTraj{0};
76  unsigned short Pass{0}; // Pass in which this vertex was created
77  float ChiDOF{0};
78  // Topo: 0 = end0-end0, 1 = end0(1)-end1(0), 2 = end1-end1, 3 = CI3DV,
79  // 4 = C3DIVIG, 5 = FHV, 6 = FHV2, 7 = SHCH, 8 = CTBC, 9 = Junk, 10 = HamBragg, 11 = neutral decay (pizero)
80  // 12 = BraggSplit, 13 = Not Used, 14 = Reconcile2VTs
81  short Topo{0};
82  CTP_t CTP{0};
83  int ID{0}; ///< set to 0 if killed
84  int UID{0}; ///< unique global ID
85  int Vx3ID{0};
86  float Score{0};
87  float TjChgFrac{0}; ///< Fraction of charge near the vertex that is from hits on the vertex Tjs
88  std::bitset<16> Stat{0}; ///< Vertex status bits using kVtxBit_t
89  };
90 
91  typedef enum {
92  kVtxTrjTried, ///< FindVtxTraj algorithm tried
93  kFixed, ///< vertex position fixed manually - no fitting done
95  kHiVx3Score, ///< matched to a high-score 3D vertex
96  kVxTruMatch, ///< tagged as a vertex between Tjs that are matched to MC truth neutrino interaction particles
98  kVxIndPlnNoChg, ///< vertex quality is suspect - No requirement made on chg btw it and the Tj
99  kVxEnvOK, ///< the environment near the vertex was checked - See UpdateVxEnvironment
100  kVxBitSize ///< don't mess with this line
101  } VtxBit_t;
102 
103  /// struct of temporary 3D vertices
104  struct Vtx3Store {
105  float X{0}; // x position
106  float XErr{0.5}; // x position error
107  float Y{0}; // y position
108  float YErr{0.5}; // y position error
109  float Z{0}; // z position
110  float ZErr{0.5}; // z position error
111  float Score{0};
112  int Wire{-1}; // wire number for an incomplete 3D vertex
114  std::vector<int> Vx2ID; // List of 2D vertex IDs in each plane
115  int ID{0}; // 0 = obsolete vertex
116  int UID{0}; ///< unique global ID
117  bool Primary{false};
118  bool Neutrino{false};
119  };
120 
121  // The (y,z) position of a valid wire intersection of two wires on two planes +
122  // + the (y,z) position variation for a one wire change in pln1 and pln2
124  unsigned short pln1;
125  unsigned short pln2;
126  float wir1;
127  float wir2;
128  double y;
129  double z;
130  double dydw1;
131  double dzdw1;
132  double dydw2;
133  double dzdw2;
134  unsigned int tpc;
135  };
136 
137  // A temporary struct for matching trajectory points; 1 struct for each TP for
138  // each trajectory. These are put into mallTraj which is then sorted by increasing xlo
139  struct Tj2Pt {
140  unsigned int wire;
141  // x range spanned by hits on the TP
142  float xlo;
143  float xhi;
144  unsigned short plane;
145  // the Trajectory ID
146  unsigned short id;
147  unsigned short ipt; // The trajectory point
148  // the number of points in the Tj so that the minimum Tj length cut (MatchCuts[2]) can be made
149  unsigned short npts;
150  };
151 
152  struct TrajPoint {
153  CTP_t CTP{0}; ///< Cryostat, TPC, Plane code
154  Point2_t HitPos{{0, 0}}; // Charge weighted position of hits in wire equivalent units
155  Point2_t Pos{{0, 0}}; // Trajectory position in wire equivalent units
156  Vector2_t Dir{{0, 0}}; // Direction cosines in the StepDir direction
157  double HitPosErr2{0}; // Uncertainty^2 of the hit position perpendiclar to the direction
158  // HitPosErr2 < 0 = HitPos not defined because no hits used
159  double Ang{0}; // Trajectory angle (-pi, +pi)
160  double AngErr{0.1}; // Trajectory angle error
161  float KinkSig{-1}; // kink significance = delta angle / angle error
162  float Chg{0}; // Chargetj2pt
163  float AveChg{-1}; // Average charge of last ~20 TPs
164  float ChgPull{0.1}; // = (Chg - AveChg) / ChgRMS
165  float Delta{0}; // Deviation between trajectory and hits (WSE)
166  float DeltaRMS{0.02}; // RMS of Deviation between trajectory and hits (WSE)
167  float FitChi{0}; // Chi/DOF of the fit
168  int InPFP{0}; // ID of the PFParticle that owns this TP
169  unsigned short NTPsFit{2}; // Number of trajectory points fitted to make this point
170  unsigned short Step{0}; // Step number at which this TP was created
171  unsigned short AngleCode{0}; // 0 = small angle, 1 = large angle, 2 = very large angle
172  std::vector<unsigned int> Hits; // vector of fHits indices
173  std::bitset<16> UseHit{0}; // set true if the hit is used in the fit
174  std::bitset<8> Environment{0}; // TPEnvironment_t bitset that describes the environment
175  };
176 
177  // struct filled by FitPar which fits TP Chg, Delta, etc
178  struct ParFit {
179  Point2_t Pos{{0, 0}}; // position origin of the fit
180  float Par0;
181  float AvePar;
182  float ParErr;
183  float ParSlp; // slope relative to the origin
184  float ParSlpErr;
185  float ChiDOF;
186  unsigned short nPtsFit;
187  };
188 
189  // Global information for the trajectory
190  struct Trajectory {
191  std::vector<TrajPoint> Pts; ///< Trajectory points
192  CTP_t CTP{0}; ///< Cryostat, TPC, Plane code
193  std::bitset<128> AlgMod; ///< Bit set if algorithm AlgBit_t modifed the trajectory
194  int WorkID{0};
195  int ParentID{
196  -1}; ///< ID of the parent, or the ID of the Tj this one was merged with if it is killed
197  float AveChg{0}; ///< Calculated using ALL hits
198  float TotChg{0}; ///< Total including an estimate for dead wires
199  float ChgRMS{0.5}; /// Normalized RMS using ALL hits. Assume it is 50% to start
200  short MCSMom{0}; //< Crude 2D estimate to use for shower-like vs track-like discrimination
201  Point2_t dEdx{{0, 0}}; ///< dE/dx for 3D matched trajectories
202  std::array<unsigned short, 2> VtxID{{0, 0}}; ///< ID of 2D vertex
203  std::array<unsigned short, 2> EndPt{
204  {0, 0}}; ///< First and last point in the trajectory that has charge
205  int ID; ///< ID that is local to one slice
206  int UID; ///< a unique ID for all slices
207  int SSID{0}; ///< ID of a 2D shower struct that this tj is in
208  unsigned short PDGCode{0}; ///< shower-like or track-like {default is track-like}
209  unsigned short Pass{0}; ///< the pass on which it was created
210  short StepDir{0}; ///< -1 = going US (-> small wire#), 1 = going DS (-> large wire#)
211  short StartEnd{-1}; ///< The starting end (-1 = don't know)
212  std::array<std::bitset<8>, 2> EndFlag{}; // Bitset that encodes the reason for stopping
213  std::bitset<8> Strategy{}; ///
214  bool NeedsUpdate{false}; ///< Set true when the Tj needs to be updated
215  bool IsGood{true}; ///< set false if there is a failure or the Tj fails quality cuts
216  bool MaskedLastTP{false};
217  };
218 
219  struct TjForecast {
220  unsigned short nextForecastUpdate{
221  0}; ///< Revise the forecast when NumPtsWithCharge == nextForecastUpdate
223  0}; ///< fraction of points in the forecast envelope that are shower-like
224  float outlook{-1}; ///< tracklike ~< 2, showerlike > 2
225  float chgSlope{0};
226  float chgSlopeErr{0};
227  float chgFitChiDOF{0};
228  float chgRMS{0};
229  short MCSMom{0};
230  bool leavesBeforeEnd{false}; ///< leaves the forecast envelope before the end
231  bool foundShower{false};
232  bool endBraggPeak{false};
233  };
234 
235  // Temporary 3D trajectory points composed of triplet or doublet wire intersections
236  struct TrajPoint3 {
237  Point3_t Pos{{0.0, 0.0, 0.0}};
238  Vector3_t Dir{{0.0, 0.0, 0.0}};
239  std::vector<Tj2Pt> Tj2Pts; // list of trajectory points
240  };
241 
242  struct SectionFit {
243  Point3_t Pos{{-10.0, 0.0, 0.0}}; ///< center position of this section
244  Vector3_t Dir{{0.0, 0.0, 0.0}}; ///< and direction
245  Vector3_t DirErr{{0.0, 0.0, 0.0}}; ///< and direction error
246  float ChiDOF{-1};
247  unsigned short NPts{0};
248  bool NeedsUpdate{true}; ///< set true if the section needs to be updated
249  };
250 
251  // a 3D trajectory point composed of a 3D point & direction and a single TP
252  struct TP3D {
253  Point3_t Pos{{-10.0, -10.0, -10.0}}; ///< position of the trajectory
254  Vector3_t Dir{{0.0, 0.0, 0.0}};
255  double TPX{-10}; ///< X position of the TP or the single hit
256  double TPXErr2{1}; ///< (X position error)^2
257  float Wire{-1};
258  float along{1E6}; ///< distance from the start Pos of the section
259  int TjID{0}; ///< ID of the trajectory -> TP3D assn
261  unsigned short TPIndex{USHRT_MAX}; ///< and the TP index
262  unsigned short SFIndex{USHRT_MAX}; ///< and the section fit index
263  std::bitset<8> Flags; //< see TP3DFlags_t
264  };
265 
266  typedef enum {
267  kTP3DGood, // Is good for fitting and calorimetry
268  kTP3DBad, // Should be removed from the trajectory
269  kTP3DHiDEdx // Has high dE/dx
270  } TP3DFlags_t;
271 
272  // Struct for 3D trajectory matching
273  struct MatchStruct {
274  // IDs of Trajectories that match in all planes
275  std::vector<int> TjIDs;
276  // Count of the number of X-matched hits and de-weight by angle
277  float Count{0}; // Set to 0 if matching failed
278  };
279 
280  constexpr unsigned int pAlgModSize = 6; // alignment for CTP sub-items - TPC
281 
282  struct PFPStruct {
283  std::vector<int> TjIDs; // used to reference Tjs within a slice
284  std::vector<int> TjUIDs; // used to reference Tjs in any slice
285  std::vector<TP3D> TP3Ds; // vector of 3D trajectory points
286  std::vector<SectionFit> SectionFits;
287  // Start is 0, End is 1
288  std::array<std::vector<float>, 2> dEdx;
289  std::array<std::vector<float>, 2> dEdxErr;
290  std::array<int, 2> Vx3ID{{0, 0}};
291  int BestPlane{-1};
292  int PDGCode{-1};
293  std::vector<int> DtrUIDs;
294  size_t ParentUID{0}; // Parent PFP UID (or 0 if no parent exists)
296  float CosmicScore{0};
297  int ID{0};
298  int UID{0}; // unique global ID
299  unsigned short MVI; // matVec index for detailed debugging
300  std::bitset<8> Flags; //< see PFPFlags_t
301  std::array<std::bitset<8>, 2> EndFlag{}; // Uses the same enum as Trajectory EndFlag
302  std::bitset<pAlgModSize> AlgMod; //< Allocate the first set of bits in AlgBit_t for 3D algs
303  };
304 
305  typedef enum {
309  } PFPFlags_t;
310 
311  struct ShowerPoint {
312  Point2_t Pos; // Hit Position in the normal coordinate system
313  Point2_t
314  RotPos; // Position rotated into the shower coordinate system (0 = along, 1 = transverse)
315  float Chg{0}; // Charge of this point
316  unsigned int HitIndex; // the hit index
317  unsigned short
318  TID; // The ID of the tj the point (hit) is in. TODO eliminate this redundant variable
319  };
320 
321  // A temporary structure that defines a 2D shower-like cluster of trajectories
322  struct ShowerStruct {
324  int ShowerTjID{0}; // ID of the shower Trajectory composed of many InShower Tjs
325  std::vector<int> TjIDs; // list of InShower Tjs
326  std::vector<int> NearTjIDs; // list of Tjs that are not InShower but satisfy the maxSep cut
327  std::vector<ShowerPoint> ShPts; // Trajectory points inside the shower
328  float Angle{0}; // Angle of the shower axis
329  float AngleErr{3}; // Error
330  float AspectRatio{1}; // The ratio of charge weighted transverse/longitudinal positions
331  float DirectionFOM{1};
332  std::vector<Point2_t> Envelope; // Vertices of a polygon that encompasses the shower
333  float EnvelopeArea{0};
334  float ChgDensity{0}; // Charge density inside the Envelope
335  float Energy{0};
336  float ParentFOM{10};
337  int ID{0};
338  int UID{0}; ///< unique global ID
339  int ParentID{0}; // The ID of a parent Tj - the one at the start of the shower
340  int TruParentID{0};
341  int SS3ID{0}; // ID of a ShowerStruct3D to which this 2D shower is matched
342  bool NeedsUpdate{true}; // Needs to be updated (e.g. after adding a tj, defining a parent, etc)
343  };
344 
345  // Shower variables filled in MakeShowers. These are in cm and radians
346  struct ShowerStruct3D {
348  Vector3_t
349  DirErr; // DirErr is hijacked to store the shower rms at the start, center and end sections
351  Point3_t StartErr; // PosErr is hijacked to temporarily store the charge in the three sections
352  Point3_t ChgPos; // position of the center of charge
353  Point3_t End; // end position
354  double Len{1};
355  double OpenAngle{0.12};
356  std::vector<double> Energy;
357  std::vector<double> EnergyErr;
358  std::vector<double> MIPEnergy;
359  std::vector<double> MIPEnergyErr;
360  std::vector<double> dEdx;
361  std::vector<double> dEdxErr;
363  std::vector<int> CotIDs; // list of indices of 2D showers in tjs.cots
364  std::vector<unsigned int> Hits;
366  int ID;
367  int UID{0}; ///< unique global ID
368  int ParentID{0}; // The ID of a track-like pfp at the start of the shower, e.g. an electron
369  float MatchFOM;
370  unsigned short PFPIndex{USHRT_MAX}; // The index of the pfp for this shower
371  int Vx3ID{0};
372  bool NeedsUpdate{true}; // This is set true whenever the shower needs to be updated
373  bool Cheat{false};
374  };
375 
377  std::array<int, 2>
378  TjIDs; // pairs of Tjs that shouldn't be clustered in shower reconstruction because...
379  int Vx2ID; // they share a 2D vertex that may be matched to...
380  int Vx3ID; // a high-score 3D vertex
381  };
382 
383  struct ShowerTreeVars {
384  // run, subrun, and event are also saved to this tree
385 
386  std::vector<float> BeginWir; // begin wire
387  std::vector<float> BeginTim; // begin tick
388  std::vector<float> BeginAng; // begin angle
389  std::vector<float> BeginChg; // beginning average charge
390  std::vector<short> BeginVtx; // ID of begin vertex
391  std::vector<float> EndWir; // end wire
392  std::vector<float> EndTim; // end tick
393  std::vector<float> EndAng; // end angle
394  std::vector<float> EndChg; // ending average charge
395  std::vector<short> EndVtx; //ID of end vertex
396 
397  std::vector<short> MCSMom;
398 
399  std::vector<short> PlaneNum;
400 
401  std::vector<int> TjID;
402  std::vector<int> IsShowerTj; // indicates tj is an shower trajectory
403  std::vector<int> ShowerID; // shower ID associated w/ trajectory. -1 = no shower
404  std::vector<int> IsShowerParent; // this tj was chosen as a parent tj
405  std::vector<int> StageNum; // stage of reconstruction
406  std::vector<std::string> StageName; // stage name
407 
408  // envelope information
409  std::vector<float> Envelope;
410  std::vector<int> EnvPlane;
411  std::vector<int> EnvStage;
412  std::vector<int> EnvShowerID;
413 
414  int nStages{0};
415  unsigned short nPlanes{0};
416  };
417 
418  struct CRTreeVars {
419  std::vector<int> cr_origin;
420  std::vector<float> cr_pfpxmin;
421  std::vector<float> cr_pfpxmax;
422  std::vector<float> cr_pfpyzmindis;
423  };
424 
425  // Algorithm modification bits
426  typedef enum {
427  kFillGaps3D, // 3D algorithms for PFPs (bitset size limited to 8 bits)
432  kMat3D, // 2D algorithms for Tjs here and below
496  kAlgBitSize ///< don't mess with this line
497  } AlgBit_t;
498 
499  typedef enum {
501  kStiffEl, ///< use the stiff electron strategy
502  kStiffMu, ///< use the stiff muon strategy
503  kSlowing ///< use the slowing-down strategy
504  } Strategy_t;
505 
506  // Stop flag bits
507  typedef enum {
515  kFlagBitSize ///< don't mess with this line
516  } EndFlag_t;
517 
518  // Environment near a trajectory point
519  typedef enum {
525  kEnvNearSrcHit, ///< TP is near a hit in the srcHit collection but no allHit hit exists (DUNE disambiguation error)
526  kEnvFlag ///< a general purpose flag bit used in 3D matching
527  } TPEnvironment_t;
528 
529  // TrajClusterAlg configuration bits
530  typedef enum {
531  kStepDir, ///< step from US -> DS (true) or DS -> US (false)
532  kTestBeam, ///< Expect tracks entering from the front face. Don't create neutrino PFParticles
533  kDebug, ///< master switch for turning on debug mode
534  kStudy1, ///< call study functions to develop cuts, etc (see TCTruth.cxx)
535  kStudy2, ///< call study functions to develop cuts, etc
536  kStudy3, ///< call study functions to develop cuts, etc
537  kStudy4, ///< call study functions to develop cuts, etc
538  kSaveCRTree, ///< save cosmic ray tree
539  kTagCosmics, ///< tag cosmic rays
540  kSaveShowerTree ///< save shower tree
541  } TCModes_t;
542 
543  extern const std::vector<std::string> AlgBitNames;
544  extern const std::vector<std::string> EndFlagNames;
545  extern const std::vector<std::string> VtxBitNames;
546  extern const std::vector<std::string> StrategyBitNames;
547 
548  // struct for configuration - used in all slices
549  struct TCConfig {
550  std::vector<float> vtx2DCuts; ///< Max position pull, max Position error rms
551  std::vector<float> vtx3DCuts; ///< 2D vtx -> 3D vtx matching cuts
552  std::vector<float> vtxScoreWeights;
553  std::vector<float> neutralVxCuts;
554  std::vector<short> deltaRayTag;
555  std::vector<short> muonTag;
556  std::vector<float> electronTag;
557  std::vector<float> chkStopCuts; ///< Bragg peak finder configuration
558  std::vector<float> showerTag; ///< shower-like trajectory tagging + shower reconstruction
559  std::vector<float> kinkCuts; ///< kink finder algorithm
560  std::vector<float> match3DCuts; ///< 3D matching cuts
561  // std::vector<float> matchTruth; ///< Match to MC truth
562  std::vector<float> chargeCuts;
563  std::vector<float> qualityCuts; ///< Min points/wire, min consecutive pts after a gap
564  std::vector<float> pfpStitchCuts; ///< cuts for stitching between TPCs
565  std::vector<unsigned short> minPtsFit; ///< Reconstruct in several passes
566  std::vector<unsigned short> minPts; ///< min number of Pts required to make a trajectory
567  std::vector<unsigned short> maxAngleCode; ///< max allowed angle code for each pass
568  std::vector<short> minMCSMom; ///< Min MCSMom for each pass
569  std::vector<float> angleRanges; ///< list of max angles for each angle range
570  float wirePitch;
571  float unitsPerTick; ///< scale factor from Tick to WSE equivalent units
572  std::vector<float> maxPos0;
573  std::vector<float> maxPos1;
574  float multHitSep; ///< preferentially "merge" hits with < this separation
575  float maxChi;
578  TMVA::Reader* showerParentReader;
579  std::vector<float> showerParentVars;
580  float hitErrFac;
581  float maxWireSkipNoSignal; ///< max number of wires to skip w/o a signal on them
582  float maxWireSkipWithSignal; ///< max number of wires to skip with a signal on them
584  float VLAStepSize;
585  float JTMaxHitSep2; /// Max hit separation for making junk trajectories. < 0 to turn off
586  std::bitset<128> useAlg; ///< Allow user to mask off specific algorithms
587  std::bitset<128> dbgAlg; ///< Allow user to turn on debug printing in algorithms (that print...)
588  short recoSlice{0}; ///< only reconstruct the slice with ID (0 = all)
589  short recoTPC{-1}; ///< only reconstruct in the seleted TPC
590  bool dbgSlc{true}; ///< debug only in the user-defined slice? default is all slices
591  bool dbgStp{false}; ///< debug stepping using debug.Cryostat, debug.TPC, etc
592  bool dbgMrg{false};
593  bool dbg2V{false}; ///< debug 2D vertex finding
594  bool dbgVxNeutral{false};
595  bool dbgVxMerge{false};
596  bool dbgVxJunk{false};
597  bool dbg3V{false}; ///< debug 3D vertex finding
598  bool dbgPFP{false};
599  bool dbgDeltaRayTag{false};
600  bool dbgMuonTag{false};
601  bool dbg2S{false};
602  bool dbg3S{false};
603  bool dbgStitch{false}; ///< debug PFParticle stitching
604  bool dbgSummary{false}; ///< print a summary report
605  bool dbgDump{false}; /// dump trajectory points
606  short nPtsAve; /// number of points to find AveChg
607  std::bitset<16> modes; /// See TCMode_t above
608  bool doForecast{true};
609  bool useChannelStatus{true};
610  };
611 
612  struct TCHit {
613  unsigned int allHitsIndex; // index into fHits
614  int InTraj{
615  0}; // ID of the trajectory this hit is used in, 0 = none, < 0 = Tj under construction
616  };
617 
618  // hit collection for all slices, TPCs and cryostats + event information
619  // Note: Ideally this hit collection would be the FULL hit collection before cosmic removal
620  struct TCEvent {
622  std::vector<recob::Hit> const* allHits = nullptr;
623  std::vector<recob::Hit> const* srcHits = nullptr;
624  // hit Range for the allHits collection in the current TPCID
625  // plane wire firstHit, lastHit
626  std::vector<std::vector<std::pair<unsigned int, unsigned int>>> wireHitRange;
627  // hit range for the srcHits collection
628  std::vector<std::pair<unsigned int, unsigned int>> tpcSrcHitRange;
629  // list of good wires in the current TPCID
630  std::vector<std::vector<bool>> goodWire;
631  std::vector<recob::SpacePoint> const* sptHandle =
632  nullptr; ///< handle to SpacePoints in the event
633  std::vector<std::array<unsigned int, 3>> sptHits; ///< SpacePoint -> Hits assns by plane
634  unsigned int event;
635  unsigned int run;
636  unsigned int subRun;
637  unsigned int eventsProcessed;
638  std::vector<float> aveHitRMS; ///< average RMS of an isolated hit
639  std::vector<TCWireIntersection> wireIntersections;
640  int WorkID;
647  bool aveHitRMSValid{false}; ///< set true when the average hit RMS is well-known
649  false}; ///< info passed from the module - used to (not) define wireHitRange
650  };
651 
652  struct TCSlice {
653  std::vector<unsigned int> nWires;
654  std::vector<unsigned int> firstWire; ///< the first wire with a hit
655  std::vector<unsigned int> lastWire; ///< the last wire with a hit
656  float xLo; // fiducial volume of the current tpc
657  float xHi;
658  float yLo;
659  float yHi;
660  float zLo;
661  float zHi;
663  unsigned short nPlanes;
664  int ID; ///< ID of the recob::Slice (not the sub-slice)
665  // The variables below do change in size from event to event
666 
667  // Save histograms to develop cosmic removal tools
669  std::vector<TCHit> slHits;
670  std::vector<Trajectory> tjs; ///< vector of all trajectories in each plane
671  std::vector<Tj2Pt> mallTraj; ///< vector of trajectory points ordered by increasing X
672  // vector of pairs of first (.first) and last+1 (.second) hit on each wire
673  // in the range fFirstWire to fLastWire. A value of UINT_MAX indicates that there
674  // are no hits on the wire.
675  std::vector<std::vector<std::pair<unsigned int, unsigned int>>> wireHitRange;
676  std::vector<VtxStore> vtxs; ///< 2D vertices
677  std::vector<Vtx3Store> vtx3s; ///< 3D vertices
678  std::vector<PFPStruct> pfps;
679  std::vector<ShowerStruct> cots; // Clusters of Trajectories that define 2D showers
680  std::vector<DontClusterStruct>
681  dontCluster; // pairs of Tjs that shouldn't clustered in one shower
682  std::vector<ShowerStruct3D> showers; // 3D showers
683  bool isValid{false}; // set false if this slice failed reconstruction
684  };
685 
686  extern TCEvent evt;
687  extern TCConfig tcc;
688  extern ShowerTreeVars stv;
689  extern std::vector<TjForecast> tjfs;
690 
691  // vector of hits, tjs, etc in each slice
692  extern std::vector<TCSlice> slices;
693  // vector of seed TPs
694  extern std::vector<TrajPoint> seeds;
695 
696 } // namespace tca
697 
698 #endif // ifndef TRAJCLUSTERALGDATASTRUCT_H
Expect tracks entering from the front face. Don&#39;t create neutrino PFParticles.
Definition: DataStructs.h:532
calo::CalorimetryAlg * caloAlg
Definition: DataStructs.h:577
std::bitset< 16 > UseHit
Definition: DataStructs.h:173
int UID
unique global ID
Definition: DataStructs.h:338
Vector2_t Dir
Definition: DataStructs.h:156
float AveChg
Calculated using ALL hits.
Definition: DataStructs.h:197
std::vector< int > EnvStage
Definition: DataStructs.h:411
Point2_t Pos
Definition: DataStructs.h:155
unsigned short NPts
Definition: DataStructs.h:247
Point2_t PosErr
Definition: DataStructs.h:74
std::vector< int > IsShowerParent
Definition: DataStructs.h:404
std::vector< Trajectory > tjs
vector of all trajectories in each plane
Definition: DataStructs.h:670
Point2_t dEdx
dE/dx for 3D matched trajectories
Definition: DataStructs.h:201
float Wire
Definition: DataStructs.h:257
bool dbgStitch
debug PFParticle stitching
Definition: DataStructs.h:603
std::vector< float > cr_pfpyzmindis
Definition: DataStructs.h:422
std::array< std::vector< float >, 2 > dEdxErr
Definition: DataStructs.h:289
std::vector< float > kinkCuts
kink finder algorithm
Definition: DataStructs.h:559
bool NeedsUpdate
set true if the section needs to be updated
Definition: DataStructs.h:248
unsigned int event
Definition: DataStructs.h:634
int TjID
ID of the trajectory -&gt; TP3D assn.
Definition: DataStructs.h:259
geo::TPCID TPCID
Definition: DataStructs.h:621
float ParSlpErr
Definition: DataStructs.h:184
Point2_t Pos
Definition: DataStructs.h:179
std::vector< float > EndWir
Definition: DataStructs.h:391
struct of temporary 2D vertices (end points)
Definition: DataStructs.h:72
FindVtxTraj algorithm tried.
Definition: DataStructs.h:92
std::vector< float > EndAng
Definition: DataStructs.h:393
const std::vector< std::string > AlgBitNames
Definition: DataStructs.cxx:16
std::vector< ShowerStruct > cots
Definition: DataStructs.h:679
CTP_t CTP
Cryostat, TPC, Plane code.
Definition: DataStructs.h:153
unsigned int run
Definition: DataStructs.h:635
float showerLikeFraction
fraction of points in the forecast envelope that are shower-like
Definition: DataStructs.h:222
std::vector< double > dEdxErr
Definition: DataStructs.h:361
std::vector< float > maxPos0
Definition: DataStructs.h:572
short recoTPC
only reconstruct in the seleted TPC
Definition: DataStructs.h:589
unsigned short NTPsFit
Definition: DataStructs.h:169
std::vector< unsigned short > minPtsFit
Reconstruct in several passes.
Definition: DataStructs.h:565
std::vector< float > cr_pfpxmax
Definition: DataStructs.h:421
int UID
unique global ID
Definition: DataStructs.h:367
std::vector< int > NearTjIDs
Definition: DataStructs.h:326
std::array< double, 3 > Point3_t
Definition: DataStructs.h:41
std::vector< ShowerStruct3D > showers
Definition: DataStructs.h:682
std::vector< float > vtx3DCuts
2D vtx -&gt; 3D vtx matching cuts
Definition: DataStructs.h:551
std::vector< float > qualityCuts
Min points/wire, min consecutive pts after a gap.
Definition: DataStructs.h:563
std::vector< float > BeginTim
Definition: DataStructs.h:387
std::array< int, 2 > TjIDs
Definition: DataStructs.h:378
std::vector< Point2_t > Envelope
Definition: DataStructs.h:332
tagged as a vertex between Tjs that are matched to MC truth neutrino interaction particles ...
Definition: DataStructs.h:96
TCConfig tcc
Definition: DataStructs.cxx:9
unsigned short id
Definition: DataStructs.h:146
unsigned short Step
Definition: DataStructs.h:170
vertex position fixed manually - no fitting done
Definition: DataStructs.h:93
std::vector< int > TjIDs
Definition: DataStructs.h:275
Declaration of signal hit object.
std::vector< float > BeginAng
Definition: DataStructs.h:388
std::bitset< pAlgModSize > AlgMod
Definition: DataStructs.h:302
bool leavesBeforeEnd
leaves the forecast envelope before the end
Definition: DataStructs.h:230
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > wireHitRange
Definition: DataStructs.h:675
std::vector< int > Vx2ID
Definition: DataStructs.h:114
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
matched to a high-score 3D vertex
Definition: DataStructs.h:95
int ParentID
ID of the parent, or the ID of the Tj this one was merged with if it is killed.
Definition: DataStructs.h:195
std::vector< unsigned int > Hits
Definition: DataStructs.h:172
std::vector< double > MIPEnergy
Definition: DataStructs.h:358
step from US -&gt; DS (true) or DS -&gt; US (false)
Definition: DataStructs.h:531
Point3_t Pos
center position of this section
Definition: DataStructs.h:243
std::vector< int > TjIDs
Definition: DataStructs.h:325
VtxBit_t
Definition: DataStructs.h:91
float TotChg
Total including an estimate for dead wires.
Definition: DataStructs.h:198
short MCSMom
Normalized RMS using ALL hits. Assume it is 50% to start.
Definition: DataStructs.h:200
unsigned short Pass
Definition: DataStructs.h:76
TP3DFlags_t
Definition: DataStructs.h:266
bool dbgDeltaRayTag
Definition: DataStructs.h:599
float maxWireSkipWithSignal
max number of wires to skip with a signal on them
Definition: DataStructs.h:582
call study functions to develop cuts, etc
Definition: DataStructs.h:536
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
std::vector< std::pair< unsigned int, unsigned int > > tpcSrcHitRange
Definition: DataStructs.h:628
std::vector< Tj2Pt > Tj2Pts
Definition: DataStructs.h:239
std::vector< float > electronTag
Definition: DataStructs.h:556
a general purpose flag bit used in 3D matching
Definition: DataStructs.h:526
bool dbgSlc
debug only in the user-defined slice? default is all slices
Definition: DataStructs.h:590
std::vector< unsigned int > lastWire
the last wire with a hit
Definition: DataStructs.h:655
std::array< int, 2 > Vx3ID
Definition: DataStructs.h:290
float AvePar
Definition: DataStructs.h:181
bool expectSlicedHits
info passed from the module - used to (not) define wireHitRange
Definition: DataStructs.h:648
unsigned int eventsProcessed
Definition: DataStructs.h:637
std::vector< int > CotIDs
Definition: DataStructs.h:363
bool IsGood
set false if there is a failure or the Tj fails quality cuts
Definition: DataStructs.h:215
std::vector< std::array< unsigned int, 3 > > sptHits
SpacePoint -&gt; Hits assns by plane.
Definition: DataStructs.h:633
std::vector< ShowerPoint > ShPts
Definition: DataStructs.h:327
bool doForecast
See TCMode_t above.
Definition: DataStructs.h:608
Strategy_t
Definition: DataStructs.h:499
AlgBit_t
Definition: DataStructs.h:426
CRTreeVars crt
Definition: DataStructs.h:668
std::vector< float > angleRanges
list of max angles for each angle range
Definition: DataStructs.h:569
const std::vector< std::string > EndFlagNames
Definition: DataStructs.cxx:88
std::vector< float > showerTag
shower-like trajectory tagging + shower reconstruction
Definition: DataStructs.h:558
unsigned short Pass
the pass on which it was created
Definition: DataStructs.h:209
bool dbg3V
debug 3D vertex finding
Definition: DataStructs.h:597
Vector3_t DirErr
and direction error
Definition: DataStructs.h:245
don&#39;t mess with this line
Definition: DataStructs.h:100
std::vector< float > EndTim
Definition: DataStructs.h:392
unsigned short plane
Definition: DataStructs.h:144
std::vector< int > ShowerID
Definition: DataStructs.h:403
ShowerTreeVars stv
Definition: DataStructs.cxx:11
unsigned short npts
Definition: DataStructs.h:149
unsigned short TID
Definition: DataStructs.h:318
std::vector< unsigned short > maxAngleCode
max allowed angle code for each pass
Definition: DataStructs.h:567
process_name can override from command line with o or output calo
Definition: pid.fcl:40
std::bitset< 8 > Flags
Definition: DataStructs.h:300
float projectionErrFactor
Definition: DataStructs.h:583
std::vector< int > TjUIDs
Definition: DataStructs.h:284
save shower tree
Definition: DataStructs.h:540
constexpr unsigned int Tpad
Definition: DataStructs.h:48
unsigned short ipt
Definition: DataStructs.h:147
std::vector< DontClusterStruct > dontCluster
Definition: DataStructs.h:681
const std::vector< std::string > StrategyBitNames
std::vector< std::string > StageName
Definition: DataStructs.h:406
CTP_t CTP
Definition: DataStructs.h:260
struct of temporary 3D vertices
Definition: DataStructs.h:104
Vector3_t Dir
Definition: DataStructs.h:254
geo::TPCID TPCID
Definition: DataStructs.h:295
short nPtsAve
dump trajectory points
Definition: DataStructs.h:606
std::vector< int > TjID
Definition: DataStructs.h:401
Vector3_t Dir
and direction
Definition: DataStructs.h:244
bool dbgStp
debug stepping using debug.Cryostat, debug.TPC, etc
Definition: DataStructs.h:591
unsigned short nextForecastUpdate
Revise the forecast when NumPtsWithCharge == nextForecastUpdate.
Definition: DataStructs.h:220
std::vector< Tj2Pt > mallTraj
vector of trajectory points ordered by increasing X
Definition: DataStructs.h:671
std::array< float, 2 > Point2_t
Definition: DataStructs.h:43
std::vector< float > maxPos1
Definition: DataStructs.h:573
don&#39;t mess with this line
Definition: DataStructs.h:515
float unitsPerTick
scale factor from Tick to WSE equivalent units
Definition: DataStructs.h:571
use the slowing-down strategy
Definition: DataStructs.h:503
std::vector< short > minMCSMom
Min MCSMom for each pass.
Definition: DataStructs.h:568
std::vector< short > BeginVtx
Definition: DataStructs.h:390
geo::TPCID TPCID
Definition: DataStructs.h:113
TP is near a hit in the srcHit collection but no allHit hit exists (DUNE disambiguation error) ...
Definition: DataStructs.h:525
CTP_t CTP
Cryostat, TPC, Plane code.
Definition: DataStructs.h:192
int UID
unique global ID
Definition: DataStructs.h:116
unsigned short TPIndex
and the TP index
Definition: DataStructs.h:261
unsigned int wire
Definition: DataStructs.h:140
the environment near the vertex was checked - See UpdateVxEnvironment
Definition: DataStructs.h:99
bool dbg2V
debug 2D vertex finding
Definition: DataStructs.h:593
std::vector< float > aveHitRMS
average RMS of an isolated hit
Definition: DataStructs.h:638
std::vector< TrajPoint > Pts
Trajectory points.
Definition: DataStructs.h:191
TMVA::Reader * showerParentReader
Definition: DataStructs.h:578
std::vector< std::vector< bool > > goodWire
Definition: DataStructs.h:630
Point3_t Pos
position of the trajectory
Definition: DataStructs.h:253
std::vector< float > showerParentVars
Definition: DataStructs.h:579
std::vector< float > neutralVxCuts
Definition: DataStructs.h:553
std::vector< short > EndVtx
Definition: DataStructs.h:395
BEGIN_PROLOG local::showertrajpointdedx icarus_pandorashower_3dTraj ShowerFinderTools[3] CalorimetryAlg
unsigned short pln2
Definition: DataStructs.h:125
std::bitset< 8 > Flags
Definition: DataStructs.h:263
std::vector< VtxStore > vtxs
2D vertices
Definition: DataStructs.h:676
std::array< unsigned short, 2 > EndPt
First and last point in the trajectory that has charge.
Definition: DataStructs.h:203
unsigned short PDGCode
shower-like or track-like {default is track-like}
Definition: DataStructs.h:208
std::vector< int > cr_origin
Definition: DataStructs.h:419
std::vector< float > match3DCuts
3D matching cuts
Definition: DataStructs.h:560
std::vector< SectionFit > SectionFits
Definition: DataStructs.h:286
short StartEnd
The starting end (-1 = don&#39;t know)
Definition: DataStructs.h:211
double TPXErr2
(X position error)^2
Definition: DataStructs.h:256
std::vector< float > Envelope
Definition: DataStructs.h:409
Point2_t Pos
Definition: DataStructs.h:73
call study functions to develop cuts, etc
Definition: DataStructs.h:537
const geo::GeometryCore * geom
Definition: DataStructs.h:576
std::vector< unsigned short > minPts
min number of Pts required to make a trajectory
Definition: DataStructs.h:566
int UID
a unique ID for all slices
Definition: DataStructs.h:206
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
Description of geometry of one entire detector.
constexpr unsigned int pAlgModSize
Definition: DataStructs.h:280
float outlook
tracklike ~&lt; 2, showerlike &gt; 2
Definition: DataStructs.h:224
std::array< double, 2 > Vector2_t
Definition: DataStructs.h:44
Definition of data types for geometry description.
std::vector< unsigned int > Hits
Definition: DataStructs.h:364
std::vector< unsigned int > firstWire
the first wire with a hit
Definition: DataStructs.h:654
float ChiDOF
Definition: DataStructs.h:185
std::vector< float > BeginChg
Definition: DataStructs.h:389
int ID
ID that is local to one slice.
Definition: DataStructs.h:205
std::vector< TCSlice > slices
Definition: DataStructs.cxx:13
std::array< unsigned short, 2 > VtxID
ID of 2D vertex.
Definition: DataStructs.h:202
vertex quality is suspect - No requirement made on chg btw it and the Tj
Definition: DataStructs.h:98
std::bitset< 16 > modes
number of points to find AveChg
Definition: DataStructs.h:607
std::vector< TCHit > slHits
Definition: DataStructs.h:669
std::vector< float > chargeCuts
Definition: DataStructs.h:562
EndFlag_t
Definition: DataStructs.h:507
bool aveHitRMSValid
set true when the average hit RMS is well-known
Definition: DataStructs.h:647
std::bitset< 16 > Stat
Vertex status bits using kVtxBit_t.
Definition: DataStructs.h:88
std::vector< int > EnvPlane
Definition: DataStructs.h:410
int ID
set to 0 if killed
Definition: DataStructs.h:83
std::vector< TrajPoint > seeds
Definition: DataStructs.cxx:14
float ParSlp
Definition: DataStructs.h:183
std::vector< recob::SpacePoint > const * sptHandle
handle to SpacePoints in the event
Definition: DataStructs.h:631
unsigned short AngleCode
Definition: DataStructs.h:171
float maxWireSkipNoSignal
max number of wires to skip w/o a signal on them
Definition: DataStructs.h:581
std::vector< short > MCSMom
Definition: DataStructs.h:397
const std::vector< std::string > VtxBitNames
Definition: DataStructs.cxx:98
std::vector< double > EnergyErr
Definition: DataStructs.h:357
std::vector< double > MIPEnergyErr
Definition: DataStructs.h:359
std::vector< float > vtxScoreWeights
Definition: DataStructs.h:552
unsigned int CTP_t
Definition: DataStructs.h:47
std::vector< Vtx3Store > vtx3s
3D vertices
Definition: DataStructs.h:677
geo::TPCID TPCID
Definition: DataStructs.h:662
TCModes_t
Definition: DataStructs.h:530
std::vector< int > StageNum
Definition: DataStructs.h:405
std::vector< TjForecast > tjfs
Definition: DataStructs.cxx:10
std::vector< recob::Hit > const * srcHits
Definition: DataStructs.h:623
std::bitset< 128 > useAlg
Max hit separation for making junk trajectories. &lt; 0 to turn off.
Definition: DataStructs.h:586
std::vector< float > pfpStitchCuts
cuts for stitching between TPCs
Definition: DataStructs.h:564
std::vector< short > deltaRayTag
Definition: DataStructs.h:554
save cosmic ray tree
Definition: DataStructs.h:538
float ParErr
Definition: DataStructs.h:182
unsigned short nPlanes
Definition: DataStructs.h:415
float VLAStepSize
Definition: DataStructs.h:584
short StepDir
-1 = going US (-&gt; small wire#), 1 = going DS (-&gt; large wire#)
Definition: DataStructs.h:210
std::bitset< 128 > AlgMod
Bit set if algorithm AlgBit_t modifed the trajectory.
Definition: DataStructs.h:193
call study functions to develop cuts, etc
Definition: DataStructs.h:535
std::vector< double > Energy
Definition: DataStructs.h:356
std::vector< short > muonTag
Definition: DataStructs.h:555
unsigned short NTraj
Definition: DataStructs.h:75
std::vector< float > BeginWir
Definition: DataStructs.h:386
geo::PlaneID DecodeCTP(CTP_t CTP)
float along
distance from the start Pos of the section
Definition: DataStructs.h:258
std::vector< float > EndChg
Definition: DataStructs.h:394
std::vector< int > TjIDs
Definition: DataStructs.h:283
PFPFlags_t
Definition: DataStructs.h:305
std::bitset< 128 > dbgAlg
Allow user to turn on debug printing in algorithms (that print...)
Definition: DataStructs.h:587
std::vector< TCWireIntersection > wireIntersections
Definition: DataStructs.h:639
std::bitset< 8 > Environment
Definition: DataStructs.h:174
std::vector< recob::Hit > const * allHits
Definition: DataStructs.h:622
CTP_t EncodeCTP(unsigned int cryo, unsigned int tpc, unsigned int plane)
Definition: DataStructs.h:52
unsigned int HitIndex
Definition: DataStructs.h:316
std::vector< unsigned int > nWires
Definition: DataStructs.h:653
use the stiff electron strategy
Definition: DataStructs.h:501
std::array< std::bitset< 8 >, 2 > EndFlag
Definition: DataStructs.h:212
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:42
std::vector< float > chkStopCuts
Bragg peak finder configuration.
Definition: DataStructs.h:557
std::vector< TP3D > TP3Ds
Definition: DataStructs.h:285
int ID
ID of the recob::Slice (not the sub-slice)
Definition: DataStructs.h:664
std::array< std::vector< float >, 2 > dEdx
Definition: DataStructs.h:288
std::vector< float > cr_pfpxmin
Definition: DataStructs.h:420
int UID
unique global ID
Definition: DataStructs.h:84
unsigned int subRun
Definition: DataStructs.h:636
Vector3_t Dir
Definition: DataStructs.h:238
std::vector< float > vtx2DCuts
Max position pull, max Position error rms.
Definition: DataStructs.h:550
unsigned short pln1
Definition: DataStructs.h:124
std::bitset< 8 > Strategy
Definition: DataStructs.h:213
unsigned short nPlanes
Definition: DataStructs.h:663
int SSID
ID of a 2D shower struct that this tj is in.
Definition: DataStructs.h:207
std::vector< PFPStruct > pfps
Definition: DataStructs.h:678
float multHitSep
preferentially &quot;merge&quot; hits with &lt; this separation
Definition: DataStructs.h:574
float JTMaxHitSep2
Definition: DataStructs.h:585
std::vector< int > EnvShowerID
Definition: DataStructs.h:412
TPEnvironment_t
Definition: DataStructs.h:519
TCEvent evt
Definition: DataStructs.cxx:8
call study functions to develop cuts, etc (see TCTruth.cxx)
Definition: DataStructs.h:534
unsigned int allHitsIndex
Definition: DataStructs.h:613
unsigned short PFPIndex
Definition: DataStructs.h:370
unsigned short MVI
Definition: DataStructs.h:299
double TPX
X position of the TP or the single hit.
Definition: DataStructs.h:255
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
std::vector< int > IsShowerTj
Definition: DataStructs.h:402
constexpr unsigned int Cpad
Definition: DataStructs.h:49
size_t ParentUID
Definition: DataStructs.h:294
unsigned short nPtsFit
Definition: DataStructs.h:186
std::vector< double > dEdx
Definition: DataStructs.h:360
std::vector< short > PlaneNum
Definition: DataStructs.h:399
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > wireHitRange
Definition: DataStructs.h:626
short recoSlice
only reconstruct the slice with ID (0 = all)
Definition: DataStructs.h:588
bool useChannelStatus
Definition: DataStructs.h:609
bool dbgSummary
print a summary report
Definition: DataStructs.h:604
bool NeedsUpdate
Set true when the Tj needs to be updated.
Definition: DataStructs.h:214
float TjChgFrac
Fraction of charge near the vertex that is from hits on the vertex Tjs.
Definition: DataStructs.h:87
master switch for turning on debug mode
Definition: DataStructs.h:533
Point2_t HitPos
Definition: DataStructs.h:154
tag cosmic rays
Definition: DataStructs.h:539
don&#39;t mess with this line
Definition: DataStructs.h:496
std::vector< int > DtrUIDs
Definition: DataStructs.h:293
double HitPosErr2
Definition: DataStructs.h:157
use the stiff muon strategy
Definition: DataStructs.h:502
std::array< std::bitset< 8 >, 2 > EndFlag
Definition: DataStructs.h:301
unsigned short SFIndex
and the section fit index
Definition: DataStructs.h:262
unsigned int index
Definition: DataStructs.h:36