Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*! \class   TTClusterAlgorithm_official
0002  *  \brief   Class for "official" algorithm to be used
0003  *           in TTClusterBuilder
0004  *  \details 2D clusters: make 1D and then attach them to each other
0005  *           if their pixels are close to each other, CW cut at the end
0006  *           After moving from SimDataFormats to DataFormats,
0007  *           the template structure of the class was maintained
0008  *           in order to accomodate any types other than PixelDigis
0009  *           in case there is such a need in the future.
0010  *
0011  *  \author Nicola Pozzobon
0012  *  \date   2013, Jul 12
0013  *
0014  */
0015 
0016 #ifndef L1_TRACK_TRIGGER_CLUSTER_ALGO_official_H
0017 #define L1_TRACK_TRIGGER_CLUSTER_ALGO_official_H
0018 
0019 #include "FWCore/Framework/interface/EventSetup.h"
0020 #include "FWCore/Framework/interface/ESHandle.h"
0021 #include "FWCore/Framework/interface/ModuleFactory.h"
0022 #include "FWCore/Framework/interface/ESProducer.h"
0023 
0024 #include "L1Trigger/TrackTrigger/interface/TTClusterAlgorithm.h"
0025 #include "L1Trigger/TrackTrigger/interface/TTClusterAlgorithmRecord.h"
0026 
0027 #include <memory>
0028 #include <string>
0029 #include <map>
0030 
0031 template <typename T>
0032 class TTClusterAlgorithm_official : public TTClusterAlgorithm<T> {
0033 private:
0034   /// Data members
0035   int mWidthCut;  /// Cluster max width
0036 
0037   /// Function to compare clusters and sort them by row
0038   static bool CompareClusters(const T& a, const T& b);
0039 
0040 public:
0041   /// Constructor
0042 
0043   TTClusterAlgorithm_official(int aWidthCut) : TTClusterAlgorithm<T>(__func__) { mWidthCut = aWidthCut; }
0044 
0045   /// Destructor
0046   ~TTClusterAlgorithm_official() override {}
0047 
0048   /// Clustering operations
0049   void Cluster(std::vector<std::vector<T> >& output, const std::vector<T>& input, bool isPS) const override;
0050 
0051 };  /// Close class
0052 
0053 /*! \brief   Implementation of methods
0054  *  \details Here, in the header file, the methods which do not depend
0055  *           on the specific type <T> that can fit the template.
0056  *           Other methods, with type-specific features, are implemented
0057  *           in the source file.
0058  */
0059 
0060 /// Function to compare clusters and sort them by row
0061 template <>
0062 bool TTClusterAlgorithm_official<Ref_Phase2TrackerDigi_>::CompareClusters(const Ref_Phase2TrackerDigi_& a,
0063                                                                           const Ref_Phase2TrackerDigi_& b);
0064 
0065 /// Clustering operations
0066 template <>
0067 void TTClusterAlgorithm_official<Ref_Phase2TrackerDigi_>::Cluster(
0068     std::vector<std::vector<Ref_Phase2TrackerDigi_> >& output,
0069     const std::vector<Ref_Phase2TrackerDigi_>& input,
0070     bool isPS) const;
0071 
0072 /*! \class   ES_TTClusterAlgorithm_official
0073  *  \brief   Class to declare the algorithm to the framework
0074  *
0075  *  \author Nicola Pozzobon
0076  *  \date   2013, Jul 12
0077  *
0078  */
0079 
0080 template <typename T>
0081 class ES_TTClusterAlgorithm_official : public edm::ESProducer {
0082 private:
0083   /// Data members
0084   int mWidthCut;
0085 
0086 public:
0087   /// Constructor
0088   ES_TTClusterAlgorithm_official(const edm::ParameterSet& p) : mWidthCut(p.getParameter<int>("WidthCut")) {
0089     setWhatProduced(this);
0090   }
0091 
0092   /// Destructor
0093   ~ES_TTClusterAlgorithm_official() override {}
0094 
0095   /// Implement the producer
0096   std::unique_ptr<TTClusterAlgorithm<T> > produce(const TTClusterAlgorithmRecord& record) {
0097     TTClusterAlgorithm<T>* TTClusterAlgo = new TTClusterAlgorithm_official<T>(mWidthCut);
0098 
0099     return std::unique_ptr<TTClusterAlgorithm<T> >(TTClusterAlgo);
0100   }
0101 
0102 };  /// Close class
0103 
0104 #endif