CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCalBackendLayer1Processor2DClustering.cc
Go to the documentation of this file.
2 
9 
11 public:
13  std::string typeCluster(conf.getParameterSet("C2d_parameters").getParameter<std::string>("clusterType"));
14  if (typeCluster == "dRC2d") {
16  clustering_ = std::make_unique<HGCalClusteringImpl>(conf.getParameterSet("C2d_parameters"));
17  } else if (typeCluster == "NNC2d") {
19  clustering_ = std::make_unique<HGCalClusteringImpl>(conf.getParameterSet("C2d_parameters"));
20  } else if (typeCluster == "dRNNC2d") {
22  clustering_ = std::make_unique<HGCalClusteringImpl>(conf.getParameterSet("C2d_parameters"));
23  } else if (typeCluster == "dummyC2d") {
25  clusteringDummy_ = std::make_unique<HGCalClusteringDummyImpl>(conf.getParameterSet("C2d_parameters"));
26  } else {
27  throw cms::Exception("HGCTriggerParameterError") << "Unknown clustering type '" << typeCluster;
28  }
29  }
30 
32  l1t::HGCalClusterBxCollection& collCluster2D) override {
33  if (clustering_)
34  clustering_->setGeometry(geometry());
35  if (clusteringDummy_)
36  clusteringDummy_->setGeometry(geometry());
37 
38  /* create a persistent vector of pointers to the trigger-cells */
39  std::vector<edm::Ptr<l1t::HGCalTriggerCell>> triggerCellsPtrs;
40  for (unsigned i = 0; i < collHandle->size(); ++i) {
41  edm::Ptr<l1t::HGCalTriggerCell> ptr(collHandle, i);
42  triggerCellsPtrs.push_back(ptr);
43  }
44 
45  std::sort(triggerCellsPtrs.begin(),
46  triggerCellsPtrs.end(),
48  return a->mipPt() > b->mipPt();
49  });
50 
51  /* call to C2d clustering */
52  switch (clusteringAlgorithmType_) {
53  case dRC2d:
54  clustering_->clusterizeDR(triggerCellsPtrs, collCluster2D);
55  break;
56  case NNC2d:
57  clustering_->clusterizeNN(triggerCellsPtrs, collCluster2D, *geometry());
58  break;
59  case dRNNC2d:
60  clustering_->clusterizeDRNN(triggerCellsPtrs, collCluster2D, *geometry());
61  break;
62  case dummyC2d:
63  clusteringDummy_->clusterizeDummy(triggerCellsPtrs, collCluster2D);
64  break;
65  default:
66  // Should not happen, clustering type checked in constructor
67  break;
68  }
69  }
70 
71 private:
73 
74  /* algorithms instances */
75  std::unique_ptr<HGCalClusteringImpl> clustering_;
76  std::unique_ptr<HGCalClusteringDummyImpl> clusteringDummy_;
77 
78  /* algorithm type */
80 };
81 
84  "HGCalBackendLayer1Processor2DClustering");
void run(const edm::Handle< l1t::HGCalTriggerCellBxCollection > &collHandle, l1t::HGCalClusterBxCollection &collCluster2D) override
const HGCalTriggerGeometryBase * geometry() const
std::unique_ptr< HGCalClusteringDummyImpl > clusteringDummy_
ParameterSet const & getParameterSet(std::string const &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
#define DEFINE_EDM_PLUGIN(factory, type, name)