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