CMS 3D CMS Logo

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

Create L3MuonTrajectorySeeds from L2 Muons in an outside-in manner. More...

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

Classes

struct  StrategyParameters
 Container for DNN outupts. More...
 

Public Member Functions

void produce (edm::StreamID sid, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 TSGForOIDNN (const edm::ParameterSet &iConfig)
 
 ~TSGForOIDNN () 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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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 Member Functions

void evaluateClassifier (const std::unordered_map< std::string, float > &feature_map, tensorflow::Session *session, const pt::ptree &metadata, StrategyParameters &out, bool &dnnSuccess) const
 Evaluate DNN classifier. More...
 
void evaluateRegressor (const std::unordered_map< std::string, float > &feature_map, tensorflow::Session *session_HB, const pt::ptree &metadata_HB, tensorflow::Session *session_HLIP, const pt::ptree &metadata_HLIP, tensorflow::Session *session_HLMuS, const pt::ptree &metadata_HLMuS, StrategyParameters &out, bool &dnnSuccess) const
 Evaluate DNN regressor. More...
 
void makeSeedsFromHitDoublets (const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const Chi2MeasurementEstimatorBase &estimator, const MeasurementTrackerEvent &measurementTracker, const NavigationSchool &navSchool, unsigned int &hitDoubletSeedsMade, unsigned int &numSeedsMade, const unsigned int &maxHitDoubletSeeds, unsigned int &layerCount, std::vector< TrajectorySeed > &out) const
 Similar to makeSeedsFromHits, but seed is created only if there are compatible hits on two adjacent layers. More...
 
void makeSeedsFromHits (const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const Chi2MeasurementEstimatorBase &estimator, const MeasurementTrackerEvent &measurementTracker, unsigned int &hitSeedsMade, unsigned int &numSeedsMade, const unsigned int &maxHitSeeds, unsigned int &layerCount, std::vector< TrajectorySeed > &out) const
 Find hits on a given layer (TOB or TEC) and create seeds from updated TSOS with hit. More...
 
void makeSeedsWithoutHits (const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const Chi2MeasurementEstimatorBase &estimator, double errorSF, unsigned int &hitlessSeedsMade, unsigned int &numSeedsMade, std::vector< TrajectorySeed > &out) const
 Create seeds without hits on a given layer (TOB or TEC) More...
 
void updateFeatureMap (std::unordered_map< std::string, float > &the_map, const reco::Track &l2, const TrajectoryStateOnSurface &tsos_IP, const TrajectoryStateOnSurface &tsos_MuS) const
 Update dictionary of inputs for DNN. More...
 

Private Attributes

const std::string dnnMetadataPath_
 DNN metadata. More...
 
std::string dnnModelPath_
 Settings for classifier. More...
 
std::string dnnModelPath_HB_
 Settings for regressor. More...
 
std::string dnnModelPath_HLIP_
 
std::string dnnModelPath_HLMuS_
 
const std::string estimatorName_
 Estimator used to find dets and TrajectoryMeasurements. More...
 
const double fixedErrorRescalingForHitless_
 Rescale L2 parameter uncertainties (fixed error vs pT, eta) More...
 
const bool getStrategyFromDNN_
 Get number of seeds to use from DNN output instead of "max..Seeds" parameters. More...
 
std::unique_ptr< tensorflow::GraphDef > graphDef_
 
std::unique_ptr< tensorflow::GraphDef > graphDef_HB_
 
std::unique_ptr< tensorflow::GraphDef > graphDef_HLIP_
 
std::unique_ptr< tensorflow::GraphDef > graphDef_HLMuS_
 
const double maxEtaForTOB_
 Maximum eta value to activate searching in the TOB. More...
 
const unsigned int maxHitDoubletSeeds_
 
const unsigned int maxHitlessSeeds_
 Maximum number of hitless seeds for each L2. More...
 
const unsigned int maxHitlessSeedsIP_
 
const unsigned int maxHitlessSeedsMuS_
 
const unsigned int maxHitSeeds_
 Maximum number of hitbased seeds for each L2. More...
 
const unsigned int maxSeeds_
 Maximum number of seeds for each L2. More...
 
const edm::EDGetTokenT< MeasurementTrackerEventmeasurementTrackerTag_
 
pt::ptree metadata_
 
const double minEtaForTEC_
 Minimum eta value to activate searching in the TEC. More...
 
const unsigned int numOfHitsToTry_
 How many hits to try per layer. More...
 
const unsigned int numOfLayersToTry_
 How many layers to try. More...
 
const edm::EDGetTokenT< reco::TrackCollectionsrc_
 Labels for input collections. More...
 
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecordt_estimatorH_
 Tokens for ESHandle. More...
 
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordt_geometryH_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordt_magfieldH_
 
const edm::ESGetToken< NavigationSchool, NavigationSchoolRecordt_navSchool_
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordt_propagatorAlongH_
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordt_propagatorOppositeH_
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordt_SHPOpposite_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordt_tmpTkGeometryH_
 
tensorflow::Session * tf_session_
 
tensorflow::Session * tf_session_HB_
 
tensorflow::Session * tf_session_HLIP_
 
tensorflow::Session * tf_session_HLMuS_
 
const std::string theCategory_
 
const std::unique_ptr< TrajectoryStateUpdatorupdator_
 
const bool useRegressor_
 Whether to use DNN regressor (if false, will use classifier) More...
 

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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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

Create L3MuonTrajectorySeeds from L2 Muons in an outside-in manner.

Author
Dmitry Kondratyev, Arnab Purohit, Jan-Frederik Schulte (Purdue University, West Lafayette, USA)

Definition at line 40 of file TSGForOIDNN.cc.

Constructor & Destructor Documentation

◆ TSGForOIDNN()

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

Definition at line 178 of file TSGForOIDNN.cc.

References tensorflow::createSession(), HLT_2022v15_cff::dnnMetadataPath, dnnMetadataPath_, dnnModelPath_, dnnModelPath_HB_, dnnModelPath_HLIP_, dnnModelPath_HLMuS_, getStrategyFromDNN_, graphDef_, graphDef_HB_, graphDef_HLIP_, graphDef_HLMuS_, tensorflow::loadGraphDef(), metadata_, tensorflow::setLogging(), AlCaHLTBitMon_QueryRunRegistry::string, tf_session_, tf_session_HB_, tf_session_HLIP_, tf_session_HLMuS_, and useRegressor_.

179  : src_(consumes(iConfig.getParameter<edm::InputTag>("src"))),
180  t_estimatorH_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("estimator")))),
182  t_propagatorAlongH_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("propagatorName")))),
186  t_navSchool_(esConsumes(edm::ESInputTag("", "SimpleNavigationSchool"))),
187  t_SHPOpposite_(esConsumes(edm::ESInputTag("", "hltESPSteppingHelixPropagatorOpposite"))),
188  updator_(new KFUpdator()),
189  measurementTrackerTag_(consumes(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent"))),
190  theCategory_(std::string("Muon|RecoMuon|TSGForOIDNN")),
191  maxSeeds_(iConfig.getParameter<uint32_t>("maxSeeds")),
192  maxHitSeeds_(iConfig.getParameter<uint32_t>("maxHitSeeds")),
193  maxHitlessSeeds_(iConfig.getParameter<uint32_t>("maxHitlessSeeds")),
194  numOfLayersToTry_(iConfig.getParameter<int32_t>("layersToTry")),
195  numOfHitsToTry_(iConfig.getParameter<int32_t>("hitsToTry")),
196  fixedErrorRescalingForHitless_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHitless")),
197  minEtaForTEC_(iConfig.getParameter<double>("minEtaForTEC")),
198  maxEtaForTOB_(iConfig.getParameter<double>("maxEtaForTOB")),
199  maxHitlessSeedsIP_(iConfig.getParameter<uint32_t>("maxHitlessSeedsIP")),
200  maxHitlessSeedsMuS_(iConfig.getParameter<uint32_t>("maxHitlessSeedsMuS")),
201  maxHitDoubletSeeds_(iConfig.getParameter<uint32_t>("maxHitDoubletSeeds")),
202  getStrategyFromDNN_(iConfig.getParameter<bool>("getStrategyFromDNN")),
203  useRegressor_(iConfig.getParameter<bool>("useRegressor")),
204  dnnMetadataPath_(iConfig.getParameter<std::string>("dnnMetadataPath")) {
205  if (getStrategyFromDNN_) {
207  pt::read_json(dnnMetadataPath.fullPath(), metadata_);
209 
210  if (useRegressor_) {
211  // use regressor
212  dnnModelPath_HB_ = metadata_.get<std::string>("HB.dnnmodel_path");
213  edm::FileInPath dnnPath_HB(dnnModelPath_HB_);
214  graphDef_HB_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_HB.fullPath()));
216 
217  dnnModelPath_HLIP_ = metadata_.get<std::string>("HLIP.dnnmodel_path");
218  edm::FileInPath dnnPath_HLIP(dnnModelPath_HLIP_);
219  graphDef_HLIP_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_HLIP.fullPath()));
221 
222  dnnModelPath_HLMuS_ = metadata_.get<std::string>("HLMuS.dnnmodel_path");
223  edm::FileInPath dnnPath_HLMuS(dnnModelPath_HLMuS_);
224  graphDef_HLMuS_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_HLMuS.fullPath()));
226  } else {
227  // use classifier (default)
228  dnnModelPath_ = metadata_.get<std::string>("dnnmodel_path");
230  graphDef_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath.fullPath()));
232  }
233  }
234  produces<std::vector<TrajectorySeed> >();
235 }
Session * createSession(SessionOptions &sessionOptions)
Definition: TensorFlow.cc:84
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOIDNN.cc:72
std::string dnnModelPath_HLIP_
Definition: TSGForOIDNN.cc:100
const unsigned int maxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOIDNN.cc:64
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string dnnModelPath_HLMuS_
Definition: TSGForOIDNN.cc:101
tensorflow::Session * tf_session_HLMuS_
Definition: TSGForOIDNN.cc:107
const edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > t_navSchool_
Definition: TSGForOIDNN.cc:57
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > t_geometryH_
Definition: TSGForOIDNN.cc:56
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
Definition: TSGForOIDNN.cc:60
GraphDef * loadGraphDef(const std::string &pbFile)
Definition: TensorFlow.cc:67
tensorflow::Session * tf_session_HB_
Definition: TSGForOIDNN.cc:103
const unsigned int maxHitlessSeedsMuS_
Definition: TSGForOIDNN.cc:85
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
Definition: TSGForOIDNN.cc:49
const unsigned int maxHitlessSeedsIP_
Definition: TSGForOIDNN.cc:84
std::unique_ptr< tensorflow::GraphDef > graphDef_HLIP_
Definition: TSGForOIDNN.cc:104
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > t_estimatorH_
Tokens for ESHandle.
Definition: TSGForOIDNN.cc:51
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
Definition: TSGForOIDNN.cc:78
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const double fixedErrorRescalingForHitless_
Rescale L2 parameter uncertainties (fixed error vs pT, eta)
Definition: TSGForOIDNN.cc:74
const std::string dnnMetadataPath_
DNN metadata.
Definition: TSGForOIDNN.cc:110
const std::string theCategory_
Definition: TSGForOIDNN.cc:61
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_propagatorOppositeH_
Definition: TSGForOIDNN.cc:54
const unsigned int maxHitSeeds_
Maximum number of hitbased seeds for each L2.
Definition: TSGForOIDNN.cc:66
const unsigned int maxHitDoubletSeeds_
Definition: TSGForOIDNN.cc:86
std::string dnnModelPath_
Settings for classifier.
Definition: TSGForOIDNN.cc:94
const bool useRegressor_
Whether to use DNN regressor (if false, will use classifier)
Definition: TSGForOIDNN.cc:91
void setLogging(const std::string &level="3")
Definition: TensorFlow.cc:14
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_SHPOpposite_
Definition: TSGForOIDNN.cc:58
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
Definition: TSGForOIDNN.cc:80
std::string dnnModelPath_HB_
Settings for regressor.
Definition: TSGForOIDNN.cc:99
std::unique_ptr< tensorflow::GraphDef > graphDef_
Definition: TSGForOIDNN.cc:95
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > t_magfieldH_
Definition: TSGForOIDNN.cc:52
std::unique_ptr< tensorflow::GraphDef > graphDef_HB_
Definition: TSGForOIDNN.cc:102
tensorflow::Session * tf_session_
Definition: TSGForOIDNN.cc:96
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_propagatorAlongH_
Definition: TSGForOIDNN.cc:53
const unsigned int numOfLayersToTry_
How many layers to try.
Definition: TSGForOIDNN.cc:70
const bool getStrategyFromDNN_
Get number of seeds to use from DNN output instead of "max..Seeds" parameters.
Definition: TSGForOIDNN.cc:89
std::unique_ptr< tensorflow::GraphDef > graphDef_HLMuS_
Definition: TSGForOIDNN.cc:106
pt::ptree metadata_
Definition: TSGForOIDNN.cc:111
const std::unique_ptr< TrajectoryStateUpdator > updator_
Definition: TSGForOIDNN.cc:59
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > t_tmpTkGeometryH_
Definition: TSGForOIDNN.cc:55
const unsigned int maxHitlessSeeds_
Maximum number of hitless seeds for each L2.
Definition: TSGForOIDNN.cc:68
tensorflow::Session * tf_session_HLIP_
Definition: TSGForOIDNN.cc:105

