CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
L1TrackVertexAssociationProducer Class Reference

#include <L1Trigger/L1TTrackMatch/plugins/L1TrackVertexAssociationProducer.cc>

Inheritance diagram for L1TrackVertexAssociationProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  NNTrackWordSelector
 
struct  TTTrackDeltaZMaxSelector
 
struct  TTTrackWordDeltaZMaxSelector
 
struct  TTTrackWordLinkLimitSelector
 

Public Member Functions

 L1TrackVertexAssociationProducer (const edm::ParameterSet &)
 
 ~L1TrackVertexAssociationProducer () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

enum  TrackBitWidths { kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1, kPtMagSize = 9, kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize, kEtaMagSize = 3 }
 
typedef edm::Handle< TTTrackCollectionTypeTTTrackCollectionHandle
 
typedef std::vector< TTTrackTypeTTTrackCollectionType
 
typedef edm::RefVector< TTTrackCollectionTypeTTTrackRefCollectionType
 
typedef std::unique_ptr< TTTrackRefCollectionTypeTTTrackRefCollectionUPtr
 
typedef TTTrack< Ref_Phase2TrackerDigi_TTTrackType
 

Private Member Functions

void printDebugInfo (const edm::Handle< TTTrackRefCollectionType > &l1SelectedTracksHandle, const edm::Handle< TTTrackRefCollectionType > &l1SelectedTracksEmulationHandle, const TTTrackRefCollectionUPtr &vTTTrackAssociatedOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedEmulationOutput) const
 
void printTrackInfo (edm::LogInfo &log, const TTTrackType &track, bool printEmulation=false) const
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

tensorflow::GraphDef * associationGraph_
 
edm::FileInPath associationGraphPath_
 
std::vector< double > associationNetworkEtaBounds_
 
std::vector< double > associationNetworkZ0binning_
 
std::vector< double > associationNetworkZ0ResBins_
 
tensorflow::Session * associationSesh_
 
const double associationThreshold_
 
const edm::ParameterSet cutSet_
 
int debug_
 
std::vector< double > deltaZMax_
 
std::vector< double > deltaZMaxEtaBounds_
 
const unsigned int fwNTrackSetsTVA_
 
const edm::EDGetTokenT< TTTrackRefCollectionTypel1SelectedTracksEmulationToken_
 
const edm::EDGetTokenT< TTTrackRefCollectionTypel1SelectedTracksToken_
 
const edm::EDGetTokenT< TTTrackCollectionTypel1TracksToken_
 
const edm::EDGetTokenT< l1t::VertexWordCollectionl1VerticesEmulationToken_
 
const edm::EDGetTokenT< l1t::VertexCollectionl1VerticesToken_
 
const std::string outputCollectionName_
 
const bool processEmulatedTracks_
 
const bool processSimulatedTracks_
 
bool useAssociationNetwork_
 
const double useDisplacedTracksDeltaZOverride_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: Selects a set of L1Tracks based on a set of predefined criteria.

Implementation: Inputs: std::vector<TTTrack> - Each floating point TTTrack inside this collection inherits from a bit-accurate TTTrack_TrackWord, used for emulation purposes. Outputs: std::vector<TTTrackRef> - A collection of TTTrack Refs selected from cuts on the TTTrack properties std::vector<TTTrackRef> - A collection of TTTrack Refs selected from cuts on the TTTrack_TrackWord properties

Definition at line 73 of file L1TrackVertexAssociationProducer.cc.

Member Typedef Documentation

◆ TTTrackCollectionHandle

Definition at line 92 of file L1TrackVertexAssociationProducer.cc.

◆ TTTrackCollectionType

Definition at line 91 of file L1TrackVertexAssociationProducer.cc.

◆ TTTrackRefCollectionType

Definition at line 93 of file L1TrackVertexAssociationProducer.cc.

◆ TTTrackRefCollectionUPtr

Definition at line 94 of file L1TrackVertexAssociationProducer.cc.

◆ TTTrackType

Definition at line 90 of file L1TrackVertexAssociationProducer.cc.

Member Enumeration Documentation

◆ TrackBitWidths

Enumerator
kPtSize 
kPtMagSize 
kEtaSize 
kEtaMagSize 

Definition at line 83 of file L1TrackVertexAssociationProducer.cc.

