All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
evd::InfoTransfer Class Reference

#include <InfoTransfer.h>

Inheritance diagram for evd::InfoTransfer:

Public Member Functions

 InfoTransfer (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
 ~InfoTransfer ()
 
void Rebuild (const art::Event &evt, art::ScheduleContext)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void SetTestFlag (int value)
 
int GetTestFlag () const
 
void SetRunNumber (int value)
 
int GetRunNumber () const
 
void SetSubRunNumber (int value)
 
int GetSubRunNumber () const
 
void SetEvtNumber (int value)
 
int GetEvtNumber () const
 
void SetHitList (unsigned int p, std::vector< art::Ptr< recob::Hit > > hits_to_save)
 
std::vector< art::Ptr
< recob::Hit > > const & 
GetHitList (unsigned int plane) const
 
std::vector< art::Ptr
< recob::Hit > > const & 
GetSelectedHitList (unsigned int plane) const
 
void ClearSelectedHitList (int plane)
 
void SetStartHit (unsigned int p, recob::Hit *starthit)
 
recob::HitGetStartHit (unsigned int plane) const
 
void SetEndHit (unsigned int p, recob::Hit *endhit)
 
recob::HitGetEndHit (unsigned int plane) const
 
std::vector< double > const & GetStartHitCoords (unsigned int plane) const
 
std::vector< double > const & GetEndHitCoords (unsigned int plane) const
 
void SetStartHitCoords (unsigned int plane, std::vector< double > starthitin)
 
void SetEndHitCoords (unsigned int plane, std::vector< double > endhitin)
 
void SetSeedList (std::vector< util::PxLine > seedlines)
 
std::vector< util::PxLine > const & GetSeedList () const
 

Private Member Functions

void FillStartEndHitCoords (unsigned int plane)
 

Private Attributes

int testflag
 
int fEvt
 
int fRun
 
int fSubRun
 
std::vector< std::vector
< art::Ptr< recob::Hit > > > 
fSelectedHitlist
 the list selected by the GUI (one for each plane) More...
 
std::vector< std::vector
< art::Ptr< recob::Hit > > > 
fRefinedHitlist
 the refined hitlist after rebuild (one for each plane) More...
 
std::vector< art::Ptr
< recob::Hit > > 
fFullHitlist
 the full Hit list from the Hitfinder. More...
 
std::string fHitModuleLabel
 label for geant4 module More...
 
std::vector< recob::Hit * > fStartHit
 The Starthit. More...
 
std::vector< recob::Hit * > fRefStartHit
 The Refined Starthit. More...
 
std::vector< recob::Hit * > fEndHit
 The Starthit. More...
 
std::vector< recob::Hit * > fRefEndHit
 The Refined Starthit. More...
 
std::vector< util::PxLinefSeedList
 
std::vector< std::vector
< double > > 
starthitout
 
std::vector< std::vector
< double > > 
endhitout
 
std::vector< std::vector
< double > > 
refstarthitout
 
std::vector< std::vector
< double > > 
refendhitout
 

Detailed Description

Definition at line 40 of file InfoTransfer.h.

Constructor & Destructor Documentation

evd::InfoTransfer::InfoTransfer ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry &  reg 
)
explicit

Definition at line 38 of file InfoTransfer.cc.

40  : evdb::Reconfigurable{pset}
41  {
42  this->reconfigure(pset);
43  testflag=-1;
44  fEvt=-1;
45  fRun=-1;
46  fSubRun=-1;
47  reg.sPreProcessEvent.watch(this, &InfoTransfer::Rebuild);
48  art::ServiceHandle<geo::Geometry const> geo;
49  unsigned int nplanes = geo->Nplanes();
50 
51  fSelectedHitlist.resize(nplanes);
52  fStartHit.resize(nplanes);
53  fRefStartHit.resize(nplanes);
54  fEndHit.resize(nplanes);
55  fRefEndHit.resize(nplanes);
56  starthitout.resize(nplanes);
57  endhitout.resize(nplanes);
58  refstarthitout.resize(nplanes);
59  refendhitout.resize(nplanes);
60  for(unsigned int i=0;i<nplanes;i++){
61  starthitout[i].resize(2);
62  endhitout[i].resize(2);
63  refstarthitout[i].resize(2);
64  refendhitout[i].resize(2);
65  }
66  // hitlist=NULL;
67  }
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:146
std::vector< recob::Hit * > fStartHit
The Starthit.
Definition: InfoTransfer.h:137
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:138
std::vector< std::vector< double > > refstarthitout
Definition: InfoTransfer.h:148
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:141
std::vector< recob::Hit * > fEndHit
The Starthit.
Definition: InfoTransfer.h:140
std::vector< std::vector< double > > starthitout
Definition: InfoTransfer.h:145
void Rebuild(const art::Event &evt, art::ScheduleContext)
Definition: InfoTransfer.cc:92
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
std::vector< std::vector< double > > refendhitout
Definition: InfoTransfer.h:149
void reconfigure(fhicl::ParameterSet const &pset)
Definition: InfoTransfer.cc:75
evd::InfoTransfer::~InfoTransfer ( )

