CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
TrackstersMergeProducer Class Reference
Inheritance diagram for TrackstersMergeProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TrackstersMergeProducer (const edm::ParameterSet &ps)
 
 ~TrackstersMergeProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef ticl::Trackster::IterationIndex TracksterIterIndex
 

Private Member Functions

void assignTimeToCandidates (std::vector< TICLCandidate > &resultCandidates) const
 
void dumpTrackster (const Trackster &) const
 
void energyRegressionAndID (const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result) const
 
void fillTile (TICLTracksterTiles &, const std::vector< Trackster > &, TracksterIterIndex)
 
void printTrackstersDebug (const std::vector< Trackster > &, const char *label) const
 

Private Attributes

const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
 
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
 
const double cosangle_align_
 
const bool debug_
 
const double e_over_h_threshold_
 
const std::string eidInputName_
 
const float eidMinClusterEnergy_
 
const int eidNClusters_
 
const int eidNLayers_
 
const std::string eidOutputNameEnergy_
 
const std::string eidOutputNameId_
 
tensorflow::Session * eidSession_
 
const int eta_bin_window_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeometry_token_
 
const double halo_max_distance2_
 
const bool optimiseAcrossTracksters_
 
const int phi_bin_window_
 
const double pt_neutral_threshold_
 
const double pt_sigma_high_
 
const double pt_sigma_low_
 
const double resol_calo_offset_em_
 
const double resol_calo_offset_had_
 
const double resol_calo_scale_em_
 
const double resol_calo_scale_had_
 
hgcal::RecHitTools rhtools_
 
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seedingTrk_token_
 
const std::string tfDnnLabel_
 
const edm::ESGetToken< TfGraphDefWrapper, TfGraphRecordtfDnnToken_
 
const tensorflow::Session * tfSession_
 
const double track_max_eta_
 
const int track_max_missing_outerhits_
 
const double track_min_eta_
 
const double track_min_pt_
 
const edm::EDGetTokenT< std::vector< reco::Track > > tracks_token_
 
const edm::EDGetTokenT< std::vector< Trackster > > trackstersem_token_
 
const edm::EDGetTokenT< std::vector< Trackster > > trackstershad_token_
 
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrk_token_
 
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrkem_token_
 

Static Private Attributes

static constexpr int eidNFeatures_ = 3
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 27 of file TrackstersMergeProducer.cc.

Member Typedef Documentation

◆ TracksterIterIndex

Definition at line 35 of file TrackstersMergeProducer.cc.

Constructor & Destructor Documentation

◆ TrackstersMergeProducer()

TrackstersMergeProducer::TrackstersMergeProducer ( const edm::ParameterSet ps)
explicit

Definition at line 90 of file TrackstersMergeProducer.cc.