◆ ~TSGForOIDNN()

TSGForOIDNN::~TSGForOIDNN ( )
override

Definition at line 237 of file TSGForOIDNN.cc.

References tensorflow::closeSession(), getStrategyFromDNN_, tf_session_, tf_session_HB_, tf_session_HLIP_, tf_session_HLMuS_, and useRegressor_.

237  {
238  if (getStrategyFromDNN_) {
239  if (useRegressor_) {
243  } else {
245  }
246  }
247 }
tensorflow::Session * tf_session_HLMuS_
Definition: TSGForOIDNN.cc:107
tensorflow::Session * tf_session_HB_
Definition: TSGForOIDNN.cc:103
bool closeSession(Session *&session)
Definition: TensorFlow.cc:197
const bool useRegressor_
Whether to use DNN regressor (if false, will use classifier)
Definition: TSGForOIDNN.cc:91
tensorflow::Session * tf_session_
Definition: TSGForOIDNN.cc:96
const bool getStrategyFromDNN_
Get number of seeds to use from DNN output instead of "max..Seeds" parameters.
Definition: TSGForOIDNN.cc:89
tensorflow::Session * tf_session_HLIP_
Definition: TSGForOIDNN.cc:105

Member Function Documentation

◆ evaluateClassifier()

void TSGForOIDNN::evaluateClassifier ( const std::unordered_map< std::string, float > &  feature_map,
tensorflow::Session *  session,
const pt::ptree &  metadata,
StrategyParameters out,
bool &  dnnSuccess 
) const
private

Evaluate DNN classifier.

Definition at line 835 of file TSGForOIDNN.cc.