83  {
84  kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1, // Width of pt
85  kPtMagSize = 9, // Width of pt magnitude (unsigned)
86  kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize, // Width of eta
87  kEtaMagSize = 3, // Width of eta magnitude (signed)
88  };

Constructor & Destructor Documentation

◆ L1TrackVertexAssociationProducer()

L1TrackVertexAssociationProducer::L1TrackVertexAssociationProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 299 of file L1TrackVertexAssociationProducer.cc.

References associationGraph_, associationGraphPath_, associationSesh_, tensorflow::createSession(), deltaZMax_, deltaZMaxEtaBounds_, Exception, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), tensorflow::loadGraphDef(), outputCollectionName_, processEmulatedTracks_, processSimulatedTracks_, useAssociationNetwork_, and useDisplacedTracksDeltaZOverride_.

300  : processSimulatedTracks_(iConfig.getParameter<bool>("processSimulatedTracks")),
301  processEmulatedTracks_(iConfig.getParameter<bool>("processEmulatedTracks")),
302  l1TracksToken_(consumes<TTTrackCollectionType>(iConfig.getParameter<edm::InputTag>("l1TracksInputTag"))),
304  ? consumes<l1t::VertexCollection>(iConfig.getParameter<edm::InputTag>("l1VerticesInputTag"))
308  ? consumes<TTTrackRefCollectionType>(iConfig.getParameter<edm::InputTag>("l1SelectedTracksInputTag"))
312  ? consumes<l1t::VertexWordCollection>(iConfig.getParameter<edm::InputTag>("l1VerticesEmulationInputTag"))
315  ? consumes<TTTrackRefCollectionType>(iConfig.getParameter<edm::InputTag>(
316  "l1SelectedTracksEmulationInputTag"))
318  outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")),
319  cutSet_(iConfig.getParameter<edm::ParameterSet>("cutSet")),
320 
321  deltaZMaxEtaBounds_(cutSet_.getParameter<std::vector<double>>("deltaZMaxEtaBounds")),
322  deltaZMax_(cutSet_.getParameter<std::vector<double>>("deltaZMax")),
323  useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>("useDisplacedTracksDeltaZOverride")),
324  fwNTrackSetsTVA_(iConfig.getParameter<unsigned int>("fwNTrackSetsTVA")),
325  associationThreshold_(iConfig.getParameter<double>("associationThreshold")),
326  useAssociationNetwork_(iConfig.getParameter<bool>("useAssociationNetwork")),
327  associationNetworkZ0binning_(iConfig.getParameter<std::vector<double>>("associationNetworkZ0binning")),
328  associationNetworkEtaBounds_(iConfig.getParameter<std::vector<double>>("associationNetworkEtaBounds")),
329  associationNetworkZ0ResBins_(iConfig.getParameter<std::vector<double>>("associationNetworkZ0ResBins")),
330  debug_(iConfig.getParameter<int>("debug")) {
332  associationGraphPath_ = iConfig.getParameter<edm::FileInPath>("associationGraph");
335  }
336  // Confirm the the configuration makes sense
338  throw cms::Exception("You must process at least one of the track collections (simulated or emulated).");
339  }
340 
341  if (deltaZMax_.size() != deltaZMaxEtaBounds_.size() - 1) {
342  throw cms::Exception("The number of deltaZ cuts does not match the number of eta bins!");
343  }
344 
346  deltaZMax_ = std::vector<double>(deltaZMax_.size(), useDisplacedTracksDeltaZOverride_);
347  }
348 
349  // Get additional input tags and define the EDM output based on the previous configuration parameters
351  produces<TTTrackRefCollectionType>(outputCollectionName_);
353  produces<TTTrackRefCollectionType>(outputCollectionName_ + "Emulation");
354 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< TTTrackCollectionType > l1TracksToken_
GraphDef * loadGraphDef(const std::string &pbFile)
Definition: TensorFlow.cc:119
const edm::EDGetTokenT< l1t::VertexCollection > l1VerticesToken_
const edm::EDGetTokenT< TTTrackRefCollectionType > l1SelectedTracksToken_
Session * createSession()
Definition: TensorFlow.cc:136
const edm::EDGetTokenT< l1t::VertexWordCollection > l1VerticesEmulationToken_
const std::string & fullPath() const
Definition: FileInPath.cc:144
const edm::EDGetTokenT< TTTrackRefCollectionType > l1SelectedTracksEmulationToken_