91  : tracksterstrkem_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("tracksterstrkem"))),
92  trackstersem_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("trackstersem"))),
93  tracksterstrk_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("tracksterstrk"))),
94  trackstershad_token_(consumes<std::vector<Trackster>>(ps.getParameter<edm::InputTag>("trackstershad"))),
95  seedingTrk_token_(consumes<std::vector<TICLSeedingRegion>>(ps.getParameter<edm::InputTag>("seedingTrk"))),
96  clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"))),
98  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("layer_clustersTime"))),
99  tracks_token_(consumes<std::vector<reco::Track>>(ps.getParameter<edm::InputTag>("tracks"))),
100  geometry_token_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
101  tfDnnLabel_(ps.getParameter<std::string>("tfDnnLabel")),
103  tfSession_(nullptr),
104  optimiseAcrossTracksters_(ps.getParameter<bool>("optimiseAcrossTracksters")),
105  eta_bin_window_(ps.getParameter<int>("eta_bin_window")),
106  phi_bin_window_(ps.getParameter<int>("phi_bin_window")),
107  pt_sigma_high_(ps.getParameter<double>("pt_sigma_high")),
108  pt_sigma_low_(ps.getParameter<double>("pt_sigma_low")),
109  halo_max_distance2_(ps.getParameter<double>("halo_max_distance2")),
110  track_min_pt_(ps.getParameter<double>("track_min_pt")),
111  track_min_eta_(ps.getParameter<double>("track_min_eta")),
112  track_max_eta_(ps.getParameter<double>("track_max_eta")),
113  track_max_missing_outerhits_(ps.getParameter<int>("track_max_missing_outerhits")),
114  cosangle_align_(ps.getParameter<double>("cosangle_align")),
115  e_over_h_threshold_(ps.getParameter<double>("e_over_h_threshold")),
116  pt_neutral_threshold_(ps.getParameter<double>("pt_neutral_threshold")),
117  resol_calo_offset_had_(ps.getParameter<double>("resol_calo_offset_had")),
118  resol_calo_scale_had_(ps.getParameter<double>("resol_calo_scale_had")),
119  resol_calo_offset_em_(ps.getParameter<double>("resol_calo_offset_em")),
120  resol_calo_scale_em_(ps.getParameter<double>("resol_calo_scale_em")),
121  debug_(ps.getParameter<bool>("debug")),
122  eidInputName_(ps.getParameter<std::string>("eid_input_name")),
123  eidOutputNameEnergy_(ps.getParameter<std::string>("eid_output_name_energy")),
124  eidOutputNameId_(ps.getParameter<std::string>("eid_output_name_id")),
125  eidMinClusterEnergy_(ps.getParameter<double>("eid_min_cluster_energy")),
126  eidNLayers_(ps.getParameter<int>("eid_n_layers")),
127  eidNClusters_(ps.getParameter<int>("eid_n_clusters")),
128  eidSession_(nullptr) {
129  produces<std::vector<Trackster>>();
130  produces<std::vector<TICLCandidate>>();
131 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< std::vector< Trackster > > trackstersem_token_
tensorflow::Session * eidSession_
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seedingTrk_token_
const tensorflow::Session * tfSession_
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrkem_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometry_token_
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrk_token_
const edm::EDGetTokenT< std::vector< Trackster > > trackstershad_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
const edm::EDGetTokenT< std::vector< reco::Track > > tracks_token_
const std::string eidOutputNameEnergy_
const edm::ESGetToken< TfGraphDefWrapper, TfGraphRecord > tfDnnToken_

◆ ~TrackstersMergeProducer()

TrackstersMergeProducer::~TrackstersMergeProducer ( )
inlineoverride

Definition at line 30 of file TrackstersMergeProducer.cc.

30 {};

Member Function Documentation

◆ assignTimeToCandidates()

void TrackstersMergeProducer::assignTimeToCandidates ( std::vector< TICLCandidate > &  resultCandidates) const
private

Definition at line 687 of file TrackstersMergeProducer.cc.

References funct::pow(), mathSSE::sqrt(), and protons_cff::time.

Referenced by produce().

687  {
688  for (auto &cand : resultCandidates) {
689  if (cand.tracksters().size() > 1) { // For single-trackster candidates the timing is already set
690  float time = 0.f;
691  float timeErr = 0.f;
692  for (const auto &tr : cand.tracksters()) {
693  if (tr->timeError() > 0) {
694  auto invTimeESq = pow(tr->timeError(), -2);
695  time += tr->time() * invTimeESq;
696  timeErr += invTimeESq;
697  }
698  }
699  if (timeErr > 0) {
700  timeErr = 1. / timeErr;
701 
702  cand.setTime(time * timeErr);
703  cand.setTimeError(sqrt(timeErr));
704  }
705  }
706  }
707 }
T sqrt(T t)
Definition: SSEVec.h:19
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ dumpTrackster()

void TrackstersMergeProducer::dumpTrackster ( const Trackster t) const
private

Definition at line 148 of file TrackstersMergeProducer.cc.

References mps_fire::end, alignBH_cfg::fixed, dqmMemoryStats::float, LogDebug, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, mathSSE::sqrt(), and submitPVValidationJobs::t.

148  {
149  auto e_over_h = (t.raw_em_pt() / ((t.raw_pt() - t.raw_em_pt()) != 0. ? (t.raw_pt() - t.raw_em_pt()) : 1.));
150  LogDebug("TrackstersMergeProducer")
151  << "\nTrackster raw_pt: " << t.raw_pt() << " raw_em_pt: " << t.raw_em_pt() << " eoh: " << e_over_h
152  << " barycenter: " << t.barycenter() << " eta,phi (baricenter): " << t.barycenter().eta() << ", "
153  << t.barycenter().phi() << " eta,phi (eigen): " << t.eigenvectors(0).eta() << ", " << t.eigenvectors(0).phi()
154  << " pt(eigen): " << std::sqrt(t.eigenvectors(0).Unit().perp2()) * t.raw_energy() << " seedID: " << t.seedID()
155  << " seedIndex: " << t.seedIndex() << " size: " << t.vertices().size() << " average usage: "
156  << (std::accumulate(std::begin(t.vertex_multiplicity()), std::end(t.vertex_multiplicity()), 0.) /
157  (float)t.vertex_multiplicity().size())
158  << " raw_energy: " << t.raw_energy() << " regressed energy: " << t.regressed_energy()
159  << " probs(ga/e/mu/np/cp/nh/am/unk): ";
160  for (auto const &p : t.id_probabilities()) {
161  LogDebug("TrackstersMergeProducer") << std::fixed << p << " ";
162  }
163  LogDebug("TrackstersMergeProducer") << " sigmas: ";
164  for (auto const &s : t.sigmas()) {
165  LogDebug("TrackstersMergeProducer") << s << " ";
166  }
167  LogDebug("TrackstersMergeProducer") << std::endl;
168 }
T sqrt(T t)
Definition: SSEVec.h:19
#define LogDebug(id)

◆ energyRegressionAndID()

void TrackstersMergeProducer::energyRegressionAndID ( const std::vector< reco::CaloCluster > &  layerClusters,
const tensorflow::Session *  eidSession,
std::vector< Trackster > &  result 
) const
private

Definition at line 545 of file TrackstersMergeProducer.cc.

References a, funct::abs(), b, data, eidInputName_, eidMinClusterEnergy_, eidNClusters_, eidNFeatures_, eidNLayers_, eidOutputNameEnergy_, eidOutputNameId_, HCALHighEnergyHPDFilter_cfi::energy, reco::CaloCluster::energy(), reco::CaloCluster::eta(), f, lowptgsfeleseed::features(), dqmMemoryStats::float, hgcal::RecHitTools::getLayerWithOffset(), reco::CaloCluster::hitsAndFractions(), mps_fire::i, input, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, cmsLHEtoEOSManager::l, hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, jetsAK4_CHS_cff::outputNames, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, reco::CaloCluster::phi(), rhtools_, tensorflow::run(), jetUpdater_cfi::sort, bphysicsOniaDQM_cfi::vertex, ticl::Trackster::vertex_multiplicity(), AlignmentTracksFromVertexSelector_cfi::vertices, and ticl::Trackster::vertices().

Referenced by produce().

547  {
548  // Energy regression and particle identification strategy:
549  //
550  // 1. Set default values for regressed energy and particle id for each trackster.
551  // 2. Store indices of tracksters whose total sum of cluster energies is above the
552  // eidMinClusterEnergy_ (GeV) treshold. Inference is not applied for soft tracksters.
553  // 3. When no trackster passes the selection, return.
554  // 4. Create input and output tensors. The batch dimension is determined by the number of
555  // selected tracksters.
556  // 5. Fill input tensors with layer cluster features. Per layer, clusters are ordered descending
557  // by energy. Given that tensor data is contiguous in memory, we can use pointer arithmetic to
558  // fill values, even with batching.
559  // 6. Zero-fill features for empty clusters in each layer.
560  // 7. Batched inference.
561  // 8. Assign the regressed energy and id probabilities to each trackster.
562  //
563  // Indices used throughout this method:
564  // i -> batch element / trackster
565  // j -> layer
566  // k -> cluster
567  // l -> feature
568 
569  // set default values per trackster, determine if the cluster energy threshold is passed,
570  // and store indices of hard tracksters
571  std::vector<int> tracksterIndices;
572  for (int i = 0; i < (int)tracksters.size(); i++) {
573  // calculate the cluster energy sum (2)
574  // note: after the loop, sumClusterEnergy might be just above the threshold
575  // which is enough to decide whether to run inference for the trackster or
576  // not
577  float sumClusterEnergy = 0.;
578  for (const unsigned int &vertex : tracksters[i].vertices()) {
579  sumClusterEnergy += (float)layerClusters[vertex].energy();
580  // there might be many clusters, so try to stop early
581  if (sumClusterEnergy >= eidMinClusterEnergy_) {
582  // set default values (1)
583  tracksters[i].setRegressedEnergy(0.f);
584  tracksters[i].zeroProbabilities();
585  tracksterIndices.push_back(i);
586  break;
587  }
588  }
589  }
590 
591  // do nothing when no trackster passes the selection (3)
592  int batchSize = (int)tracksterIndices.size();
593  if (batchSize == 0) {
594  return;
595  }
596 
597  // create input and output tensors (4)
598  tensorflow::TensorShape shape({batchSize, eidNLayers_, eidNClusters_, eidNFeatures_});
599  tensorflow::Tensor input(tensorflow::DT_FLOAT, shape);
601  static constexpr int inputDimension = 4;
602 
603  std::vector<tensorflow::Tensor> outputs;
604  std::vector<std::string> outputNames;
605  if (!eidOutputNameEnergy_.empty()) {
607  }
608  if (!eidOutputNameId_.empty()) {
609  outputNames.push_back(eidOutputNameId_);
610  }
611 
612  // fill input tensor (5)
613  for (int i = 0; i < batchSize; i++) {
614  const Trackster &trackster = tracksters[tracksterIndices[i]];
615 
616  // per layer, we only consider the first eidNClusters_ clusters in terms of
617  // energy, so in order to avoid creating large / nested structures to do
618  // the sorting for an unknown number of total clusters, create a sorted
619  // list of layer cluster indices to keep track of the filled clusters
620  std::vector<int> clusterIndices(trackster.vertices().size());
621  for (int k = 0; k < (int)trackster.vertices().size(); k++) {
622  clusterIndices[k] = k;
623  }
624  sort(clusterIndices.begin(), clusterIndices.end(), [&layerClusters, &trackster](const int &a, const int &b) {
625  return layerClusters[trackster.vertices(a)].energy() > layerClusters[trackster.vertices(b)].energy();
626  });
627 
628  // keep track of the number of seen clusters per layer
629  std::vector<int> seenClusters(eidNLayers_);
630 
631  // loop through clusters by descending energy
632  for (const int &k : clusterIndices) {
633  // get features per layer and cluster and store the values directly in the input tensor
634  const reco::CaloCluster &cluster = layerClusters[trackster.vertices(k)];
635  int j = rhtools_.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1;
636  if (j < eidNLayers_ && seenClusters[j] < eidNClusters_) {
637  // get the pointer to the first feature value for the current batch, layer and cluster
638  float *features = &input.tensor<float, inputDimension>()(i, j, seenClusters[j], 0);
639 
640  // fill features
641  *(features++) = float(cluster.energy() / float(trackster.vertex_multiplicity(k)));
642  *(features++) = float(std::abs(cluster.eta()));
643  *(features) = float(cluster.phi());
644 
645  // increment seen clusters
646  seenClusters[j]++;
647  }
648  }
649 
650  // zero-fill features of empty clusters in each layer (6)
651  for (int j = 0; j < eidNLayers_; j++) {
652  for (int k = seenClusters[j]; k < eidNClusters_; k++) {
653  float *features = &input.tensor<float, inputDimension>()(i, j, k, 0);
654  for (int l = 0; l < eidNFeatures_; l++) {
655  *(features++) = 0.f;
656  }
657  }
658  }
659  }
660 
661  // run the inference (7)
662  tensorflow::run(const_cast<tensorflow::Session *>(eidSession), inputList, outputNames, &outputs);
663 
664  // store regressed energy per trackster (8)
665  if (!eidOutputNameEnergy_.empty()) {
666  // get the pointer to the energy tensor, dimension is batch x 1
667  float *energy = outputs[0].flat<float>().data();
668 
669  for (const int &i : tracksterIndices) {
670  tracksters[i].setRegressedEnergy(*(energy++));
671  }
672  }
673 
674  // store id probabilities per trackster (8)
675  if (!eidOutputNameId_.empty()) {
676  // get the pointer to the id probability tensor, dimension is batch x id_probabilities.size()
677  int probsIdx = !eidOutputNameEnergy_.empty();
678  float *probs = outputs[probsIdx].flat<float>().data();
679 
680  for (const int &i : tracksterIndices) {
681  tracksters[i].setProbabilities(probs);
682  probs += tracksters[i].id_probabilities().size();
683  }
684  }
685 }
std::vector< NamedTensor > NamedTensorList
Definition: TensorFlow.h:30
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
static std::string const input
Definition: EdmProvDump.cc:50
static constexpr int eidNFeatures_
std::vector< float > features(const reco::PreId &ecal, const reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
Definition: TensorFlow.cc:213
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
double energy() const
cluster energy
Definition: CaloCluster.h:149
std::vector< unsigned int > & vertices()
Definition: Trackster.h:57
const std::string eidOutputNameEnergy_
std::vector< float > & vertex_multiplicity()
Definition: Trackster.h:58
double b
Definition: hdecay.h:118
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
double a
Definition: hdecay.h:119
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:365

◆ fillDescriptions()

void TrackstersMergeProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 736 of file TrackstersMergeProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_2022v14_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

736  {
738  desc.add<edm::InputTag>("tracksterstrkem", edm::InputTag("ticlTrackstersTrkEM"));
739  desc.add<edm::InputTag>("trackstersem", edm::InputTag("ticlTrackstersEM"));
740  desc.add<edm::InputTag>("tracksterstrk", edm::InputTag("ticlTrackstersTrk"));
741  desc.add<edm::InputTag>("trackstershad", edm::InputTag("ticlTrackstersHAD"));
742  desc.add<edm::InputTag>("seedingTrk", edm::InputTag("ticlSeedingTrk"));
743  desc.add<edm::InputTag>("layer_clusters", edm::InputTag("hgcalLayerClusters"));
744  desc.add<edm::InputTag>("layer_clustersTime", edm::InputTag("hgcalLayerClusters", "timeLayerCluster"));
745  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
746  desc.add<bool>("optimiseAcrossTracksters", true);
747  desc.add<int>("eta_bin_window", 1);
748  desc.add<int>("phi_bin_window", 1);
749  desc.add<double>("pt_sigma_high", 2.);
750  desc.add<double>("pt_sigma_low", 2.);
751  desc.add<double>("halo_max_distance2", 4.);
752  desc.add<double>("track_min_pt", 1.);
753  desc.add<double>("track_min_eta", 1.48);
754  desc.add<double>("track_max_eta", 3.);
755  desc.add<int>("track_max_missing_outerhits", 5);
756  desc.add<double>("cosangle_align", 0.9945);
757  desc.add<double>("e_over_h_threshold", 1.);
758  desc.add<double>("pt_neutral_threshold", 2.);
759  desc.add<double>("resol_calo_offset_had", 1.5);
760  desc.add<double>("resol_calo_scale_had", 0.15);
761  desc.add<double>("resol_calo_offset_em", 1.5);
762  desc.add<double>("resol_calo_scale_em", 0.15);
763  desc.add<bool>("debug", true);
764  desc.add<std::string>("tfDnnLabel", "tracksterSelectionTf");
765  desc.add<std::string>("eid_input_name", "input");
766  desc.add<std::string>("eid_output_name_energy", "output/regressed_energy");
767  desc.add<std::string>("eid_output_name_id", "output/id_probabilities");
768  desc.add<double>("eid_min_cluster_energy", 1.);
769  desc.add<int>("eid_n_layers", 50);
770  desc.add<int>("eid_n_clusters", 10);
771  descriptions.add("trackstersMergeProducer", desc);
772 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillTile()

void TrackstersMergeProducer::fillTile ( TICLTracksterTiles tracksterTile,
const std::vector< Trackster > &  tracksters,
TracksterIterIndex  tracksterIteration 
)
private

Definition at line 133 of file TrackstersMergeProducer.cc.

References TICLGenericTile< T >::fill(), LogDebug, BeamMonitor_cff::phiBin, and submitPVValidationJobs::t.

Referenced by produce().

135  {
136  int tracksterId = 0;
137  for (auto const &t : tracksters) {
138  tracksterTile.fill(tracksterIteration, t.barycenter().eta(), t.barycenter().phi(), tracksterId);
139  LogDebug("TrackstersMergeProducer") << "Adding tracksterId: " << tracksterId << " into bin [eta,phi]: [ "
140  << tracksterTile[tracksterIteration].etaBin(t.barycenter().eta()) << ", "
141  << tracksterTile[tracksterIteration].phiBin(t.barycenter().phi())
142  << "] for iteration: " << tracksterIteration << std::endl;
143 
144  tracksterId++;
145  }
146 }
void fill(int index, double eta, double phi, unsigned int objectId)
Definition: TICLLayerTile.h:88
#define LogDebug(id)

◆ printTrackstersDebug()

void TrackstersMergeProducer::printTrackstersDebug ( const std::vector< Trackster > &  tracksters,
const char *  label 
) const
private

Definition at line 709 of file TrackstersMergeProducer.cc.

References debug_, mps_fire::end, alignBH_cfg::fixed, dqmMemoryStats::float, label, LogDebug, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, mathSSE::sqrt(), and submitPVValidationJobs::t.

Referenced by produce().

709  {
710  if (!debug_)
711  return;
712 
713  int counter = 0;
714  for (auto const &t : tracksters) {
715  LogDebug("TrackstersMergeProducer")
716  << counter++ << " TrackstersMergeProducer (" << label << ") obj barycenter: " << t.barycenter()
717  << " eta,phi (baricenter): " << t.barycenter().eta() << ", " << t.barycenter().phi()
718  << " eta,phi (eigen): " << t.eigenvectors(0).eta() << ", " << t.eigenvectors(0).phi()
719  << " pt(eigen): " << std::sqrt(t.eigenvectors(0).Unit().perp2()) * t.raw_energy() << " seedID: " << t.seedID()
720  << " seedIndex: " << t.seedIndex() << " size: " << t.vertices().size() << " average usage: "
721  << (std::accumulate(std::begin(t.vertex_multiplicity()), std::end(t.vertex_multiplicity()), 0.) /
722  (float)t.vertex_multiplicity().size())
723  << " raw_energy: " << t.raw_energy() << " regressed energy: " << t.regressed_energy()
724  << " probs(ga/e/mu/np/cp/nh/am/unk): ";
725  for (auto const &p : t.id_probabilities()) {
726  LogDebug("TrackstersMergeProducer") << std::fixed << p << " ";
727  }
728  LogDebug("TrackstersMergeProducer") << " sigmas: ";
729  for (auto const &s : t.sigmas()) {
730  LogDebug("TrackstersMergeProducer") << s << " ";
731  }
732  LogDebug("TrackstersMergeProducer") << std::endl;
733  }
734 }
char const * label
T sqrt(T t)
Definition: SSEVec.h:19
#define LogDebug(id)

◆ produce()

void TrackstersMergeProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 170 of file TrackstersMergeProducer.cc.

References funct::abs(), TICLCandidate::addTrackster(), ticl::assignPCAtoTracksters(), assignTimeToCandidates(), clusters_token_, clustersTime_token_, debug_, HCALHighEnergyHPDFilter_cfi::energy, energyRegressionAndID(), fillTile(), relativeConstraints::geom, geometry_token_, edm::Event::getByToken(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), hgcal::RecHitTools::getPositionLayer(), halo_max_distance2_, reco::TrackBase::highPurity, mps_fire::i, hgcal::RecHitTools::lastLayerEE(), hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, mag2(), eostools::move(), printTrackstersDebug(), edm::Event::put(), rhtools_, alignCSCRings::s, ticlTrackstersMerge_cfi::seedingTrk, seedingTrk_token_, reco::LeafCandidate::setCharge(), hgcal::RecHitTools::setGeometry(), reco::LeafCandidate::setP4(), reco::LeafCandidate::setPdgId(), TICLCandidate::setRawEnergy(), TICLCandidate::setTrackPtr(), mathSSE::sqrt(), submitPVValidationJobs::t, tfDnnToken_, tfSession_, HLT_2022v14_cff::track, track_max_eta_, track_max_missing_outerhits_, track_min_eta_, track_min_pt_, tracks, tracks_token_, trackstersem_token_, trackstershad_token_, tracksterstrk_token_, tracksterstrkem_token_, and z.

170  {
173  auto resultTrackstersMerged = std::make_unique<std::vector<Trackster>>();
174  auto resultCandidates = std::make_unique<std::vector<TICLCandidate>>();
175 
176  tfSession_ = es.getData(tfDnnToken_).getSession();
177 
178  TICLTracksterTiles tracksterTile;
179  std::vector<bool> usedTrackstersMerged;
180  std::vector<int> indexInMergedCollTRKEM;
181  std::vector<int> indexInMergedCollEM;
182  std::vector<int> indexInMergedCollTRK;
183  std::vector<int> indexInMergedCollHAD;
184  std::vector<bool> usedSeeds;
185 
186  // associating seed to the index of the trackster in the merged collection and the iteration that found it
187  std::map<int, std::vector<std::pair<int, TracksterIterIndex>>> seedToTracksterAssociator;
189  evt.getByToken(tracks_token_, track_h);
190  const auto &tracks = *track_h;
191 
193  evt.getByToken(clusters_token_, cluster_h);
194  const auto &layerClusters = *cluster_h;
195 
197  evt.getByToken(clustersTime_token_, clustersTime_h);
198  const auto &layerClustersTimes = *clustersTime_h;
199 
200  edm::Handle<std::vector<Trackster>> trackstersem_h;
201  evt.getByToken(trackstersem_token_, trackstersem_h);
202  const auto &trackstersEM = *trackstersem_h;
203 
204  edm::Handle<std::vector<Trackster>> tracksterstrkem_h;
205  evt.getByToken(tracksterstrkem_token_, tracksterstrkem_h);
206  const auto &trackstersTRKEM = *tracksterstrkem_h;
207 
208  edm::Handle<std::vector<Trackster>> tracksterstrk_h;
209  evt.getByToken(tracksterstrk_token_, tracksterstrk_h);
210  const auto &trackstersTRK = *tracksterstrk_h;
211 
212  edm::Handle<std::vector<Trackster>> trackstershad_h;
213  evt.getByToken(trackstershad_token_, trackstershad_h);
214  const auto &trackstersHAD = *trackstershad_h;
215 
217  evt.getByToken(seedingTrk_token_, seedingTrk_h);
218  const auto &seedingTrk = *seedingTrk_h;
219  usedSeeds.resize(tracks.size(), false);
220 
221  fillTile(tracksterTile, trackstersTRKEM, TracksterIterIndex::TRKEM);
222  fillTile(tracksterTile, trackstersEM, TracksterIterIndex::EM);
223  fillTile(tracksterTile, trackstersTRK, TracksterIterIndex::TRKHAD);
224  fillTile(tracksterTile, trackstersHAD, TracksterIterIndex::HAD);
225 
226  auto totalNumberOfTracksters =
227  trackstersTRKEM.size() + trackstersTRK.size() + trackstersEM.size() + trackstersHAD.size();
228  resultTrackstersMerged->reserve(totalNumberOfTracksters);
229  usedTrackstersMerged.resize(totalNumberOfTracksters, false);
230  indexInMergedCollTRKEM.reserve(trackstersTRKEM.size());
231  indexInMergedCollEM.reserve(trackstersEM.size());
232  indexInMergedCollTRK.reserve(trackstersTRK.size());
233  indexInMergedCollHAD.reserve(trackstersHAD.size());
234 
235  if (debug_) {
236  printTrackstersDebug(trackstersTRKEM, "tracksterTRKEM");
237  printTrackstersDebug(trackstersEM, "tracksterEM");
238  printTrackstersDebug(trackstersTRK, "tracksterTRK");
239  printTrackstersDebug(trackstersHAD, "tracksterHAD");
240  }
241 
242  for (auto const &t : trackstersTRKEM) {
243  indexInMergedCollTRKEM.push_back(resultTrackstersMerged->size());
244  seedToTracksterAssociator[t.seedIndex()].emplace_back(resultTrackstersMerged->size(), TracksterIterIndex::TRKEM);
245  resultTrackstersMerged->push_back(t);
246  }
247 
248  for (auto const &t : trackstersEM) {
249  indexInMergedCollEM.push_back(resultTrackstersMerged->size());
250  resultTrackstersMerged->push_back(t);
251  }
252 
253  for (auto const &t : trackstersTRK) {
254  indexInMergedCollTRK.push_back(resultTrackstersMerged->size());
255  seedToTracksterAssociator[t.seedIndex()].emplace_back(resultTrackstersMerged->size(), TracksterIterIndex::TRKHAD);
256  resultTrackstersMerged->push_back(t);
257  }
258 
259  for (auto const &t : trackstersHAD) {
260  indexInMergedCollHAD.push_back(resultTrackstersMerged->size());
261  resultTrackstersMerged->push_back(t);
262  }
263 
264  assignPCAtoTracksters(*resultTrackstersMerged,
266  layerClustersTimes,
268  energyRegressionAndID(layerClusters, tfSession_, *resultTrackstersMerged);
269 
270  printTrackstersDebug(*resultTrackstersMerged, "TrackstersMergeProducer");
271 
272  auto trackstersMergedHandle = evt.put(std::move(resultTrackstersMerged));
273 
274  // TICL Candidate creation
275  // We start from neutrals first
276 
277  // Photons
278  for (unsigned i = 0; i < trackstersEM.size(); ++i) {
279  auto mergedIdx = indexInMergedCollEM[i];
280  usedTrackstersMerged[mergedIdx] = true;
281  const auto &t = trackstersEM[i]; //trackster
282  TICLCandidate tmpCandidate;
283  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
284  tmpCandidate.setCharge(0);
285  tmpCandidate.setPdgId(22);
286  tmpCandidate.setRawEnergy(t.raw_energy());
287  math::XYZTLorentzVector p4(t.raw_energy() * t.barycenter().unit().x(),
288  t.raw_energy() * t.barycenter().unit().y(),
289  t.raw_energy() * t.barycenter().unit().z(),
290  t.raw_energy());
291  tmpCandidate.setP4(p4);
292  resultCandidates->push_back(tmpCandidate);
293  }
294 
295  // Neutral Hadrons
296  constexpr double mpion = 0.13957;
297  constexpr float mpion2 = mpion * mpion;
298  for (unsigned i = 0; i < trackstersHAD.size(); ++i) {
299  auto mergedIdx = indexInMergedCollHAD[i];
300  usedTrackstersMerged[mergedIdx] = true;
301  const auto &t = trackstersHAD[i]; //trackster
302  TICLCandidate tmpCandidate;
303  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
304  tmpCandidate.setCharge(0);
305  tmpCandidate.setPdgId(130);
306  tmpCandidate.setRawEnergy(t.raw_energy());
307  float momentum = std::sqrt(t.raw_energy() * t.raw_energy() - mpion2);
308  math::XYZTLorentzVector p4(momentum * t.barycenter().unit().x(),
309  momentum * t.barycenter().unit().y(),
310  momentum * t.barycenter().unit().z(),
311  t.raw_energy());
312  tmpCandidate.setP4(p4);
313  resultCandidates->push_back(tmpCandidate);
314  }
315 
316  // Charged Particles
317  for (unsigned i = 0; i < trackstersTRKEM.size(); ++i) {
318  auto mergedIdx = indexInMergedCollTRKEM[i];
319  if (!usedTrackstersMerged[mergedIdx]) {
320  const auto &t = trackstersTRKEM[i]; //trackster
321  auto trackIdx = t.seedIndex();
322  auto const &track = tracks[trackIdx];
323  if (!usedSeeds[trackIdx] and t.raw_energy() > 0) {
324  usedSeeds[trackIdx] = true;
325  usedTrackstersMerged[mergedIdx] = true;
326 
327  std::vector<int> trackstersTRKwithSameSeed;
328  std::vector<int> trackstersTRKEMwithSameSeed;
329 
330  for (const auto &tracksterIterationPair : seedToTracksterAssociator[trackIdx]) {
331  if (tracksterIterationPair.first != mergedIdx and !usedTrackstersMerged[tracksterIterationPair.first] and
332  trackstersMergedHandle->at(tracksterIterationPair.first).raw_energy() > 0.) {
333  if (tracksterIterationPair.second == TracksterIterIndex::TRKEM) {
334  trackstersTRKEMwithSameSeed.push_back(tracksterIterationPair.first);
335  } else if (tracksterIterationPair.second == TracksterIterIndex::TRKHAD) {
336  trackstersTRKwithSameSeed.push_back(tracksterIterationPair.first);
337  }
338  }
339  }
340 
341  float tracksterTotalRawPt = t.raw_pt();
342  std::vector<int> haloTrackstersTRKIdx;
343  bool foundCompatibleTRK = false;
344 
345  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
346  usedTrackstersMerged[otherTracksterIdx] = true;
347  tracksterTotalRawPt += trackstersMergedHandle->at(otherTracksterIdx).raw_pt();
348 
349  // Check the X,Y,Z barycenter and merge if they are very close (halo)
350  if ((t.barycenter() - trackstersMergedHandle->at(otherTracksterIdx).barycenter()).mag2() <
352  haloTrackstersTRKIdx.push_back(otherTracksterIdx);
353 
354  } else {
355  foundCompatibleTRK = true;
356  }
357  }
358 
359  //check if there is 1-to-1 relationship
360  if (trackstersTRKEMwithSameSeed.empty()) {
361  if (foundCompatibleTRK) {
362  TICLCandidate tmpCandidate;
363  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
364  double raw_energy = t.raw_energy();
365 
366  tmpCandidate.setCharge(track.charge());
367  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
368  tmpCandidate.setPdgId(211 * track.charge());
369  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
370  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
371  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
372  }
373  tmpCandidate.setRawEnergy(raw_energy);
374  math::XYZTLorentzVector p4(raw_energy * track.momentum().unit().x(),
375  raw_energy * track.momentum().unit().y(),
376  raw_energy * track.momentum().unit().z(),
377  raw_energy);
378  tmpCandidate.setP4(p4);
379  resultCandidates->push_back(tmpCandidate);
380 
381  } else {
382  TICLCandidate tmpCandidate;
383  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
384  double raw_energy = t.raw_energy();
385  tmpCandidate.setCharge(track.charge());
386  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
387  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
388  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
389  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
390  }
391  tmpCandidate.setPdgId(11 * track.charge());
392 
393  tmpCandidate.setRawEnergy(raw_energy);
394  math::XYZTLorentzVector p4(raw_energy * track.momentum().unit().x(),
395  raw_energy * track.momentum().unit().y(),
396  raw_energy * track.momentum().unit().z(),
397  raw_energy);
398  tmpCandidate.setP4(p4);
399  resultCandidates->push_back(tmpCandidate);
400  }
401 
402  } else {
403  // if 1-to-many find closest trackster in momentum
404  int closestTrackster = mergedIdx;
405  float minPtDiff = std::abs(t.raw_pt() - track.pt());
406  for (auto otherTracksterIdx : trackstersTRKEMwithSameSeed) {
407  auto thisPt = tracksterTotalRawPt + trackstersMergedHandle->at(otherTracksterIdx).raw_pt() - t.raw_pt();
408  closestTrackster = std::abs(thisPt - track.pt()) < minPtDiff ? otherTracksterIdx : closestTrackster;
409  }
410  usedTrackstersMerged[closestTrackster] = true;
411 
412  if (foundCompatibleTRK) {
413  TICLCandidate tmpCandidate;
414  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, closestTrackster));
415  double raw_energy = trackstersMergedHandle->at(closestTrackster).raw_energy();
416 
417  tmpCandidate.setCharge(track.charge());
418  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
419  tmpCandidate.setPdgId(211 * track.charge());
420  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
421  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
422  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
423  }
424  tmpCandidate.setRawEnergy(raw_energy);
425  float momentum = std::sqrt(raw_energy * raw_energy - mpion2);
426  math::XYZTLorentzVector p4(momentum * track.momentum().unit().x(),
427  momentum * track.momentum().unit().y(),
428  momentum * track.momentum().unit().z(),
429  raw_energy);
430  tmpCandidate.setP4(p4);
431  resultCandidates->push_back(tmpCandidate);
432 
433  } else {
434  TICLCandidate tmpCandidate;
435  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, closestTrackster));
436  double raw_energy = trackstersMergedHandle->at(closestTrackster).raw_energy();
437 
438  tmpCandidate.setCharge(track.charge());
439  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
440  for (auto otherTracksterIdx : trackstersTRKwithSameSeed) {
441  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, otherTracksterIdx));
442  raw_energy += trackstersMergedHandle->at(otherTracksterIdx).raw_energy();
443  }
444  tmpCandidate.setPdgId(11 * track.charge());
445  tmpCandidate.setRawEnergy(raw_energy);
446  math::XYZTLorentzVector p4(raw_energy * track.momentum().unit().x(),
447  raw_energy * track.momentum().unit().y(),
448  raw_energy * track.momentum().unit().z(),
449  raw_energy);
450  tmpCandidate.setP4(p4);
451  resultCandidates->push_back(tmpCandidate);
452  }
453  // Promote all other TRKEM tracksters as photons with their energy.
454  for (auto otherTracksterIdx : trackstersTRKEMwithSameSeed) {
455  auto tmpIndex = (otherTracksterIdx != closestTrackster) ? otherTracksterIdx : mergedIdx;
456  TICLCandidate photonCandidate;
457  const auto &otherTrackster = trackstersMergedHandle->at(tmpIndex);
458  auto gammaEnergy = otherTrackster.raw_energy();
459  photonCandidate.setCharge(0);
460  photonCandidate.setPdgId(22);
461  photonCandidate.setRawEnergy(gammaEnergy);
462  math::XYZTLorentzVector gammaP4(gammaEnergy * otherTrackster.barycenter().unit().x(),
463  gammaEnergy * otherTrackster.barycenter().unit().y(),
464  gammaEnergy * otherTrackster.barycenter().unit().z(),
465  gammaEnergy);
466  photonCandidate.setP4(gammaP4);
467  photonCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, tmpIndex));
468  resultCandidates->push_back(photonCandidate);
469  }
470  }
471  }
472  }
473  } //end of loop over trackstersTRKEM
474 
475  for (unsigned i = 0; i < trackstersTRK.size(); ++i) {
476  auto mergedIdx = indexInMergedCollTRK[i];
477  const auto &t = trackstersTRK[i]; //trackster
478 
479  if (!usedTrackstersMerged[mergedIdx] and t.raw_energy() > 0) {
480  auto trackIdx = t.seedIndex();
481  auto const &track = tracks[trackIdx];
482  if (!usedSeeds[trackIdx]) {
483  usedSeeds[trackIdx] = true;
484  usedTrackstersMerged[mergedIdx] = true;
485  TICLCandidate tmpCandidate;
486  tmpCandidate.addTrackster(edm::Ptr<ticl::Trackster>(trackstersMergedHandle, mergedIdx));
487  tmpCandidate.setCharge(track.charge());
488  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, trackIdx));
489  tmpCandidate.setPdgId(211 * track.charge());
490  tmpCandidate.setRawEnergy(t.raw_energy());
491  float momentum = std::sqrt(t.raw_energy() * t.raw_energy() - mpion2);
492  math::XYZTLorentzVector p4(momentum * track.momentum().unit().x(),
493  momentum * track.momentum().unit().y(),
494  momentum * track.momentum().unit().z(),
495  t.raw_energy());
496  tmpCandidate.setP4(p4);
497  resultCandidates->push_back(tmpCandidate);
498  }
499  }
500  }
501  // For all seeds that have 0-energy tracksters whose track is not marked as used, create a charged hadron with the track information.
502  for (auto const &s : seedingTrk) {
503  if (usedSeeds[s.index] == false) {
504  auto const &track = tracks[s.index];
505  // emit a charged hadron
506  TICLCandidate tmpCandidate;
507  tmpCandidate.setCharge(track.charge());
508  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, s.index));
509  tmpCandidate.setPdgId(211 * track.charge());
510  float energy = std::sqrt(track.p() * track.p() + mpion2);
511  tmpCandidate.setRawEnergy(energy);
512  math::PtEtaPhiMLorentzVector p4Polar(track.pt(), track.eta(), track.phi(), mpion);
513  tmpCandidate.setP4(p4Polar);
514  resultCandidates->push_back(tmpCandidate);
515  usedSeeds[s.index] = true;
516  }
517  }
518 
519  // for all general tracks (high purity, pt > 1), check if they have been used: if not, promote them as charged hadrons
520  for (unsigned i = 0; i < tracks.size(); ++i) {
521  auto const &track = tracks[i];
522  if (track.pt() > track_min_pt_ and track.quality(reco::TrackBase::highPurity) and
523  track.missingOuterHits() < track_max_missing_outerhits_ and std::abs(track.outerEta()) > track_min_eta_ and
524  std::abs(track.outerEta()) < track_max_eta_ and usedSeeds[i] == false) {
525  // emit a charged hadron
526  TICLCandidate tmpCandidate;
527  tmpCandidate.setCharge(track.charge());
528  tmpCandidate.setTrackPtr(edm::Ptr<reco::Track>(track_h, i));
529  tmpCandidate.setPdgId(211 * track.charge());
530  float energy = std::sqrt(track.p() * track.p() + mpion2);
531  tmpCandidate.setRawEnergy(energy);
532  math::PtEtaPhiMLorentzVector p4Polar(track.pt(), track.eta(), track.phi(), mpion);
533  tmpCandidate.setP4(p4Polar);
534  resultCandidates->push_back(tmpCandidate);
535  usedSeeds[i] = true;
536  }
537  }
538 
539  // Compute timing
540  assignTimeToCandidates(*resultCandidates);
541 
542  evt.put(std::move(resultCandidates));
543 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< std::vector< Trackster > > trackstersem_token_
void fillTile(TICLTracksterTiles &, const std::vector< Trackster > &, TracksterIterIndex)
void assignTimeToCandidates(std::vector< TICLCandidate > &resultCandidates) const
const edm::EDGetTokenT< std::vector< TICLSeedingRegion > > seedingTrk_token_
const tensorflow::Session * tfSession_
void printTrackstersDebug(const std::vector< Trackster > &, const char *label) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrkem_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometry_token_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
void setCharge(Charge q) final
set electric charge
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
const edm::EDGetTokenT< std::vector< Trackster > > tracksterstrk_token_
void setRawEnergy(float rawEnergy)
Definition: TICLCandidate.h:40
T sqrt(T t)
Definition: SSEVec.h:19
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< std::vector< Trackster > > trackstershad_token_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
const edm::EDGetTokenT< std::vector< reco::Track > > tracks_token_
auto const & tracks
cannot be loose
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:141
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
void addTrackster(const edm::Ptr< ticl::Trackster > &trackster)
Definition: TICLCandidate.h:45
void setPdgId(int pdgId) final
void setTrackPtr(const edm::Ptr< reco::Track > &trackPtr)
Definition: TICLCandidate.h:37
void setP4(const LorentzVector &p4) final
set 4-momentum
def move(src, dest)
Definition: eostools.py:511
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:75
const edm::ESGetToken< TfGraphDefWrapper, TfGraphRecord > tfDnnToken_

