File indexing completed on 2024-04-06 12:22:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef CLUSTERING_ALGORITHM_NEIGHBOR_H
0020 #define CLUSTERING_ALGORITHM_NEIGHBOR_H
0021
0022 #include "FWCore/Framework/interface/EventSetup.h"
0023 #include "FWCore/Framework/interface/ESHandle.h"
0024 #include "FWCore/Framework/interface/ModuleFactory.h"
0025 #include "FWCore/Framework/interface/ESProducer.h"
0026
0027 #include "L1Trigger/TrackTrigger/interface/TTClusterAlgorithm.h"
0028 #include "L1Trigger/TrackTrigger/interface/TTClusterAlgorithmRecord.h"
0029
0030 #include <string>
0031 #include <cstdlib>
0032 #include <map>
0033
0034 template <typename T>
0035 class TTClusterAlgorithm_neighbor : public TTClusterAlgorithm<T> {
0036 private:
0037
0038
0039
0040 public:
0041
0042 TTClusterAlgorithm_neighbor() : TTClusterAlgorithm<T>(__func__) {}
0043
0044
0045 ~TTClusterAlgorithm_neighbor() override {}
0046
0047
0048 void Cluster(std::vector<std::vector<T> >& output, const std::vector<T>& input) const override;
0049
0050
0051 bool isANeighbor(const T& center, const T& mayNeigh) const;
0052 void addNeighbors(std::vector<T>& cluster,
0053 const std::vector<T>& input,
0054 unsigned int start,
0055 std::vector<bool>& masked) const;
0056
0057 };
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 template <>
0068 void TTClusterAlgorithm_neighbor<Ref_Phase2TrackerDigi_>::Cluster(
0069 std::vector<std::vector<Ref_Phase2TrackerDigi_> >& output, const std::vector<Ref_Phase2TrackerDigi_>& input) const;
0070
0071
0072 template <>
0073 bool TTClusterAlgorithm_neighbor<Ref_Phase2TrackerDigi_>::isANeighbor(const Ref_Phase2TrackerDigi_& center,
0074 const Ref_Phase2TrackerDigi_& mayNeigh) const;
0075
0076
0077 template <>
0078 void TTClusterAlgorithm_neighbor<Ref_Phase2TrackerDigi_>::addNeighbors(std::vector<Ref_Phase2TrackerDigi_>& cluster,
0079 const std::vector<Ref_Phase2TrackerDigi_>& input,
0080 unsigned int startVal,
0081 std::vector<bool>& used) const;
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 template <typename T>
0092 class ES_TTClusterAlgorithm_neighbor : public edm::ESProducer {
0093 private:
0094
0095
0096 public:
0097
0098 ES_TTClusterAlgorithm_neighbor(const edm::ParameterSet& p) { setWhatProduced(this); }
0099
0100
0101 ~ES_TTClusterAlgorithm_neighbor() override {}
0102
0103
0104 std::unique_ptr<TTClusterAlgorithm<T> > produce(const TTClusterAlgorithmRecord& record) {
0105 TTClusterAlgorithm<T>* TTClusterAlgo = new TTClusterAlgorithm_neighbor<T>();
0106
0107 return std::unique_ptr<TTClusterAlgorithm<T> >(TTClusterAlgo);
0108 }
0109
0110 };
0111
0112 #endif