LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
InfoTransfer.h
Go to the documentation of this file.
1 //
3 // Transfer hitlist and run info into a producer module.
4 // Do not copy this code without contacting Andrzej Szelc and Brian Rebel first.
5 //
6 // \author andrzej.szelc@yale.edu
7 // \author ellen.klein@yale.edu
9 #ifndef INFOTRANSFER_H
10 #define INFOTRANSFER_H
11 #ifndef __CINT__
12 #include <iostream>
13 #include <string>
14 #include <vector>
15 
17 
20 
21 namespace art {
22  class ActivityRegistry;
23  class Event;
24 }
26 
27 namespace fhicl {
28  class ParameterSet;
29 }
30 
31 namespace recob {
32  class Hit;
33 }
34 
35 namespace util {
36  class PxPoint;
37  class PxLine;
38 }
39 
40 namespace evd {
42  public:
43  explicit InfoTransfer(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
44  ~InfoTransfer();
45 
46  // The Rebuild function rebuilds the various maps we need to pickup hits.
47  // It is called automatically before each event is processed. For jobs involving
48  // Monte Carlo generation, this is too soon. So, we'll call rebuild after those data
49  // products are put into the event in LArG4. This is the least bad way of ensuring the
50  // InfoTransfer works in jobs that combine MC production and reconstruction analysis based
51  // on MC truth. Don't copy this design pattern without talking to brebel@fnal.gov first
52  void Rebuild(const art::Event& evt, art::ScheduleContext);
53 
54  void reconfigure(fhicl::ParameterSet const& pset);
55  void SetTestFlag(int value) { testflag = value; }
56  int GetTestFlag() const { return testflag; }
57  void SetRunNumber(int value) { fRun = value; }
58  int GetRunNumber() const { return fRun; }
59  void SetSubRunNumber(int value) { fSubRun = value; }
60  int GetSubRunNumber() const { return fSubRun; }
61  void SetEvtNumber(int value) { fEvt = value; }
62  int GetEvtNumber() const { return fEvt; }
63 
64  void SetHitList(unsigned int p, std::vector<art::Ptr<recob::Hit>> hits_to_save)
65  {
66  fSelectedHitlist[p].clear();
67  fSelectedHitlist[p] = hits_to_save;
68  }
69 
70  std::vector<art::Ptr<recob::Hit>> const& GetHitList(unsigned int plane) const
71  {
72  return fRefinedHitlist[plane];
73  }
74 
75  std::vector<art::Ptr<recob::Hit>> const& GetSelectedHitList(unsigned int plane) const
76  {
77  return fSelectedHitlist[plane];
78  }
79 
80  void ClearSelectedHitList(int plane)
81  {
82  if (fSelectedHitlist.size() == 0) {
83  return;
84  std::cout << "no size" << std::endl;
85  }
86  fSelectedHitlist[plane].clear();
87  for (unsigned int i = 0; i < fRefStartHit.size(); i++) {
88  fRefStartHit[i] = NULL;
89  fRefEndHit[i] = NULL;
90  }
91  return;
92  }
93 
94  void SetStartHit(unsigned int p, recob::Hit* starthit) { fStartHit[p] = starthit; }
95 
96  recob::Hit* GetStartHit(unsigned int plane) const { return fRefStartHit[plane]; }
97 
98  void SetEndHit(unsigned int p, recob::Hit* endhit) { fEndHit[p] = endhit; }
99 
100  recob::Hit* GetEndHit(unsigned int plane) const { return fRefEndHit[plane]; }
101 
102  std::vector<double> const& GetStartHitCoords(unsigned int plane) const
103  {
104  return refstarthitout[plane];
105  }
106 
107  std::vector<double> const& GetEndHitCoords(unsigned int plane) const
108  {
109  return refendhitout[plane];
110  }
111 
112  void SetStartHitCoords(unsigned int plane, std::vector<double> starthitin)
113  {
114  starthitout[plane].clear();
115  starthitout[plane].resize(2);
116  starthitout[plane] = starthitin;
117  }
118 
119  void SetEndHitCoords(unsigned int plane, std::vector<double> endhitin)
120  {
121  endhitout[plane].clear();
122  endhitout[plane].resize(2);
123  endhitout[plane] = endhitin;
124  }
125 
126  void SetSeedList(std::vector<util::PxLine> seedlines);
127 
128  std::vector<util::PxLine> const& GetSeedList() const;
129 
130  private:
131  void FillStartEndHitCoords(unsigned int plane);
132 
133  int testflag;
134  int fEvt;
135  int fRun;
136  int fSubRun;
137  std::vector<std::vector<art::Ptr<recob::Hit>>>
139  std::vector<std::vector<art::Ptr<recob::Hit>>>
141  std::vector<art::Ptr<recob::Hit>> fFullHitlist;
142  std::string fHitModuleLabel;
143 
144  std::vector<recob::Hit*> fStartHit;
145  std::vector<recob::Hit*> fRefStartHit;
146 
147  std::vector<recob::Hit*> fEndHit;
148  std::vector<recob::Hit*> fRefEndHit;
149 
150  std::vector<util::PxLine> fSeedList;
151 
152  std::vector<std::vector<double>> starthitout;
153  std::vector<std::vector<double>> endhitout;
154 
155  std::vector<std::vector<double>> refstarthitout;
156  std::vector<std::vector<double>> refendhitout;
157  };
158 } //namespace
159 #endif // __CINT__
161 #endif
void SetTestFlag(int value)
Definition: InfoTransfer.h:55
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
recob::Hit * GetStartHit(unsigned int plane) const
Definition: InfoTransfer.h:96
void SetStartHit(unsigned int p, recob::Hit *starthit)
Definition: InfoTransfer.h:94
Reconstruction base classes.
void SetEndHit(unsigned int p, recob::Hit *endhit)
Definition: InfoTransfer.h:98
void ClearSelectedHitList(int plane)
Definition: InfoTransfer.h:80
std::vector< recob::Hit * > fEndHit
The Starthit.
Definition: InfoTransfer.h:147
void SetHitList(unsigned int p, std::vector< art::Ptr< recob::Hit >> hits_to_save)
Definition: InfoTransfer.h:64
std::vector< double > const & GetEndHitCoords(unsigned int plane) const
Definition: InfoTransfer.h:107
std::vector< recob::Hit * > fStartHit
The Starthit.
Definition: InfoTransfer.h:144
std::vector< art::Ptr< recob::Hit > > const & GetHitList(unsigned int plane) const
Definition: InfoTransfer.h:70
recob::Hit * GetEndHit(unsigned int plane) const
Definition: InfoTransfer.h:100
std::vector< art::Ptr< recob::Hit > > fFullHitlist
the full Hit list from the Hitfinder.
Definition: InfoTransfer.h:141
void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
Definition: InfoTransfer.h:112
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:153
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
void SetRunNumber(int value)
Definition: InfoTransfer.h:57
LArSoft includes.
void SetSubRunNumber(int value)
Definition: InfoTransfer.h:59
#define DECLARE_ART_SERVICE(svc, scope)
parameter set interface
std::vector< art::Ptr< recob::Hit > > const & GetSelectedHitList(unsigned int plane) const
Definition: InfoTransfer.h:75
int GetRunNumber() const
Definition: InfoTransfer.h:58
std::vector< std::vector< double > > refendhitout
Definition: InfoTransfer.h:156
int GetSubRunNumber() const
Definition: InfoTransfer.h:60
Interface class to services that are intended to be reconfigurable through the event display...
std::string fHitModuleLabel
label for geant4 module
Definition: InfoTransfer.h:142
int GetTestFlag() const
Definition: InfoTransfer.h:56
std::vector< std::vector< art::Ptr< recob::Hit > > > fRefinedHitlist
the refined hitlist after rebuild (one for each plane)
Definition: InfoTransfer.h:140
double value
Definition: spectrum.C:18
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:145
void SetEvtNumber(int value)
Definition: InfoTransfer.h:61
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:148
Definition: MVAAlg.h:12
void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
Definition: InfoTransfer.h:119
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
TCEvent evt
Definition: DataStructs.cxx:8
std::vector< util::PxLine > fSeedList
Definition: InfoTransfer.h:150
std::vector< std::vector< double > > starthitout
Definition: InfoTransfer.h:152
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:138
int GetEvtNumber() const
Definition: InfoTransfer.h:62
std::vector< std::vector< double > > refstarthitout
Definition: InfoTransfer.h:155
std::vector< double > const & GetStartHitCoords(unsigned int plane) const
Definition: InfoTransfer.h:102