Member Data Documentation

◆ clusters_token_

const edm::EDGetTokenT<std::vector<reco::CaloCluster> > TrackstersMergeProducer::clusters_token_
private

Definition at line 51 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ clustersTime_token_

const edm::EDGetTokenT<edm::ValueMap<std::pair<float, float> > > TrackstersMergeProducer::clustersTime_token_
private

Definition at line 52 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ cosangle_align_

const double TrackstersMergeProducer::cosangle_align_
private

Definition at line 69 of file TrackstersMergeProducer.cc.

◆ debug_

const bool TrackstersMergeProducer::debug_
private

Definition at line 76 of file TrackstersMergeProducer.cc.

Referenced by printTrackstersDebug(), and produce().

◆ e_over_h_threshold_

const double TrackstersMergeProducer::e_over_h_threshold_
private

Definition at line 70 of file TrackstersMergeProducer.cc.

◆ eidInputName_

const std::string TrackstersMergeProducer::eidInputName_
private

Definition at line 77 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidMinClusterEnergy_

const float TrackstersMergeProducer::eidMinClusterEnergy_
private

Definition at line 80 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidNClusters_

const int TrackstersMergeProducer::eidNClusters_
private

Definition at line 82 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidNFeatures_

constexpr int TrackstersMergeProducer::eidNFeatures_ = 3
staticprivate

