CMS 3D CMS Logo

SpecialClusterImporter.cc
Go to the documentation of this file.
8 
9 // NOTE! This should come *after* and importers that bring in super clusters
10 // of their own (like electron seeds or photons)
11 // otherwise ECAL <-> ECAL linking will not work correctly
12 template <reco::PFBlockElement::Type T>
14 public:
17  _src(cc.consumes<reco::PFClusterCollection>(conf.getParameter<edm::InputTag>("source"))),
18  _assoc(cc.consumes<edm::ValueMap<reco::CaloClusterPtr> >(conf.getParameter<edm::InputTag>("BCtoPFCMap"))) {}
19 
20  void importToBlock(const edm::Event&, ElementList&) const override;
21 
22 private:
25 };
26 
27 template <reco::PFBlockElement::Type T>
30  auto clusters = e.getHandle(_src);
31  auto assoc = e.getHandle(_assoc);
32  auto bclus = clusters->cbegin();
33  auto eclus = clusters->cend();
34  // get all the SCs in the element list
35  auto sc_end = std::partition(elems.begin(), elems.end(), [](const ElementList::value_type& o) {
36  return o->type() == reco::PFBlockElement::SC;
37  });
38  ecals.reserve(clusters->size());
39  for (auto clus = bclus; clus != eclus; ++clus) {
40  reco::PFClusterRef tempref(clusters, std::distance(bclus, clus));
42  for (auto scelem = elems.begin(); scelem != sc_end; ++scelem) {
43  const reco::PFBlockElementSuperCluster* elem_as_sc =
44  static_cast<const reco::PFBlockElementSuperCluster*>(scelem->get());
45  const reco::SuperClusterRef& this_sc = elem_as_sc->superClusterRef();
46 
47  const bool in_sc = (elem_as_sc->fromPFSuperCluster() ?
48  // use association map if from PFSC
49  ClusterClusterMapping::overlap(tempref, *this_sc, *assoc)
50  :
51  // match by overlapping rechit otherwise
52  ClusterClusterMapping::overlap(*tempref, *this_sc));
53  if (in_sc) {
54  newelem->setSuperClusterRef(this_sc);
55  break;
56  }
57  }
58  ecals.emplace_back(newelem);
59  }
60  elems.reserve(elems.size() + ecals.size());
61  for (auto& ecal : ecals) {
62  elems.emplace_back(ecal.release());
63  }
64 }
65 
68 
reco::PFBlockElementCluster::setSuperClusterRef
void setSuperClusterRef(const SuperClusterRef &ref)
Definition: PFBlockElementCluster.h:32
PFBlockElementCluster.h
edm::EDGetTokenT< reco::PFClusterCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::PFBlockElementSuperCluster
Cluster Element.
Definition: PFBlockElementSuperCluster.h:15
reco::PFBlockElement::SC
Definition: PFBlockElement.h:41
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
ECALClusterImporter
SpecialClusterImporter< reco::PFBlockElement::ECAL > ECALClusterImporter
Definition: SpecialClusterImporter.cc:66
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
HGCalClusterImporter
SpecialClusterImporter< reco::PFBlockElement::HGCAL > HGCalClusterImporter
Definition: SpecialClusterImporter.cc:69
SpecialClusterImporter
Definition: SpecialClusterImporter.cc:13
ecal
Definition: ElectronicsMappingGPU.h:13
reco::CaloClusterPtr
edm::Ptr< CaloCluster > CaloClusterPtr
Definition: CaloClusterFwd.h:21
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
edm::Ref< PFClusterCollection >
trackingPlots.assoc
assoc
Definition: trackingPlots.py:183
BlockElementImporterBase.h
PFCluster.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
ClusterClusterMapping::overlap
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
Definition: ClusterClusterMapping.cc:4
BlockElementImporterBase::ElementList
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
Definition: BlockElementImporterBase.h:16
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
PFBlockElementSuperCluster.h
SpecialClusterImporter::SpecialClusterImporter
SpecialClusterImporter(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
Definition: SpecialClusterImporter.cc:15
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
cc
reco::PFBlockElementSuperCluster::superClusterRef
const SuperClusterRef & superClusterRef() const
Definition: PFBlockElementSuperCluster.h:36
SpecialClusterImporter::importToBlock
void importToBlock(const edm::Event &, ElementList &) const override
Definition: SpecialClusterImporter.cc:28
ValueMap.h
SpecialClusterImporter::_src
edm::EDGetTokenT< reco::PFClusterCollection > _src
Definition: SpecialClusterImporter.cc:23
ClusterClusterMapping.h
SpecialClusterImporter::_assoc
edm::EDGetTokenT< edm::ValueMap< reco::CaloClusterPtr > > _assoc
Definition: SpecialClusterImporter.cc:24
T
long double T
Definition: Basic3DVectorLD.h:48
reco::PFBlockElementCluster
Cluster Element.
Definition: PFBlockElementCluster.h:16
SuperCluster.h
edm::Event
Definition: Event.h:73
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7746
l1t::PFClusterCollection
std::vector< l1t::PFCluster > PFClusterCollection
Definition: PFCluster.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::PFBlockElementSuperCluster::fromPFSuperCluster
bool fromPFSuperCluster() const
Definition: PFBlockElementSuperCluster.h:86
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
BlockElementImporterBase
Definition: BlockElementImporterBase.h:14