References dqmMemoryStats::float, alignmentValidation::fname, mps_fire::i, input, label, OccupancyTask_cfi::metadata, MillePedeFileConverter_cfg::out, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, tensorflow::run(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

Referenced by produce().

839  {
840  int n_features = metadata.get<int>("n_features", 0);
841 
842  // Prepare tensor for DNN inputs
843  tensorflow::Tensor input(tensorflow::DT_FLOAT, {1, n_features});
845  int i_feature = 0;
846  for (const pt::ptree::value_type& feature : metadata.get_child("feature_names")) {
847  fname = feature.second.data();
848  if (feature_map.find(fname) == feature_map.end()) {
849  // don't evaluate DNN if any input feature is missing
850  dnnSuccess = false;
851  } else {
852  input.matrix<float>()(0, i_feature) = float(feature_map.at(fname));
853  i_feature++;
854  }
855  }
856 
857  // Prepare tensor for DNN outputs
858  std::vector<tensorflow::Tensor> outputs;
859 
860  // Evaluate DNN and put results in output tensor
861  std::string inputLayer = metadata.get<std::string>("input_layer");
862  std::string outputLayer = metadata.get<std::string>("output_layer");
863 
864  tensorflow::run(session, {{inputLayer, input}}, {outputLayer}, &outputs);
865  tensorflow::Tensor out_tensor = outputs[0];
866  tensorflow::TTypes<float, 1>::Matrix dnn_outputs = out_tensor.matrix<float>();
867 
868  // Find output with largest prediction
869  int imax = 0;
870  float out_max = 0;
871  for (long long int i = 0; i < out_tensor.dim_size(1); i++) {
872  float ith_output = dnn_outputs(0, i);
873  if (ith_output > out_max) {
874  imax = i;
875  out_max = ith_output;
876  }
877  }
878 
879  // Decode output
880  const std::string label = "output_labels.label_" + std::to_string(imax);
881  out.nHBd = metadata.get<int>(label + ".nHBd");
882  out.nHLIP = metadata.get<int>(label + ".nHLIP");
883  out.nHLMuS = metadata.get<int>(label + ".nHLMuS");
884  out.sf = metadata.get<int>(label + ".SF");
885 
886  dnnSuccess = true;
887 }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
static std::string const input
Definition: EdmProvDump.cc:50
char const * label
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
Definition: TensorFlow.cc:222
string fname
main script
portabletest::Matrix Matrix

◆ evaluateRegressor()

void TSGForOIDNN::evaluateRegressor ( const std::unordered_map< std::string, float > &  feature_map,
tensorflow::Session *  session_HB,
const pt::ptree &  metadata_HB,
tensorflow::Session *  session_HLIP,
const pt::ptree &  metadata_HLIP,
tensorflow::Session *  session_HLMuS,
const pt::ptree &  metadata_HLMuS,
StrategyParameters out,
bool &  dnnSuccess 
) const
private

Evaluate DNN regressor.

Definition at line 892 of file TSGForOIDNN.cc.

References dqmMemoryStats::float, alignmentValidation::fname, input, MillePedeFileConverter_cfg::out, tensorflow::run(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

900  {
901  int n_features = metadata_HB.get<int>("n_features", 0);
902 
903  // Prepare tensor for DNN inputs
904  tensorflow::Tensor input(tensorflow::DT_FLOAT, {1, n_features});
906  int i_feature = 0;
907  for (const pt::ptree::value_type& feature : metadata_HB.get_child("feature_names")) {
908  fname = feature.second.data();
909  if (feature_map.find(fname) == feature_map.end()) {
910  // don't evaluate DNN if any input feature is missing
911  dnnSuccess = false;
912  } else {
913  input.matrix<float>()(0, i_feature) = float(feature_map.at(fname));
914  i_feature++;
915  }
916  }
917 
918  // Prepare tensor for DNN outputs
919  std::vector<tensorflow::Tensor> outputs_HB;
920  // Evaluate DNN and put results in output tensor
921  std::string inputLayer_HB = metadata_HB.get<std::string>("input_layer");
922  std::string outputLayer_HB = metadata_HB.get<std::string>("output_layer");
923  tensorflow::run(session_HB, {{inputLayer_HB, input}}, {outputLayer_HB}, &outputs_HB);
924  tensorflow::Tensor out_tensor_HB = outputs_HB[0];
925  tensorflow::TTypes<float, 1>::Matrix dnn_outputs_HB = out_tensor_HB.matrix<float>();
926 
927  // Prepare tensor for DNN outputs
928  std::vector<tensorflow::Tensor> outputs_HLIP;
929  // Evaluate DNN and put results in output tensor
930  std::string inputLayer_HLIP = metadata_HLIP.get<std::string>("input_layer");
931  std::string outputLayer_HLIP = metadata_HLIP.get<std::string>("output_layer");
932  tensorflow::run(session_HLIP, {{inputLayer_HLIP, input}}, {outputLayer_HLIP}, &outputs_HLIP);
933  tensorflow::Tensor out_tensor_HLIP = outputs_HLIP[0];
934  tensorflow::TTypes<float, 1>::Matrix dnn_outputs_HLIP = out_tensor_HLIP.matrix<float>();
935 
936  // Prepare tensor for DNN outputs
937  std::vector<tensorflow::Tensor> outputs_HLMuS;
938  // Evaluate DNN and put results in output tensor
939  std::string inputLayer_HLMuS = metadata_HLMuS.get<std::string>("input_layer");
940  std::string outputLayer_HLMuS = metadata_HLMuS.get<std::string>("output_layer");
941  tensorflow::run(session_HLMuS, {{inputLayer_HLMuS, input}}, {outputLayer_HLMuS}, &outputs_HLMuS);
942  tensorflow::Tensor out_tensor_HLMuS = outputs_HLMuS[0];
943  tensorflow::TTypes<float, 1>::Matrix dnn_outputs_HLMuS = out_tensor_HLMuS.matrix<float>();
944 
945  // Decode output
946  out.nHBd = round(dnn_outputs_HB(0, 0));
947  out.nHLIP = round(dnn_outputs_HLIP(0, 0));
948  out.sf = round(dnn_outputs_HLIP(0, 1));
949  out.nHLMuS = round(dnn_outputs_HLMuS(0, 0));
950 
951  // Prevent prediction of negative number of seeds or too many seeds
952  out.nHBd = std::clamp(out.nHBd, 0, 10);
953  out.nHLIP = std::clamp(out.nHLIP, 0, 10);
954  out.nHLMuS = std::clamp(out.nHLMuS, 0, 10);
955 
956  // Prevent prediction of 0 seeds in total
957  if (out.nHBd == 0 && out.nHLIP == 0 && out.nHLMuS == 0) {
958  // default strategy, similar to Run 2
959  out.nHBd = 1;
960  out.nHLIP = 5;
961  }
962 
963  // Prevent extreme predictions for scale factors
964  // (on average SF=2 was found to be optimal)
965  if (out.sf <= 0)
966  out.sf = 2;
967  if (out.sf > 10)
968  out.sf = 10;
969 
970  dnnSuccess = true;
971 }
static std::string const input
Definition: EdmProvDump.cc:50
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
Definition: TensorFlow.cc:222
string fname
main script
portabletest::Matrix Matrix

◆ fillDescriptions()

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

Definition at line 976 of file TSGForOIDNN.cc.

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

976  {
978  desc.add<edm::InputTag>("src", edm::InputTag("hltL2Muons", "UpdatedAtVtx"));
979  desc.add<int>("layersToTry", 2);
980  desc.add<double>("fixedErrorRescaleFactorForHitless", 2.0);
981  desc.add<int>("hitsToTry", 1);
982  desc.add<edm::InputTag>("MeasurementTrackerEvent", edm::InputTag("hltSiStripClusters"));
983  desc.add<std::string>("estimator", "hltESPChi2MeasurementEstimator100");
984  desc.add<double>("maxEtaForTOB", 1.8);
985  desc.add<double>("minEtaForTEC", 0.7);
986  desc.addUntracked<bool>("debug", false);
987  desc.add<unsigned int>("maxSeeds", 20);
988  desc.add<unsigned int>("maxHitlessSeeds", 5);
989  desc.add<unsigned int>("maxHitSeeds", 1);
990  desc.add<std::string>("propagatorName", "PropagatorWithMaterialParabolicMf");
991  desc.add<unsigned int>("maxHitlessSeedsIP", 5);
992  desc.add<unsigned int>("maxHitlessSeedsMuS", 0);
993  desc.add<unsigned int>("maxHitDoubletSeeds", 0);
994  desc.add<bool>("getStrategyFromDNN", false);
995  desc.add<bool>("useRegressor", false);
996  desc.add<std::string>("dnnMetadataPath", "");
997  descriptions.add("tsgForOIDNN", desc);
998 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ makeSeedsFromHitDoublets()

void TSGForOIDNN::makeSeedsFromHitDoublets ( const GeometricSearchDet layer,
const TrajectoryStateOnSurface tsos,
const Propagator propagatorAlong,
const Chi2MeasurementEstimatorBase estimator,
const MeasurementTrackerEvent measurementTracker,
const NavigationSchool navSchool,
unsigned int &  hitDoubletSeedsMade,
unsigned int &  numSeedsMade,
const unsigned int &  maxHitDoubletSeeds,
unsigned int &  layerCount,
std::vector< TrajectorySeed > &  out 
) const
private

Similar to makeSeedsFromHits, but seed is created only if there are compatible hits on two adjacent layers.

Definition at line 583 of file TSGForOIDNN.cc.

References alongMomentum, MeasurementDetWithData::fastMeasurements(), newFWLiteAna::found, TrajectoryStateOnSurface::freeState(), MeasurementDetWithData::isNull(), TrajectoryStateOnSurface::isValid(), pixelTopology::layer, LogTrace, HLT_2022v15_cff::maxHitDoubletSeeds, HLTSiStripMonitoring_cff::measurementTracker, eostools::move(), HLT_2022v15_cff::navSchool, numOfHitsToTry_, oppositeToMomentum, MillePedeFileConverter_cfg::out, trajectoryStateTransform::persistentState(), L1TMuonDQMOffline_cfi::propagatorAlong, edm::OwnVector< T, P >::push_back(), fileCollector::seed, edm::OwnVector< T, P >::size(), jetUpdater_cfi::sort, and updator_.

Referenced by produce().

593  {
594  // This method is similar to makeSeedsFromHits, but the seed is created
595  // only when in addition to a hit on a given layer, there are more compatible hits
596  // on next layers (going from outside inwards), compatible with updated TSOS.
597  // If that's the case, multiple compatible hits are used to create a single seed.
598 
599  // Configured to only check the immideately adjacent layer and add one more hit
600  int max_addtnl_layers = 1; // max number of additional layers to scan
601  int max_meas = 1; // number of measurements to consider on each additional layer
602 
603  // // // First, regular procedure to find a compatible hit - like in makeSeedsFromHits // // //
604 
605  const TrajectoryStateOnSurface& onLayer(tsos);
606 
607  // Find dets compatible with original TSOS
608  std::vector<GeometricSearchDet::DetWithState> dets;
609  layer.compatibleDetsV(onLayer, propagatorAlong, estimator, dets);
610 
611  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHitDoublets: Find measurements on each detWithState "
612  << dets.size();
613  std::vector<TrajectoryMeasurement> meas;
614 
615  // Loop over dets
616  for (auto const& detI : dets) {
617  MeasurementDetWithData det = measurementTracker.idToDet(detI.first->geographicalId());
618 
619  if (det.isNull())
620  continue; // skip if det does not exist
621  if (!detI.second.isValid())
622  continue; // skip if TSOS is invalid
623 
624  // Find measurements on this det
625  std::vector<TrajectoryMeasurement> mymeas = det.fastMeasurements(detI.second, onLayer, propagatorAlong, estimator);
626 
627  // Save valid measurements
628  for (auto const& measurement : mymeas) {
629  if (measurement.recHit()->isValid())
630  meas.push_back(measurement);
631  } // end loop over meas
632  } // end loop over dets
633 
634  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHitDoublets: Update TSOS using TMs after sorting, then create "
635  "Trajectory Seed, number of TM = "
636  << meas.size();
637 
638  // sort valid measurements found on the first layer
639  std::sort(meas.begin(), meas.end(), TrajMeasLessEstim());
640 
641  unsigned int found = 0;
642  int hit_num = 0;
643 
644  // Loop over all valid measurements compatible with original TSOS
645  //for (std::vector<TrajectoryMeasurement>::const_iterator mea = meas.begin(); mea != meas.end(); ++mea) {
646  for (auto const& measurement : meas) {
647  if (hitDoubletSeedsMade >= maxHitDoubletSeeds)
648  return; // abort if enough seeds created
649 
650  hit_num++;
651 
652  // Update TSOS with measurement on first considered layer
653  TrajectoryStateOnSurface updatedTSOS = updator_->update(measurement.forwardPredictedState(), *measurement.recHit());
654 
655  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHitDoublets: TSOS for TM " << found;
656  if (not updatedTSOS.isValid())
657  continue; // Skip if updated TSOS is invalid
658 
660 
661  // Save hit on first layer
662  seedHits.push_back(*measurement.recHit()->hit());
663  const DetLayer* detLayer = dynamic_cast<const DetLayer*>(&layer);
664 
665  // // // Now for this measurement we will loop over additional layers and try to update the TSOS again // // //
666 
667  // find layers compatible with updated TSOS
668  auto const& compLayers = navSchool.nextLayers(*detLayer, *updatedTSOS.freeState(), alongMomentum);
669 
670  int addtnl_layers_scanned = 0;
671  int found_compatible_on_next_layer = 0;
672  int det_id = 0;
673 
674  // Copy updated TSOS - we will update it again with a measurement from the next layer, if we find it
675  TrajectoryStateOnSurface updatedTSOS_next(updatedTSOS);
676 
677  // loop over layers compatible with updated TSOS
678  for (auto compLayer : compLayers) {
679  int nmeas = 0;
680 
681  if (addtnl_layers_scanned >= max_addtnl_layers)
682  break; // break if we already looped over enough layers
683  if (found_compatible_on_next_layer > 0)
684  break; // break if we already found additional hit
685 
686  // find dets compatible with updated TSOS
687  std::vector<GeometricSearchDet::DetWithState> dets_next;
688  TrajectoryStateOnSurface onLayer_next(updatedTSOS);
689 
690  compLayer->compatibleDetsV(onLayer_next, propagatorAlong, estimator, dets_next);
691 
692  //if (!detWithState.size()) continue;
693  std::vector<TrajectoryMeasurement> meas_next;
694 
695  // find measurements on dets_next and save the valid ones
696  for (auto const& detI_next : dets_next) {
697  MeasurementDetWithData det = measurementTracker.idToDet(detI_next.first->geographicalId());
698 
699  if (det.isNull())
700  continue; // skip if det does not exist
701  if (!detI_next.second.isValid())
702  continue; // skip if TSOS is invalid
703 
704  // Find measurements on this det
705  std::vector<TrajectoryMeasurement> mymeas_next =
706  det.fastMeasurements(detI_next.second, onLayer_next, propagatorAlong, estimator);
707 
708  for (auto const& mea_next : mymeas_next) {
709  // save valid measurements
710  if (mea_next.recHit()->isValid())
711  meas_next.push_back(mea_next);
712 
713  } // end loop over mymeas_next
714  } // end loop over dets_next
715 
716  // sort valid measurements found on this layer
717  std::sort(meas_next.begin(), meas_next.end(), TrajMeasLessEstim());
718 
719  // loop over valid measurements compatible with updated TSOS (TSOS updated with a hit on the first layer)
720  for (auto const& mea_next : meas_next) {
721  if (nmeas >= max_meas)
722  break; // skip if we already found enough hits
723 
724  // try to update TSOS again, with an additional hit
725  updatedTSOS_next = updator_->update(mea_next.forwardPredictedState(), *mea_next.recHit());
726 
727  if (not updatedTSOS_next.isValid())
728  continue; // skip if TSOS updated with additional hit is not valid
729 
730  // If there was a compatible hit on this layer, we end up here.
731  // An additional compatible hit is saved.
732  seedHits.push_back(*mea_next.recHit()->hit());
733  det_id = mea_next.recHit()->geographicalId().rawId();
734  nmeas++;
735  found_compatible_on_next_layer++;
736 
737  } // end loop over meas_next
738 
739  addtnl_layers_scanned++;
740 
741  } // end loop over compLayers (additional layers scanned after the original layer)
742 
743  if (found_compatible_on_next_layer == 0)
744  continue;
745  // only consider the hit if there was a compatible hit on one of the additional scanned layers
746 
747  // Create a seed from two saved hits
748  PTrajectoryStateOnDet const& pstate = trajectoryStateTransform::persistentState(updatedTSOS_next, det_id);
749  TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum);
750 
751  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHitDoublets: Number of seedHits: " << seedHits.size();
752  out.push_back(seed);
753 
754  found++;
755  numSeedsMade++;
756  hitDoubletSeedsMade++;
757 
758  if (found == numOfHitsToTry_)
759  break; // break if enough measurements scanned
760 
761  } // end loop over measurements compatible with original TSOS
762 
763  if (found)
764  layerCount++;
765 }
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOIDNN.cc:72
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void push_back(D *&d)
Definition: OwnVector.h:326
size_type size() const
Definition: OwnVector.h:300
FreeTrajectoryState const * freeState(bool withErrors=true) const
const std::unique_ptr< TrajectoryStateUpdator > updator_
Definition: TSGForOIDNN.cc:59
def move(src, dest)
Definition: eostools.py:511

◆ makeSeedsFromHits()

void TSGForOIDNN::makeSeedsFromHits ( const GeometricSearchDet layer,
const TrajectoryStateOnSurface tsos,
const Propagator propagatorAlong,
const Chi2MeasurementEstimatorBase estimator,
const MeasurementTrackerEvent measurementTracker,
unsigned int &  hitSeedsMade,
unsigned int &  numSeedsMade,
const unsigned int &  maxHitSeeds,
unsigned int &  layerCount,
std::vector< TrajectorySeed > &  out 
) const
private

Find hits on a given layer (TOB or TEC) and create seeds from updated TSOS with hit.

Definition at line 511 of file TSGForOIDNN.cc.

References MeasurementDetWithData::fastMeasurements(), newFWLiteAna::found, MeasurementDetWithData::isNull(), TrajectoryStateOnSurface::isValid(), pixelTopology::layer, LogTrace, HLT_2022v15_cff::maxHitSeeds, HLTSiStripMonitoring_cff::measurementTracker, eostools::move(), numOfHitsToTry_, numOfLayersToTry_, oppositeToMomentum, MillePedeFileConverter_cfg::out, trajectoryStateTransform::persistentState(), L1TMuonDQMOffline_cfi::propagatorAlong, edm::OwnVector< T, P >::push_back(), fileCollector::seed, edm::OwnVector< T, P >::size(), jetUpdater_cfi::sort, and updator_.

Referenced by produce().

520  {
521  if (layerCount > numOfLayersToTry_)
522  return;
523 
524  const TrajectoryStateOnSurface& onLayer(tsos);
525 
526  std::vector<GeometricSearchDet::DetWithState> dets;
527  layer.compatibleDetsV(onLayer, propagatorAlong, estimator, dets);
528 
529  // Find Measurements on each DetWithState
530  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: Find measurements on each detWithState " << dets.size();
531  std::vector<TrajectoryMeasurement> meas;
532  for (auto const& detI : dets) {
533  MeasurementDetWithData det = measurementTracker.idToDet(detI.first->geographicalId());
534  if (det.isNull())
535  continue;
536  if (!detI.second.isValid())
537  continue; // Skip if TSOS is not valid
538 
539  std::vector<TrajectoryMeasurement> mymeas =
540  det.fastMeasurements(detI.second, onLayer, propagatorAlong, estimator); // Second TSOS is not used
541  for (auto const& measurement : mymeas) {
542  if (measurement.recHit()->isValid())
543  meas.push_back(measurement); // Only save those which are valid
544  }
545  }
546 
547  // Update TSOS using TMs after sorting, then create Trajectory Seed and put into vector
548  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: Update TSOS using TMs after sorting, then create "
549  "Trajectory Seed, number of TM = "
550  << meas.size();
551  std::sort(meas.begin(), meas.end(), TrajMeasLessEstim());
552 
553  unsigned int found = 0;
554  for (auto const& measurement : meas) {
555  if (hitSeedsMade >= maxHitSeeds)
556  return;
557  TrajectoryStateOnSurface updatedTSOS = updator_->update(measurement.forwardPredictedState(), *measurement.recHit());
558  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: TSOS for TM " << found;
559  if (not updatedTSOS.isValid())
560  continue;
561 
563  seedHits.push_back(*measurement.recHit()->hit());
564  PTrajectoryStateOnDet const& pstate =
565  trajectoryStateTransform::persistentState(updatedTSOS, measurement.recHit()->geographicalId().rawId());
566  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: Number of seedHits: " << seedHits.size();
567  TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum);
568  out.push_back(seed);
569  found++;
570  numSeedsMade++;
571  hitSeedsMade++;
572  if (found == numOfHitsToTry_)
573  break;
574  }
575 
576  if (found)
577  layerCount++;
578 }
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOIDNN.cc:72
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void push_back(D *&d)
Definition: OwnVector.h:326
size_type size() const
Definition: OwnVector.h:300
const unsigned int numOfLayersToTry_
How many layers to try.
Definition: TSGForOIDNN.cc:70
const std::unique_ptr< TrajectoryStateUpdator > updator_
Definition: TSGForOIDNN.cc:59
def move(src, dest)
Definition: eostools.py:511

◆ makeSeedsWithoutHits()

void TSGForOIDNN::makeSeedsWithoutHits ( const GeometricSearchDet layer,
const TrajectoryStateOnSurface tsos,
const Propagator propagatorAlong,
const Chi2MeasurementEstimatorBase estimator,
double  errorSF,
unsigned int &  hitlessSeedsMade,
unsigned int &  numSeedsMade,
std::vector< TrajectorySeed > &  out 
) const
private

Create seeds without hits on a given layer (TOB or TEC)

Definition at line 477 of file TSGForOIDNN.cc.

References pixelTopology::layer, LogTrace, oppositeToMomentum, MillePedeFileConverter_cfg::out, trajectoryStateTransform::persistentState(), L1TMuonDQMOffline_cfi::propagatorAlong, and theCategory_.

Referenced by produce().

484  {
485  // create hitless seeds
486  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsWithoutHits: Start hitless";
487  std::vector<GeometricSearchDet::DetWithState> dets;
488  layer.compatibleDetsV(tsos, propagatorAlong, estimator, dets);
489  if (!dets.empty()) {
490  auto const& detOnLayer = dets.front().first;
491  auto& tsosOnLayer = dets.front().second;
492  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsWithoutHits: tsosOnLayer " << tsosOnLayer;
493  if (!tsosOnLayer.isValid()) {
494  edm::LogInfo(theCategory_) << "ERROR!: Hitless TSOS is not valid!";
495  } else {
496  tsosOnLayer.rescaleError(errorSF);
497  PTrajectoryStateOnDet const& ptsod =
498  trajectoryStateTransform::persistentState(tsosOnLayer, detOnLayer->geographicalId().rawId());
500  out.push_back(TrajectorySeed(ptsod, rHC, oppositeToMomentum));
501  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsWithoutHits: TSOS (Hitless) done ";
502  hitlessSeedsMade++;
503  numSeedsMade++;
504  }
505  }
506 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const std::string theCategory_
Definition: TSGForOIDNN.cc:61
Log< level::Info, false > LogInfo

◆ produce()

void TSGForOIDNN::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 252 of file TSGForOIDNN.cc.

References funct::abs(), alongMomentum, Plane::build(), evaluateClassifier(), evaluateRegressor(), fixedErrorRescalingForHitless_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), getStrategyFromDNN_, iEvent, trajectoryStateTransform::initialFreeState(), trajectoryStateTransform::innerStateOnSurface(), TrackerGeometry::isThere(), TrajectoryStateOnSurface::isValid(), HLTObjectMonitor_cfi::l2muonEta, pixelTopology::layer, hgcalTBTopologyTester_cfi::layers, LogTrace, volumeBasedMagneticField_160812_cfi::magfield, makeSeedsFromHitDoublets(), makeSeedsFromHits(), makeSeedsWithoutHits(), maxEtaForTOB_, HLT_2022v15_cff::maxHitDoubletSeeds, maxHitDoubletSeeds_, HLT_2022v15_cff::maxHitlessSeedsIP, maxHitlessSeedsIP_, HLT_2022v15_cff::maxHitlessSeedsMuS, maxHitlessSeedsMuS_, HLT_2022v15_cff::maxHitSeeds, maxHitSeeds_, maxSeeds_, HLTSiStripMonitoring_cff::measurementTracker, measurementTrackerTag_, metadata_, minEtaForTEC_, eostools::move(), HLT_2022v15_cff::navSchool, TSGForOIDNN::StrategyParameters::nHBd, TSGForOIDNN::StrategyParameters::nHLIP, TSGForOIDNN::StrategyParameters::nHLMuS, oppositeToMomentum, MillePedeFileConverter_cfg::out, GeomDetEnumerators::P2OTEC, FreeTrajectoryState::position(), L1TMuonDQMOffline_cfi::propagatorAlong, L1TMuonDQMOffline_cfi::propagatorOpposite, mps_fire::result, groupFilesInBlocks::reverse, SetPropagationDirection(), TSGForOIDNN::StrategyParameters::sf, src_, t_estimatorH_, t_geometryH_, t_magfieldH_, t_navSchool_, t_propagatorAlongH_, t_propagatorOppositeH_, t_SHPOpposite_, t_tmpTkGeometryH_, tf_session_, tf_session_HB_, tf_session_HLIP_, tf_session_HLMuS_, theCategory_, updateFeatureMap(), and useRegressor_.

252  {
253  // Initialize variables
254  unsigned int numSeedsMade = 0;
255  unsigned int layerCount = 0;
256  unsigned int hitlessSeedsMadeIP = 0;
257  unsigned int hitlessSeedsMadeMuS = 0;
258  unsigned int hitSeedsMade = 0;
259  unsigned int hitDoubletSeedsMade = 0;
260 
261  // Container for DNN inputs
262  std::unordered_map<std::string, float> feature_map;
263 
264  // Container for DNN outputs
265  StrategyParameters strPars;
266 
267  // Surface used to make a TSOS at the PCA to the beamline
269 
270  // Get setup objects
271  const MagneticField& magfield = iEventSetup.getData(t_magfieldH_);
272  const Chi2MeasurementEstimatorBase& estimator = iEventSetup.getData(t_estimatorH_);
273  const Propagator& tmpPropagatorAlong = iEventSetup.getData(t_propagatorAlongH_);
274  const Propagator& tmpPropagatorOpposite = iEventSetup.getData(t_propagatorOppositeH_);
275  const TrackerGeometry& tmpTkGeometry = iEventSetup.getData(t_tmpTkGeometryH_);
276  const GlobalTrackingGeometry& geometry = iEventSetup.getData(t_geometryH_);
277  const NavigationSchool& navSchool = iEventSetup.getData(t_navSchool_);
279 
280  // Read L2 track collection
281  auto const& l2TrackCol = iEvent.get(src_);
282 
283  // The product
284  std::unique_ptr<std::vector<TrajectorySeed> > result(new std::vector<TrajectorySeed>());
285 
286  // Get vector of Detector layers
287  auto const* gsTracker = measurementTracker.geometricSearchTracker();
288  std::vector<BarrelDetLayer const*> const& tob = gsTracker->tobLayers();
289  std::vector<ForwardDetLayer const*> const& tecPositive =
290  tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC) ? gsTracker->posTidLayers() : gsTracker->posTecLayers();
291  std::vector<ForwardDetLayer const*> const& tecNegative =
292  tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC) ? gsTracker->negTidLayers() : gsTracker->negTecLayers();
293 
294  // Get suitable propagators
295  std::unique_ptr<Propagator> propagatorAlong = SetPropagationDirection(tmpPropagatorAlong, alongMomentum);
296  std::unique_ptr<Propagator> propagatorOpposite = SetPropagationDirection(tmpPropagatorOpposite, oppositeToMomentum);
297 
298  // Stepping Helix Propagator for propogation from muon system to tracker
299  edm::ESHandle<Propagator> shpOpposite = iEventSetup.getHandle(t_SHPOpposite_);
300 
301  // Loop over the L2's and make seeds for all of them
302  LogTrace(theCategory_) << "TSGForOIDNN::produce: Number of L2's: " << l2TrackCol.size();
303 
304  for (auto const& l2 : l2TrackCol) {
305  // Container of Seeds
306  std::vector<TrajectorySeed> out;
307  LogTrace("TSGForOIDNN") << "TSGForOIDNN::produce: L2 muon pT, eta, phi --> " << l2.pt() << " , " << l2.eta()
308  << " , " << l2.phi();
309 
311 
312  dummyPlane->move(fts.position() - dummyPlane->position());
313  TrajectoryStateOnSurface tsosAtIP = TrajectoryStateOnSurface(fts, *dummyPlane);
314  LogTrace("TSGForOIDNN") << "TSGForOIDNN::produce: Created TSOSatIP: " << tsosAtIP;
315 
316  // Get the TSOS on the innermost layer of the L2
318  LogTrace("TSGForOIDNN") << "TSGForOIDNN::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem;
319 
320  LogTrace("TSGForOIDNN")
321  << "TSGForOIDNN::produce: Check the error of the L2 parameter and use hit seeds if big errors";
322 
323  StateOnTrackerBound fromInside(propagatorAlong.get());
324  TrajectoryStateOnSurface outerTkStateInside = fromInside(fts);
325 
326  StateOnTrackerBound fromOutside(&*shpOpposite);
327  TrajectoryStateOnSurface outerTkStateOutside = fromOutside(tsosAtMuonSystem);
328 
329  // Check if the two positions (using updated and not-updated TSOS) agree withing certain extent.
330  // If both TSOSs agree, use only the one at vertex, as it uses more information. If they do not agree, search for seeds based on both.
331  double l2muonEta = l2.eta();
332  double absL2muonEta = std::abs(l2muonEta);
333 
334  // make non-const copies of parameters, so they can be overriden for individual L2 muons
335  unsigned int maxHitSeeds = maxHitSeeds_;
337  unsigned int maxHitlessSeedsIP = maxHitlessSeedsIP_;
339 
340  float errorSFHitless = fixedErrorRescalingForHitless_;
341 
342  // update strategy parameters by evaluating DNN
343  if (getStrategyFromDNN_) {
344  bool dnnSuccess = false;
345 
346  // Update feature map with parameters of the current muon
347  updateFeatureMap(feature_map, l2, tsosAtIP, outerTkStateOutside);
348 
349  if (useRegressor_) {
350  // Use regressor
351  evaluateRegressor(feature_map,
353  metadata_.get_child("HB"),
355  metadata_.get_child("HLIP"),
357  metadata_.get_child("HLMuS"),
358  strPars,
359  dnnSuccess);
360  } else {
361  // Use classifier
362  evaluateClassifier(feature_map, tf_session_, metadata_, strPars, dnnSuccess);
363  }
364  if (!dnnSuccess)
365  break;
366 
367  maxHitSeeds = 0;
368  maxHitDoubletSeeds = strPars.nHBd;
369  maxHitlessSeedsIP = strPars.nHLIP;
370  maxHitlessSeedsMuS = strPars.nHLMuS;
371  errorSFHitless = strPars.sf;
372  }
373 
374  numSeedsMade = 0;
375  hitlessSeedsMadeIP = 0;
376  hitlessSeedsMadeMuS = 0;
377  hitSeedsMade = 0;
378  hitDoubletSeedsMade = 0;
379 
380  auto createSeeds = [&](auto const& layers) {
381  for (auto const& layer : boost::adaptors::reverse(layers)) {
382  if (hitlessSeedsMadeIP < maxHitlessSeedsIP && numSeedsMade < maxSeeds_)
384  tsosAtIP,
385  *(propagatorAlong.get()),
386  estimator,
387  errorSFHitless,
388  hitlessSeedsMadeIP,
389  numSeedsMade,
390  out);
391 
392  if (outerTkStateInside.isValid() && outerTkStateOutside.isValid() && hitlessSeedsMadeMuS < maxHitlessSeedsMuS &&
393  numSeedsMade < maxSeeds_)
395  outerTkStateOutside,
396  *(propagatorOpposite.get()),
397  estimator,
398  errorSFHitless,
399  hitlessSeedsMadeMuS,
400  numSeedsMade,
401  out);
402 
403  if (hitSeedsMade < maxHitSeeds && numSeedsMade < maxSeeds_)
405  tsosAtIP,
406  *(propagatorAlong.get()),
407  estimator,
409  hitSeedsMade,
410  numSeedsMade,
411  maxHitSeeds,
412  layerCount,
413  out);
414 
415  if (hitDoubletSeedsMade < maxHitDoubletSeeds && numSeedsMade < maxSeeds_)
417  tsosAtIP,
418  *(propagatorAlong.get()),
419  estimator,
421  navSchool,
422  hitDoubletSeedsMade,
423  numSeedsMade,
425  layerCount,
426  out);
427  };
428  };
429 
430  // BARREL
431  if (absL2muonEta < maxEtaForTOB_) {
432  layerCount = 0;
433  createSeeds(tob);
434  LogTrace("TSGForOIDNN") << "TSGForOIDNN:::produce: NumSeedsMade = " << numSeedsMade
435  << " , layerCount = " << layerCount;
436  }
437 
438  // Reset number of seeds if in overlap region
439  if (absL2muonEta > minEtaForTEC_ && absL2muonEta < maxEtaForTOB_) {
440  numSeedsMade = 0;
441  hitlessSeedsMadeIP = 0;
442  hitlessSeedsMadeMuS = 0;
443  hitSeedsMade = 0;
444  hitDoubletSeedsMade = 0;
445  }
446 
447  // ENDCAP+
448  if (l2muonEta > minEtaForTEC_) {
449  layerCount = 0;
450  createSeeds(tecPositive);
451  LogTrace("TSGForOIDNN") << "TSGForOIDNN:::produce: NumSeedsMade = " << numSeedsMade
452  << " , layerCount = " << layerCount;
453  }
454 
455  // ENDCAP-
456  if (l2muonEta < -minEtaForTEC_) {
457  layerCount = 0;
458  createSeeds(tecNegative);
459  LogTrace("TSGForOIDNN") << "TSGForOIDNN:::produce: NumSeedsMade = " << numSeedsMade
460  << " , layerCount = " << layerCount;
461  }
462 
463  for (std::vector<TrajectorySeed>::iterator it = out.begin(); it != out.end(); ++it) {
464  result->push_back(*it);
465  }
466 
467  } // L2Collection
468 
469  edm::LogInfo(theCategory_) << "TSGForOIDNN::produce: number of seeds made: " << result->size();
470 
471  iEvent.put(std::move(result));
472 }
const unsigned int maxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOIDNN.cc:64
void evaluateRegressor(const std::unordered_map< std::string, float > &feature_map, tensorflow::Session *session_HB, const pt::ptree &metadata_HB, tensorflow::Session *session_HLIP, const pt::ptree &metadata_HLIP, tensorflow::Session *session_HLMuS, const pt::ptree &metadata_HLMuS, StrategyParameters &out, bool &dnnSuccess) const
Evaluate DNN regressor.
Definition: TSGForOIDNN.cc:892
void updateFeatureMap(std::unordered_map< std::string, float > &the_map, const reco::Track &l2, const TrajectoryStateOnSurface &tsos_IP, const TrajectoryStateOnSurface &tsos_MuS) const
Update dictionary of inputs for DNN.
Definition: TSGForOIDNN.cc:770
tensorflow::Session * tf_session_HLMuS_
Definition: TSGForOIDNN.cc:107
const edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > t_navSchool_
Definition: TSGForOIDNN.cc:57
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > t_geometryH_
Definition: TSGForOIDNN.cc:56
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
Definition: TSGForOIDNN.cc:60
void makeSeedsFromHitDoublets(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const Chi2MeasurementEstimatorBase &estimator, const MeasurementTrackerEvent &measurementTracker, const NavigationSchool &navSchool, unsigned int &hitDoubletSeedsMade, unsigned int &numSeedsMade, const unsigned int &maxHitDoubletSeeds, unsigned int &layerCount, std::vector< TrajectorySeed > &out) const
Similar to makeSeedsFromHits, but seed is created only if there are compatible hits on two adjacent l...
Definition: TSGForOIDNN.cc:583
tensorflow::Session * tf_session_HB_
Definition: TSGForOIDNN.cc:103
const unsigned int maxHitlessSeedsMuS_
Definition: TSGForOIDNN.cc:85
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
Definition: TSGForOIDNN.cc:49
const unsigned int maxHitlessSeedsIP_
Definition: TSGForOIDNN.cc:84
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > t_estimatorH_
Tokens for ESHandle.
Definition: TSGForOIDNN.cc:51
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
Definition: TSGForOIDNN.cc:78
#define LogTrace(id)
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
GlobalPoint position() const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
int iEvent
Definition: GenABIO.cc:224
const double fixedErrorRescalingForHitless_
Rescale L2 parameter uncertainties (fixed error vs pT, eta)
Definition: TSGForOIDNN.cc:74
bool isThere(GeomDetEnumerators::SubDetector subdet) const
const std::string theCategory_
Definition: TSGForOIDNN.cc:61
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_propagatorOppositeH_
Definition: TSGForOIDNN.cc:54
const unsigned int maxHitSeeds_
Maximum number of hitbased seeds for each L2.
Definition: TSGForOIDNN.cc:66
const unsigned int maxHitDoubletSeeds_
Definition: TSGForOIDNN.cc:86
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const bool useRegressor_
Whether to use DNN regressor (if false, will use classifier)
Definition: TSGForOIDNN.cc:91
void makeSeedsWithoutHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const Chi2MeasurementEstimatorBase &estimator, double errorSF, unsigned int &hitlessSeedsMade, unsigned int &numSeedsMade, std::vector< TrajectorySeed > &out) const
Create seeds without hits on a given layer (TOB or TEC)
Definition: TSGForOIDNN.cc:477
Log< level::Info, false > LogInfo
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_SHPOpposite_
Definition: TSGForOIDNN.cc:58
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
Definition: TSGForOIDNN.cc:80
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > t_magfieldH_
Definition: TSGForOIDNN.cc:52
tensorflow::Session * tf_session_
Definition: TSGForOIDNN.cc:96
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_propagatorAlongH_
Definition: TSGForOIDNN.cc:53
const bool getStrategyFromDNN_
Get number of seeds to use from DNN output instead of "max..Seeds" parameters.
Definition: TSGForOIDNN.cc:89
pt::ptree metadata_
Definition: TSGForOIDNN.cc:111
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > t_tmpTkGeometryH_
Definition: TSGForOIDNN.cc:55
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
void evaluateClassifier(const std::unordered_map< std::string, float > &feature_map, tensorflow::Session *session, const pt::ptree &metadata, StrategyParameters &out, bool &dnnSuccess) const
Evaluate DNN classifier.
Definition: TSGForOIDNN.cc:835
def move(src, dest)
Definition: eostools.py:511
void makeSeedsFromHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsos, const Propagator &propagatorAlong, const Chi2MeasurementEstimatorBase &estimator, const MeasurementTrackerEvent &measurementTracker, unsigned int &hitSeedsMade, unsigned int &numSeedsMade, const unsigned int &maxHitSeeds, unsigned int &layerCount, std::vector< TrajectorySeed > &out) const
Find hits on a given layer (TOB or TEC) and create seeds from updated TSOS with hit.
Definition: TSGForOIDNN.cc:511
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
tensorflow::Session * tf_session_HLIP_
Definition: TSGForOIDNN.cc:105