Definition at line 87 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidNLayers_

const int TrackstersMergeProducer::eidNLayers_
private

Definition at line 81 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidOutputNameEnergy_

const std::string TrackstersMergeProducer::eidOutputNameEnergy_
private

Definition at line 78 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidOutputNameId_

const std::string TrackstersMergeProducer::eidOutputNameId_
private

Definition at line 79 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID().

◆ eidSession_

tensorflow::Session* TrackstersMergeProducer::eidSession_
private

Definition at line 84 of file TrackstersMergeProducer.cc.

◆ eta_bin_window_

const int TrackstersMergeProducer::eta_bin_window_
private

Definition at line 60 of file TrackstersMergeProducer.cc.

◆ geometry_token_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> TrackstersMergeProducer::geometry_token_
private

Definition at line 54 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ halo_max_distance2_

const double TrackstersMergeProducer::halo_max_distance2_
private

Definition at line 64 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ optimiseAcrossTracksters_

const bool TrackstersMergeProducer::optimiseAcrossTracksters_
private

Definition at line 59 of file TrackstersMergeProducer.cc.

◆ phi_bin_window_

const int TrackstersMergeProducer::phi_bin_window_
private

Definition at line 61 of file TrackstersMergeProducer.cc.

◆ pt_neutral_threshold_

