All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
16 #include "art/Framework/Principal/Event.h"
17 #include "art/Framework/Services/Registry/ServiceHandle.h"
18 #include "canvas/Persistency/Common/Ptr.h"
19 #include "canvas/Persistency/Common/PtrVector.h"
20 #include "messagefacility/MessageLogger/MessageLogger.h"
21 
22  //-------------------------------------------------
23  evd::GraphClusterAlg::GraphClusterAlg(fhicl::ParameterSet const& pset)
24  {
25  this->reconfigure(pset);
26  art::ServiceHandle<geo::Geometry const> geo;
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  //-------------------------------------------------
46  void evd::GraphClusterAlg::reconfigure(fhicl::ParameterSet const& /*pset*/)
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;
69  art::ServiceHandle<evd::InfoTransfer const> intr;
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  {
178  art::ServiceHandle<evd::InfoTransfer const> intr;
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 
204  art::ServiceHandle<evd::InfoTransfer const> intr;
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 
217  art::ServiceHandle<evd::InfoTransfer const> intr;
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  }
double t1
defined to be the ending t-position (of line or seed depending)
Definition: PxUtils.h:72
GraphClusterAlg(fhicl::ParameterSet const &pset)
std::vector< util::PxLine > GetSeedLines()
double w0
defined to be the vertex w-position
Definition: PxUtils.h:69
double w1
defined to be the ending w-position (of line or seed depending)
Definition: PxUtils.h:71
int CheckValidity(art::Event &evt)
void GetHitListAndEndPoints(unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist, util::PxLine &startendpoints)
void GetStartEndHits(unsigned int plane, util::PxLine &startendpoints)
void GetHitList(unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist)
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int plane
Definition: PxUtils.h:73
void reconfigure(fhicl::ParameterSet const &pset)
double t0
defined to be the vertex t-position
Definition: PxUtils.h:70
art framework interface to geometry description
BEGIN_PROLOG could also be cout