All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "nuevdb/EventDisplayBase/Reconfigurable.h"
17 
18 #include "art/Persistency/Provenance/ScheduleContext.h"
19 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
20 
21 namespace art {
22  class ActivityRegistry;
23  class Event;
24 }
25 #include "canvas/Persistency/Common/Ptr.h"
26 
27 namespace fhicl { class ParameterSet; }
28 
29 namespace recob {
30  class Hit;
31 }
32 
33 namespace util {
34  class PxPoint;
35  class PxLine;
36 }
37 
38 
39 namespace evd {
40  class InfoTransfer : public evdb::Reconfigurable
41  {
42  public:
43  explicit InfoTransfer(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
44  ~InfoTransfer();
45 
46 
47  // The Rebuild function rebuilds the various maps we need to pickup hits.
48  // It is called automatically before each event is processed. For jobs involving
49  // Monte Carlo generation, this is too soon. So, we'll call rebuild after those data
50  // products are put into the event in LArG4. This is the least bad way of ensuring the
51  // InfoTransfer works in jobs that combine MC production and reconstruction analysis based
52  // on MC truth. Don't copy this design pattern without talking to brebel@fnal.gov first
53  void Rebuild(const art::Event& evt, art::ScheduleContext);
54 
55 
56  void reconfigure(fhicl::ParameterSet const& pset) ;
57  void SetTestFlag(int value){ testflag = value; }
58  int GetTestFlag() const { return testflag; }
59  void SetRunNumber(int value){ fRun = value; }
60  int GetRunNumber() const { return fRun; }
62  int GetSubRunNumber() const { return fSubRun; }
63  void SetEvtNumber(int value){ fEvt = value; }
64  int GetEvtNumber() const { return fEvt; }
65 
66 
67  void SetHitList(unsigned int p,std::vector<art::Ptr < recob::Hit> > hits_to_save)
68  { fSelectedHitlist[p].clear(); fSelectedHitlist[p]=hits_to_save; }
69 
70  std::vector < art::Ptr < recob::Hit> > const& GetHitList(unsigned int plane) const
71  { return fRefinedHitlist[plane]; }
72 
73  std::vector< art::Ptr < recob::Hit> > const& GetSelectedHitList(unsigned int plane) const
74  { return fSelectedHitlist[plane]; }
75 
76  void ClearSelectedHitList(int plane)
77  {
78  if (fSelectedHitlist.size()==0) {return; std::cout<<"no size"<<std::endl;}
79  fSelectedHitlist[plane].clear();
80  for(unsigned int i=0; i<fRefStartHit.size(); i++){
81  fRefStartHit[i]=NULL;
82  fRefEndHit[i]=NULL;
83  }
84  return;
85  }
86 
87  void SetStartHit(unsigned int p, recob::Hit * starthit)
88  { fStartHit[p]=starthit; }
89 
90  recob::Hit * GetStartHit(unsigned int plane) const
91  {return fRefStartHit[plane];}
92 
93  void SetEndHit(unsigned int p, recob::Hit * endhit)
94  { fEndHit[p]=endhit; }
95 
96  recob::Hit * GetEndHit(unsigned int plane) const
97  { return fRefEndHit[plane]; }
98 
99  std::vector< double > const& GetStartHitCoords(unsigned int plane) const
100  { return refstarthitout[plane]; }
101 
102  std::vector< double > const& GetEndHitCoords(unsigned int plane) const
103  { return refendhitout[plane]; }
104 
105  void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
106  {
107  starthitout[plane].clear();
108  starthitout[plane].resize(2);
109  starthitout[plane]=starthitin;
110  }
111 
112  void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
113  {
114  endhitout[plane].clear();
115  endhitout[plane].resize(2);
116  endhitout[plane]=endhitin;
117  }
118 
119  void SetSeedList(std::vector < util::PxLine > seedlines);
120 
121 
122  std::vector < util::PxLine > const& GetSeedList() const;
123 
124  private:
125 
126  void FillStartEndHitCoords(unsigned int plane);
127 
128  int testflag;
129  int fEvt;
130  int fRun;
131  int fSubRun;
132  std::vector < std::vector< art::Ptr < recob::Hit > > > fSelectedHitlist; ///< the list selected by the GUI (one for each plane)
133  std::vector < std::vector< art::Ptr < recob::Hit > > > fRefinedHitlist; ///< the refined hitlist after rebuild (one for each plane)
134  std::vector< art::Ptr < recob::Hit > > fFullHitlist; ///< the full Hit list from the Hitfinder.
135  std::string fHitModuleLabel; ///< label for geant4 module
136 
137  std::vector < recob::Hit * > fStartHit; ///< The Starthit
138  std::vector < recob::Hit * > fRefStartHit; ///< The Refined Starthit
139 
140  std::vector < recob::Hit * > fEndHit; ///< The Starthit
141  std::vector < recob::Hit * > fRefEndHit; ///< The Refined Starthit
142 
143  std::vector < util::PxLine > fSeedList;
144 
145  std::vector < std::vector <double > > starthitout;
146  std::vector < std::vector <double > > endhitout;
147 
148  std::vector < std::vector <double > > refstarthitout;
149  std::vector < std::vector <double > > refendhitout;
150 
151  };
152 }//namespace
153 #endif // __CINT__
154 DECLARE_ART_SERVICE(evd::InfoTransfer, LEGACY)
155 #endif
void SetTestFlag(int value)
Definition: InfoTransfer.h:57
void FillStartEndHitCoords(unsigned int plane)
recob::Hit * GetStartHit(unsigned int plane) const
Definition: InfoTransfer.h:90
void SetStartHit(unsigned int p, recob::Hit *starthit)
Definition: InfoTransfer.h:87
void SetEndHit(unsigned int p, recob::Hit *endhit)
Definition: InfoTransfer.h:93
void ClearSelectedHitList(int plane)
Definition: InfoTransfer.h:76
InfoTransfer(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
Definition: InfoTransfer.cc:38
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:146
pdgs p
Definition: selectors.fcl:22
recob::Hit * GetEndHit(unsigned int plane) const
Definition: InfoTransfer.h:96
void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
Definition: InfoTransfer.h:105
std::vector< double > const & GetEndHitCoords(unsigned int plane) const
Definition: InfoTransfer.h:102
std::vector< recob::Hit * > fStartHit
The Starthit.
Definition: InfoTransfer.h:137
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:138
void SetRunNumber(int value)
Definition: InfoTransfer.h:59
std::vector< std::vector< double > > refstarthitout
Definition: InfoTransfer.h:148
void SetSubRunNumber(int value)
Definition: InfoTransfer.h:61
std::vector< art::Ptr< recob::Hit > > const & GetHitList(unsigned int plane) const
Definition: InfoTransfer.h:70
void SetHitList(unsigned int p, std::vector< art::Ptr< recob::Hit > > hits_to_save)
Definition: InfoTransfer.h:67
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:141
int GetRunNumber() const
Definition: InfoTransfer.h:60
std::vector< recob::Hit * > fEndHit
The Starthit.
Definition: InfoTransfer.h:140
std::vector< std::vector< art::Ptr< recob::Hit > > > fRefinedHitlist
the refined hitlist after rebuild (one for each plane)
Definition: InfoTransfer.h:133
int GetSubRunNumber() const
Definition: InfoTransfer.h:62
std::string fHitModuleLabel
label for geant4 module
Definition: InfoTransfer.h:135
int GetTestFlag() const
Definition: InfoTransfer.h:58
std::vector< std::vector< double > > starthitout
Definition: InfoTransfer.h:145
std::vector< art::Ptr< recob::Hit > > fFullHitlist
the full Hit list from the Hitfinder.
Definition: InfoTransfer.h:134
void Rebuild(const art::Event &evt, art::ScheduleContext)
Definition: InfoTransfer.cc:92
void SetEvtNumber(int value)
Definition: InfoTransfer.h:63
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
void SetSeedList(std::vector< util::PxLine > seedlines)
std::vector< art::Ptr< recob::Hit > > const & GetSelectedHitList(unsigned int plane) const
Definition: InfoTransfer.h:73
std::vector< std::vector< double > > refendhitout
Definition: InfoTransfer.h:149
void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
Definition: InfoTransfer.h:112
temporary value
std::vector< util::PxLine > const & GetSeedList() const
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TCEvent evt
Definition: DataStructs.cxx:8
void reconfigure(fhicl::ParameterSet const &pset)
Definition: InfoTransfer.cc:75
std::vector< double > const & GetStartHitCoords(unsigned int plane) const
Definition: InfoTransfer.h:99
BEGIN_PROLOG could also be cout
std::vector< util::PxLine > fSeedList
Definition: InfoTransfer.h:143
int GetEvtNumber() const
Definition: InfoTransfer.h:64