◆ ~L1TrackVertexAssociationProducer()

L1TrackVertexAssociationProducer::~L1TrackVertexAssociationProducer ( )
override

Definition at line 356 of file L1TrackVertexAssociationProducer.cc.

356 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 585 of file L1TrackVertexAssociationProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

585  {
587  desc.add<edm::InputTag>("l1TracksInputTag", edm::InputTag("l1tGTTInputProducer", "Level1TTTracksConverted"));
588  desc.add<edm::InputTag>("l1SelectedTracksInputTag",
589  edm::InputTag("l1tTrackSelectionProducer", "Level1TTTracksSelected"));
590  desc.add<edm::InputTag>("l1SelectedTracksEmulationInputTag",
591  edm::InputTag("l1tTrackSelectionProducer", "Level1TTTracksSelectedEmulation"));
592  desc.add<edm::InputTag>("l1VerticesInputTag", edm::InputTag("l1tVertexFinder", "L1Vertices"));
593  desc.add<edm::InputTag>("l1VerticesEmulationInputTag",
594  edm::InputTag("l1tVertexFinderEmulator", "L1VerticesEmulation"));
595  desc.add<std::string>("outputCollectionName", "Level1TTTracksSelectedAssociated");
596  {
597  edm::ParameterSetDescription descCutSet;
598  descCutSet.add<std::vector<double>>("deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
599  ->setComment("these values define the bin boundaries in |eta|");
600  descCutSet.add<std::vector<double>>("deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
601  ->setComment(
602  "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, "
603  "[cm]");
604  desc.add<edm::ParameterSetDescription>("cutSet", descCutSet);
605  }
606  desc.add<double>("useDisplacedTracksDeltaZOverride", -1.0)
607  ->setComment("override the deltaZ cut value for displaced tracks");
608  desc.add<bool>("processSimulatedTracks", true)
609  ->setComment("return selected tracks after cutting on the floating point values");
610  desc.add<bool>("processEmulatedTracks", true)
611  ->setComment("return selected tracks after cutting on the bitwise emulated values");
612  desc.add<unsigned int>("fwNTrackSetsTVA", 94)->setComment("firmware limit on processed tracks per GTT input link");
613  desc.add<bool>("useAssociationNetwork", false)->setComment("Enable Association Network");
614  desc.add<double>("associationThreshold", 0)->setComment("Association Network threshold for PV tracks");
615  desc.addOptional<edm::FileInPath>("associationGraph")->setComment("Location of Association Network model file");
616  desc.add<std::vector<double>>("associationNetworkZ0binning", {})
617  ->setComment("z0 binning used for setting the input feature digitisation");
618  desc.add<std::vector<double>>("associationNetworkEtaBounds", {})
619  ->setComment("Eta bounds used to set z0 resolution input feature");
620  desc.add<std::vector<double>>("associationNetworkZ0ResBins", {})->setComment("z0 resolution input feature bins");
621 
622  desc.add<int>("debug", 0)->setComment("Verbosity levels: 0, 1, 2, 3");
623  descriptions.addWithDefaultLabel(desc);
624 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ printDebugInfo()

void L1TrackVertexAssociationProducer::printDebugInfo ( const edm::Handle< TTTrackRefCollectionType > &  l1SelectedTracksHandle,
const edm::Handle< TTTrackRefCollectionType > &  l1SelectedTracksEmulationHandle,
const TTTrackRefCollectionUPtr vTTTrackAssociatedOutput,
const TTTrackRefCollectionUPtr vTTTrackAssociatedEmulationOutput 
) const
private

Definition at line 362 of file L1TrackVertexAssociationProducer.cc.

References edm::RefVector< C, T, F >::begin(), debug_, edm::RefVector< C, T, F >::end(), CrabHelper::log, printTrackInfo(), processEmulatedTracks_, processSimulatedTracks_, DBoxMetadataHelper::set_difference(), and HLT_2024v14_cff::track.

Referenced by produce().

366  {
367  edm::LogInfo log("L1TrackVertexAssociationProducer");
369  log << "The original selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are "
370  "... \n";
371  for (const auto& track : *l1SelectedTracksHandle) {
372  printTrackInfo(log, *track, debug_ >= 4);
373  }
374  log << "\t---\n\tNumber of tracks in this selection = " << l1SelectedTracksHandle->size() << "\n\n";
375  }
377  log << "The original selected emulated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) "
378  "values are ... \n";
379  for (const auto& track : *l1SelectedTracksEmulationHandle) {
380  printTrackInfo(log, *track, debug_ >= 4);
381  }
382  log << "\t---\n\tNumber of tracks in this selection = " << l1SelectedTracksEmulationHandle->size() << "\n\n";
383  }
385  TTTrackRefCollectionType inSimButNotEmu;
386  TTTrackRefCollectionType inEmuButNotSim;
387  std::set_difference(l1SelectedTracksHandle->begin(),
388  l1SelectedTracksHandle->end(),
389  l1SelectedTracksEmulationHandle->begin(),
390  l1SelectedTracksEmulationHandle->end(),
391  std::back_inserter(inSimButNotEmu));
392  std::set_difference(l1SelectedTracksEmulationHandle->begin(),
393  l1SelectedTracksEmulationHandle->end(),
394  l1SelectedTracksHandle->begin(),
395  l1SelectedTracksHandle->end(),
396  std::back_inserter(inEmuButNotSim));
397  log << "The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected "
398  "by cutting on the emulated values ... \n";
399  for (const auto& track : inSimButNotEmu) {
400  printTrackInfo(log, *track, debug_ >= 3);
401  }
402  log << "\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() << "\n\n"
403  << "The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected "
404  "by cutting on the simulated values ... \n";
405  for (const auto& track : inEmuButNotSim) {
406  printTrackInfo(log, *track, debug_ >= 3);
407  }
408  log << "\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() << "\n\n";
409  }
411  log << "The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, "
412  "chi2rphi, z0) values are ... \n";
413  for (const auto& track : *vTTTrackAssociatedOutput) {
414  printTrackInfo(log, *track, debug_ >= 4);
415  }
416  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() << "\n\n";
417  }
419  log << "The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, "
420  "chi2rz, chi2rphi, z0) values are "
421  "... \n";
422  for (const auto& track : *vTTTrackAssociatedEmulationOutput) {
423  printTrackInfo(log, *track, debug_ >= 4);
424  }
425  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() << "\n\n";
426  }
428  TTTrackRefCollectionType inSimButNotEmu;
429  TTTrackRefCollectionType inEmuButNotSim;
430  std::set_difference(vTTTrackAssociatedOutput->begin(),
431  vTTTrackAssociatedOutput->end(),
432  vTTTrackAssociatedEmulationOutput->begin(),
433  vTTTrackAssociatedEmulationOutput->end(),
434  std::back_inserter(inSimButNotEmu));
435  std::set_difference(vTTTrackAssociatedEmulationOutput->begin(),
436  vTTTrackAssociatedEmulationOutput->end(),
437  vTTTrackAssociatedOutput->begin(),
438  vTTTrackAssociatedOutput->end(),
439  std::back_inserter(inEmuButNotSim));
440  log << "The set of vertex associated tracks selected via cuts on the simulated values which are not in the set of "
441  "tracks selected "
442  "by cutting on the emulated values ... \n";
443  for (const auto& track : inSimButNotEmu) {
444  printTrackInfo(log, *track, debug_ >= 3);
445  }
446  log << "\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() << "\n\n"
447  << "The set of vertex associated tracks selected via cuts on the emulated values which are not in the set of "
448  "tracks selected "
449  "by cutting on the simulated values ... \n";
450  for (const auto& track : inEmuButNotSim) {
451  printTrackInfo(log, *track, debug_ >= 3);
452  }
453  log << "\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() << "\n\n";
454  }
455 }
void printTrackInfo(edm::LogInfo &log, const TTTrackType &track, bool printEmulation=false) const
edm::RefVector< TTTrackCollectionType > TTTrackRefCollectionType
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)

