InfoTransfer.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
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
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef INFOTRANSFER_H
10 #define INFOTRANSFER_H
11 #ifndef __CINT__
12 #include <string>
13 #include <vector>
14 #include <iostream>
15 
16 #include "fhiclcpp/ParameterSet.h"
20 #include "nuevdb/EventDisplayBase/Reconfigurable.h"
21 
24 
25 
26  namespace util {
27  class PxPoint;
28  class PxLine;
29  }
30 
31 
32 namespace evd {
33  class InfoTransfer : public evdb::Reconfigurable
34  {
35  public:
36  explicit InfoTransfer(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
37  ~InfoTransfer();
38 
39 
40  // The Rebuild function rebuilds the various maps we need to pickup hits.
41  // It is called automatically before each event is processed. For jobs involving
42  // Monte Carlo generation, this is too soon. So, we'll call rebuild after those data
43  // products are put into the event in LArG4. This is the least bad way of ensuring the
44  // InfoTransfer works in jobs that combine MC production and reconstruction analysis based
45  // on MC truth. Don't copy this design pattern without talking to brebel@fnal.gov first
46  void Rebuild(const art::Event& evt, art::ScheduleContext);
47 
48 
49  void reconfigure(fhicl::ParameterSet const& pset) ;
50  void SetTestFlag(int value){ testflag = value; }
51  int GetTestFlag() const { return testflag; }
52  void SetRunNumber(int value){ fRun = value; }
53  int GetRunNumber() const { return fRun; }
54  void SetSubRunNumber(int value){ fSubRun = value; }
55  int GetSubRunNumber() const { return fSubRun; }
56  void SetEvtNumber(int value){ fEvt = value; }
57  int GetEvtNumber() const { return fEvt; }
58 
59 
60  void SetHitList(unsigned int p,std::vector<art::Ptr < recob::Hit> > hits_to_save)
61  { fSelectedHitlist[p].clear(); fSelectedHitlist[p]=hits_to_save; }
62 
63  std::vector < art::Ptr < recob::Hit> > const& GetHitList(unsigned int plane) const
64  { return fRefinedHitlist[plane]; }
65 
66  std::vector< art::Ptr < recob::Hit> > const& GetSelectedHitList(unsigned int plane) const
67  { return fSelectedHitlist[plane]; }
68 
69  void ClearSelectedHitList(int plane)
70  {
71  if (fSelectedHitlist.size()==0) {return; std::cout<<"no size"<<std::endl;}
72  fSelectedHitlist[plane].clear();
73  for(unsigned int i=0; i<fRefStartHit.size(); i++){
74  fRefStartHit[i]=NULL;
75  fRefEndHit[i]=NULL;
76  }
77  return;
78  }
79 
80  void SetStartHit(unsigned int p, recob::Hit * starthit)
81  { fStartHit[p]=starthit; }
82 
83  recob::Hit * GetStartHit(unsigned int plane) const
84  {return fRefStartHit[plane];}
85 
86  void SetEndHit(unsigned int p, recob::Hit * endhit)
87  { fEndHit[p]=endhit; }
88 
89  recob::Hit * GetEndHit(unsigned int plane) const
90  { return fRefEndHit[plane]; }
91 
92  std::vector< double > const& GetStartHitCoords(unsigned int plane) const
93  { return refstarthitout[plane]; }
94 
95  std::vector< double > const& GetEndHitCoords(unsigned int plane) const
96  { return refendhitout[plane]; }
97 
98  void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
99  {
100  starthitout[plane].clear();
101  starthitout[plane].resize(2);
102  starthitout[plane]=starthitin;
103  }
104 
105  void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
106  {
107  endhitout[plane].clear();
108  endhitout[plane].resize(2);
109  endhitout[plane]=endhitin;
110  }
111 
112  void SetSeedList(std::vector < util::PxLine > seedlines);
113 
114 
115  std::vector < util::PxLine > const& GetSeedList() const;
116 
117  private:
118 
119  void FillStartEndHitCoords(unsigned int plane);
120 
121  int testflag;
122  int fEvt;
123  int fRun;
124  int fSubRun;
125  std::vector < std::vector< art::Ptr < recob::Hit > > > fSelectedHitlist; ///< the list selected by the GUI (one for each plane)
126  std::vector < std::vector< art::Ptr < recob::Hit > > > fRefinedHitlist; ///< the refined hitlist after rebuild (one for each plane)
127  std::vector< art::Ptr < recob::Hit > > fFullHitlist; ///< the full Hit list from the Hitfinder.
128  std::string fHitModuleLabel; ///< label for geant4 module
129 
130  std::vector < recob::Hit * > fStartHit; ///< The Starthit
131  std::vector < recob::Hit * > fRefStartHit; ///< The Refined Starthit
132 
133  std::vector < recob::Hit * > fEndHit; ///< The Starthit
134  std::vector < recob::Hit * > fRefEndHit; ///< The Refined Starthit
135 
136  std::vector < util::PxLine > fSeedList;
137 
138  std::vector < std::vector <double > > starthitout;
139  std::vector < std::vector <double > > endhitout;
140 
141  std::vector < std::vector <double > > refstarthitout;
142  std::vector < std::vector <double > > refendhitout;
143 
144  };
145 }//namespace
146 #endif // __CINT__
148 #endif
void SetTestFlag(int value)
Definition: InfoTransfer.h:50
Namespace for general, non-LArSoft-specific utilities.
recob::Hit * GetStartHit(unsigned int plane) const
Definition: InfoTransfer.h:83
void SetStartHit(unsigned int p, recob::Hit *starthit)
Definition: InfoTransfer.h:80
void SetEndHit(unsigned int p, recob::Hit *endhit)
Definition: InfoTransfer.h:86
void ClearSelectedHitList(int plane)
Definition: InfoTransfer.h:69
std::string string
Definition: nybbler.cc:12
struct vector vector
recob::Hit * GetEndHit(unsigned int plane) const
Definition: InfoTransfer.h:89
void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
Definition: InfoTransfer.h:98
std::vector< double > const & GetEndHitCoords(unsigned int plane) const
Definition: InfoTransfer.h:95
void SetRunNumber(int value)
Definition: InfoTransfer.h:52
LArSoft includes.
Definition: InfoTransfer.h:33
void SetSubRunNumber(int value)
Definition: InfoTransfer.h:54
virtual void reconfigure(fhicl::ParameterSet const &pset)
#define DECLARE_ART_SERVICE(svc, scope)
std::vector< art::Ptr< recob::Hit > > const & GetHitList(unsigned int plane) const
Definition: InfoTransfer.h:63
void SetHitList(unsigned int p, std::vector< art::Ptr< recob::Hit > > hits_to_save)
Definition: InfoTransfer.h:60
int GetRunNumber() const
Definition: InfoTransfer.h:53
p
Definition: test.py:223
int GetSubRunNumber() const
Definition: InfoTransfer.h:55
int GetTestFlag() const
Definition: InfoTransfer.h:51
void SetEvtNumber(int value)
Definition: InfoTransfer.h:56
Declaration of signal hit object.
std::vector< art::Ptr< recob::Hit > > const & GetSelectedHitList(unsigned int plane) const
Definition: InfoTransfer.h:66
void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
Definition: InfoTransfer.h:105
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< double > const & GetStartHitCoords(unsigned int plane) const
Definition: InfoTransfer.h:92
QTextStream & endl(QTextStream &s)
int GetEvtNumber() const
Definition: InfoTransfer.h:57