Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:56

0001 #ifndef _Cluster1D_H_
0002 #define _Cluster1D_H_
0003 
0004 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
0005 
0006 #include <vector>
0007 
0008 /**
0009  *  A generic templated cluster that lives in 1d.
0010  */
0011 
0012 template <class T>
0013 class Cluster1D {
0014 public:
0015   Cluster1D();  // needed :-(
0016   Cluster1D(const Measurement1D &meas, const std::vector<const T *> &tracks, double weight = 1.0);
0017 
0018   Measurement1D position() const;
0019   std::vector<const T *> tracks() const;
0020   double weight() const;
0021   // bool operator== ( const Cluster1D<T> & other ) const;
0022 
0023 private:
0024   Measurement1D theMeasurement1D;
0025   std::vector<const T *> theTracks;
0026   double theWeight;
0027 };
0028 
0029 /*
0030  *                                 implementation
0031  */
0032 
0033 template <class T>
0034 Cluster1D<T>::Cluster1D(const Measurement1D &meas, const std::vector<const T *> &t, double weight)
0035     : theMeasurement1D(meas), theTracks(t), theWeight(weight) {}
0036 
0037 template <class T>
0038 Cluster1D<T>::Cluster1D() : theMeasurement1D(), theTracks(), theWeight(0.) {}
0039 
0040 template <class T>
0041 std::vector<const T *> Cluster1D<T>::tracks() const {
0042   return theTracks;
0043 }
0044 
0045 template <class T>
0046 Measurement1D Cluster1D<T>::position() const {
0047   return theMeasurement1D;
0048 }
0049 
0050 template <class T>
0051 double Cluster1D<T>::weight() const {
0052   return theWeight;
0053 }
0054 
0055 #endif