◆ updateFeatureMap()

void TSGForOIDNN::updateFeatureMap ( std::unordered_map< std::string, float > &  the_map,
const reco::Track l2,
const TrajectoryStateOnSurface tsos_IP,
const TrajectoryStateOnSurface tsos_MuS 
) const
private

Update dictionary of inputs for DNN.

Definition at line 770 of file TSGForOIDNN.cc.

References TrajectoryStateOnSurface::curvilinearError(), PV3DBase< T, PVType, FrameType >::eta(), reco::TrackBase::eta(), reco::Track::found(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), CurvilinearTrajectoryError::matrix(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), reco::TrackBase::phi(), reco::TrackBase::pt(), and mathSSE::sqrt().

Referenced by produce().

773  {
774  the_map["pt"] = l2.pt();
775  the_map["eta"] = l2.eta();
776  the_map["phi"] = l2.phi();
777  the_map["validHits"] = l2.found();
778  if (tsos_IP.isValid()) {
779  the_map["tsos_IP_eta"] = tsos_IP.globalPosition().eta();
780  the_map["tsos_IP_phi"] = tsos_IP.globalPosition().phi();
781  the_map["tsos_IP_pt"] = tsos_IP.globalMomentum().perp();
782  the_map["tsos_IP_pt_eta"] = tsos_IP.globalMomentum().eta();
783  the_map["tsos_IP_pt_phi"] = tsos_IP.globalMomentum().phi();
784  const AlgebraicSymMatrix55& matrix_IP = tsos_IP.curvilinearError().matrix();
785  the_map["err0_IP"] = sqrt(matrix_IP[0][0]);
786  the_map["err1_IP"] = sqrt(matrix_IP[1][1]);
787  the_map["err2_IP"] = sqrt(matrix_IP[2][2]);
788  the_map["err3_IP"] = sqrt(matrix_IP[3][3]);
789  the_map["err4_IP"] = sqrt(matrix_IP[4][4]);
790  the_map["tsos_IP_valid"] = 1.0;
791  } else {
792  the_map["tsos_IP_eta"] = -999;
793  the_map["tsos_IP_phi"] = -999;
794  the_map["tsos_IP_pt"] = -999;
795  the_map["tsos_IP_pt_eta"] = -999;
796  the_map["tsos_IP_pt_phi"] = -999;
797  the_map["err0_IP"] = -999;
798  the_map["err1_IP"] = -999;
799  the_map["err2_IP"] = -999;
800  the_map["err3_IP"] = -999;
801  the_map["err4_IP"] = -999;
802  the_map["tsos_IP_valid"] = 0.0;
803  }
804  if (tsos_MuS.isValid()) {
805  the_map["tsos_MuS_eta"] = tsos_MuS.globalPosition().eta();
806  the_map["tsos_MuS_phi"] = tsos_MuS.globalPosition().phi();
807  the_map["tsos_MuS_pt"] = tsos_MuS.globalMomentum().perp();
808  the_map["tsos_MuS_pt_eta"] = tsos_MuS.globalMomentum().eta();
809  the_map["tsos_MuS_pt_phi"] = tsos_MuS.globalMomentum().phi();
810  const AlgebraicSymMatrix55& matrix_MuS = tsos_MuS.curvilinearError().matrix();
811  the_map["err0_MuS"] = sqrt(matrix_MuS[0][0]);
812  the_map["err1_MuS"] = sqrt(matrix_MuS[1][1]);
813  the_map["err2_MuS"] = sqrt(matrix_MuS[2][2]);
814  the_map["err3_MuS"] = sqrt(matrix_MuS[3][3]);
815  the_map["err4_MuS"] = sqrt(matrix_MuS[4][4]);
816  the_map["tsos_MuS_valid"] = 1.0;
817  } else {
818  the_map["tsos_MuS_eta"] = -999;
819  the_map["tsos_MuS_phi"] = -999;
820  the_map["tsos_MuS_pt"] = -999;
821  the_map["tsos_MuS_pt_eta"] = -999;
822  the_map["tsos_MuS_pt_phi"] = -999;
823  the_map["err0_MuS"] = -999;
824  the_map["err1_MuS"] = -999;
825  the_map["err2_MuS"] = -999;
826  the_map["err3_MuS"] = -999;
827  the_map["err4_MuS"] = -999;
828  the_map["tsos_MuS_valid"] = 0.0;
829  }
830 }
T perp() const
Definition: PV3DBase.h:69
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:142
double pt() const
track transverse momentum
Definition: TrackBase.h:637
GlobalPoint globalPosition() const
T sqrt(T t)
Definition: SSEVec.h:19
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
const CurvilinearTrajectoryError & curvilinearError() const
const AlgebraicSymMatrix55 & matrix() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalVector globalMomentum() const

