Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gar::rec::alg::AlgCluster< T > Class Template Reference

#include <NNClusters.h>

Public Member Functions

 AlgCluster (float xendcap)
 
gar::rec::Clusteroperator() (GenericCluster< T > *c)
 

Protected Member Functions

 AlgCluster ()
 

Protected Attributes

float _xendcap
 

Detailed Description

template<class T>
class gar::rec::alg::AlgCluster< T >

Helper class that creates an gar::rec::Cluster from a generic cluster with hit types that have a Position() and a Energy() method.

Definition at line 333 of file NNClusters.h.

Constructor & Destructor Documentation

template<class T>
gar::rec::alg::AlgCluster< T >::AlgCluster ( float  xendcap)
inline

Definition at line 337 of file NNClusters.h.

337 : _xendcap( xendcap ) {}
template<class T>
gar::rec::alg::AlgCluster< T >::AlgCluster ( )
inlineprotected

Definition at line 440 of file NNClusters.h.

440 {} ;

Member Function Documentation

template<class T>
gar::rec::Cluster* gar::rec::alg::AlgCluster< T >::operator() ( GenericCluster< T > *  c)
inline

Definition at line 339 of file NNClusters.h.

339  {
340 
342 
343  unsigned n = c->size() ;
344  unsigned i = 0 ;
345  float rmin = 9999.;
346  float rmax = 0.;
347  std::vector<float> tmin;
348  std::vector<float> tmax;
349 
350  std::vector<float> a, t, x, y, z;
351  a.resize(n);
352  t.resize(n);
353  x.resize(n);
354  y.resize(n);
355  z.resize(n);
356 
357  for( typename GenericCluster<T>::iterator hi = c->begin(); hi != c->end() ; hi++) {
358 
359  T* hit = (*hi)->first ;
360 
361  a[i] = hit->Energy() ;
362  t[i] = hit->Time().first ;
363  x[i] = hit->Position()[0] ;
364  y[i] = hit->Position()[1] ;
365  z[i] = hit->Position()[2] ;
366 
367  clu->addHit( hit , a[i] ) ;
368 
369  //get time of first layer and last layer to compute the difference
370  float r = std::sqrt(y[i]*y[i] + z[i]*z[i]);
371  if( std::fabs(x[i]) < _xendcap ){
372  //case in barrel
373  if(rmin >= r)
374  {
375  rmin = r;
376  tmin.push_back(t[i]);
377  }
378  if(rmax <= r)
379  {
380  rmax = r;
381  tmax.push_back(t[i]);
382  }
383  }
384  else{
385  //case endcap
386  if( rmin >= std::fabs(x[i]) )
387  {
388  rmin = std::fabs(x[i]);
389  tmin.push_back(t[i]);
390  }
391  if( rmax <= std::fabs(x[i]) )
392  {
393  rmax = std::fabs(x[i]);
394  tmax.push_back(t[i]);
395  }
396  }
397 
398  ++i ;
399  }
400 
401  //get minimum time of the first layer
402  auto time_first = std::min_element( tmin.begin(), tmin.end() );
403  assert(time_first != tmin.end());
404  //get minimum time of the last layer
405  auto time_last = std::min_element( tmax.begin(), tmax.end() );
406  assert(time_last != tmax.end());
407 
408  util::ClusterShapes cs(n, a, t, x, y, z) ;
409 
410  clu->setEnergy( cs.getTotalAmplitude() ) ;
411  clu->setTime( cs.getAverageTime(), *time_first - *time_last ) ;
412  clu->setPosition( cs.getCenterOfGravity() ) ;
413 
414  // direction of cluster's PCA
415  float* d = cs.getEigenVecInertia() ;
416  clu->setEigenVectors( d );
417 
418  //Main eigenvector
419  CLHEP::Hep3Vector v( d[0], d[1], d[2] ) ;
420 
421  clu->setITheta( v.theta() ) ;
422  clu->setIPhi( v.phi() ) ;
423 
424  float param[6] ;
425 
426  // param[0] = cs.getElipsoid_r1() ;
427  param[0] = cs.getElipsoid_r_forw();
428  param[1] = cs.getElipsoid_r_back();
429  param[2] = cs.getElipsoid_r2() ;
430  param[3] = cs.getElipsoid_r3() ;
431  param[4] = cs.getElipsoid_vol() ;
432  param[5] = cs.getWidth() ;
433 
434  clu->setShape( param ) ;
435 
436  return clu;
437  }
intermediate_table::iterator iterator
void setShape(const float *shape)
Definition: Cluster.cxx:54
void setEigenVectors(const float *eigenvectors)
Definition: Cluster.cxx:49
void setEnergy(float energy)
Definition: Cluster.cxx:18
std::void_t< T > n
void setPosition(const float *position)
Definition: Cluster.cxx:34
const double a
Detector simulation of raw signals on wires.
void addHit(gar::rec::CaloHit *hit, float contribution)
Definition: Cluster.cxx:64
void setIPhi(float phi)
Definition: Cluster.cxx:44
void setITheta(float theta)
Definition: Cluster.cxx:39
list x
Definition: train.py:276
const char * cs
void setTime(float time, float time_diff)
Definition: Cluster.cxx:28

Member Data Documentation

template<class T>
float gar::rec::alg::AlgCluster< T >::_xendcap
protected

Definition at line 440 of file NNClusters.h.


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