◆ printTrackInfo()

void L1TrackVertexAssociationProducer::printTrackInfo ( edm::LogInfo log,
const TTTrackType track,
bool  printEmulation = false 
) const
private

Definition at line 457 of file L1TrackVertexAssociationProducer.cc.

References CrabHelper::log, TTTrack_TrackWord::stepPhi0, TTTrack_TrackWord::stepZ0, and HLT_2024v14_cff::track.

Referenced by printDebugInfo().

459  {
460  log << "\t(" << track.momentum().perp() << ", " << track.momentum().eta() << ", " << track.momentum().phi() << ", "
461  << track.getStubRefs().size() << ", " << track.stubPtConsistency() << ", " << track.chi2ZRed() << ", "
462  << track.chi2XYRed() << ", " << track.z0() << ")\n";
463 
464  if (printEmulation) {
465  ap_uint<TrackBitWidths::kPtSize> ptEmulationBits = track.getTrackWord()(
466  TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
467  ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
468  ptEmulation.V = ptEmulationBits.range();
469  TTTrack_TrackWord::tanl_t etaEmulationBits = track.getTanlWord();
470  ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
471  etaEmulation.V = etaEmulationBits.range();
472  double floatTkZ0 = track.undigitizeSignedValue(
473  track.getZ0Bits(), TTTrack_TrackWord::TrackBitWidths::kZ0Size, TTTrack_TrackWord::stepZ0, 0.0);
474  double floatTkPhi = track.undigitizeSignedValue(
475  track.getPhiBits(), TTTrack_TrackWord::TrackBitWidths::kPhiSize, TTTrack_TrackWord::stepPhi0, 0.0);
476  log << "\t\t(" << ptEmulation.to_double() << ", " << etaEmulation.to_double() << ", " << floatTkPhi << ", "
477  << track.getNStubs() << ", " << track.getBendChi2() << ", " << track.getChi2RZ() << ", " << track.getChi2RPhi()
478  << ", " << floatTkZ0 << ")\n";
479  }
480 }
static constexpr double stepPhi0
ap_uint< TrackBitWidths::kTanlSize > tanl_t
static constexpr double stepZ0

◆ produce()

void L1TrackVertexAssociationProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 483 of file L1TrackVertexAssociationProducer.cc.

References associationNetworkEtaBounds_, associationNetworkZ0binning_, associationNetworkZ0ResBins_, associationSesh_, associationThreshold_, edm::RefVector< C, T, F >::begin(), debug_, deltaZMax_, deltaZMaxEtaBounds_, edm::RefVector< C, T, F >::end(), fwNTrackSetsTVA_, mps_fire::i, iEvent, l1SelectedTracksEmulationToken_, l1SelectedTracksToken_, l1TracksToken_, l1VerticesEmulationToken_, l1VerticesToken_, L1TrackVertexAssociationProducer::TTTrackWordLinkLimitSelector::log(), eostools::move(), outputCollectionName_, printDebugInfo(), processEmulatedTracks_, processSimulatedTracks_, HLT_2024v14_cff::track, useAssociationNetwork_, l1t::Vertex::z0(), and l1t::VertexWord::z0().

483  {
484  auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollectionType>();
485  auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollectionType>();
486 
487  TTTrackCollectionHandle l1TracksHandle;
488  edm::Handle<TTTrackRefCollectionType> l1SelectedTracksHandle;
489  edm::Handle<TTTrackRefCollectionType> l1SelectedTracksEmulationHandle;
490  edm::Handle<l1t::VertexCollection> l1VerticesHandle;
491  edm::Handle<l1t::VertexWordCollection> l1VerticesEmulationHandle;
492 
493  l1t::Vertex leadingVertex;
494  l1t::VertexWord leadingEmulationVertex;
495 
496  TTTrackWordLinkLimitSelector linkLimitSel(fwNTrackSetsTVA_); //stateful functor for simulated tracks
497  TTTrackWordLinkLimitSelector linkLimitSelEmu(fwNTrackSetsTVA_); //stateful functor for emulated tracks
498 
499  TTTrackDeltaZMaxSelector deltaZSel(deltaZMaxEtaBounds_, deltaZMax_);
500  TTTrackWordDeltaZMaxSelector deltaZSelEmu(deltaZMaxEtaBounds_, deltaZMax_);
501 
502  NNTrackWordSelector TTTrackNetworkSelector(associationSesh_,
507 
508  iEvent.getByToken(l1TracksToken_, l1TracksHandle);
509  size_t nOutputApproximate = l1TracksHandle->size();
510 
512  iEvent.getByToken(l1SelectedTracksToken_, l1SelectedTracksHandle);
513  iEvent.getByToken(l1VerticesToken_, l1VerticesHandle);
514  leadingVertex = l1VerticesHandle->at(0);
515  if (debug_ >= 2) {
516  edm::LogInfo("L1TrackVertexAssociationProducer") << "leading vertex z0 = " << leadingVertex.z0();
517  }
518  vTTTrackAssociatedOutput->reserve(nOutputApproximate);
519  }
521  iEvent.getByToken(l1SelectedTracksEmulationToken_, l1SelectedTracksEmulationHandle);
522  iEvent.getByToken(l1VerticesEmulationToken_, l1VerticesEmulationHandle);
523  leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
524  if (debug_ >= 2) {
525  edm::LogInfo("L1TrackVertexAssociationProducer")
526  << "leading emulation vertex z0 = " << leadingEmulationVertex.z0();
527  }
528  vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximate);
529  }
530  for (size_t i = 0; i < nOutputApproximate; i++) {
531  const auto& track = l1TracksHandle->at(i);
533  // Limit the number of processed tracks according to the firmware capability: must be run on non-selected tracks (i.e. GTTConverted tracks)
534  bool passLinkLimit = linkLimitSel(track);
535  // Only match Selected tracks, by testing that the track is in the SelectedTracks collection
536  auto itr = std::find_if(l1SelectedTracksHandle->begin(), l1SelectedTracksHandle->end(), [track](const auto& ref) {
537  return (*ref).getTrackWord() == track.getTrackWord();
538  });
539  bool passSelection = (itr != l1SelectedTracksHandle->end());
540  // Associate tracks based on the simulation delta Z
541  if (passLinkLimit && passSelection && deltaZSel(track, leadingVertex)) {
542  vTTTrackAssociatedOutput->push_back(TTTrackRef(l1TracksHandle, i));
543  }
544  } //end if (processSimulatedTracks_)
546  // Limit the number of processed tracks according to the firmware capability: must be run on non-selected tracks (i.e. GTTConverted tracks)
547  bool passLinkLimitEmu = linkLimitSelEmu(track);
548  // Only match Selected tracks, by testing that the track is in the SelectedTracks collection
549  auto itrEmu = std::find_if(l1SelectedTracksEmulationHandle->begin(),
550  l1SelectedTracksEmulationHandle->end(),
551  [track](const auto& ref) { return (*ref).getTrackWord() == track.getTrackWord(); });
552  bool passSelectionEmu = (itrEmu != l1SelectedTracksEmulationHandle->end());
553  // Associated tracks based on the bitwise accurate TTTrack_TrackWord
555  if (passLinkLimitEmu && passSelectionEmu && TTTrackNetworkSelector(track, l1VerticesEmulationHandle->at(0))) {
556  vTTTrackAssociatedEmulationOutput->push_back(TTTrackRef(l1TracksHandle, i));
557  }
558  } else {
559  if (passLinkLimitEmu && passSelectionEmu && deltaZSelEmu(track, l1VerticesEmulationHandle->at(0))) {
560  vTTTrackAssociatedEmulationOutput->push_back(TTTrackRef(l1TracksHandle, i));
561  } //end block for satisfying LinkLimitEmu and SelectionEmu criteria
562  } //end if use track association NN
563  } //end if (processEmulatedTracks_)
564  } //end loop over input converted tracks
565 
567  printDebugInfo(l1SelectedTracksHandle,
568  l1SelectedTracksEmulationHandle,
569  vTTTrackAssociatedOutput,
570  vTTTrackAssociatedEmulationOutput);
571  }
572 
574  iEvent.put(std::move(vTTTrackAssociatedOutput), outputCollectionName_);
575  }
576 
578  iEvent.put(std::move(vTTTrackAssociatedEmulationOutput), outputCollectionName_ + "Emulation");
579  if (debug_ >= 2)
580  linkLimitSelEmu.log();
581  }
582 }
const edm::EDGetTokenT< TTTrackCollectionType > l1TracksToken_
const edm::EDGetTokenT< l1t::VertexCollection > l1VerticesToken_
const edm::EDGetTokenT< TTTrackRefCollectionType > l1SelectedTracksToken_
int iEvent
Definition: GenABIO.cc:224
edm::Handle< TTTrackCollectionType > TTTrackCollectionHandle
Log< level::Info, false > LogInfo
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
void printDebugInfo(const edm::Handle< TTTrackRefCollectionType > &l1SelectedTracksHandle, const edm::Handle< TTTrackRefCollectionType > &l1SelectedTracksEmulationHandle, const TTTrackRefCollectionUPtr &vTTTrackAssociatedOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedEmulationOutput) const
double z0() const
Definition: VertexWord.h:158
const edm::EDGetTokenT< l1t::VertexWordCollection > l1VerticesEmulationToken_
float z0() const
Definition: Vertex.h:21
edm::Ref< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >, TTTrack< Ref_Phase2TrackerDigi_ > > TTTrackRef
Definition: TTTypes.h:51
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
const edm::EDGetTokenT< TTTrackRefCollectionType > l1SelectedTracksEmulationToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ associationGraph_