Member Data Documentation

◆ dnnMetadataPath_

const std::string TSGForOIDNN::dnnMetadataPath_
private

DNN metadata.

Definition at line 110 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ dnnModelPath_

std::string TSGForOIDNN::dnnModelPath_
private

Settings for classifier.

Definition at line 94 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ dnnModelPath_HB_

std::string TSGForOIDNN::dnnModelPath_HB_
private

Settings for regressor.

Definition at line 99 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ dnnModelPath_HLIP_

std::string TSGForOIDNN::dnnModelPath_HLIP_
private

Definition at line 100 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ dnnModelPath_HLMuS_

std::string TSGForOIDNN::dnnModelPath_HLMuS_
private

Definition at line 101 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ estimatorName_

const std::string TSGForOIDNN::estimatorName_
private

Estimator used to find dets and TrajectoryMeasurements.

Definition at line 76 of file TSGForOIDNN.cc.

◆ fixedErrorRescalingForHitless_

const double TSGForOIDNN::fixedErrorRescalingForHitless_
private

Rescale L2 parameter uncertainties (fixed error vs pT, eta)

Definition at line 74 of file TSGForOIDNN.cc.

Referenced by produce().

◆ getStrategyFromDNN_

const bool TSGForOIDNN::getStrategyFromDNN_
private

