CMS 3D CMS Logo

TrackstersMergeProducer.cc
Go to the documentation of this file.
1 #include <memory> // unique_ptr
7 
18 
19 #include "TrackstersPCA.h"
20 
21 using namespace ticl;
22 
23 class TrackstersMergeProducer : public edm::stream::EDProducer<edm::GlobalCache<TrackstersCache>> {
24 public:
25  explicit TrackstersMergeProducer(const edm::ParameterSet &ps, const CacheBase *cache);
27  void produce(edm::Event &, const edm::EventSetup &) override;
28  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
29 
30  // static methods for handling the global cache
31  static std::unique_ptr<TrackstersCache> initializeGlobalCache(const edm::ParameterSet &);
32  static void globalEndJob(TrackstersCache *);
33 
34 private:
35  enum TracksterIterIndex { TRKEM = 0, EM, TRK, HAD };
36 
37  void fillTile(TICLTracksterTiles &, const std::vector<Trackster> &, TracksterIterIndex);
38 
39  void energyRegressionAndID(const std::vector<reco::CaloCluster> &layerClusters, std::vector<Trackster> &result) const;
40  void printTrackstersDebug(const std::vector<Trackster> &, const char *label) const;
41  void assignTimeToCandidates(std::vector<TICLCandidate> &resultCandidates) const;
42  void dumpTrackster(const Trackster &) const;
43 
54  const int eta_bin_window_;
55  const int phi_bin_window_;
56  const double pt_sigma_high_;
57  const double pt_sigma_low_;
58  const double halo_max_distance2_;
59  const double track_min_pt_;
60  const double track_min_eta_;
61  const double track_max_eta_;
63  const double cosangle_align_;
64  const double e_over_h_threshold_;
65  const double pt_neutral_threshold_;
66  const double resol_calo_offset_had_;
67  const double resol_calo_scale_had_;
68  const double resol_calo_offset_em_;
69  const double resol_calo_scale_em_;
70  const bool debug_;
74  const float eidMinClusterEnergy_;
75  const int eidNLayers_;
76  const int eidNClusters_;
77 
78  tensorflow::Session *eidSession_;
80 
81  static constexpr int eidNFeatures_ = 3;
82 };
83 
85  : tracksterstrkem_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("tracksterstrkem"))),
86  trackstersem_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("trackstersem"))),
87  tracksterstrk_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("tracksterstrk"))),
88  trackstershad_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("trackstershad"))),
89  seedingTrk_token_(consumes<std::vector<TICLSeedingRegion>>(ps.getParameter<edm::InputTag>("seedingTrk"))),
90  clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"))),
91  clustersTime_token_(
92  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("layer_clustersTime"))),
93  tracks_token_(consumes<std::vector<reco::Track>>(ps.getParameter<edm::InputTag>("tracks"))),
94  geometry_token_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
95  optimiseAcrossTracksters_(ps.getParameter<bool>("optimiseAcrossTracksters")),
96  eta_bin_window_(ps.getParameter<int>("eta_bin_window")),
97  phi_bin_window_(ps.getParameter<int>("phi_bin_window")),
98  pt_sigma_high_(ps.getParameter<double>("pt_sigma_high")),
99  pt_sigma_low_(ps.getParameter<double>("pt_sigma_low")),
100  halo_max_distance2_(ps.getParameter<double>("halo_max_distance2")),
101  track_min_pt_(ps.getParameter<double>("track_min_pt")),
102  track_min_eta_(ps.getParameter<double>("track_min_eta")),
103  track_max_eta_(ps.getParameter<double>("track_max_eta")),
104  track_max_missing_outerhits_(ps.getParameter<int>("track_max_missing_outerhits")),
105  cosangle_align_(ps.getParameter<double>("cosangle_align")),
106  e_over_h_threshold_(ps.getParameter<double>("e_over_h_threshold")),
107  pt_neutral_threshold_(ps.getParameter<double>("pt_neutral_threshold")),
108  resol_calo_offset_had_(ps.getParameter<double>("resol_calo_offset_had")),
109  resol_calo_scale_had_(ps.getParameter<double>("resol_calo_scale_had")),
110  resol_calo_offset_em_(ps.getParameter<double>("resol_calo_offset_em")),
111  resol_calo_scale_em_(ps.getParameter<double>("resol_calo_scale_em")),
112  debug_(ps.getParameter<bool>("debug")),
113  eidInputName_(ps.getParameter<std::string>("eid_input_name")),
114  eidOutputNameEnergy_(ps.getParameter<std::string>("eid_output_name_energy")),
115  eidOutputNameId_(ps.getParameter<std::string>("eid_output_name_id")),
116  eidMinClusterEnergy_(ps.getParameter<double>("eid_min_cluster_energy")),
117  eidNLayers_(ps.getParameter<int>("eid_n_layers")),
118  eidNClusters_(ps.getParameter<int>("eid_n_clusters")),
119  eidSession_(nullptr) {
120  // mount the tensorflow graph onto the session when set
121  const TrackstersCache *trackstersCache = dynamic_cast<const TrackstersCache *>(cache);
122  if (trackstersCache == nullptr || trackstersCache->eidGraphDef == nullptr) {
123  throw cms::Exception("MissingGraphDef")
124  << "TrackstersMergeProducer received an empty graph definition from the global cache";
125  }
127 
128  produces<std::vector<Trackster>>();
129  produces<std::vector<TICLCandidate>>();
130 }
131 
133  const std::vector<Trackster> &tracksters,
134  TracksterIterIndex tracksterIteration) {
135  int tracksterId = 0;
136  for (auto const &t : tracksters) {
137  tracksterTile.fill(tracksterIteration, t.barycenter().eta(), t.barycenter().phi(), tracksterId);
138  LogDebug("TrackstersMergeProducer") << "Adding tracksterId: " << tracksterId << " into bin [eta,phi]: [ "
139  << tracksterTile[tracksterIteration].etaBin(t.barycenter().eta()) << ", "
140  << tracksterTile[tracksterIteration].phiBin(t.barycenter().phi())
141  << "] for iteration: " << tracksterIteration << std::endl;
142 
143  tracksterId++;
144  }
145 }
146 
148  auto e_over_h = (t.raw_em_pt() / ((t.raw_pt() - t.raw_em_pt()) != 0. ? (t.raw_pt() - t.raw_em_pt()) : 1.));
149  LogDebug("TrackstersMergeProducer")
150  << "\nTrackster raw_pt: " << t.raw_pt() << " raw_em_pt: " << t.raw_em_pt() << " eoh: " << e_over_h
151  << " barycenter: " << t.barycenter() << " eta,phi (baricenter): " << t.barycenter().eta() << ", "
152  << t.barycenter().phi() << " eta,phi (eigen): " << t.eigenvectors(0).eta() << ", " << t.eigenvectors(0).phi()
153  << " pt(eigen): " << std::sqrt(t.eigenvectors(0).Unit().perp2()) * t.raw_energy() << " seedID: " << t.seedID()
154  << " seedIndex: " << t.seedIndex() << " size: " << t.vertices().size() << " average usage: "
155  << (std::accumulate(std::begin(t.vertex_multiplicity()), std::end(t.vertex_multiplicity()), 0.) /
156  (float)t.vertex_multiplicity().size())
157  << " raw_energy: " << t.raw_energy() << " regressed energy: " << t.regressed_energy()
158  << " probs(ga/e/mu/np/cp/nh/am/unk): ";
159  for (auto const &p : t.id_probabilities()) {
160  LogDebug("TrackstersMergeProducer") << std::fixed << p << " ";
161  }
162  LogDebug("TrackstersMergeProducer") << " sigmas: ";
163  for (auto const &s : t.sigmas()) {
164  LogDebug("TrackstersMergeProducer") << s << " ";
165  }
166  LogDebug("TrackstersMergeProducer") << std::endl;
167 }
168 
172  auto resultTrackstersMerged = std::make_unique<std::vector<Trackster>>();
173  auto resultCandidates = std::make_unique<std::vector<TICLCandidate>>();
174 
175  TICLTracksterTiles tracksterTile;
176  std::vector<bool> usedTrackstersMerged;
177  std::vector<int> indexInMergedCollTRKEM;
178  std::vector<int> indexInMergedCollEM;
179  std::vector<int> indexInMergedCollTRK;
180  std::vector<int> indexInMergedCollHAD;
181  std::vector<bool> usedSeeds;
182 
183  // associating seed to the index of the trackster in the merged collection and the iteration that found it
184  std::map<int, std::vector<std::pair<int, TracksterIterIndex>>> seedToTracksterAssociator;
185  std::vector<TracksterIterIndex> iterMergedTracksters;
187  evt.getByToken(tracks_token_, track_h);
188  const auto &tracks = *track_h;
189 
191  evt.getByToken(clusters_token_, cluster_h);
192  const auto &layerClusters = *cluster_h;
193 
195  evt.getByToken(clustersTime_token_, clustersTime_h);
196  const auto &layerClustersTimes = *clustersTime_h;
197 
198  edm::Handle<std::vector<Trackster>> trackstersem_h;
199  evt.getByToken(trackstersem_token_, trackstersem_h);
200  const auto &trackstersEM = *trackstersem_h;
201 
202  edm::Handle<std::vector<Trackster>> tracksterstrkem_h;
203  evt.getByToken(tracksterstrkem_token_, tracksterstrkem_h);
204  const auto &trackstersTRKEM = *tracksterstrkem_h;
205 
206  edm::Handle<std::vector<Trackster>> tracksterstrk_h;
207  evt.getByToken(tracksterstrk_token_, tracksterstrk_h);
208  const auto &trackstersTRK = *tracksterstrk_h;
209 
210  edm::Handle<std::vector<Trackster>> trackstershad_h;
211  evt.getByToken(trackstershad_token_, trackstershad_h);
212  const auto &trackstersHAD = *trackstershad_h;
213 
215  evt.getByToken(seedingTrk_token_, seedingTrk_h);
216  const auto &seedingTrk = *seedingTrk_h;
217  usedSeeds.resize(tracks.size(), false);
218 
219  fillTile(tracksterTile, trackstersTRKEM, TracksterIterIndex::TRKEM);
220  fillTile(tracksterTile, trackstersEM, TracksterIterIndex::EM);
221  fillTile(tracksterTile, trackstersTRK, TracksterIterIndex::TRK);
222  fillTile(tracksterTile, trackstersHAD, TracksterIterIndex::HAD);
223 
224  auto totalNumberOfTracksters =
225  trackstersTRKEM.size() + trackstersTRK.size() + trackstersEM.size() + trackstersHAD.size();
226  resultTrackstersMerged->reserve(totalNumberOfTracksters);
227  iterMergedTracksters.reserve(totalNumberOfTracksters);
228  usedTrackstersMerged.resize(totalNumberOfTracksters, false);
229  indexInMergedCollTRKEM.reserve(trackstersTRKEM.size());
230  indexInMergedCollEM.reserve(trackstersEM.size());
231  indexInMergedCollTRK.reserve(trackstersTRK.size());
232  indexInMergedCollHAD.reserve(trackstersHAD.size());
233 
234  if (debug_) {
235  printTrackstersDebug(trackstersTRKEM, "tracksterTRKEM");
236  printTrackstersDebug(trackstersEM, "tracksterEM");
237  printTrackstersDebug(trackstersTRK, "tracksterTRK");
238  printTrackstersDebug(trackstersHAD, "tracksterHAD");
239  }
240 
241  for (auto const &t : trackstersTRKEM) {
242  indexInMergedCollTRKEM.push_back(resultTrackstersMerged->size());
243  seedToTracksterAssociator[t.seedIndex()].emplace_back(resultTrackstersMerged->size(), TracksterIterIndex::TRKEM);
244  resultTrackstersMerged->push_back(t);
245  iterMergedTracksters.push_back(TracksterIterIndex::TRKEM);
246  }
247 
248  for (auto const &t : trackstersEM) {
249  indexInMergedCollEM.push_back(resultTrackstersMerged->size());
250  resultTrackstersMerged->push_back(t);
251  iterMergedTracksters.push_back(TracksterIterIndex::EM);
252  }
253 
254  for (auto const &t : trackstersTRK) {
255  indexInMergedCollTRK.push_back(resultTrackstersMerged->size());
256  seedToTracksterAssociator[t.seedIndex()].emplace_back(resultTrackstersMerged->size(), TracksterIterIndex::TRK);
257  resultTrackstersMerged->push_back(t);
258  iterMergedTracksters.push_back(TracksterIterIndex::TRK);
259  }
260 
261  for (auto const &t : trackstersHAD) {
262  indexInMergedCollHAD.push_back(resultTrackstersMerged->size());
263  resultTrackstersMerged->push_back(t);
264  iterMergedTracksters.push_back(TracksterIterIndex::HAD);
265  }
266 
267  assignPCAtoTracksters(*resultTrackstersMerged,
269  layerClustersTimes,
271  energyRegressionAndID(layerClusters, *resultTrackstersMerged);
272 
273  printTrackstersDebug(*resultTrackstersMerged, "TrackstersMergeProducer");
274 
275  auto trackstersMergedHandle = evt.put(std::move(resultTrackstersMerged));
276 
277  // TICL Candidate creation
278  // We start from neutrals first
279 
280  // Photons
281  for (unsigned i = 0; i < trackstersEM.size(); ++i) {
282  auto mergedIdx = indexInMergedCollEM[i];
283  usedTrackstersMerged[mergedIdx] = true;
284  const auto &t = trackstersEM[i]; //trackster
285  TICLCandidate tmpCandidate;
286  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
287  tmpCandidate.setCharge(0);
288  tmpCandidate.setPdgId(22);
289  tmpCandidate.setRawEnergy(t.raw_energy());
290  math::XYZTLorentzVector p4(t.raw_energy() * t.barycenter().unit().x(),
291  t.raw_energy() * t.barycenter().unit().y(),
292  t.raw_energy() * t.barycenter().unit().z(),
293  t.raw_energy());
294  tmpCandidate.setP4(p4);
295  resultCandidates->push_back(tmpCandidate);
296  }
297 
298  // Neutral Hadrons
299  constexpr float mpion2 = 0.13957f * 0.13957f;
300  for (unsigned i = 0; i < trackstersHAD.size(); ++i) {
301  auto mergedIdx = indexInMergedCollHAD[i];
302  usedTrackstersMerged[mergedIdx] = true;
303  const auto &t = trackstersHAD[i]; //trackster
304  TICLCandidate tmpCandidate;
305  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
306  tmpCandidate.setCharge(0);
307  tmpCandidate.setPdgId(130);
308  tmpCandidate.setRawEnergy(t.raw_energy());
309  float momentum = std::sqrt(t.raw_energy() * t.raw_energy() - mpion2);
310  math::XYZTLorentzVector p4(momentum * t.barycenter().unit().x(),
311  momentum * t.barycenter().unit().y(),
312  momentum * t.barycenter().unit().z(),
313  t.raw_energy());
314  tmpCandidate.setP4(p4);
315  resultCandidates->push_back(tmpCandidate);
316  }
317 
318  // Charged Particles
319  for (unsigned i = 0; i < trackstersTRKEM.size(); ++i) {
320  auto mergedIdx = indexInMergedCollTRKEM[i];
321  if (!usedTrackstersMerged[mergedIdx]) {
322  const auto &t = trackstersTRKEM[i]; //trackster
323  auto trackIdx = t.seedIndex();
324  auto const &track = tracks[trackIdx];
325  if (!usedSeeds[trackIdx] and t.raw_energy() > 0) {
326  usedSeeds[trackIdx] = true;
327  usedTrackstersMerged[mergedIdx] = true;
328 
329  std::vector<int> trackstersTRKwithSameSeed;
330  std::vector<int> trackstersTRKEMwithSameSeed;
331 
332  for (const auto &tracksterIterationPair : seedToTracksterAssociator[trackIdx]) {
333  if (tracksterIterationPair.first != mergedIdx and !usedTrackstersMerged[tracksterIterationPair.first] and
334  trackstersMergedHandle->at(tracksterIterationPair.first).raw_energy() > 0.) {
335  if (tracksterIterationPair.second == TracksterIterIndex::TRKEM) {
336  trackstersTRKEMwithSameSeed.push_back(tracksterIterationPair.first);
337  } else if (tracksterIterationPair.second == TracksterIterIndex::TRK) {
338  trackstersTRKwithSameSeed.push_back(tracksterIterationPair.first);
339  }
340  }
341  }
342 
343  float tracksterTotalRawPt = t.raw_pt();
344  std::vector<int> haloTrackstersTRKIdx;
345  bool foundCompatibleTRK = false;
346 
347  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
348  usedTrackstersMerged[otherTracksterIdx] = true;
349  tracksterTotalRawPt += trackstersMergedHandle->at(otherTracksterIdx).raw_pt();
350 
351  // Check the X,Y,Z barycenter and merge if they are very close (halo)
352  if ((t.barycenter() - trackstersMergedHandle->at(otherTracksterIdx).barycenter()).mag2() <
354  haloTrackstersTRKIdx.push_back(otherTracksterIdx);
355 
356  } else {
357  foundCompatibleTRK = true;
358  }
359  }
360 
361  //check if there is 1-to-1 relationship
362  if (trackstersTRKEMwithSameSeed.empty()) {
363  if (foundCompatibleTRK) {
364  TICLCandidate tmpCandidate;
365  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
366  double raw_energy = t.raw_energy();
367 
368  tmpCandidate.setCharge(track.charge());
369  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
370  tmpCandidate.setPdgId(211 * track.charge());
371  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
372  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
373  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
374  }
375  tmpCandidate.setRawEnergy(raw_energy);
376  math::XYZTLorentzVector p4(raw_energy * track.momentum().unit().x(),
377  raw_energy * track.momentum().unit().y(),
378  raw_energy * track.momentum().unit().z(),
379  raw_energy);
380  tmpCandidate.setP4(p4);
381  resultCandidates->push_back(tmpCandidate);
382 
383  } else {
384  TICLCandidate tmpCandidate;
385  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
386  double raw_energy = t.raw_energy();
387  tmpCandidate.setCharge(track.charge());
388  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
389  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
390  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
391  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
392  }
393  tmpCandidate.setPdgId(11 * track.charge());
394 
395  tmpCandidate.setRawEnergy(raw_energy);
396  math::XYZTLorentzVector p4(raw_energy * track.momentum().unit().x(),
397  raw_energy * track.momentum().unit().y(),
398  raw_energy * track.momentum().unit().z(),
399  raw_energy);
400  tmpCandidate.setP4(p4);
401  resultCandidates->push_back(tmpCandidate);
402  }
403 
404  } else {
405  // if 1-to-many find closest trackster in momentum
406  int closestTrackster = mergedIdx;
407  float minPtDiff = std::abs(t.raw_pt() - track.pt());
408  for (auto otherTracksterIdx : trackstersTRKEMwithSameSeed) {
409  auto thisPt = tracksterTotalRawPt + trackstersMergedHandle->at(otherTracksterIdx).raw_pt() - t.raw_pt();
410  closestTrackster = std::abs(thisPt - track.pt()) < minPtDiff ? otherTracksterIdx : closestTrackster;
411  }
412  usedTrackstersMerged[closestTrackster] = true;
413 
414  if (foundCompatibleTRK) {
415  TICLCandidate tmpCandidate;
416  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, closestTrackster));
417  double raw_energy = trackstersMergedHandle->at(closestTrackster).raw_energy();
418 
419  tmpCandidate.setCharge(track.charge());
420  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
421  tmpCandidate.setPdgId(211 * track.charge());
422  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
423  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
424  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
425  }
426  tmpCandidate.setRawEnergy(raw_energy);
427  float momentum = std::sqrt(raw_energy * raw_energy - mpion2);
428  math::XYZTLorentzVector p4(momentum * track.momentum().unit().x(),
429  momentum * track.momentum().unit().y(),
430  momentum * track.momentum().unit().z(),
431  raw_energy);
432  tmpCandidate.setP4(p4);
433  resultCandidates->push_back(tmpCandidate);
434 
435  } else {
436  TICLCandidate tmpCandidate;
437  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, closestTrackster));
438  double raw_energy = trackstersMergedHandle->at(closestTrackster).raw_energy();
439 
440  tmpCandidate.setCharge(track.charge());
441  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
442  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
443  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
444  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
445  }
446  tmpCandidate.setPdgId(11 * track.charge());
447  tmpCandidate.setRawEnergy(raw_energy);
448  math::XYZTLorentzVector p4(raw_energy * track.momentum().unit().x(),
449  raw_energy * track.momentum().unit().y(),
450  raw_energy * track.momentum().unit().z(),
451  raw_energy);
452  tmpCandidate.setP4(p4);
453  resultCandidates->push_back(tmpCandidate);
454  }
455  // Promote all other TRKEM tracksters as photons with their energy.
456  for (auto otherTracksterIdx : trackstersTRKEMwithSameSeed) {
457  auto tmpIndex = (otherTracksterIdx != closestTrackster) ? otherTracksterIdx : mergedIdx;
458  TICLCandidate photonCandidate;
459  const auto &otherTrackster = trackstersMergedHandle->at(tmpIndex);
460  auto gammaEnergy = otherTrackster.raw_energy();
461  photonCandidate.setCharge(0);
462  photonCandidate.setPdgId(22);
463  photonCandidate.setRawEnergy(gammaEnergy);
464  math::XYZTLorentzVector gammaP4(gammaEnergy * otherTrackster.barycenter().unit().x(),
465  gammaEnergy * otherTrackster.barycenter().unit().y(),
466  gammaEnergy * otherTrackster.barycenter().unit().z(),
467  gammaEnergy);
468  photonCandidate.setP4(gammaP4);
469  photonCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, tmpIndex));
470  resultCandidates->push_back(photonCandidate);
471  }
472  }
473  }
474  }
475  } //end of loop over trackstersTRKEM
476 
477  for (unsigned i = 0; i < trackstersTRK.size(); ++i) {
478  auto mergedIdx = indexInMergedCollTRK[i];
479  const auto &t = trackstersTRK[i]; //trackster
480 
481  if (!usedTrackstersMerged[mergedIdx] and t.raw_energy() > 0) {
482  auto trackIdx = t.seedIndex();
483  auto const &track = tracks[trackIdx];
484  if (!usedSeeds[trackIdx]) {
485  usedSeeds[trackIdx] = true;
486  usedTrackstersMerged[mergedIdx] = true;
487  TICLCandidate tmpCandidate;
488  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
489  tmpCandidate.setCharge(track.charge());
490  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
491  tmpCandidate.setPdgId(211 * track.charge());
492  tmpCandidate.setRawEnergy(t.raw_energy());
493  float momentum = std::sqrt(t.raw_energy() * t.raw_energy() - mpion2);
494  math::XYZTLorentzVector p4(momentum * track.momentum().unit().x(),
495  momentum * track.momentum().unit().y(),
496  momentum * track.momentum().unit().z(),
497  t.raw_energy());
498  tmpCandidate.setP4(p4);
499  resultCandidates->push_back(tmpCandidate);
500  }
501  }
502  }
503  // For all seeds that have 0-energy tracksters whose track is not marked as used, create a charged hadron with the track information.
504  for (auto const &s : seedingTrk) {
505  if (usedSeeds[s.index] == false) {
506  auto const &track = tracks[s.index];
507  // emit a charged hadron
508  TICLCandidate tmpCandidate;
509  tmpCandidate.setCharge(track.charge());
510  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, s.index));
511  tmpCandidate.setPdgId(211 * track.charge());
512  float energy = std::sqrt(track.pt() * track.pt() + mpion2);
513  tmpCandidate.setRawEnergy(energy);
514  math::XYZTLorentzVector p4(track.momentum().x(), track.momentum().y(), track.momentum().z(), energy);
515  tmpCandidate.setP4(p4);
516  resultCandidates->push_back(tmpCandidate);
517  usedSeeds[s.index] = true;
518  }
519  }
520 
521  // for all general tracks (high purity, pt > 1), check if they have been used: if not, promote them as charged hadrons
522  for (unsigned i = 0; i < tracks.size(); ++i) {
523  auto const &track = tracks[i];
524  if (track.pt() > track_min_pt_ and track.quality(reco::TrackBase::highPurity) and
525  track.missingOuterHits() < track_max_missing_outerhits_ and std::abs(track.outerEta()) > track_min_eta_ and
526  std::abs(track.outerEta()) < track_max_eta_ and usedSeeds[i] == false) {
527  // emit a charged hadron
528  TICLCandidate tmpCandidate;
529  tmpCandidate.setCharge(track.charge());
530  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, i));
531  tmpCandidate.setPdgId(211 * track.charge());
532  float energy = std::sqrt(track.pt() * track.pt() + mpion2);
533  tmpCandidate.setRawEnergy(energy);
534  math::XYZTLorentzVector p4(track.momentum().x(), track.momentum().y(), track.momentum().z(), energy);
535  tmpCandidate.setP4(p4);
536  resultCandidates->push_back(tmpCandidate);
537  usedSeeds[i] = true;
538  }
539  }
540 
541  // Compute timing
542  assignTimeToCandidates(*resultCandidates);
543 
544  evt.put(std::move(resultCandidates));
545 }
546 
547 void TrackstersMergeProducer::energyRegressionAndID(const std::vector<reco::CaloCluster> &layerClusters,
548  std::vector<Trackster> &tracksters) const {
549  // Energy regression and particle identification strategy:
550  //
551  // 1. Set default values for regressed energy and particle id for each trackster.
552  // 2. Store indices of tracksters whose total sum of cluster energies is above the
553  // eidMinClusterEnergy_ (GeV) treshold. Inference is not applied for soft tracksters.
554  // 3. When no trackster passes the selection, return.
555  // 4. Create input and output tensors. The batch dimension is determined by the number of
556  // selected tracksters.
557  // 5. Fill input tensors with layer cluster features. Per layer, clusters are ordered descending
558  // by energy. Given that tensor data is contiguous in memory, we can use pointer arithmetic to
559  // fill values, even with batching.
560  // 6. Zero-fill features for empty clusters in each layer.
561  // 7. Batched inference.
562  // 8. Assign the regressed energy and id probabilities to each trackster.
563  //
564  // Indices used throughout this method:
565  // i -> batch element / trackster
566  // j -> layer
567  // k -> cluster
568  // l -> feature
569 
570  // set default values per trackster, determine if the cluster energy threshold is passed,
571  // and store indices of hard tracksters
572  std::vector<int> tracksterIndices;
573  for (int i = 0; i < (int)tracksters.size(); i++) {
574  // calculate the cluster energy sum (2)
575  // note: after the loop, sumClusterEnergy might be just above the threshold
576  // which is enough to decide whether to run inference for the trackster or
577  // not
578  float sumClusterEnergy = 0.;
579  for (const unsigned int &vertex : tracksters[i].vertices()) {
580  sumClusterEnergy += (float)layerClusters[vertex].energy();
581  // there might be many clusters, so try to stop early
582  if (sumClusterEnergy >= eidMinClusterEnergy_) {
583  // set default values (1)
584  tracksters[i].setRegressedEnergy(0.f);
585  tracksters[i].zeroProbabilities();
586  tracksterIndices.push_back(i);
587  break;
588  }
589  }
590  }
591 
592  // do nothing when no trackster passes the selection (3)
593  int batchSize = (int)tracksterIndices.size();
594  if (batchSize == 0) {
595  return;
596  }
597 
598  // create input and output tensors (4)
599  tensorflow::TensorShape shape({batchSize, eidNLayers_, eidNClusters_, eidNFeatures_});
600  tensorflow::Tensor input(tensorflow::DT_FLOAT, shape);
602  static constexpr int inputDimension = 4;
603 
604  std::vector<tensorflow::Tensor> outputs;
605  std::vector<std::string> outputNames;
606  if (!eidOutputNameEnergy_.empty()) {
608  }
609  if (!eidOutputNameId_.empty()) {
610  outputNames.push_back(eidOutputNameId_);
611  }
612 
613  // fill input tensor (5)
614  for (int i = 0; i < batchSize; i++) {
615  const Trackster &trackster = tracksters[tracksterIndices[i]];
616 
617  // per layer, we only consider the first eidNClusters_ clusters in terms of
618  // energy, so in order to avoid creating large / nested structures to do
619  // the sorting for an unknown number of total clusters, create a sorted
620  // list of layer cluster indices to keep track of the filled clusters
621  std::vector<int> clusterIndices(trackster.vertices().size());
622  for (int k = 0; k < (int)trackster.vertices().size(); k++) {
623  clusterIndices[k] = k;
624  }
625  sort(clusterIndices.begin(), clusterIndices.end(), [&layerClusters, &trackster](const int &a, const int &b) {
626  return layerClusters[trackster.vertices(a)].energy() > layerClusters[trackster.vertices(b)].energy();
627  });
628 
629  // keep track of the number of seen clusters per layer
630  std::vector<int> seenClusters(eidNLayers_);
631 
632  // loop through clusters by descending energy
633  for (const int &k : clusterIndices) {
634  // get features per layer and cluster and store the values directly in the input tensor
635  const reco::CaloCluster &cluster = layerClusters[trackster.vertices(k)];
636  int j = rhtools_.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1;
637  if (j < eidNLayers_ && seenClusters[j] < eidNClusters_) {
638  // get the pointer to the first feature value for the current batch, layer and cluster
639  float *features = &input.tensor<float, inputDimension>()(i, j, seenClusters[j], 0);
640 
641  // fill features
642  *(features++) = float(cluster.energy() / float(trackster.vertex_multiplicity(k)));
643  *(features++) = float(std::abs(cluster.eta()));
644  *(features) = float(cluster.phi());
645 
646  // increment seen clusters
647  seenClusters[j]++;
648  }
649  }
650 
651  // zero-fill features of empty clusters in each layer (6)
652  for (int j = 0; j < eidNLayers_; j++) {
653  for (int k = seenClusters[j]; k < eidNClusters_; k++) {
654  float *features = &input.tensor<float, inputDimension>()(i, j, k, 0);
655  for (int l = 0; l < eidNFeatures_; l++) {
656  *(features++) = 0.f;
657  }
658  }
659  }
660  }
661 
662  // run the inference (7)
664 
665  // store regressed energy per trackster (8)
666  if (!eidOutputNameEnergy_.empty()) {
667  // get the pointer to the energy tensor, dimension is batch x 1
668  float *energy = outputs[0].flat<float>().data();
669 
670  for (const int &i : tracksterIndices) {
671  tracksters[i].setRegressedEnergy(*(energy++));
672  }
673  }
674 
675  // store id probabilities per trackster (8)
676  if (!eidOutputNameId_.empty()) {
677  // get the pointer to the id probability tensor, dimension is batch x id_probabilities.size()
678  int probsIdx = !eidOutputNameEnergy_.empty();
679  float *probs = outputs[probsIdx].flat<float>().data();
680 
681  for (const int &i : tracksterIndices) {
682  tracksters[i].setProbabilities(probs);
683  probs += tracksters[i].id_probabilities().size();
684  }
685  }
686 }
687 
688 void TrackstersMergeProducer::assignTimeToCandidates(std::vector<TICLCandidate> &resultCandidates) const {
689  for (auto &cand : resultCandidates) {
690  if (cand.tracksters().size() > 1) { // For single-trackster candidates the timing is already set
691  float time = 0.f;
692  float timeErr = 0.f;
693  for (const auto &tr : cand.tracksters()) {
694  if (tr->timeError() > 0) {
695  auto invTimeESq = pow(tr->timeError(), -2);
696  time += tr->time() * invTimeESq;
697  timeErr += invTimeESq;
698  }
699  }
700  if (timeErr > 0) {
701  timeErr = 1. / timeErr;
702 
703  cand.setTime(time * timeErr);
704  cand.setTimeError(sqrt(timeErr));
705  }
706  }
707  }
708 }
709 
711  // this method is supposed to create, initialize and return a TrackstersCache instance
712  std::unique_ptr<TrackstersCache> cache = std::make_unique<TrackstersCache>(params);
713 
714  // load the graph def and save it
715  std::string graphPath = params.getParameter<std::string>("eid_graph_path");
716  if (!graphPath.empty()) {
717  graphPath = edm::FileInPath(graphPath).fullPath();
718  cache->eidGraphDef = tensorflow::loadGraphDef(graphPath);
719  }
720 
721  return cache;
722 }
723 
725  delete cache->eidGraphDef;
726  cache->eidGraphDef = nullptr;
727 }
728 
729 void TrackstersMergeProducer::printTrackstersDebug(const std::vector<Trackster> &tracksters, const char *label) const {
730  if (!debug_)
731  return;
732 
733  int counter = 0;
734  for (auto const &t : tracksters) {
735  LogDebug("TrackstersMergeProducer")
736  << counter++ << " TrackstersMergeProducer (" << label << ") obj barycenter: " << t.barycenter()
737  << " eta,phi (baricenter): " << t.barycenter().eta() << ", " << t.barycenter().phi()
738  << " eta,phi (eigen): " << t.eigenvectors(0).eta() << ", " << t.eigenvectors(0).phi()
739  << " pt(eigen): " << std::sqrt(t.eigenvectors(0).Unit().perp2()) * t.raw_energy() << " seedID: " << t.seedID()
740  << " seedIndex: " << t.seedIndex() << " size: " << t.vertices().size() << " average usage: "
741  << (std::accumulate(std::begin(t.vertex_multiplicity()), std::end(t.vertex_multiplicity()), 0.) /
742  (float)t.vertex_multiplicity().size())
743  << " raw_energy: " << t.raw_energy() << " regressed energy: " << t.regressed_energy()
744  << " probs(ga/e/mu/np/cp/nh/am/unk): ";
745  for (auto const &p : t.id_probabilities()) {
746  LogDebug("TrackstersMergeProducer") << std::fixed << p << " ";
747  }
748  LogDebug("TrackstersMergeProducer") << " sigmas: ";
749  for (auto const &s : t.sigmas()) {
750  LogDebug("TrackstersMergeProducer") << s << " ";
751  }
752  LogDebug("TrackstersMergeProducer") << std::endl;
753  }
754 }
755 
758  desc.add<edm::InputTag>("tracksterstrkem", edm::InputTag("ticlTrackstersTrkEM"));
759  desc.add<edm::InputTag>("trackstersem", edm::InputTag("ticlTrackstersEM"));
760  desc.add<edm::InputTag>("tracksterstrk", edm::InputTag("ticlTrackstersTrk"));
761  desc.add<edm::InputTag>("trackstershad", edm::InputTag("ticlTrackstersHAD"));
762  desc.add<edm::InputTag>("seedingTrk", edm::InputTag("ticlSeedingTrk"));
763  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
764  desc.add<edm::InputTag>("layer_clustersTime", edm::InputTag("hgcalLayerClusters", "timeLayerCluster"));
765  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
766  desc.add<bool>("optimiseAcrossTracksters", true);
767  desc.add<int>("eta_bin_window", 1);
768  desc.add<int>("phi_bin_window", 1);
769  desc.add<double>("pt_sigma_high", 2.);
770  desc.add<double>("pt_sigma_low", 2.);
771  desc.add<double>("halo_max_distance2", 4.);
772  desc.add<double>("track_min_pt", 1.);
773  desc.add<double>("track_min_eta", 1.48);
774  desc.add<double>("track_max_eta", 3.);
775  desc.add<int>("track_max_missing_outerhits", 5);
776  desc.add<double>("cosangle_align", 0.9945);
777  desc.add<double>("e_over_h_threshold", 1.);
778  desc.add<double>("pt_neutral_threshold", 2.);
779  desc.add<double>("resol_calo_offset_had", 1.5);
780  desc.add<double>("resol_calo_scale_had", 0.15);
781  desc.add<double>("resol_calo_offset_em", 1.5);
782  desc.add<double>("resol_calo_scale_em", 0.15);
783  desc.add<bool>("debug", true);
784  desc.add<std::string>("eid_graph_path", "RecoHGCal/TICL/data/tf_models/energy_id_v0.pb");
785  desc.add<std::string>("eid_input_name", "input");
786  desc.add<std::string>("eid_output_name_energy", "output/regressed_energy");
787  desc.add<std::string>("eid_output_name_id", "output/id_probabilities");
788  desc.add<double>("eid_min_cluster_energy", 1.);
789  desc.add<int>("eid_n_layers", 50);
790  desc.add<int>("eid_n_clusters", 10);
791  descriptions.add("trackstersMergeProducer", desc);
792 }
793 
ConfigurationDescriptions.h
reco::CaloCluster::phi
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
reco::LeafCandidate::setPdgId
void setPdgId(int pdgId) final
Definition: LeafCandidate.h:178
tensorflow::createSession
Session * createSession(SessionOptions &sessionOptions)
Definition: TensorFlow.cc:85
TrackstersPCA.h
TrackstersMergeProducer::track_min_pt_
const double track_min_pt_
Definition: TrackstersMergeProducer.cc:59
TICLCandidate::setTrackPtr
void setTrackPtr(const edm::Ptr< reco::Track > &trackPtr)
Definition: TICLCandidate.h:37
counter
Definition: counter.py:1
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
hgcal::RecHitTools
Definition: RecHitTools.h:23
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
Common.h
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
input
static const std::string input
Definition: EdmProvDump.cc:48
TensorFlow.h
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
Trackster.h
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TrackstersMergeProducer::halo_max_distance2_
const double halo_max_distance2_
Definition: TrackstersMergeProducer.cc:58
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
postprocess-scan-build.features
features
Definition: postprocess-scan-build.py:8
edm::EDGetTokenT
Definition: EDGetToken.h:33
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
TICLGenericTile
Definition: TICLLayerTile.h:72
TrackstersMergeProducer::TracksterIterIndex
TracksterIterIndex
Definition: TrackstersMergeProducer.cc:35
TrackstersMergeProducer::eta_bin_window_
const int eta_bin_window_
Definition: TrackstersMergeProducer.cc:54
TrackstersMergeProducer::printTrackstersDebug
void printTrackstersDebug(const std::vector< Trackster > &, const char *label) const
Definition: TrackstersMergeProducer.cc:729
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PatBasicFWLiteJetAnalyzer_Selector_cfg.outputs
outputs
Definition: PatBasicFWLiteJetAnalyzer_Selector_cfg.py:48
TrackstersMergeProducer::assignTimeToCandidates
void assignTimeToCandidates(std::vector< TICLCandidate > &resultCandidates) const
Definition: TrackstersMergeProducer.cc:688
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
HLTEgPhaseIITestSequence_cff.seedingTrk
seedingTrk
Definition: HLTEgPhaseIITestSequence_cff.py:2288
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackstersMergeProducer::seedingTrk_token_
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seedingTrk_token_
Definition: TrackstersMergeProducer.cc:48
EDProducer.h
TrackstersMergeProducer::eidMinClusterEnergy_
const float eidMinClusterEnergy_
Definition: TrackstersMergeProducer.cc:74
TrackstersMergeProducer::eidOutputNameId_
const std::string eidOutputNameId_
Definition: TrackstersMergeProducer.cc:73
TrackstersMergeProducer::fillTile
void fillTile(TICLTracksterTiles &, const std::vector< Trackster > &, TracksterIterIndex)
Definition: TrackstersMergeProducer.cc:132
TrackstersMergeProducer::trackstersem_token_
const edm::EDGetTokenT< std::vector< Trackster > > trackstersem_token_
Definition: TrackstersMergeProducer.cc:45
TrackstersMergeProducer::track_min_eta_
const double track_min_eta_
Definition: TrackstersMergeProducer.cc:60
TrackstersMergeProducer::geometry_token_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometry_token_
Definition: TrackstersMergeProducer.cc:52
TrackstersMergeProducer::pt_neutral_threshold_
const double pt_neutral_threshold_
Definition: TrackstersMergeProducer.cc:65
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
ticl
Definition: Common.h:8
edm::Handle
Definition: AssociativeIterator.h:50
TrackstersMergeProducer::tracksterstrk_token_
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrk_token_
Definition: TrackstersMergeProducer.cc:46
ESGetToken.h
ticl::assignPCAtoTracksters
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
Definition: TrackstersPCA.cc:12
TrackstersMergeProducer::clusters_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
Definition: TrackstersMergeProducer.cc:49
TrackstersMergeProducer::energyRegressionAndID
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, std::vector< Trackster > &result) const
Definition: TrackstersMergeProducer.cc:547
TrackstersMergeProducer::resol_calo_scale_had_
const double resol_calo_scale_had_
Definition: TrackstersMergeProducer.cc:67
TICLLayerTile.h
edm::FileInPath
Definition: FileInPath.h:64
TrackstersMergeProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TrackstersMergeProducer.cc:169
MakerMacros.h
TrackstersMergeProducer::eidNFeatures_
static constexpr int eidNFeatures_
Definition: TrackstersMergeProducer.cc:81
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CaloGeometry
Definition: CaloGeometry.h:21
TICLCandidate::setRawEnergy
void setRawEnergy(float rawEnergy)
Definition: TICLCandidate.h:40
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ticl::TrackstersCache
Definition: GlobalCache.h:19
ticl::CacheBase
Definition: GlobalCache.h:11
TrackstersMergeProducer::rhtools_
hgcal::RecHitTools rhtools_
Definition: TrackstersMergeProducer.cc:79
TrackstersMergeProducer::~TrackstersMergeProducer
~TrackstersMergeProducer() override
Definition: TrackstersMergeProducer.cc:26
TrackstersMergeProducer::initializeGlobalCache
static std::unique_ptr< TrackstersCache > initializeGlobalCache(const edm::ParameterSet &)
Definition: TrackstersMergeProducer.cc:710
reco::CaloCluster
Definition: CaloCluster.h:31
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TrackstersMergeProducer::tracksterstrkem_token_
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrkem_token_
Definition: TrackstersMergeProducer.cc:44
ticl::Trackster::vertex_multiplicity
std::vector< uint8_t > & vertex_multiplicity()
Definition: Trackster.h:54
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackstersMergeProducer::e_over_h_threshold_
const double e_over_h_threshold_
Definition: TrackstersMergeProducer.cc:64
mps_fire.end
end
Definition: mps_fire.py:242
DDAxes::z
edm::ESHandle< CaloGeometry >
TrackstersMergeProducer::phi_bin_window_
const int phi_bin_window_
Definition: TrackstersMergeProducer.cc:55
TrackstersMergeProducer::pt_sigma_low_
const double pt_sigma_low_
Definition: TrackstersMergeProducer.cc:57
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
b
double b
Definition: hdecay.h:118
TrackstersMergeProducer::tracks_token_
const edm::EDGetTokenT< std::vector< reco::Track > > tracks_token_
Definition: TrackstersMergeProducer.cc:51
TrackstersMergeProducer::eidNLayers_
const int eidNLayers_
Definition: TrackstersMergeProducer.cc:75
utilities.cache
def cache(function)
Definition: utilities.py:3
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GlobalCache.h
TrackstersMergeProducer::eidInputName_
const std::string eidInputName_
Definition: TrackstersMergeProducer.cc:71
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
TICLCandidate.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
TrackstersMergeProducer::TrackstersMergeProducer
TrackstersMergeProducer(const edm::ParameterSet &ps, const CacheBase *cache)
Definition: TrackstersMergeProducer.cc:84
hgcal::RecHitTools::getLayerWithOffset
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:352
hgcal::RecHitTools::lastLayerEE
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:64
TrackstersMergeProducer::resol_calo_offset_em_
const double resol_calo_offset_em_
Definition: TrackstersMergeProducer.cc:68
tensorflow::NamedTensorList
std::vector< NamedTensor > NamedTensorList
Definition: TensorFlow.h:30
cand
Definition: decayParser.h:32
TrackstersMergeProducer::dumpTrackster
void dumpTrackster(const Trackster &) const
Definition: TrackstersMergeProducer.cc:147
TrackstersMergeProducer::eidOutputNameEnergy_
const std::string eidOutputNameEnergy_
Definition: TrackstersMergeProducer.cc:72
createfilelist.int
int
Definition: createfilelist.py:10
TrackstersMergeProducer::clustersTime_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
Definition: TrackstersMergeProducer.cc:50
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::stream::EDProducer
Definition: EDProducer.h:38
TrackstersMergeProducer::optimiseAcrossTracksters_
const bool optimiseAcrossTracksters_
Definition: TrackstersMergeProducer.cc:53
TrackstersMergeProducer::globalEndJob
static void globalEndJob(TrackstersCache *)
Definition: TrackstersMergeProducer.cc:724
edm::EventSetup
Definition: EventSetup.h:57
TICLCandidate
Definition: TICLCandidate.h:13
hgcal::RecHitTools::getPositionLayer
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:138
ticl::TrackstersCache::eidGraphDef
std::atomic< tensorflow::GraphDef * > eidGraphDef
Definition: GlobalCache.h:25
TrackstersMergeProducer::trackstershad_token_
const edm::EDGetTokenT< std::vector< Trackster > > trackstershad_token_
Definition: TrackstersMergeProducer.cc:47
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
TICLSeedingRegion
Definition: TICLSeedingRegion.h:14
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
edm::Ptr
Definition: AssociationVector.h:31
tensorflow::loadGraphDef
GraphDef * loadGraphDef(const std::string &pbFile)
Definition: TensorFlow.cc:68
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
TICLSeedingRegion.h
TICLCandidate::addTrackster
void addTrackster(const edm::Ptr< ticl::Trackster > &trackster)
Definition: TICLCandidate.h:45
TrackstersMergeProducer::track_max_missing_outerhits_
const int track_max_missing_outerhits_
Definition: TrackstersMergeProducer.cc:62
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
TrackstersMergeProducer::resol_calo_scale_em_
const double resol_calo_scale_em_
Definition: TrackstersMergeProducer.cc:69
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
ticl::Trackster::vertices
std::vector< unsigned int > & vertices()
Definition: Trackster.h:53
Exception
Definition: hltDiff.cc:246
reco::LeafCandidate::setCharge
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:108
tensorflow::run
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
Definition: TensorFlow.cc:211
TrackstersMergeProducer
Definition: TrackstersMergeProducer.cc:23
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
TrackstersMergeProducer::debug_
const bool debug_
Definition: TrackstersMergeProducer.cc:70
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TrackstersMergeProducer::pt_sigma_high_
const double pt_sigma_high_
Definition: TrackstersMergeProducer.cc:56
TrackstersMergeProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackstersMergeProducer.cc:756
TrackstersMergeProducer::track_max_eta_
const double track_max_eta_
Definition: TrackstersMergeProducer.cc:61
ParameterSet.h
TrackstersMergeProducer::resol_calo_offset_had_
const double resol_calo_offset_had_
Definition: TrackstersMergeProducer.cc:66
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
ntuplemaker.time
time
Definition: ntuplemaker.py:310
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TrackstersMergeProducer::eidNClusters_
const int eidNClusters_
Definition: TrackstersMergeProducer.cc:76
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
TrackstersMergeProducer::cosangle_align_
const double cosangle_align_
Definition: TrackstersMergeProducer.cc:63
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
RecHitTools.h
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
TrackstersMergeProducer::eidSession_
tensorflow::Session * eidSession_
Definition: TrackstersMergeProducer.cc:78
ticl::Trackster
Definition: Trackster.h:19
jets_cff.outputNames
outputNames
Definition: jets_cff.py:322
CaloCluster.h
TICLGenericTile::fill
void fill(int index, double eta, double phi, unsigned int objectId)
Definition: TICLLayerTile.h:78
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
reco::TrackBase::highPurity
Definition: TrackBase.h:154