GraphClusterAlg.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // GraphClusterAlg class
4 //
5 // andrzej.szelc@yale.edu
6 // ellen.klein@yale.edu
7 //
8 // Methods to use by a dummy producer
9 ////////////////////////////////////////////////////////////////////////
10 
15 
21 
22  //-------------------------------------------------
24  {
25  this->reconfigure(pset);
27 
28 
29 
30 
31 
32  fNPlanes = geo->Nplanes();
33 // starthit.resize(fNPlanes);
34 // endhit.resize(fNPlanes);
35 
36  /*
37  swire.resize(fNPlanes);
38  ewire.resize(fNPlanes);
39  stime.resize(fNPlanes);
40  etime.resize(fNPlanes);*/
41  }
42 
43 
44 
45  //-------------------------------------------------
47  {
48 
49 
50  return;
51  }
52 
53 
54 
55  void evd::GraphClusterAlg::GetHitListAndEndPoints(unsigned int plane, art::PtrVector <recob::Hit> &ptrhitlist,util::PxLine &startendpoints)
56  {
57  GetHitList(plane,ptrhitlist);
58  GetStartEndHits(plane,startendpoints);
59 
60 
61  }
62 
63 
64 
65  void evd::GraphClusterAlg::GetStartEndHits(unsigned int plane,util::PxLine &startendpoints)
66  {
67  std::vector < double > starthit;
68  std::vector < double > endhit;
70  starthit=intr->GetStartHitCoords(plane);
71  endhit=intr->GetEndHitCoords(plane);
72 
73  startendpoints.w0=starthit[0];
74  startendpoints.t0=starthit[1];
75  startendpoints.w1=endhit[0];
76  startendpoints.t1=endhit[1];
77  startendpoints.plane=plane;
78 
79  }
80 
81 
82 // //----------------------------------------------------------------------------
83 // void evd::GraphClusterAlg::GetStartEndHits(unsigned int plane)
84 // {
85 // std::vector < double > starthit;
86 // std::vector < double > endhit;
87 // art::ServiceHandle<evd::InfoTransfer const> intr;
88 // starthit=intr->GetStartHitCoords(plane);
89 // endhit=intr->GetEndHitCoords(plane);
90 //
91 //
92 // swire[plane]=starthit[0];
93 // stime[plane]=starthit[1];
94 // ewire[plane]=endhit[0];
95 // etime[plane]=endhit[1];
96 //
97 // }
98 
99 
100 
101 // //----------------------------------------------------------------------------
102 // void evd::GraphClusterAlg::GetStartEndHits(unsigned int plane,
103 // recob::Hit *starthit,
104 // recob::Hit *endhit)
105 // {
106 //
107 // art::ServiceHandle<evd::InfoTransfer const> intr;
108 // art::ServiceHandle<geo::Geometry const> geo;
109 //
110 // starthit=intr->GetStartHit(plane);
111 // endhit=intr->GetEndHit(plane);
112 //
113 // // error checking for bogus transfers
114 // if(starthit!=NULL){
115 // stime[plane] = starthit->PeakTime() ;
116 // try{
117 // if(starthit->Wire() != NULL){
118 // swire[plane] = starthit->WireID().Wire;
119 // }
120 // else{
121 // swire[plane]=0;
122 // }
123 // }
124 // catch(cet::exception e) {
125 // mf::LogWarning("GraphClusterAlg") << "caught exception \n"
126 // << e;
127 // swire[plane]=0;
128 // }
129 // }
130 // else{
131 // stime[plane]=0.;
132 // }
133 //
134 // if(endhit!=NULL){
135 // etime[plane] = endhit->PeakTime();
136 // if(endhit->Wire()!=NULL){
137 // ewire[plane] = endhit->WireID().Wire;
138 // }
139 // else{
140 // ewire[plane]=0;
141 // }
142 // }
143 // else{
144 // etime[plane]=0.;
145 // }
146 //
147 // }
148 
149  //----------------------------------------------------------------------------
150  // void evd::GraphClusterAlg::GetHitList(unsigned int plane,std::vector< art::Ptr <recob::Hit> > ptrhitlist)
151  // {
152  // art::ServiceHandle<evd::InfoTransfer const> intr;
153  //
154  //
155  // ptrhitlist=intr->GetHitList(plane);
156  // //std::vector <recob::Hit *> hitlist_out;
157  //
158  // if(ptrhitlist.size()==0) {
159  // WriteMsg("hit list of zero size, please select some hits");
160  // return;
161  // }
162  //
163  // for(art::PtrVector<recob::Hit>::const_iterator hitIter = ptrhitlist.begin(); hitIter != ptrhitlist.end(); hitIter++){
164  // // art::Ptr<recob::Hit> theHit = (*hitIter);
165  // // unsigned int plane,cstat,tpc,wire;
166  // // hitlist_out.push_back((*hitIter)->Get());
167  // }
168  //
169  //
170  //
171  //
172  // return;// hitlist_out;
173  // }
174 
175  //----------------------------------------------------------------------------
176  void evd::GraphClusterAlg::GetHitList(unsigned int plane, art::PtrVector <recob::Hit> &ptrhitlist)
177  {
179 
180  std::vector< art::Ptr <recob::Hit> > ptlist=intr->GetHitList(plane);
181 
182 
183  //std::vector <recob::Hit *> hitlist_out;
184 
185  if(ptlist.size()==0) {
186  mf::LogVerbatim("GraphClusterAlg") << ("hit list of zero size, please select some hits");
187  return;
188  }
189 
190  for(art::PtrVector<recob::Hit>::const_iterator hitIter = ptlist.begin(); hitIter != ptlist.end(); hitIter++){
191  // art::Ptr<recob::Hit> theHit = (*hitIter);
192  // unsigned int plane,cstat,tpc,wire;
193  ptrhitlist.push_back((*hitIter));
194  }
195 
196  return;// hitlist_out;
197  }
198 
199 
200  //----------------------------------------------------------------------------
201  std::vector < util::PxLine > evd::GraphClusterAlg::GetSeedLines()
202  {
203 
205  //////////////////////////////////////////////////
206  //this is where you could create Bezier Tracks if you wanted to do it inside a producer
207  //////////////////////////////////////////////////
208  std::vector < util::PxLine > plines = intr->GetSeedList();
209 
210  std::cout << " Received Seed List of Size: " << plines.size() << std::endl;
211 
212  return plines;
213  }
214 
215 
218  TestFlag=intr->GetTestFlag();
219 
220  fEvent=intr->GetEvtNumber();
221  fRun=intr->GetRunNumber();
222  fSubRun=intr->GetSubRunNumber();
223 
224 
225 
226  if(TestFlag==-1)
227  return -1;
228 
229  if(fEvent!=(int)evt.id().event() || fRun!=(int)evt.id().run() || fSubRun!=(int)evt.id().subRun() ) {
230  mf::LogVerbatim("GraphClusterAlg") << (" old event ");
231  return -1;
232  }
233 
234  return TestFlag;
235  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< double > GetStartHitCoords(unsigned int plane)
Definition: InfoTransfer.h:93
double t1
defined to be the ending t-position (of line or seed depending)
Definition: PxUtils.h:72
std::vector< util::PxLine > GetSeedList()
GraphClusterAlg(fhicl::ParameterSet const &pset)
std::vector< util::PxLine > GetSeedLines()
double w0
defined to be the vertex w-position
Definition: PxUtils.h:69
RunNumber_t run() const
Definition: EventID.h:98
art framework interface to geometry description
double w1
defined to be the ending w-position (of line or seed depending)
Definition: PxUtils.h:71
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
int CheckValidity(art::Event &evt)
std::vector< double > GetEndHitCoords(unsigned int plane)
Definition: InfoTransfer.h:95
void GetHitListAndEndPoints(unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist, util::PxLine &startendpoints)
void GetStartEndHits(unsigned int plane, util::PxLine &startendpoints)
EventNumber_t event() const
Definition: EventID.h:116
void GetHitList(unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist)
TCEvent evt
Definition: DataStructs.cxx:7
unsigned int plane
Definition: PxUtils.h:73
void reconfigure(fhicl::ParameterSet const &pset)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
double t0
defined to be the vertex t-position
Definition: PxUtils.h:70
SubRunNumber_t subRun() const
Definition: EventID.h:110
EventID id() const
Definition: Event.cc:34
QTextStream & endl(QTextStream &s)
std::vector< art::Ptr< recob::Hit > > GetHitList(unsigned int plane)
Definition: InfoTransfer.h:64