CMS 3D CMS Logo

TracksterToSimTracksterAssociatorByHitsProducer.cc
Go to the documentation of this file.
1 // Author: Felice Pantaleo, felice.pantaleo@cern.ch 06/2024
16 
18  const edm::ParameterSet& pset)
19  : recoTracksterCollectionToken_(
20  consumes<std::vector<ticl::Trackster>>(pset.getParameter<edm::InputTag>("tracksters"))),
21  simTracksterCollectionToken_(
22  consumes<std::vector<ticl::Trackster>>(pset.getParameter<edm::InputTag>("simTracksters"))),
23  simTracksterFromCPCollectionToken_(
24  consumes<std::vector<ticl::Trackster>>(pset.getParameter<edm::InputTag>("simTrackstersFromCP"))),
25  hitToTracksterMapToken_(
26  consumes<ticl::AssociationMap<ticl::mapWithFraction>>(pset.getParameter<edm::InputTag>("hitToTracksterMap"))),
27  hitToSimTracksterMapToken_(consumes<ticl::AssociationMap<ticl::mapWithFraction>>(
28  pset.getParameter<edm::InputTag>("hitToSimTracksterMap"))),
29  hitToSimTracksterFromCPMapToken_(consumes<ticl::AssociationMap<ticl::mapWithFraction>>(
30  pset.getParameter<edm::InputTag>("hitToSimTracksterFromCPMap"))),
31  hitToSimClusterMapToken_(consumes<ticl::AssociationMap<ticl::mapWithFraction>>(
32  pset.getParameter<edm::InputTag>("hitToSimClusterMap"))),
33  hitToCaloParticleMapToken_(consumes<ticl::AssociationMap<ticl::mapWithFraction>>(
34  pset.getParameter<edm::InputTag>("hitToCaloParticleMap"))),
35  tracksterToHitMapToken_(
36  consumes<ticl::AssociationMap<ticl::mapWithFraction>>(pset.getParameter<edm::InputTag>("tracksterToHitMap"))),
37  simTracksterToHitMapToken_(consumes<ticl::AssociationMap<ticl::mapWithFraction>>(
38  pset.getParameter<edm::InputTag>("simTracksterToHitMap"))),
39  simTracksterFromCPToHitMapToken_(consumes<ticl::AssociationMap<ticl::mapWithFraction>>(
40  pset.getParameter<edm::InputTag>("simTracksterFromCPToHitMap"))),
41  caloParticleToken_(consumes<std::vector<CaloParticle>>(pset.getParameter<edm::InputTag>("caloParticles"))) {
42  auto hitsTags = pset.getParameter<std::vector<edm::InputTag>>("hits");
43  for (const auto& tag : hitsTags) {
44  hitsTokens_.push_back(consumes<HGCRecHitCollection>(tag));
45  }
46  produces<
48  "tracksterToSimTracksterMap");
49  produces<
51  "simTracksterToTracksterMap");
52  produces<
54  "tracksterToSimTracksterFromCPMap");
55  produces<
57  "simTracksterFromCPToTracksterMap");
58 }
59 
61 
64  const edm::EventSetup& iSetup) const {
65  using namespace edm;
66 
67  Handle<std::vector<ticl::Trackster>> recoTrackstersHandle;
68  iEvent.getByToken(recoTracksterCollectionToken_, recoTrackstersHandle);
69  const auto& recoTracksters = *recoTrackstersHandle;
70 
71  Handle<std::vector<ticl::Trackster>> simTrackstersHandle;
72  iEvent.getByToken(simTracksterCollectionToken_, simTrackstersHandle);
73  const auto& simTracksters = *simTrackstersHandle;
74 
75  Handle<std::vector<ticl::Trackster>> simTrackstersFromCPHandle;
76  iEvent.getByToken(simTracksterFromCPCollectionToken_, simTrackstersFromCPHandle);
77  const auto& simTrackstersFromCP = *simTrackstersFromCPHandle;
78 
80  iEvent.getByToken(hitToTracksterMapToken_, hitToTracksterMapHandle);
81  const auto& hitToTracksterMap = *hitToTracksterMapHandle;
82 
83  Handle<ticl::AssociationMap<ticl::mapWithFraction>> hitToSimTracksterMapHandle;
84  iEvent.getByToken(hitToSimTracksterMapToken_, hitToSimTracksterMapHandle);
85  const auto& hitToSimTracksterMap = *hitToSimTracksterMapHandle;
86 
87  Handle<ticl::AssociationMap<ticl::mapWithFraction>> hitToSimTracksterFromCPMapHandle;
88  iEvent.getByToken(hitToSimTracksterFromCPMapToken_, hitToSimTracksterFromCPMapHandle);
89  const auto& hitToSimTracksterFromCPMap = *hitToSimTracksterFromCPMapHandle;
90 
92  iEvent.getByToken(hitToSimClusterMapToken_, hitToSimClusterMapHandle);
93  const auto& hitToSimClusterMap = *hitToSimClusterMapHandle;
94 
95  Handle<ticl::AssociationMap<ticl::mapWithFraction>> hitToCaloParticleMapHandle;
96  iEvent.getByToken(hitToCaloParticleMapToken_, hitToCaloParticleMapHandle);
97  const auto& hitToCaloParticleMap = *hitToCaloParticleMapHandle;
98 
100  iEvent.getByToken(tracksterToHitMapToken_, tracksterToHitMapHandle);
101  const auto& tracksterToHitMap = *tracksterToHitMapHandle;
102 
103  Handle<ticl::AssociationMap<ticl::mapWithFraction>> simTracksterToHitMapHandle;
104  iEvent.getByToken(simTracksterToHitMapToken_, simTracksterToHitMapHandle);
105  const auto& simTracksterToHitMap = *simTracksterToHitMapHandle;
106 
107  Handle<ticl::AssociationMap<ticl::mapWithFraction>> simTracksterFromCPToHitMapHandle;
108  iEvent.getByToken(simTracksterFromCPToHitMapToken_, simTracksterFromCPToHitMapHandle);
109  const auto& simTracksterFromCPToHitMap = *simTracksterFromCPToHitMapHandle;
110 
111  Handle<std::vector<CaloParticle>> caloParticlesHandle;
112  iEvent.getByToken(caloParticleToken_, caloParticlesHandle);
113 
114  MultiVectorManager<HGCRecHit> rechitManager;
115  for (const auto& token : hitsTokens_) {
116  Handle<HGCRecHitCollection> hitsHandle;
117  iEvent.getByToken(token, hitsHandle);
118  rechitManager.addVector(*hitsHandle);
119  }
120 
121  auto tracksterToSimTracksterMap = std::make_unique<
123  recoTrackstersHandle, simTrackstersHandle, iEvent);
124  auto tracksterToSimTracksterFromCPMap = std::make_unique<
126  recoTrackstersHandle, simTrackstersFromCPHandle, iEvent);
127 
128  auto simTracksterToTracksterMap = std::make_unique<
130  simTrackstersHandle, recoTrackstersHandle, iEvent);
131  auto simTracksterFromCPToTracksterMap = std::make_unique<
133  simTrackstersFromCPHandle, recoTrackstersHandle, iEvent);
134  for (unsigned int tracksterIndex = 0; tracksterIndex < recoTracksters.size(); ++tracksterIndex) {
135  edm::Ref<std::vector<ticl::Trackster>> recoTracksterRef(recoTrackstersHandle, tracksterIndex);
136  float recoToSimScoresDenominator = 0.f;
137  const auto& recoTracksterHitsAndFractions = tracksterToHitMap[tracksterIndex];
138  ticl::AssociationMap<ticl::mapWithFraction> hitToAssociatedSimTracksterMap(recoTracksterHitsAndFractions.size());
139  std::vector<unsigned int> associatedSimTracksterIndices;
140  ticl::AssociationMap<ticl::mapWithFraction> hitToAssociatedSimTracksterFromCPMap(
141  recoTracksterHitsAndFractions.size());
142  std::vector<unsigned int> associatedSimTracksterFromCPIndices;
143  for (unsigned int i = 0; i < recoTracksterHitsAndFractions.size(); ++i) {
144  const auto& [hitIndex, recoFraction] = recoTracksterHitsAndFractions[i];
145  const auto& recHit = rechitManager[hitIndex];
146  float squaredRecoFraction = recoFraction * recoFraction;
147  float rechitEnergy = recHit.energy();
148  float squaredRecHitEnergy = rechitEnergy * rechitEnergy;
149  recoToSimScoresDenominator += squaredRecoFraction * squaredRecHitEnergy;
150 
151  const auto& hitToSimTracksterVec = hitToSimTracksterMap[hitIndex];
152  for (const auto& [simTracksterIndex, fraction] : hitToSimTracksterVec) {
153  const auto& simTrackster = simTracksters[simTracksterIndex];
154  auto& seed = simTrackster.seedID();
155  float simFraction = 0;
156  if (seed == caloParticlesHandle.id()) {
157  unsigned int caloParticleIndex = simTrackster.seedIndex();
158  auto it = std::find_if(hitToCaloParticleMap[hitIndex].begin(),
159  hitToCaloParticleMap[hitIndex].end(),
160  [caloParticleIndex](const auto& pair) { return pair.first == caloParticleIndex; });
161  if (it != hitToCaloParticleMap[hitIndex].end()) {
162  simFraction = it->second;
163  }
164  } else {
165  unsigned int simClusterIndex = simTracksters[simTracksterIndex].seedIndex();
166  auto it = std::find_if(hitToSimClusterMap[hitIndex].begin(),
167  hitToSimClusterMap[hitIndex].end(),
168  [simClusterIndex](const auto& pair) { return pair.first == simClusterIndex; });
169  if (it != hitToSimClusterMap[hitIndex].end()) {
170  simFraction = it->second;
171  }
172  }
173  hitToAssociatedSimTracksterMap.insert(i, simTracksterIndex, simFraction);
174  associatedSimTracksterIndices.push_back(simTracksterIndex);
175  }
176 
177  // do the same for caloparticles and simTracksterFromCP
178  const auto& hitToSimTracksterFromCPVec = hitToSimTracksterFromCPMap[hitIndex];
179  for (const auto& [simTracksterIndex, simFraction] : hitToSimTracksterFromCPVec) {
180  unsigned int caloParticleIndex = simTracksters[simTracksterIndex].seedIndex();
181  float caloParticleFraction = 0;
182  auto it = std::find_if(hitToCaloParticleMap[hitIndex].begin(),
183  hitToCaloParticleMap[hitIndex].end(),
184  [caloParticleIndex](const auto& pair) { return pair.first == caloParticleIndex; });
185  if (it != hitToCaloParticleMap[hitIndex].end()) {
186  caloParticleFraction = it->second;
187  }
188  hitToAssociatedSimTracksterFromCPMap.insert(i, simTracksterIndex, caloParticleFraction);
189  associatedSimTracksterFromCPIndices.push_back(simTracksterIndex);
190  }
191  }
192  std::sort(associatedSimTracksterIndices.begin(), associatedSimTracksterIndices.end());
193  associatedSimTracksterIndices.erase(
194  std::unique(associatedSimTracksterIndices.begin(), associatedSimTracksterIndices.end()),
195  associatedSimTracksterIndices.end());
196 
197  std::sort(associatedSimTracksterFromCPIndices.begin(), associatedSimTracksterFromCPIndices.end());
198  associatedSimTracksterFromCPIndices.erase(
199  std::unique(associatedSimTracksterFromCPIndices.begin(), associatedSimTracksterFromCPIndices.end()),
200  associatedSimTracksterFromCPIndices.end());
201 
202  // Add missing sim tracksters with 0 shared energy to hitToAssociatedSimTracksterMap and hitToAssociatedSimTracksterFromCPMap
203  for (unsigned int i = 0; i < recoTracksterHitsAndFractions.size(); ++i) {
204  unsigned int hitId = recoTracksterHitsAndFractions[i].first;
205  const auto& simTracksterVec = hitToSimTracksterMap[hitId];
206  for (unsigned int simTracksterIndex : associatedSimTracksterIndices) {
207  if (std::find_if(simTracksterVec.begin(), simTracksterVec.end(), [simTracksterIndex](const auto& pair) {
208  return pair.first == simTracksterIndex;
209  }) == simTracksterVec.end()) {
210  hitToAssociatedSimTracksterMap.insert(i, simTracksterIndex, 0);
211  }
212  }
213 
214  const auto& simTracksterFromCPVec = hitToSimTracksterFromCPMap[hitId];
215  for (unsigned int simTracksterIndex : associatedSimTracksterFromCPIndices) {
216  if (std::find_if(
217  simTracksterFromCPVec.begin(), simTracksterFromCPVec.end(), [simTracksterIndex](const auto& pair) {
218  return pair.first == simTracksterIndex;
219  }) == simTracksterFromCPVec.end()) {
220  hitToAssociatedSimTracksterFromCPMap.insert(i, simTracksterIndex, 0);
221  }
222  }
223  }
224 
225  const float invDenominator = 1.f / recoToSimScoresDenominator;
226 
227  for (unsigned int i = 0; i < recoTracksterHitsAndFractions.size(); ++i) {
228  unsigned int hitIndex = recoTracksterHitsAndFractions[i].first;
229  const auto& recHit = rechitManager[hitIndex];
230  float recoFraction = recoTracksterHitsAndFractions[i].second;
231  float squaredRecoFraction = recoFraction * recoFraction;
232  float squaredRecHitEnergy = recHit.energy() * recHit.energy();
233  float recoSharedEnergy = recHit.energy() * recoFraction;
234  const auto& simTracksterVec = hitToAssociatedSimTracksterMap[i];
235  for (const auto& [simTracksterIndex, simFraction] : simTracksterVec) {
236  edm::Ref<std::vector<ticl::Trackster>> simTracksterRef(simTrackstersHandle, simTracksterIndex);
237  float sharedEnergy = std::min(simFraction * recHit.energy(), recoSharedEnergy);
238  float squaredFraction =
239  std::min(squaredRecoFraction, (recoFraction - simFraction) * (recoFraction - simFraction));
240  float score = invDenominator * squaredFraction * squaredRecHitEnergy;
241  tracksterToSimTracksterMap->insert(recoTracksterRef, simTracksterRef, sharedEnergy, score);
242  }
243 
244  const auto& simTracksterFromCPVec = hitToAssociatedSimTracksterFromCPMap[i];
245  for (const auto& [simTracksterIndex, simFraction] : simTracksterFromCPVec) {
246  edm::Ref<std::vector<ticl::Trackster>> simTracksterRef(simTrackstersFromCPHandle, simTracksterIndex);
247  float sharedEnergy = std::min(simFraction * recHit.energy(), recoSharedEnergy);
248  float squaredFraction =
249  std::min(squaredRecoFraction, (recoFraction - simFraction) * (recoFraction - simFraction));
250  float score = invDenominator * squaredFraction * squaredRecHitEnergy;
251  tracksterToSimTracksterFromCPMap->insert(recoTracksterRef, simTracksterRef, sharedEnergy, score);
252  }
253  }
254  }
255 
256  // Reverse mapping: SimTrackster -> RecoTrackster
257  for (unsigned int tracksterIndex = 0; tracksterIndex < simTracksters.size(); ++tracksterIndex) {
258  edm::Ref<std::vector<ticl::Trackster>> simTracksterRef(simTrackstersHandle, tracksterIndex);
259  float simToRecoScoresDenominator = 0.f;
260  const auto& simTracksterHitsAndFractions = simTracksterToHitMap[tracksterIndex];
261  ticl::AssociationMap<ticl::mapWithFraction> hitToAssociatedRecoTracksterMap(simTracksterHitsAndFractions.size());
262  std::vector<unsigned int> associatedRecoTracksterIndices;
263  const auto& simTrackster = simTracksters[tracksterIndex];
264  auto& seed = simTrackster.seedID();
265  unsigned int simObjectIndex = simTrackster.seedIndex();
266  bool isSimTracksterFromCP = (seed == caloParticlesHandle.id());
267  std::vector<float> simFractions(simTracksterHitsAndFractions.size(), 0.f);
268  for (unsigned int i = 0; i < simTracksterHitsAndFractions.size(); ++i) {
269  const auto& [hitIndex, simTracksterFraction] = simTracksterHitsAndFractions[i];
270 
271  auto it = isSimTracksterFromCP
272  ? (std::find_if(hitToCaloParticleMap[hitIndex].begin(),
273  hitToCaloParticleMap[hitIndex].end(),
274  [simObjectIndex](const auto& pair) { return pair.first == simObjectIndex; }))
275  : std::find_if(hitToSimClusterMap[hitIndex].begin(),
276  hitToSimClusterMap[hitIndex].end(),
277  [simObjectIndex](const auto& pair) { return pair.first == simObjectIndex; });
278  if (it != hitToCaloParticleMap[hitIndex].end() and it != hitToSimClusterMap[hitIndex].end()) {
279  simFractions[i] = it->second;
280  }
281  float simFraction = simFractions[i];
282  const auto& recHit = rechitManager[hitIndex];
283  float squaredSimFraction = simFraction * simFraction;
284  float squaredRecHitEnergy = recHit.energy() * recHit.energy();
285  simToRecoScoresDenominator += squaredSimFraction * squaredRecHitEnergy;
286 
287  const auto& hitToRecoTracksterVec = hitToTracksterMap[hitIndex];
288  for (const auto& [recoTracksterIndex, recoFraction] : hitToRecoTracksterVec) {
289  hitToAssociatedRecoTracksterMap.insert(i, recoTracksterIndex, recoFraction);
290  associatedRecoTracksterIndices.push_back(recoTracksterIndex);
291  }
292  }
293 
294  std::sort(associatedRecoTracksterIndices.begin(), associatedRecoTracksterIndices.end());
295  associatedRecoTracksterIndices.erase(
296  std::unique(associatedRecoTracksterIndices.begin(), associatedRecoTracksterIndices.end()),
297  associatedRecoTracksterIndices.end());
298 
299  for (unsigned int i = 0; i < simTracksterHitsAndFractions.size(); ++i) {
300  unsigned int hitIndex = simTracksterHitsAndFractions[i].first;
301  const auto& hitToRecoTracksterVec = hitToTracksterMap[hitIndex];
302  for (unsigned int recoTracksterIndex : associatedRecoTracksterIndices) {
303  if (std::find_if(
304  hitToRecoTracksterVec.begin(), hitToRecoTracksterVec.end(), [recoTracksterIndex](const auto& pair) {
305  return pair.first == recoTracksterIndex;
306  }) == hitToRecoTracksterVec.end()) {
307  hitToAssociatedRecoTracksterMap.insert(i, recoTracksterIndex, 0);
308  }
309  }
310  }
311 
312  const float invDenominator = 1.f / simToRecoScoresDenominator;
313 
314  for (unsigned int i = 0; i < simTracksterHitsAndFractions.size(); ++i) {
315  const auto& [hitIndex, simTracksterFraction] = simTracksterHitsAndFractions[i];
316  float simFraction = simFractions[i];
317  const auto& recHit = rechitManager[hitIndex];
318  float squaredSimFraction = simFraction * simFraction;
319  float squaredRecHitEnergy = recHit.energy() * recHit.energy();
320  float simSharedEnergy = recHit.energy() * simFraction;
321 
322  const auto& hitToRecoTracksterVec = hitToAssociatedRecoTracksterMap[i];
323  for (const auto& [recoTracksterIndex, recoFraction] : hitToRecoTracksterVec) {
324  edm::Ref<std::vector<ticl::Trackster>> recoTracksterRef(recoTrackstersHandle, recoTracksterIndex);
325  float sharedEnergy = std::min(recoFraction * recHit.energy(), simSharedEnergy);
326  float squaredFraction =
327  std::min(squaredSimFraction, (recoFraction - simFraction) * (recoFraction - simFraction));
328  float score = invDenominator * squaredFraction * squaredRecHitEnergy;
329  simTracksterToTracksterMap->insert(simTracksterRef, recoTracksterRef, sharedEnergy, score);
330  }
331  }
332  }
333 
334  // Repeat the reverse mapping process for SimTracksterFromCP
335  for (unsigned int tracksterIndex = 0; tracksterIndex < simTrackstersFromCP.size(); ++tracksterIndex) {
336  edm::Ref<std::vector<ticl::Trackster>> simTracksterRef(simTrackstersFromCPHandle, tracksterIndex);
337  float simToRecoScoresDenominator = 0.f;
338  const auto& simTracksterHitsAndFractions = simTracksterFromCPToHitMap[tracksterIndex];
339  ticl::AssociationMap<ticl::mapWithFraction> hitToAssociatedRecoTracksterMap(simTracksterHitsAndFractions.size());
340  std::vector<unsigned int> associatedRecoTracksterIndices;
341  std::vector<float> simFractions(simTracksterHitsAndFractions.size(), 0.f);
342  const auto& simTrackster = simTrackstersFromCP[tracksterIndex];
343  unsigned int simObjectIndex = simTrackster.seedIndex();
344  for (unsigned int i = 0; i < simTracksterHitsAndFractions.size(); ++i) {
345  const auto& [hitIndex, simTracksterFraction] = simTracksterHitsAndFractions[i];
346  auto it = std::find_if(hitToCaloParticleMap[hitIndex].begin(),
347  hitToCaloParticleMap[hitIndex].end(),
348  [simObjectIndex](const auto& pair) { return pair.first == simObjectIndex; });
349  if (it != hitToCaloParticleMap[hitIndex].end()) {
350  simFractions[i] = it->second;
351  }
352  float simFraction = simFractions[i];
353 
354  const auto& recHit = rechitManager[hitIndex];
355  float squaredSimFraction = simFraction * simFraction;
356  float squaredRecHitEnergy = recHit.energy() * recHit.energy();
357  simToRecoScoresDenominator += squaredSimFraction * squaredRecHitEnergy;
358 
359  const auto& hitToRecoTracksterVec = hitToTracksterMap[hitIndex];
360  for (const auto& [recoTracksterIndex, recoFraction] : hitToRecoTracksterVec) {
361  hitToAssociatedRecoTracksterMap.insert(i, recoTracksterIndex, recoFraction);
362  associatedRecoTracksterIndices.push_back(recoTracksterIndex);
363  }
364  }
365 
366  std::sort(associatedRecoTracksterIndices.begin(), associatedRecoTracksterIndices.end());
367  associatedRecoTracksterIndices.erase(
368  std::unique(associatedRecoTracksterIndices.begin(), associatedRecoTracksterIndices.end()),
369  associatedRecoTracksterIndices.end());
370 
371  for (unsigned int i = 0; i < simTracksterHitsAndFractions.size(); ++i) {
372  unsigned int hitIndex = simTracksterHitsAndFractions[i].first;
373  const auto& hitToRecoTracksterVec = hitToTracksterMap[hitIndex];
374  for (unsigned int recoTracksterIndex : associatedRecoTracksterIndices) {
375  if (std::find_if(
376  hitToRecoTracksterVec.begin(), hitToRecoTracksterVec.end(), [recoTracksterIndex](const auto& pair) {
377  return pair.first == recoTracksterIndex;
378  }) == hitToRecoTracksterVec.end()) {
379  hitToAssociatedRecoTracksterMap.insert(i, recoTracksterIndex, 0.f);
380  }
381  }
382  }
383 
384  const float invDenominator = 1.f / simToRecoScoresDenominator;
385 
386  for (unsigned int i = 0; i < simTracksterHitsAndFractions.size(); ++i) {
387  const auto& [hitIndex, simTracksterFraction] = simTracksterHitsAndFractions[i];
388  const auto& recHit = rechitManager[hitIndex];
389  float simFraction = simFractions[i];
390  float squaredSimFraction = simFraction * simFraction;
391  float squaredRecHitEnergy = recHit.energy() * recHit.energy();
392  float simSharedEnergy = recHit.energy() * simFraction;
393 
394  const auto& hitToRecoTracksterVec = hitToAssociatedRecoTracksterMap[i];
395  for (const auto& [recoTracksterIndex, recoFraction] : hitToRecoTracksterVec) {
396  edm::Ref<std::vector<ticl::Trackster>> recoTracksterRef(recoTrackstersHandle, recoTracksterIndex);
397  float sharedEnergy = std::min(recoFraction * recHit.energy(), simSharedEnergy);
398  float squaredFraction =
399  std::min(squaredSimFraction, (recoFraction - simFraction) * (recoFraction - simFraction));
400  float score = invDenominator * squaredFraction * squaredRecHitEnergy;
401  simTracksterFromCPToTracksterMap->insert(simTracksterRef, recoTracksterRef, sharedEnergy, score);
402  }
403  }
404  }
405  tracksterToSimTracksterMap->sort(true);
406  tracksterToSimTracksterFromCPMap->sort(true);
407  simTracksterToTracksterMap->sort(true);
408  simTracksterFromCPToTracksterMap->sort(true);
409 
410  iEvent.put(std::move(tracksterToSimTracksterMap), "tracksterToSimTracksterMap");
411  iEvent.put(std::move(tracksterToSimTracksterFromCPMap), "tracksterToSimTracksterFromCPMap");
412  iEvent.put(std::move(simTracksterToTracksterMap), "simTracksterToTracksterMap");
413  iEvent.put(std::move(simTracksterFromCPToTracksterMap), "simTracksterFromCPToTracksterMap");
414 }
415 
418  desc.add<edm::InputTag>("tracksters", edm::InputTag("ticlTrackstersMerge"));
419  desc.add<edm::InputTag>("simTracksters", edm::InputTag("ticlSimTracksters"));
420  desc.add<edm::InputTag>("simTrackstersFromCP", edm::InputTag("ticlSimTracksters", "fromCPs"));
421 
422  desc.add<edm::InputTag>("hitToTracksterMap", edm::InputTag("hitToTracksterAssociator", "hitToTracksterMap"));
423  desc.add<edm::InputTag>("hitToSimTracksterMap",
424  edm::InputTag("allHitToTracksterAssociations", "hitToticlSimTracksters"));
425  desc.add<edm::InputTag>("hitToSimTracksterFromCPMap",
426  edm::InputTag("allHitToTracksterAssociations", "hitToticlSimTrackstersfromCPs"));
427  desc.add<edm::InputTag>("hitToSimClusterMap",
428  edm::InputTag("hitToSimClusterCaloParticleAssociator", "hitToSimClusterMap"));
429  desc.add<edm::InputTag>("hitToCaloParticleMap",
430  edm::InputTag("hitToSimClusterCaloParticleAssociator", "hitToCaloParticleMap"));
431  desc.add<edm::InputTag>("tracksterToHitMap", edm::InputTag("hitToTrackstersAssociationPR", "tracksterToHitMap"));
432  desc.add<edm::InputTag>("simTracksterToHitMap",
433  edm::InputTag("allHitToTracksterAssociations", "ticlSimTrackstersToHit"));
434  desc.add<edm::InputTag>("simTracksterFromCPToHitMap",
435  edm::InputTag("allHitToTracksterAssociations", "ticlSimTrackstersfromCPsToHit"));
436  desc.add<edm::InputTag>("caloParticles", edm::InputTag("mix", "MergedCaloTruth"));
437 
438  desc.add<std::vector<edm::InputTag>>("hits",
439  {edm::InputTag("HGCalRecHit", "HGCEERecHits"),
440  edm::InputTag("HGCalRecHit", "HGCHEFRecHits"),
441  edm::InputTag("HGCalRecHit", "HGCHEBRecHits")});
442  descriptions.add("tracksterToSimTracksterAssociatorByHitsProducer", desc);
443 }
444 
445 // Define this as a plug-in
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > hitToCaloParticleMapToken_
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > simTracksterToHitMapToken_
ProductID id() const
Definition: HandleBase.cc:29
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > hitToSimTracksterMapToken_
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > hitToSimTracksterFromCPMapToken_
edm::EDGetTokenT< std::vector< ticl::Trackster > > simTracksterCollectionToken_
edm::EDGetTokenT< std::vector< ticl::Trackster > > simTracksterFromCPCollectionToken_
std::vector< std::vector< std::pair< unsigned int, float > >> mapWithFraction
int iEvent
Definition: GenABIO.cc:224
std::vector< edm::EDGetTokenT< HGCRecHitCollection > > hitsTokens_
def unique(seq, keepstr=True)
Definition: tier0.py:24
double f[11][100]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > simTracksterFromCPToHitMapToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > tracksterToHitMapToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void addVector(std::span< const T > vec)
float sharedEnergy(reco::CaloCluster const &clu1, reco::CaloCluster const &clu2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
HLT enums.
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > hitToSimClusterMapToken_
Definition: Common.h:10
edm::EDGetTokenT< ticl::AssociationMap< ticl::mapWithFraction > > hitToTracksterMapToken_
edm::EDGetTokenT< std::vector< ticl::Trackster > > recoTracksterCollectionToken_
def move(src, dest)
Definition: eostools.py:511