tensorflow::GraphDef* L1TrackVertexAssociationProducer::associationGraph_
private

◆ associationGraphPath_

edm::FileInPath L1TrackVertexAssociationProducer::associationGraphPath_
private

◆ associationNetworkEtaBounds_

std::vector<double> L1TrackVertexAssociationProducer::associationNetworkEtaBounds_
private

Definition at line 291 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ associationNetworkZ0binning_

std::vector<double> L1TrackVertexAssociationProducer::associationNetworkZ0binning_
private

Definition at line 291 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ associationNetworkZ0ResBins_

std::vector<double> L1TrackVertexAssociationProducer::associationNetworkZ0ResBins_
private

Definition at line 291 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ associationSesh_

tensorflow::Session* L1TrackVertexAssociationProducer::associationSesh_
private

◆ associationThreshold_

const double L1TrackVertexAssociationProducer::associationThreshold_
private

Definition at line 287 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ cutSet_

const edm::ParameterSet L1TrackVertexAssociationProducer::cutSet_
private

Definition at line 279 of file L1TrackVertexAssociationProducer.cc.

◆ debug_

int L1TrackVertexAssociationProducer::debug_
private

Definition at line 293 of file L1TrackVertexAssociationProducer.cc.

Referenced by printDebugInfo(), and produce().