const double TrackstersMergeProducer::pt_neutral_threshold_
private

Definition at line 71 of file TrackstersMergeProducer.cc.

◆ pt_sigma_high_

const double TrackstersMergeProducer::pt_sigma_high_
private

Definition at line 62 of file TrackstersMergeProducer.cc.

◆ pt_sigma_low_

const double TrackstersMergeProducer::pt_sigma_low_
private

Definition at line 63 of file TrackstersMergeProducer.cc.

◆ resol_calo_offset_em_

const double TrackstersMergeProducer::resol_calo_offset_em_
private

Definition at line 74 of file TrackstersMergeProducer.cc.

◆ resol_calo_offset_had_

const double TrackstersMergeProducer::resol_calo_offset_had_
private

Definition at line 72 of file TrackstersMergeProducer.cc.

◆ resol_calo_scale_em_

const double TrackstersMergeProducer::resol_calo_scale_em_
private

Definition at line 75 of file TrackstersMergeProducer.cc.

◆ resol_calo_scale_had_

const double TrackstersMergeProducer::resol_calo_scale_had_
private

Definition at line 73 of file TrackstersMergeProducer.cc.

◆ rhtools_

hgcal::RecHitTools TrackstersMergeProducer::rhtools_
private

Definition at line 85 of file TrackstersMergeProducer.cc.

