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::GraphCluster Class Reference
Inheritance diagram for evd::GraphCluster:

Public Member Functions

 GraphCluster (fhicl::ParameterSet const &)
 
void produce (art::Event &evt)
 

Private Member Functions

void GetStartEndHits (unsigned int plane, recob::Hit *starthit, recob::Hit *endhit)
 
void GetStartEndHits (unsigned int plane)
 
void GetHitList (unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist)
 
std::vector< util::PxLineGetSeedLines ()
 

Private Attributes

GraphClusterAlg fGClAlg
 
unsigned int fNPlanes
 
int TestFlag
 
int fRun
 
int fSubRun
 
int fEvent
 
std::vector< recob::Hit * > starthit
 
std::vector< recob::Hit * > endhit
 
std::vector< util::PxLinestartendpoints
 

Detailed Description

Definition at line 83 of file GraphCluster_module.cc.

Constructor & Destructor Documentation

evd::GraphCluster::GraphCluster ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 138 of file GraphCluster_module.cc.

138  :
139  EDProducer{pset},
140  fGClAlg(pset.get< fhicl::ParameterSet >("GraphClusterAlg"))
141  {
142  art::ServiceHandle<geo::Geometry const> geo;
143 
144 
145  produces< std::vector<recob::Cluster> >();
146  produces< art::Assns<recob::Cluster, recob::Hit> >();
147  produces< std::vector < art::PtrVector <recob::Cluster> > >();
148 
149 
150  fNPlanes = geo->Nplanes();
151  starthit.resize(fNPlanes);
152  endhit.resize(fNPlanes);
153 
154 
155  startendpoints.resize(fNPlanes);
156 // swire.resize(fNPlanes);
157 // ewire.resize(fNPlanes);
158 // stime.resize(fNPlanes);
159 // etime.resize(fNPlanes);
160  }
GraphClusterAlg fGClAlg
std::vector< recob::Hit * > starthit
std::vector< util::PxLine > startendpoints
std::vector< recob::Hit * > endhit

Member Function Documentation

void evd::GraphCluster::GetHitList ( unsigned int  plane,
art::PtrVector< recob::Hit > &  ptrhitlist 
)
private
std::vector< util::PxLine > evd::GraphCluster::GetSeedLines ( )
private
void evd::GraphCluster::GetStartEndHits ( unsigned int  plane,
recob::Hit starthit,
recob::Hit endhit 
)
private
void evd::GraphCluster::GetStartEndHits ( unsigned int  plane)
private
void evd::GraphCluster::produce ( art::Event &  evt)
Todo:

This method appears to produce a recob::Cluster really as it is

a collection of 2D clusters from single planes

Definition at line 167 of file GraphCluster_module.cc.