◆ deltaZMax_

std::vector<double> L1TrackVertexAssociationProducer::deltaZMax_
private

◆ deltaZMaxEtaBounds_

std::vector<double> L1TrackVertexAssociationProducer::deltaZMaxEtaBounds_
private

◆ fwNTrackSetsTVA_

const unsigned int L1TrackVertexAssociationProducer::fwNTrackSetsTVA_
private

Definition at line 283 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ l1SelectedTracksEmulationToken_

const edm::EDGetTokenT<TTTrackRefCollectionType> L1TrackVertexAssociationProducer::l1SelectedTracksEmulationToken_
private

Definition at line 277 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ l1SelectedTracksToken_

const edm::EDGetTokenT<TTTrackRefCollectionType> L1TrackVertexAssociationProducer::l1SelectedTracksToken_
private

Definition at line 275 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ l1TracksToken_

const edm::EDGetTokenT<TTTrackCollectionType> L1TrackVertexAssociationProducer::l1TracksToken_
private

Definition at line 273 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ l1VerticesEmulationToken_

const edm::EDGetTokenT<l1t::VertexWordCollection> L1TrackVertexAssociationProducer::l1VerticesEmulationToken_
private

Definition at line 276 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ l1VerticesToken_

const edm::EDGetTokenT<l1t::VertexCollection> L1TrackVertexAssociationProducer::l1VerticesToken_
private

Definition at line 274 of file L1TrackVertexAssociationProducer.cc.

Referenced by produce().

◆ outputCollectionName_

const std::string L1TrackVertexAssociationProducer::outputCollectionName_
private

◆ processEmulatedTracks_

const bool L1TrackVertexAssociationProducer::processEmulatedTracks_
private

◆ processSimulatedTracks_

const bool L1TrackVertexAssociationProducer::processSimulatedTracks_
private

◆ useAssociationNetwork_

bool L1TrackVertexAssociationProducer::useAssociationNetwork_
private

◆ useDisplacedTracksDeltaZOverride_

const double L1TrackVertexAssociationProducer::useDisplacedTracksDeltaZOverride_
private