Definition at line 70 of file InfoTransfer.cc.

71  {
72  }

Member Function Documentation

void evd::InfoTransfer::ClearSelectedHitList ( int  plane)
inline

Definition at line 76 of file InfoTransfer.h.

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  }
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:138
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:141
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
BEGIN_PROLOG could also be cout
void evd::InfoTransfer::FillStartEndHitCoords ( unsigned int  plane)
private

Definition at line 216 of file InfoTransfer.cc.

217  {
218 
219  art::ServiceHandle<geo::Geometry const> geo;
220  // std::vector <double> sthitout(2);
221  if(fRefStartHit[plane]){
222  starthitout[plane][1] = fRefStartHit[plane]->PeakTime() ;
223  try{
224  if(fRefStartHit[plane]->WireID().isValid){
225  starthitout[plane][0] = fRefStartHit[plane]->WireID().Wire;
226  }
227  else{
228  starthitout[plane][0]=0;
229  }
230  }
231  catch(cet::exception const& e) {
232  mf::LogWarning("GraphCluster") << "caught exception \n"
233  << e;
234  starthitout[plane][0]=0;
235  }
236  }
237  else{
238  starthitout[plane][1]=0.;
239  starthitout[plane][0]=0.;
240  }
241 
242 
243  if(fRefEndHit[plane]){
244  endhitout[plane][1] = fRefEndHit[plane]->PeakTime() ;
245  try{
246  if(fRefEndHit[plane]->WireID().isValid){
247  endhitout[plane][0] = fRefEndHit[plane]->WireID().Wire;
248  }
249  else{
250  endhitout[plane][0]=0;
251  }
252  }
253  catch(cet::exception const& e) {
254  mf::LogWarning("GraphCluster") << "caught exception \n"
255  << e;
256  endhitout[plane][0]=0;
257  }
258  }
259  else{
260  endhitout[plane][1]=0.;
261  endhitout[plane][0]=0.;
262  }
263 
264 
265  }
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:146
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:138
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:141
std::vector< std::vector< double > > starthitout
Definition: InfoTransfer.h:145
do i e
recob::Hit* evd::InfoTransfer::GetEndHit ( unsigned int  plane) const
inline

Definition at line 96 of file InfoTransfer.h.

97  { return fRefEndHit[plane]; }
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:141
std::vector< double > const& evd::InfoTransfer::GetEndHitCoords ( unsigned int  plane) const
inline

Definition at line 102 of file InfoTransfer.h.

103  { return refendhitout[plane]; }
std::vector< std::vector< double > > refendhitout
Definition: InfoTransfer.h:149
int evd::InfoTransfer::GetEvtNumber ( ) const
inline

Definition at line 64 of file InfoTransfer.h.

64 { return fEvt; }
std::vector< art::Ptr < recob::Hit> > const& evd::InfoTransfer::GetHitList ( unsigned int  plane) const
inline

Definition at line 70 of file InfoTransfer.h.

71  { return fRefinedHitlist[plane]; }
std::vector< std::vector< art::Ptr< recob::Hit > > > fRefinedHitlist
the refined hitlist after rebuild (one for each plane)
Definition: InfoTransfer.h:133
int evd::InfoTransfer::GetRunNumber ( ) const
inline

Definition at line 60 of file InfoTransfer.h.