168  {
169 
170  std::unique_ptr<std::vector<recob::Cluster> > Graphcol(new std::vector<recob::Cluster>);
171  std::unique_ptr< art::Assns<recob::Cluster, recob::Hit> > hassn(new art::Assns<recob::Cluster, recob::Hit>);
172  // std::unique_ptr< art::Assns<recob::Cluster, recob::Cluster> > classn(new art::Assns<recob::Cluster, recob::Cluster>);
173  std::unique_ptr< std::vector < art::PtrVector < recob::Cluster > > > classn(new std::vector < art::PtrVector < recob::Cluster > >);
174 
175 
176 
177 
178  art::ServiceHandle<geo::Geometry const> geo;
179 
180  // check if evt and run numbers check out, etc...
181  if(fGClAlg.CheckValidity( evt ) == -1)
182  {
183  return;
184  }
185 
186 
187  for(unsigned int ip=0;ip<fNPlanes;ip++) {
188  startendpoints[ip]=util::PxLine(); //assign empty PxLine
189 
190  }
191 
192  std::vector < art::PtrVector < recob::Hit > > hitlist;
193  hitlist.resize(fNPlanes);
194 
195  for(unsigned int ip=0;ip<fNPlanes;ip++) {
196 
197  fGClAlg.GetHitListAndEndPoints(ip,hitlist[ip],startendpoints[ip]);
198  // Read in the Hit List object(s).
199  //fGClAlg.GetHitList(ip,hitlist[ip]);
200 
201  if(hitlist[ip].size()==0)
202  continue;
203  //Read in the starthit:
204  // GetStartEndHits(ip, starthit[ip],endhit[ip]);
205 
206 
207 
208 
209  //fGClAlg.GetStartEndHits(&startendpoints[ip]);
210 
211  if(hitlist[ip].size()>0 && !(TestFlag==-1 ) ) //old event or transfer not ready
212  {
213  double swterror=0.,ewterror=0.;
214 
215  if(startendpoints[ip].w0==0 )
216  swterror=999;
217 
218  if(startendpoints[ip].t1==0 )
219  ewterror=999;
220 
221  std::cout << " clustering @ " <<startendpoints[ip].w0 << " +/- "<< swterror
222  <<" " << startendpoints[ip].t0<< " +/- "<< swterror
223  <<" " << startendpoints[ip].w1<< " +/- "<< ewterror
224  <<" " << startendpoints[ip].t1<< " +/- "<< ewterror << std::endl;
225 
226  // this is all we can do easily without getting the full-blown
227  // ClusterParamsAlg (that means lareventdisplay has to depend on larreco!)
228  lar::util::StatCollector<float> integral, summedADC;
229  for (art::Ptr<recob::Hit> const& hit: hitlist[ip]) {
230  integral.add(hit->Integral());
231  summedADC.add(hit->SummedADC());
232  } // for
233 
234  // get the plane ID from the first hit
235  geo::PlaneID planeID = hitlist[ip].front()->WireID().planeID();
236  Graphcol->emplace_back(
237  startendpoints[ip].w0,
238  swterror,
239  startendpoints[ip].t0,
240  swterror,
241  0., // start_charge
242  0., // start_angle
243  0., // start_opening
244  startendpoints[ip].w1,
245  ewterror,
246  startendpoints[ip].t1,
247  ewterror,
248  0., // end_charge
249  0., // end_angle
250  0., // end_opening
251  integral.Sum(), // integral
252  integral.RMS(), // integral_stddev
253  summedADC.Sum(), // summedADC
254  summedADC.RMS(), // summedADC_stddev
255  hitlist[ip].size(), // n_hits
256  0., // multiple_hit_density
257  0., // width
258  ip,
259  geo->Plane(ip,planeID.TPC,planeID.Cryostat).View(),
260  planeID,
262  );
263 
264  // associate the hits to this cluster
265  util::CreateAssn(*this, evt, *Graphcol, hitlist[ip], *hassn);
266  }
267 
268  }// end of loop on planes
269 
270  art::PtrVector < recob::Cluster > cvec;
271  cvec.reserve(fNPlanes);
272 
273  for(unsigned int ip=0;ip<fNPlanes;ip++) {
274  art::ProductID aid = evt.getProductID< std::vector < recob::Cluster > >();
275  art::Ptr< recob::Cluster > aptr(aid, ip, evt.productGetter(aid));
276  cvec.push_back(aptr);
277  }
278 
279  classn->push_back(cvec);
280 
281  // for(unsigned int ip=0;ip<fNPlanes;ip++) {
282  // for(unsigned int jp=ip+1;jp<fNPlanes;jp++) {
283  // util::CreateSameAssn(*this, evt, *Graphcol, *Graphcol, *classn,ip,ip+1,jp );
284  // // std::cout << "associating cluster" << ip <<" with cluster " << jp << std::endl;
285  // }
286  // }
287  //
288 
289  evt.put(std::move(Graphcol));
290  evt.put(std::move(hassn));
291  evt.put(std::move(classn));
292 
293  return;
294  } // end of produce
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
GraphClusterAlg fGClAlg
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
process_name hit
Definition: cheaterreco.fcl:51
Weight_t RMS() const
Returns the root mean square.
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:182
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Weight_t Sum() const
Returns the weighted sum of the values.
int CheckValidity(art::Event &evt)
std::vector< util::PxLine > startendpoints
void GetHitListAndEndPoints(unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist, util::PxLine &startendpoints)
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
TCEvent evt
Definition: DataStructs.cxx:8
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
Collects statistics on a single quantity (weighted)
BEGIN_PROLOG could also be cout
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.

Member Data Documentation

std::vector< recob::Hit * > evd::GraphCluster::endhit
private

Definition at line 120 of file GraphCluster_module.cc.

int evd::GraphCluster::fEvent
private

Definition at line 114 of file GraphCluster_module.cc.

GraphClusterAlg evd::GraphCluster::fGClAlg
private

Definition at line 93 of file GraphCluster_module.cc.

unsigned int evd::GraphCluster::fNPlanes
private

Definition at line 109 of file GraphCluster_module.cc.

int evd::GraphCluster::fRun
private

Definition at line 112 of file GraphCluster_module.cc.

int evd::GraphCluster::fSubRun
private

Definition at line 113 of file GraphCluster_module.cc.

std::vector< util::PxLine > evd::GraphCluster::startendpoints
private

Definition at line 124 of file GraphCluster_module.cc.

std::vector< recob::Hit * > evd::GraphCluster::starthit
private

Definition at line 119 of file GraphCluster_module.cc.

int evd::GraphCluster::TestFlag
private

Definition at line 111 of file GraphCluster_module.cc.


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