Get number of seeds to use from DNN output instead of "max..Seeds" parameters.

Definition at line 89 of file TSGForOIDNN.cc.

Referenced by produce(), TSGForOIDNN(), and ~TSGForOIDNN().

◆ graphDef_

std::unique_ptr<tensorflow::GraphDef> TSGForOIDNN::graphDef_
private

Definition at line 95 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ graphDef_HB_

std::unique_ptr<tensorflow::GraphDef> TSGForOIDNN::graphDef_HB_
private

Definition at line 102 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ graphDef_HLIP_

std::unique_ptr<tensorflow::GraphDef> TSGForOIDNN::graphDef_HLIP_
private

Definition at line 104 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ graphDef_HLMuS_

std::unique_ptr<tensorflow::GraphDef> TSGForOIDNN::graphDef_HLMuS_
private

Definition at line 106 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

◆ maxEtaForTOB_

const double TSGForOIDNN::maxEtaForTOB_
private

Maximum eta value to activate searching in the TOB.

Definition at line 80 of file TSGForOIDNN.cc.

Referenced by produce().

◆ maxHitDoubletSeeds_

const unsigned int TSGForOIDNN::maxHitDoubletSeeds_
private

Definition at line 86 of file TSGForOIDNN.cc.

Referenced by produce().