60 { return fRun; }
std::vector< util::PxLine > const & evd::InfoTransfer::GetSeedList ( ) const

Definition at line 209 of file InfoTransfer.cc.

210  {
211  return fSeedList;
212  }
std::vector< util::PxLine > fSeedList
Definition: InfoTransfer.h:143
std::vector< art::Ptr < recob::Hit> > const& evd::InfoTransfer::GetSelectedHitList ( unsigned int  plane) const
inline

Definition at line 73 of file InfoTransfer.h.

74  { return fSelectedHitlist[plane]; }
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
recob::Hit* evd::InfoTransfer::GetStartHit ( unsigned int  plane) const
inline

Definition at line 90 of file InfoTransfer.h.

91  {return fRefStartHit[plane];}
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:138
std::vector< double > const& evd::InfoTransfer::GetStartHitCoords ( unsigned int  plane) const
inline

Definition at line 99 of file InfoTransfer.h.

100  { return refstarthitout[plane]; }
std::vector< std::vector< double > > refstarthitout
Definition: InfoTransfer.h:148
int evd::InfoTransfer::GetSubRunNumber ( ) const
inline

Definition at line 62 of file InfoTransfer.h.

62 { return fSubRun; }
int evd::InfoTransfer::GetTestFlag ( ) const
inline

Definition at line 58 of file InfoTransfer.h.

58 { return testflag; }
void evd::InfoTransfer::Rebuild ( const art::Event &  evt,
art::ScheduleContext   
)

< the refined hitlist after rebuild

Definition at line 92 of file InfoTransfer.cc.

93  {
94  art::ServiceHandle<geo::Geometry const> geo;
95  unsigned int nplanes = geo->Nplanes();
96  unsigned int which_call=evdb::NavState::Which();
97  if(which_call!=2){
98  //unless we're reloading we want to clear all the selected and refined hits
99  fRefinedHitlist.resize(nplanes);
100  fSelectedHitlist.resize(nplanes);
101  for(unsigned int j=0; j<nplanes;j++){
102  fRefinedHitlist[j].clear();
103  fSelectedHitlist[j].clear();
104  starthitout[j].clear();
105  endhitout[j].clear();
106  starthitout[j].resize(2);
107  endhitout[j].resize(2);
108  refstarthitout[j].clear();
109  refendhitout[j].clear();
110  refstarthitout[j].resize(2);
111  refendhitout[j].resize(2);
112  }
113  //also clear start and end points
114  fRefStartHit.clear();
115  fRefEndHit.clear();
116  fFullHitlist.clear();
117  }
118  art::Handle< std::vector<recob::Hit> > hHandle;
119 
120  fEvt=evt.id().event();
121  fRun=evt.id().run();
122  fSubRun=evt.id().subRun();
123  evt.getByLabel(fHitModuleLabel, hHandle);
124 
125  if(hHandle.failedToGet()){
126 // mf::LogWarning("InfoTransfer") << "failed to get handle to std::vector<recob::Hit> from "<< fHitModuleLabel;
127  return;
128  }
129 
130  // Clear out anything remaining from previous calls to Rebuild
131 
132  fRefinedHitlist.resize(nplanes);
133 
134  for(unsigned int i=0;i<nplanes;i++){
135  fRefinedHitlist[i].clear(); ///< the refined hitlist after rebuild
136  }
137 
138 
139  fFullHitlist.clear();
140  for(unsigned int i=0; i<fRefStartHit.size(); i++){
141  fRefStartHit[i]=NULL;
142  fRefEndHit[i]=NULL;
143  }
144 
145  /////Store start and end hits in new lists and clear the old ones:
146  for(unsigned int i=0;i<nplanes;i++ )
147  { refstarthitout[i].clear();
148  refendhitout[i].clear();
149  refstarthitout[i].resize(2);
150  refendhitout[i].resize(2);
151 
153  refendhitout[i]=endhitout[i];
154 
155  starthitout[i].clear();
156  endhitout[i].clear();
157  starthitout[i].resize(2);
158  endhitout[i].resize(2);
159  }
160 
161  for(size_t p = 0; p < hHandle->size(); ++p){
162  art::Ptr<recob::Hit> hit(hHandle, p);
163  fFullHitlist.push_back(hit);
164  }
165 
166  // fill the selected Hits into the fRefinedHitList from the fSelectedHitList
167  char buf[200];
168  for(unsigned int j=0; j<nplanes; j++){
169  sprintf(buf," ++++rebuilding with %lu selected hits in plane %u \n", fSelectedHitlist[j].size(),j);
170  WriteMsg(buf);
171  }
172 
173  for(size_t t = 0; t < fFullHitlist.size(); ++t){
174  for(unsigned int ip=0;ip<nplanes;ip++) {
175  for(size_t xx = 0; xx < fSelectedHitlist[ip].size(); ++xx){
176  if(fFullHitlist[t]==fSelectedHitlist[ip][xx]) {
177  fRefinedHitlist[ip].push_back(fFullHitlist[t]);
178  break;
179  }
180  }
181 
182  if(fStartHit[ip] && fFullHitlist[t].get()==fStartHit[ip]){
183  fRefStartHit[ip]=const_cast<recob::Hit *>(fFullHitlist[t].get());
184  }
185 
186  if(fEndHit[ip] && fFullHitlist[t].get()==fEndHit[ip]){
187  fRefEndHit[ip]=const_cast<recob::Hit *>(fFullHitlist[t].get());
188  }
189 
190  }
191  }
192  //for(int ip=0;ip<nplanes;ip++)
193  // FillStartEndHitCoords(ip);
194 
195  fSelectedHitlist.clear();
197 
198  return;
199  }
unsigned int event
Definition: DataStructs.h:634
unsigned int run
Definition: DataStructs.h:635
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:146
pdgs p
Definition: selectors.fcl:22
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
process_name hit
Definition: cheaterreco.fcl:51
std::vector< recob::Hit * > fStartHit
The Starthit.
Definition: InfoTransfer.h:137
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:138
std::vector< std::vector< double > > refstarthitout
Definition: InfoTransfer.h:148
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:141
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
std::string fHitModuleLabel
label for geant4 module
Definition: InfoTransfer.h:135
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
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
std::vector< std::vector< double > > refendhitout
Definition: InfoTransfer.h:149
unsigned int subRun
Definition: DataStructs.h:636
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TCEvent evt
Definition: DataStructs.cxx:8
void evd::InfoTransfer::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 75 of file InfoTransfer.cc.

