CMS 3D CMS Logo

HGCalClusteringDummyImpl.cc
Go to the documentation of this file.
2 #include <unordered_map>
3 #include <unordered_set>
6 
7 // class constructor
9  : calibSF_(conf.getParameter<double>("calibSF_cluster")),
10  layerWeights_(conf.getParameter<std::vector<double>>("layerWeights")),
11  applyLayerWeights_(conf.getParameter<bool>("applyLayerCalibration")) {
12  edm::LogInfo("HGCalClusterParameters") << "C2d global calibration factor: " << calibSF_;
13 }
14 
15 // Create one cluster per TC for direct TC->3D clustering
18  std::vector<l1t::HGCalCluster> clustersTmp;
19  for (std::vector<edm::Ptr<l1t::HGCalTriggerCell>>::const_iterator tc = triggerCellsPtrs.begin();
20  tc != triggerCellsPtrs.end();
21  ++tc) {
22  clustersTmp.emplace_back(*tc);
23  }
24 
25  /* store clusters in the persistent collection */
26  clusters.resize(0, clustersTmp.size());
27  for (unsigned i(0); i < clustersTmp.size(); ++i) {
28  calibratePt(clustersTmp.at(i));
29  clusters.set(0, i, clustersTmp.at(i));
30  }
31 }
32 
34  double calibPt = 0.;
35 
36  if (applyLayerWeights_ && !triggerTools_.isNose(cluster.detId())) {
37  unsigned layerN = triggerTools_.layerWithOffset(cluster.detId());
38 
39  if (layerWeights_.at(layerN) == 0.) {
40  throw cms::Exception("BadConfiguration")
41  << "2D cluster energy forced to 0 by calibration coefficients.\n"
42  << "The configuration should be changed. "
43  << "Discarded layers should be defined in hgcalTriggerGeometryESProducer.TriggerGeometry.DisconnectedLayers "
44  "and not with calibration coefficients = 0\n";
45  }
46 
47  calibPt = layerWeights_.at(layerN) * cluster.mipPt();
48 
49  }
50 
51  else {
52  calibPt = cluster.pt() * calibSF_;
53  }
54 
55  cluster.setPt(calibPt);
56 }
l1t::HGCalCluster
Definition: HGCalCluster.h:11
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
l1t::HGCalClusterT::mipPt
double mipPt() const
Definition: HGCalClusterT.h:91
HGCalClusteringDummyImpl::applyLayerWeights_
bool applyLayerWeights_
Definition: HGCalClusteringDummyImpl.h:25
HGCalClusteringDummyImpl::calibratePt
void calibratePt(l1t::HGCalCluster &cluster)
Definition: HGCalClusteringDummyImpl.cc:33
HGCalClusteringDummyImpl::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalClusteringDummyImpl.h:26
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
HGCalClusteringDummyImpl::layerWeights_
std::vector< double > layerWeights_
Definition: HGCalClusteringDummyImpl.h:24
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
l1t::HGCalClusterT::setPt
void setPt(double pt)
Definition: HGCalClusterT.h:95
l1t::HGCalClusterT::detId
uint32_t detId() const
Definition: HGCalClusterT.h:93
BXVector
Definition: BXVector.h:15
PtrVector.h
OrphanHandle.h
HGCalTriggerTools::layerWithOffset
unsigned layerWithOffset(const DetId &) const
Definition: HGCalTriggerTools.cc:134
HGCalClusteringDummyImpl::HGCalClusteringDummyImpl
HGCalClusteringDummyImpl(const edm::ParameterSet &conf)
Definition: HGCalClusteringDummyImpl.cc:8
HGCalClusteringDummyImpl::calibSF_
double calibSF_
Definition: HGCalClusteringDummyImpl.h:23
HGCalClusteringDummyImpl::clusterizeDummy
void clusterizeDummy(const std::vector< edm::Ptr< l1t::HGCalTriggerCell >> &triggerCellsPtrs, l1t::HGCalClusterBxCollection &clusters)
Definition: HGCalClusteringDummyImpl.cc:16
HGCalTriggerTools::isNose
bool isNose(const DetId &) const
Definition: HGCalTriggerTools.cc:170
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalClusteringDummyImpl.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::Ptr
Definition: AssociationVector.h:31
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246