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