◆ maxHitlessSeeds_

const unsigned int TSGForOIDNN::maxHitlessSeeds_
private

Maximum number of hitless seeds for each L2.

Definition at line 68 of file TSGForOIDNN.cc.

◆ maxHitlessSeedsIP_

const unsigned int TSGForOIDNN::maxHitlessSeedsIP_
private

IP refers to TSOS at interaction point, MuS refers to TSOS at muon system

Definition at line 84 of file TSGForOIDNN.cc.

Referenced by produce().

◆ maxHitlessSeedsMuS_

const unsigned int TSGForOIDNN::maxHitlessSeedsMuS_
private

Definition at line 85 of file TSGForOIDNN.cc.

Referenced by produce().

◆ maxHitSeeds_

const unsigned int TSGForOIDNN::maxHitSeeds_
private

Maximum number of hitbased seeds for each L2.

Definition at line 66 of file TSGForOIDNN.cc.

Referenced by produce().

◆ maxSeeds_

const unsigned int TSGForOIDNN::maxSeeds_
private

Maximum number of seeds for each L2.

Definition at line 64 of file TSGForOIDNN.cc.

Referenced by produce().

◆ measurementTrackerTag_

const edm::EDGetTokenT<MeasurementTrackerEvent> TSGForOIDNN::measurementTrackerTag_
private

