Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:09

0001 /*! \class   TTClusterAlgorithm
0002  *  \brief   Base class for any algorithm to be used
0003  *           in TTClusterBuilder
0004  *  \details After moving from SimDataFormats to DataFormats,
0005  *           the template structure of the class was maintained
0006  *           in order to accomodate any types other than PixelDigis
0007  *           in case there is such a need in the future.
0008  *
0009  *  \author Andrew W. Rose
0010  *  \author Nicola Pozzobon
0011  *  \date   2013, Jul 12
0012  *
0013  */
0014 
0015 #ifndef L1_TRACK_TRIGGER_CLUSTER_ALGO_BASE_H
0016 #define L1_TRACK_TRIGGER_CLUSTER_ALGO_BASE_H
0017 
0018 #include <sstream>
0019 #include <map>
0020 #include <string>
0021 #include "classNameFinder.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0024 
0025 template <typename T>
0026 class TTClusterAlgorithm {
0027 protected:
0028   /// Data members
0029   std::string className_;
0030 
0031 public:
0032   /// Constructors
0033 
0034   TTClusterAlgorithm(std::string fName) { className_ = classNameFinder<T>(fName); }
0035 
0036   /// Destructor
0037   virtual ~TTClusterAlgorithm() {}
0038 
0039   /// Clustering operations
0040   /// Overloaded method (***) to preserve the interface of all the algorithms but official
0041   virtual void Cluster(std::vector<std::vector<T> > &output, const std::vector<T> &input, bool module) const {
0042     Cluster(output, input);
0043   }
0044 
0045   /// Basic version common to all the algorithms but official
0046   virtual void Cluster(std::vector<std::vector<T> > &output, const std::vector<T> &input) const { output.clear(); }
0047 
0048   /// NOTE
0049   /// When calling TTClusterAlgoHandle->Cluster( output, input, module )
0050   /// in L1TkClusterBuilder, this will go in the following way
0051   /// * case official
0052   /// it will go with the overloaded method (***) which has its
0053   /// specific implementation in TTClusterAlgorithm_official.h
0054   /// * case "everything else"
0055   /// the overloaded method will call the basic one
0056   /// it is the basic one which has its specific implementation
0057   /// in the various TTClusterAlgorithm_*.h
0058   /// This way, all the existing interfaces will be
0059   /// unchanged, but the new algorithm will use the new interface
0060 
0061   /// Algorithm name
0062   virtual std::string AlgorithmName() const { return className_; }
0063 
0064 };  /// Close class
0065 
0066 #endif