76  {
77  art::ServiceHandle<geo::Geometry const> geo;
78  unsigned int nplanes = geo->Nplanes();
79  //clear everything
80  fRefinedHitlist.resize(nplanes);
81  fSelectedHitlist.resize(nplanes);
82  for (unsigned int i=0;i<nplanes;i++){
83  fRefinedHitlist[i].clear();
84  fSelectedHitlist[i].clear();
85  }
86  fHitModuleLabel = pset.get<std::string>("HitModuleLabel", "ffthit");
87  }
std::vector< std::vector< art::Ptr< recob::Hit > > > fRefinedHitlist
the refined hitlist after rebuild (one for each plane)
Definition: InfoTransfer.h:133
std::string fHitModuleLabel
label for geant4 module
Definition: InfoTransfer.h:135
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
void evd::InfoTransfer::SetEndHit ( unsigned int  p,
recob::Hit endhit 
)
inline

Definition at line 93 of file InfoTransfer.h.

94  { fEndHit[p]=endhit; }
pdgs p
Definition: selectors.fcl:22
std::vector< recob::Hit * > fEndHit
The Starthit.
Definition: InfoTransfer.h:140
void evd::InfoTransfer::SetEndHitCoords ( unsigned int  plane,
std::vector< double >  endhitin 
)
inline

Definition at line 112 of file InfoTransfer.h.

113  {
114  endhitout[plane].clear();
115  endhitout[plane].resize(2);
116  endhitout[plane]=endhitin;
117  }
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:146
void evd::InfoTransfer::SetEvtNumber ( int  value)
inline

Definition at line 63 of file InfoTransfer.h.

63 { fEvt = value; }
temporary value
void evd::InfoTransfer::SetHitList ( unsigned int  p,
std::vector< art::Ptr< recob::Hit > >  hits_to_save 
)
inline

Definition at line 67 of file InfoTransfer.h.