Referenced by energyRegressionAndID(), and produce().

◆ seedingTrk_token_

const edm::EDGetTokenT<std::vector<TICLSeedingRegion> > TrackstersMergeProducer::seedingTrk_token_
private

Definition at line 50 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ tfDnnLabel_

const std::string TrackstersMergeProducer::tfDnnLabel_
private

Definition at line 55 of file TrackstersMergeProducer.cc.

◆ tfDnnToken_

const edm::ESGetToken<TfGraphDefWrapper, TfGraphRecord> TrackstersMergeProducer::tfDnnToken_
private

Definition at line 56 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ tfSession_

const tensorflow::Session* TrackstersMergeProducer::tfSession_
private

Definition at line 57 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ track_max_eta_

const double TrackstersMergeProducer::track_max_eta_
private

Definition at line 67 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ track_max_missing_outerhits_

const int TrackstersMergeProducer::track_max_missing_outerhits_
private

Definition at line 68 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ track_min_eta_

const double TrackstersMergeProducer::track_min_eta_
private

Definition at line 66 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ track_min_pt_

const double TrackstersMergeProducer::track_min_pt_
private

Definition at line 65 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ tracks_token_

const edm::EDGetTokenT<std::vector<reco::Track> > TrackstersMergeProducer::tracks_token_
private

Definition at line 53 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ trackstersem_token_

const edm::EDGetTokenT<std::vector<Trackster> > TrackstersMergeProducer::trackstersem_token_
private

Definition at line 47 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ trackstershad_token_

const edm::EDGetTokenT<std::vector<Trackster> > TrackstersMergeProducer::trackstershad_token_
private

Definition at line 49 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ tracksterstrk_token_

const edm::EDGetTokenT<std::vector<Trackster> > TrackstersMergeProducer::tracksterstrk_token_
private

Definition at line 48 of file TrackstersMergeProducer.cc.

Referenced by produce().

◆ tracksterstrkem_token_

const edm::EDGetTokenT<std::vector<Trackster> > TrackstersMergeProducer::tracksterstrkem_token_
private

Definition at line 46 of file TrackstersMergeProducer.cc.

Referenced by produce().