Definition at line 60 of file TSGForOIDNN.cc.

Referenced by produce().

◆ metadata_

pt::ptree TSGForOIDNN::metadata_
private

Definition at line 111 of file TSGForOIDNN.cc.

Referenced by produce(), and TSGForOIDNN().

◆ minEtaForTEC_

const double TSGForOIDNN::minEtaForTEC_
private

Minimum eta value to activate searching in the TEC.

Definition at line 78 of file TSGForOIDNN.cc.

Referenced by produce().

◆ numOfHitsToTry_

const unsigned int TSGForOIDNN::numOfHitsToTry_
private

How many hits to try per layer.

Definition at line 72 of file TSGForOIDNN.cc.

Referenced by makeSeedsFromHitDoublets(), and makeSeedsFromHits().

◆ numOfLayersToTry_

const unsigned int TSGForOIDNN::numOfLayersToTry_
private

How many layers to try.

Definition at line 70 of file TSGForOIDNN.cc.

Referenced by makeSeedsFromHits().

◆ src_

const edm::EDGetTokenT<reco::TrackCollection> TSGForOIDNN::src_
private

Labels for input collections.

Definition at line 49 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_estimatorH_

const edm::ESGetToken<Chi2MeasurementEstimatorBase, TrackingComponentsRecord> TSGForOIDNN::t_estimatorH_
private

Tokens for ESHandle.

Definition at line 51 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_geometryH_

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> TSGForOIDNN::t_geometryH_
private

Definition at line 56 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_magfieldH_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TSGForOIDNN::t_magfieldH_
private

Definition at line 52 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_navSchool_

const edm::ESGetToken<NavigationSchool, NavigationSchoolRecord> TSGForOIDNN::t_navSchool_
private

Definition at line 57 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_propagatorAlongH_

const edm::ESGetToken<Propagator, TrackingComponentsRecord> TSGForOIDNN::t_propagatorAlongH_
private

Definition at line 53 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_propagatorOppositeH_

const edm::ESGetToken<Propagator, TrackingComponentsRecord> TSGForOIDNN::t_propagatorOppositeH_
private

Definition at line 54 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_SHPOpposite_

const edm::ESGetToken<Propagator, TrackingComponentsRecord> TSGForOIDNN::t_SHPOpposite_
private

Definition at line 58 of file TSGForOIDNN.cc.

Referenced by produce().

◆ t_tmpTkGeometryH_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> TSGForOIDNN::t_tmpTkGeometryH_
private

Definition at line 55 of file TSGForOIDNN.cc.

Referenced by produce().

◆ tf_session_

tensorflow::Session* TSGForOIDNN::tf_session_
private

Definition at line 96 of file TSGForOIDNN.cc.

Referenced by produce(), TSGForOIDNN(), and ~TSGForOIDNN().

◆ tf_session_HB_

tensorflow::Session* TSGForOIDNN::tf_session_HB_
private

Definition at line 103 of file TSGForOIDNN.cc.

Referenced by produce(), TSGForOIDNN(), and ~TSGForOIDNN().

◆ tf_session_HLIP_

tensorflow::Session* TSGForOIDNN::tf_session_HLIP_
private

Definition at line 105 of file TSGForOIDNN.cc.

Referenced by produce(), TSGForOIDNN(), and ~TSGForOIDNN().

◆ tf_session_HLMuS_

tensorflow::Session* TSGForOIDNN::tf_session_HLMuS_
private

Definition at line 107 of file TSGForOIDNN.cc.

Referenced by produce(), TSGForOIDNN(), and ~TSGForOIDNN().

◆ theCategory_

const std::string TSGForOIDNN::theCategory_
private

Definition at line 61 of file TSGForOIDNN.cc.

Referenced by makeSeedsWithoutHits(), and produce().

◆ updator_

const std::unique_ptr<TrajectoryStateUpdator> TSGForOIDNN::updator_
private

Definition at line 59 of file TSGForOIDNN.cc.

Referenced by makeSeedsFromHitDoublets(), and makeSeedsFromHits().

◆ useRegressor_

const bool TSGForOIDNN::useRegressor_
private

Whether to use DNN regressor (if false, will use classifier)

Definition at line 91 of file TSGForOIDNN.cc.

Referenced by produce(), TSGForOIDNN(), and ~TSGForOIDNN().