68  { fSelectedHitlist[p].clear(); fSelectedHitlist[p]=hits_to_save; }
pdgs p
Definition: selectors.fcl:22
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:132
void evd::InfoTransfer::SetRunNumber ( int  value)
inline

Definition at line 59 of file InfoTransfer.h.

59 { fRun = value; }
temporary value
void evd::InfoTransfer::SetSeedList ( std::vector< util::PxLine seedlines)

Definition at line 202 of file InfoTransfer.cc.

203  {
204  fSeedList=seedlines;
205  }
std::vector< util::PxLine > fSeedList
Definition: InfoTransfer.h:143
void evd::InfoTransfer::SetStartHit ( unsigned int  p,
recob::Hit starthit 
)
inline

Definition at line 87 of file InfoTransfer.h.

88  { fStartHit[p]=starthit; }
pdgs p
Definition: selectors.fcl:22
std::vector< recob::Hit * > fStartHit
The Starthit.
Definition: InfoTransfer.h:137
void evd::InfoTransfer::SetStartHitCoords ( unsigned int  plane,
std::vector< double >  starthitin 
)
inline

Definition at line 105 of file InfoTransfer.h.

106  {
107  starthitout[plane].clear();
108  starthitout[plane].resize(2);
109  starthitout[plane]=starthitin;
110  }
std::vector< std::vector< double > > starthitout
Definition: InfoTransfer.h:145
void evd::InfoTransfer::SetSubRunNumber ( int  value)
inline

Definition at line 61 of file InfoTransfer.h.

61 { fSubRun = value; }
temporary value
void evd::InfoTransfer::SetTestFlag ( int  value)
inline

Definition at line 57 of file InfoTransfer.h.

57 { testflag = value; }
temporary value

Member Data Documentation

std::vector< std::vector <double > > evd::InfoTransfer::endhitout
private

Definition at line 146 of file InfoTransfer.h.

std::vector< recob::Hit * > evd::InfoTransfer::fEndHit
private

The Starthit.

Definition at line 140 of file InfoTransfer.h.

int evd::InfoTransfer::fEvt
private

Definition at line 129 of file InfoTransfer.h.

std::vector< art::Ptr < recob::Hit > > evd::InfoTransfer::fFullHitlist
private

the full Hit list from the Hitfinder.

Definition at line 134 of file InfoTransfer.h.

std::string evd::InfoTransfer::fHitModuleLabel
private

label for geant4 module

Definition at line 135 of file InfoTransfer.h.

std::vector< recob::Hit * > evd::InfoTransfer::fRefEndHit
private

The Refined Starthit.

Definition at line 141 of file InfoTransfer.h.

std::vector< std::vector< art::Ptr < recob::Hit > > > evd::InfoTransfer::fRefinedHitlist
private

the refined hitlist after rebuild (one for each plane)

Definition at line 133 of file InfoTransfer.h.

std::vector< recob::Hit * > evd::InfoTransfer::fRefStartHit
private

The Refined Starthit.

Definition at line 138 of file InfoTransfer.h.

int evd::InfoTransfer::fRun
private

Definition at line 130 of file InfoTransfer.h.

std::vector< util::PxLine > evd::InfoTransfer::fSeedList
private

Definition at line 143 of file InfoTransfer.h.

std::vector< std::vector< art::Ptr < recob::Hit > > > evd::InfoTransfer::fSelectedHitlist
private

the list selected by the GUI (one for each plane)

Definition at line 132 of file InfoTransfer.h.

std::vector< recob::Hit * > evd::InfoTransfer::fStartHit
private

The Starthit.

Definition at line 137 of file InfoTransfer.h.

int evd::InfoTransfer::fSubRun
private

Definition at line 131 of file InfoTransfer.h.

std::vector< std::vector <double > > evd::InfoTransfer::refendhitout
private

Definition at line 149 of file InfoTransfer.h.

std::vector< std::vector <double > > evd::InfoTransfer::refstarthitout
private

Definition at line 148 of file InfoTransfer.h.

std::vector< std::vector <double > > evd::InfoTransfer::starthitout
private

Definition at line 145 of file InfoTransfer.h.

int evd::InfoTransfer::testflag
private

Definition at line 128 of file InfoTransfer.h.


The documentation for this class was generated from the following files: