CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LCToTSAssociatorProducer.cc
Go to the documentation of this file.
1 // Author: Felice Pantaleo, felice.pantaleo@cern.ch 06/2024
2 
3 // user include files
16 
18  : LCCollectionToken_(consumes<std::vector<reco::CaloCluster>>(pset.getParameter<edm::InputTag>("layer_clusters"))),
19  tracksterCollectionToken_(
20  consumes<std::vector<ticl::Trackster>>(pset.getParameter<edm::InputTag>("tracksters"))) {
21  produces<ticl::AssociationMap<ticl::mapWithFraction, std::vector<reco::CaloCluster>, std::vector<ticl::Trackster>>>();
22 }
23 
25 
26 //
27 // member functions
28 //
29 
30 // ------------ method called to produce the data ------------
32  using namespace edm;
33 
36 
39 
40  // Create association map
41  auto lcToTracksterMap = std::make_unique<
44 
45  // Loop over tracksters
46  for (unsigned int tracksterId = 0; tracksterId < tracksters->size(); ++tracksterId) {
47  const auto &trackster = (*tracksters)[tracksterId];
48  // Loop over vertices in trackster
49  for (unsigned int i = 0; i < trackster.vertices().size(); ++i) {
50  // Get layerCluster
51  const auto &lc = (*layer_clusters)[trackster.vertices()[i]];
52  float sharedEnergy = lc.energy() / trackster.vertex_multiplicity()[i];
53  edm::Ref<std::vector<reco::CaloCluster>> lcRef(layer_clusters, trackster.vertices()[i]);
54  edm::Ref<std::vector<ticl::Trackster>> tracksterRef(tracksters, tracksterId);
55  lcToTracksterMap->insert(lcRef, tracksterRef, sharedEnergy);
56  }
57  }
58  iEvent.put(std::move(lcToTracksterMap));
59 }
60 
63  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalMergeLayerClusters"));
64  desc.add<edm::InputTag>("tracksters", edm::InputTag("ticlTracksters"));
65  descriptions.add("LCToTSAssociatorProducer", desc);
66 }
67 
edm::EDGetTokenT< std::vector< reco::CaloCluster > > LCCollectionToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksterCollectionToken_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void add(std::string const &label, ParameterSetDescription const &psetDescription)
float sharedEnergy(reco::CaloCluster const &clu1, reco::CaloCluster const &clu2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
fixed size matrix
HLT enums.
Definition: Common.h:10
LCToTSAssociatorProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:511