CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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_barrel_
 
std::string dnnModelPath_endcap_
 
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 etaSplitForDnn_
 Settings for classifier. 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_barrel_
 
std::unique_ptr
< tensorflow::GraphDef > 
graphDef_endcap_
 
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
< MeasurementTrackerEvent
measurementTrackerTag_
 
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::TrackCollection
src_
 Labels for input collections. More...
 
const edm::ESGetToken
< Chi2MeasurementEstimatorBase,
TrackingComponentsRecord
t_estimatorH_
 Tokens for ESHandle. More...
 
const edm::ESGetToken
< GlobalTrackingGeometry,
GlobalTrackingGeometryRecord
t_geometryH_
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
t_magfieldH_
 
const edm::ESGetToken
< NavigationSchool,
NavigationSchoolRecord
t_navSchool_
 
const edm::ESGetToken
< Propagator,
TrackingComponentsRecord
t_propagatorAlongH_
 
const edm::ESGetToken
< Propagator,
TrackingComponentsRecord
t_propagatorOppositeH_
 
const edm::ESGetToken
< Propagator,
TrackingComponentsRecord
t_SHPOpposite_
 
const edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
t_tmpTkGeometryH_
 
tensorflow::Session * tf_session_barrel_
 
tensorflow::Session * tf_session_endcap_
 
tensorflow::Session * tf_session_HB_
 
tensorflow::Session * tf_session_HLIP_
 
tensorflow::Session * tf_session_HLMuS_
 
const std::string theCategory_
 
const std::unique_ptr
< TrajectoryStateUpdator
updator_
 
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
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
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< B > consumes (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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 182 of file TSGForOIDNN.cc.

References tensorflow::createSession(), dnnMetadataPath_, dnnModelPath_barrel_, dnnModelPath_endcap_, dnnModelPath_HB_, dnnModelPath_HLIP_, dnnModelPath_HLMuS_, edm::FileInPath::fullPath(), getStrategyFromDNN_, graphDef_barrel_, graphDef_endcap_, graphDef_HB_, graphDef_HLIP_, graphDef_HLMuS_, tensorflow::loadGraphDef(), metadata_, tensorflow::setLogging(), AlCaHLTBitMon_QueryRunRegistry::string, tf_session_barrel_, tf_session_endcap_, tf_session_HB_, tf_session_HLIP_, tf_session_HLMuS_, and useRegressor_.

183  : src_(consumes(iConfig.getParameter<edm::InputTag>("src"))),
184  t_estimatorH_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("estimator")))),
186  t_propagatorAlongH_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("propagatorName")))),
190  t_navSchool_(esConsumes(edm::ESInputTag("", "SimpleNavigationSchool"))),
191  t_SHPOpposite_(esConsumes(edm::ESInputTag("", "hltESPSteppingHelixPropagatorOpposite"))),
192  updator_(new KFUpdator()),
193  measurementTrackerTag_(consumes(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent"))),
194  theCategory_(std::string("Muon|RecoMuon|TSGForOIDNN")),
195  maxSeeds_(iConfig.getParameter<uint32_t>("maxSeeds")),
196  maxHitSeeds_(iConfig.getParameter<uint32_t>("maxHitSeeds")),
197  maxHitlessSeeds_(iConfig.getParameter<uint32_t>("maxHitlessSeeds")),
198  numOfLayersToTry_(iConfig.getParameter<int32_t>("layersToTry")),
199  numOfHitsToTry_(iConfig.getParameter<int32_t>("hitsToTry")),
200  fixedErrorRescalingForHitless_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHitless")),
201  minEtaForTEC_(iConfig.getParameter<double>("minEtaForTEC")),
202  maxEtaForTOB_(iConfig.getParameter<double>("maxEtaForTOB")),
203  maxHitlessSeedsIP_(iConfig.getParameter<uint32_t>("maxHitlessSeedsIP")),
204  maxHitlessSeedsMuS_(iConfig.getParameter<uint32_t>("maxHitlessSeedsMuS")),
205  maxHitDoubletSeeds_(iConfig.getParameter<uint32_t>("maxHitDoubletSeeds")),
206  getStrategyFromDNN_(iConfig.getParameter<bool>("getStrategyFromDNN")),
207  useRegressor_(iConfig.getParameter<bool>("useRegressor")),
208  etaSplitForDnn_(iConfig.getParameter<double>("etaSplitForDnn")),
209  dnnMetadataPath_(iConfig.getParameter<std::string>("dnnMetadataPath")) {
210  if (getStrategyFromDNN_) {
211  edm::FileInPath dnnMetadataPath(dnnMetadataPath_);
212  pt::read_json(dnnMetadataPath.fullPath(), metadata_);
214 
215  if (useRegressor_) {
216  // use regressor
217  dnnModelPath_HB_ = metadata_.get<std::string>("HB.dnnmodel_path");
218  edm::FileInPath dnnPath_HB(dnnModelPath_HB_);
219  graphDef_HB_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_HB.fullPath()));
221 
222  dnnModelPath_HLIP_ = metadata_.get<std::string>("HLIP.dnnmodel_path");
223  edm::FileInPath dnnPath_HLIP(dnnModelPath_HLIP_);
224  graphDef_HLIP_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_HLIP.fullPath()));
226 
227  dnnModelPath_HLMuS_ = metadata_.get<std::string>("HLMuS.dnnmodel_path");
228  edm::FileInPath dnnPath_HLMuS(dnnModelPath_HLMuS_);
229  graphDef_HLMuS_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_HLMuS.fullPath()));
231  } else {
232  // use classifier (default)
233  dnnModelPath_barrel_ = metadata_.get<std::string>("barrel.dnnmodel_path");
234  edm::FileInPath dnnPath_barrel(dnnModelPath_barrel_);
235  graphDef_barrel_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_barrel.fullPath()));
237 
238  dnnModelPath_endcap_ = metadata_.get<std::string>("endcap.dnnmodel_path");
239  edm::FileInPath dnnPath_endcap(dnnModelPath_endcap_);
240  graphDef_endcap_ = std::unique_ptr<tensorflow::GraphDef>(tensorflow::loadGraphDef(dnnPath_endcap.fullPath()));
242  }
243  }
244  produces<std::vector<TrajectorySeed> >();
245 }
Session * createSession(SessionOptions &sessionOptions)
Definition: TensorFlow.cc:85
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOIDNN.cc:72
std::string dnnModelPath_HLIP_
Definition: TSGForOIDNN.cc:104
const unsigned int maxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOIDNN.cc:64
std::string dnnModelPath_HLMuS_
Definition: TSGForOIDNN.cc:105
tensorflow::Session * tf_session_HLMuS_
Definition: TSGForOIDNN.cc:111
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:68
std::unique_ptr< tensorflow::GraphDef > graphDef_endcap_
Definition: TSGForOIDNN.cc:99
tensorflow::Session * tf_session_HB_
Definition: TSGForOIDNN.cc:107
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:108
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > t_estimatorH_
Tokens for ESHandle.
Definition: TSGForOIDNN.cc:51
tensorflow::Session * tf_session_endcap_
Definition: TSGForOIDNN.cc:100
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:114
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
const double etaSplitForDnn_
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:15
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string dnnModelPath_HB_
Settings for regressor.
Definition: TSGForOIDNN.cc:103
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > t_magfieldH_
Definition: TSGForOIDNN.cc:52
std::string dnnModelPath_barrel_
Definition: TSGForOIDNN.cc:95
std::unique_ptr< tensorflow::GraphDef > graphDef_HB_
Definition: TSGForOIDNN.cc:106
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 &quot;max..Seeds&quot; parameters.
Definition: TSGForOIDNN.cc:89
std::unique_ptr< tensorflow::GraphDef > graphDef_HLMuS_
Definition: TSGForOIDNN.cc:110
pt::ptree metadata_
Definition: TSGForOIDNN.cc:115
const std::unique_ptr< TrajectoryStateUpdator > updator_
Definition: TSGForOIDNN.cc:59
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > t_tmpTkGeometryH_
Definition: TSGForOIDNN.cc:55
std::unique_ptr< tensorflow::GraphDef > graphDef_barrel_
Definition: TSGForOIDNN.cc:97
std::string dnnModelPath_endcap_
Definition: TSGForOIDNN.cc:96
const unsigned int maxHitlessSeeds_
Maximum number of hitless seeds for each L2.
Definition: TSGForOIDNN.cc:68
tensorflow::Session * tf_session_barrel_
Definition: TSGForOIDNN.cc:98
tensorflow::Session * tf_session_HLIP_
Definition: TSGForOIDNN.cc:109
TSGForOIDNN::~TSGForOIDNN ( )
override

Definition at line 247 of file TSGForOIDNN.cc.

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

247  {
248  if (getStrategyFromDNN_) {
249  if (useRegressor_) {
253  } else {
256  }
257  }
258 }
tensorflow::Session * tf_session_HLMuS_
Definition: TSGForOIDNN.cc:111
tensorflow::Session * tf_session_HB_
Definition: TSGForOIDNN.cc:107
tensorflow::Session * tf_session_endcap_
Definition: TSGForOIDNN.cc:100
bool closeSession(Session *&session)
Definition: TensorFlow.cc:198
const bool useRegressor_
Whether to use DNN regressor (if false, will use classifier)
Definition: TSGForOIDNN.cc:91
const bool getStrategyFromDNN_
Get number of seeds to use from DNN output instead of &quot;max..Seeds&quot; parameters.
Definition: TSGForOIDNN.cc:89
tensorflow::Session * tf_session_barrel_
Definition: TSGForOIDNN.cc:98
tensorflow::Session * tf_session_HLIP_
Definition: TSGForOIDNN.cc:109

Member Function Documentation

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 849 of file TSGForOIDNN.cc.

References alignmentValidation::fname, mps_fire::i, input, label, TSGForOIDNN::StrategyParameters::nHBd, TSGForOIDNN::StrategyParameters::nHLIP, TSGForOIDNN::StrategyParameters::nHLMuS, tensorflow::run(), TSGForOIDNN::StrategyParameters::sf, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

853  {
854  int n_features = metadata.get<int>("n_features", 0);
855 
856  // Prepare tensor for DNN inputs
857  tensorflow::Tensor input(tensorflow::DT_FLOAT, {1, n_features});
859  int i_feature = 0;
860  for (const pt::ptree::value_type& feature : metadata.get_child("feature_names")) {
861  fname = feature.second.data();
862  if (feature_map.find(fname) == feature_map.end()) {
863  // don't evaluate DNN if any input feature is missing
864  dnnSuccess = false;
865  } else {
866  input.matrix<float>()(0, i_feature) = float(feature_map.at(fname));
867  i_feature++;
868  }
869  }
870 
871  // Prepare tensor for DNN outputs
872  std::vector<tensorflow::Tensor> outputs;
873 
874  // Evaluate DNN and put results in output tensor
875  std::string inputLayer = metadata.get<std::string>("input_layer");
876  std::string outputLayer = metadata.get<std::string>("output_layer");
877 
878  tensorflow::run(session, {{inputLayer, input}}, {outputLayer}, &outputs);
879  tensorflow::Tensor out_tensor = outputs[0];
880  tensorflow::TTypes<float, 1>::Matrix dnn_outputs = out_tensor.matrix<float>();
881 
882  // Find output with largest prediction
883  int imax = -1;
884  float out_max = 0;
885  for (long long int i = 0; i < out_tensor.dim_size(1); i++) {
886  float ith_output = dnn_outputs(0, i);
887  if (ith_output > out_max) {
888  imax = i;
889  out_max = ith_output;
890  }
891  }
892 
893  // Decode output
894  const std::string label = "output_labels.label_" + std::to_string(imax);
895  out.nHBd = metadata.get<int>(label + ".nHBd");
896  out.nHLIP = metadata.get<int>(label + ".nHLIP");
897  out.nHLMuS = metadata.get<int>(label + ".nHLMuS");
898  out.sf = metadata.get<int>(label + ".SF");
899 
900  dnnSuccess = true;
901 }
CLHEP::HepMatrix Matrix
Definition: matutil.h:62
static std::string const input
Definition: EdmProvDump.cc:47
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:213
string fname
main script
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 906 of file TSGForOIDNN.cc.

References alignmentValidation::fname, input, TSGForOIDNN::StrategyParameters::nHBd, TSGForOIDNN::StrategyParameters::nHLIP, TSGForOIDNN::StrategyParameters::nHLMuS, tensorflow::run(), TSGForOIDNN::StrategyParameters::sf, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

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

Definition at line 990 of file TSGForOIDNN.cc.

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

990  {
992  desc.add<edm::InputTag>("src", edm::InputTag("hltL2Muons", "UpdatedAtVtx"));
993  desc.add<int>("layersToTry", 2);
994  desc.add<double>("fixedErrorRescaleFactorForHitless", 2.0);
995  desc.add<int>("hitsToTry", 1);
996  desc.add<edm::InputTag>("MeasurementTrackerEvent", edm::InputTag("hltSiStripClusters"));
997  desc.add<std::string>("estimator", "hltESPChi2MeasurementEstimator100");
998  desc.add<double>("maxEtaForTOB", 1.8);
999  desc.add<double>("minEtaForTEC", 0.7);
1000  desc.addUntracked<bool>("debug", false);
1001  desc.add<unsigned int>("maxSeeds", 20);
1002  desc.add<unsigned int>("maxHitlessSeeds", 5);
1003  desc.add<unsigned int>("maxHitSeeds", 1);
1004  desc.add<std::string>("propagatorName", "PropagatorWithMaterialParabolicMf");
1005  desc.add<unsigned int>("maxHitlessSeedsIP", 5);
1006  desc.add<unsigned int>("maxHitlessSeedsMuS", 0);
1007  desc.add<unsigned int>("maxHitDoubletSeeds", 0);
1008  desc.add<bool>("getStrategyFromDNN", false);
1009  desc.add<bool>("useRegressor", false);
1010  desc.add<double>("etaSplitForDnn", 1.0);
1011  desc.add<std::string>("dnnMetadataPath", "");
1012  descriptions.add("tsgForOIDNN", desc);
1013 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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 597 of file TSGForOIDNN.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), MeasurementDetWithData::fastMeasurements(), newFWLiteAna::found, TrajectoryStateOnSurface::freeState(), MeasurementTrackerEvent::idToDet(), MeasurementDetWithData::isNull(), TrajectoryStateOnSurface::isValid(), phase1PixelTopology::layer, LogTrace, eostools::move(), NavigationSchool::nextLayers(), numOfHitsToTry_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), fileCollector::seed, edm::OwnVector< T, P >::size(), and updator_.

Referenced by produce().

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

References GeometricSearchDet::compatibleDetsV(), MeasurementDetWithData::fastMeasurements(), newFWLiteAna::found, MeasurementTrackerEvent::idToDet(), MeasurementDetWithData::isNull(), TrajectoryStateOnSurface::isValid(), LogTrace, eostools::move(), numOfHitsToTry_, numOfLayersToTry_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), fileCollector::seed, edm::OwnVector< T, P >::size(), and updator_.

Referenced by produce().

534  {
535  if (layerCount > numOfLayersToTry_)
536  return;
537 
538  const TrajectoryStateOnSurface& onLayer(tsos);
539 
540  std::vector<GeometricSearchDet::DetWithState> dets;
541  layer.compatibleDetsV(onLayer, propagatorAlong, estimator, dets);
542 
543  // Find Measurements on each DetWithState
544  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: Find measurements on each detWithState " << dets.size();
545  std::vector<TrajectoryMeasurement> meas;
546  for (auto const& detI : dets) {
547  MeasurementDetWithData det = measurementTracker.idToDet(detI.first->geographicalId());
548  if (det.isNull())
549  continue;
550  if (!detI.second.isValid())
551  continue; // Skip if TSOS is not valid
552 
553  std::vector<TrajectoryMeasurement> mymeas =
554  det.fastMeasurements(detI.second, onLayer, propagatorAlong, estimator); // Second TSOS is not used
555  for (auto const& measurement : mymeas) {
556  if (measurement.recHit()->isValid())
557  meas.push_back(measurement); // Only save those which are valid
558  }
559  }
560 
561  // Update TSOS using TMs after sorting, then create Trajectory Seed and put into vector
562  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: Update TSOS using TMs after sorting, then create "
563  "Trajectory Seed, number of TM = "
564  << meas.size();
565  std::sort(meas.begin(), meas.end(), TrajMeasLessEstim());
566 
567  unsigned int found = 0;
568  for (auto const& measurement : meas) {
569  if (hitSeedsMade >= maxHitSeeds)
570  return;
571  TrajectoryStateOnSurface updatedTSOS = updator_->update(measurement.forwardPredictedState(), *measurement.recHit());
572  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: TSOS for TM " << found;
573  if (not updatedTSOS.isValid())
574  continue;
575 
577  seedHits.push_back(*measurement.recHit()->hit());
578  PTrajectoryStateOnDet const& pstate =
579  trajectoryStateTransform::persistentState(updatedTSOS, measurement.recHit()->geographicalId().rawId());
580  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsFromHits: Number of seedHits: " << seedHits.size();
581  TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum);
582  out.push_back(seed);
583  found++;
584  numSeedsMade++;
585  hitSeedsMade++;
586  if (found == numOfHitsToTry_)
587  break;
588  }
589 
590  if (found)
591  layerCount++;
592 }
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOIDNN.cc:72
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
size_type size() const
Definition: OwnVector.h:300
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
#define LogTrace(id)
void push_back(D *&d)
Definition: OwnVector.h:326
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
def move
Definition: eostools.py:511
const unsigned int numOfLayersToTry_
How many layers to try.
Definition: TSGForOIDNN.cc:70
const std::unique_ptr< TrajectoryStateUpdator > updator_
Definition: TSGForOIDNN.cc:59
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
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 491 of file TSGForOIDNN.cc.

References GeometricSearchDet::compatibleDetsV(), LogTrace, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), and theCategory_.

Referenced by produce().

498  {
499  // create hitless seeds
500  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsWithoutHits: Start hitless";
501  std::vector<GeometricSearchDet::DetWithState> dets;
502  layer.compatibleDetsV(tsos, propagatorAlong, estimator, dets);
503  if (!dets.empty()) {
504  auto const& detOnLayer = dets.front().first;
505  auto& tsosOnLayer = dets.front().second;
506  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsWithoutHits: tsosOnLayer " << tsosOnLayer;
507  if (!tsosOnLayer.isValid()) {
508  edm::LogInfo(theCategory_) << "ERROR!: Hitless TSOS is not valid!";
509  } else {
510  tsosOnLayer.rescaleError(errorSF);
511  PTrajectoryStateOnDet const& ptsod =
512  trajectoryStateTransform::persistentState(tsosOnLayer, detOnLayer->geographicalId().rawId());
514  out.push_back(TrajectorySeed(ptsod, rHC, oppositeToMomentum));
515  LogTrace("TSGForOIDNN") << "TSGForOIDNN::makeSeedsWithoutHits: TSOS (Hitless) done ";
516  hitlessSeedsMade++;
517  numSeedsMade++;
518  }
519  }
520 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
#define LogTrace(id)
const std::string theCategory_
Definition: TSGForOIDNN.cc:61
Log< level::Info, false > LogInfo
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
void TSGForOIDNN::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 263 of file TSGForOIDNN.cc.

References funct::abs(), alongMomentum, Plane::build(), etaSplitForDnn_, evaluateClassifier(), evaluateRegressor(), fixedErrorRescalingForHitless_, relativeConstraints::geometry, edm::Event::get(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), getStrategyFromDNN_, trajectoryStateTransform::initialFreeState(), trajectoryStateTransform::innerStateOnSurface(), PixelPluginsPhase0_cfi::isBarrel, TrackerGeometry::isThere(), TrajectoryStateOnSurface::isValid(), phase1PixelTopology::layer, LayerTriplets::layers(), LogTrace, volumeBasedMagneticField_160812_cfi::magfield, makeSeedsFromHitDoublets(), makeSeedsFromHits(), makeSeedsWithoutHits(), maxEtaForTOB_, maxHitDoubletSeeds_, maxHitlessSeedsIP_, maxHitlessSeedsMuS_, HLT_FULL_cff::maxHitSeeds, maxHitSeeds_, maxSeeds_, HLT_FULL_cff::measurementTracker, measurementTrackerTag_, metadata_, minEtaForTEC_, eostools::move(), TSGForOIDNN::StrategyParameters::nHBd, TSGForOIDNN::StrategyParameters::nHLIP, TSGForOIDNN::StrategyParameters::nHLMuS, oppositeToMomentum, submitPVResolutionJobs::out, GeomDetEnumerators::P2OTEC, FreeTrajectoryState::position(), HLT_FULL_cff::propagatorAlong, HLT_FULL_cff::propagatorOpposite, edm::Event::put(), mps_fire::result, SetPropagationDirection(), TSGForOIDNN::StrategyParameters::sf, src_, t_estimatorH_, t_geometryH_, t_magfieldH_, t_navSchool_, t_propagatorAlongH_, t_propagatorOppositeH_, t_SHPOpposite_, t_tmpTkGeometryH_, tf_session_barrel_, tf_session_endcap_, tf_session_HB_, tf_session_HLIP_, tf_session_HLMuS_, theCategory_, updateFeatureMap(), and useRegressor_.

263  {
264  // Initialize variables
265  unsigned int numSeedsMade = 0;
266  unsigned int layerCount = 0;
267  unsigned int hitlessSeedsMadeIP = 0;
268  unsigned int hitlessSeedsMadeMuS = 0;
269  unsigned int hitSeedsMade = 0;
270  unsigned int hitDoubletSeedsMade = 0;
271 
272  // Container for DNN inputs
273  std::unordered_map<std::string, float> feature_map;
274 
275  // Container for DNN outputs
276  StrategyParameters strPars;
277 
278  // Surface used to make a TSOS at the PCA to the beamline
280 
281  // Get setup objects
282  const MagneticField& magfield = iEventSetup.getData(t_magfieldH_);
283  const Chi2MeasurementEstimatorBase& estimator = iEventSetup.getData(t_estimatorH_);
284  const Propagator& tmpPropagatorAlong = iEventSetup.getData(t_propagatorAlongH_);
285  const Propagator& tmpPropagatorOpposite = iEventSetup.getData(t_propagatorOppositeH_);
286  const TrackerGeometry& tmpTkGeometry = iEventSetup.getData(t_tmpTkGeometryH_);
287  const GlobalTrackingGeometry& geometry = iEventSetup.getData(t_geometryH_);
288  const NavigationSchool& navSchool = iEventSetup.getData(t_navSchool_);
289  auto const& measurementTracker = iEvent.get(measurementTrackerTag_);
290 
291  // Read L2 track collection
292  auto const& l2TrackCol = iEvent.get(src_);
293 
294  // The product
295  std::unique_ptr<std::vector<TrajectorySeed> > result(new std::vector<TrajectorySeed>());
296 
297  // Get vector of Detector layers
298  auto const* gsTracker = measurementTracker.geometricSearchTracker();
299  std::vector<BarrelDetLayer const*> const& tob = gsTracker->tobLayers();
300  std::vector<ForwardDetLayer const*> const& tecPositive =
301  tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC) ? gsTracker->posTidLayers() : gsTracker->posTecLayers();
302  std::vector<ForwardDetLayer const*> const& tecNegative =
303  tmpTkGeometry.isThere(GeomDetEnumerators::P2OTEC) ? gsTracker->negTidLayers() : gsTracker->negTecLayers();
304 
305  // Get suitable propagators
306  std::unique_ptr<Propagator> propagatorAlong = SetPropagationDirection(tmpPropagatorAlong, alongMomentum);
307  std::unique_ptr<Propagator> propagatorOpposite = SetPropagationDirection(tmpPropagatorOpposite, oppositeToMomentum);
308 
309  // Stepping Helix Propagator for propogation from muon system to tracker
310  edm::ESHandle<Propagator> shpOpposite = iEventSetup.getHandle(t_SHPOpposite_);
311 
312  // Loop over the L2's and make seeds for all of them
313  LogTrace(theCategory_) << "TSGForOIDNN::produce: Number of L2's: " << l2TrackCol.size();
314 
315  for (auto const& l2 : l2TrackCol) {
316  // Container of Seeds
317  std::vector<TrajectorySeed> out;
318  LogTrace("TSGForOIDNN") << "TSGForOIDNN::produce: L2 muon pT, eta, phi --> " << l2.pt() << " , " << l2.eta()
319  << " , " << l2.phi();
320 
322 
323  dummyPlane->move(fts.position() - dummyPlane->position());
324  TrajectoryStateOnSurface tsosAtIP = TrajectoryStateOnSurface(fts, *dummyPlane);
325  LogTrace("TSGForOIDNN") << "TSGForOIDNN::produce: Created TSOSatIP: " << tsosAtIP;
326 
327  // Get the TSOS on the innermost layer of the L2
328  TrajectoryStateOnSurface tsosAtMuonSystem = trajectoryStateTransform::innerStateOnSurface(l2, geometry, &magfield);
329  LogTrace("TSGForOIDNN") << "TSGForOIDNN::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem;
330 
331  LogTrace("TSGForOIDNN")
332  << "TSGForOIDNN::produce: Check the error of the L2 parameter and use hit seeds if big errors";
333 
334  StateOnTrackerBound fromInside(propagatorAlong.get());
335  TrajectoryStateOnSurface outerTkStateInside = fromInside(fts);
336 
337  StateOnTrackerBound fromOutside(&*shpOpposite);
338  TrajectoryStateOnSurface outerTkStateOutside = fromOutside(tsosAtMuonSystem);
339 
340  // Check if the two positions (using updated and not-updated TSOS) agree withing certain extent.
341  // 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.
342  double l2muonEta = l2.eta();
343  double absL2muonEta = std::abs(l2muonEta);
344 
345  // make non-const copies of parameters, so they can be overriden for individual L2 muons
346  unsigned int maxHitSeeds = maxHitSeeds_;
347  unsigned int maxHitDoubletSeeds = maxHitDoubletSeeds_;
348  unsigned int maxHitlessSeedsIP = maxHitlessSeedsIP_;
349  unsigned int maxHitlessSeedsMuS = maxHitlessSeedsMuS_;
350 
351  float errorSFHitless = fixedErrorRescalingForHitless_;
352 
353  // update strategy parameters by evaluating DNN
354  if (getStrategyFromDNN_) {
355  bool dnnSuccess = false;
356 
357  // Update feature map with parameters of the current muon
358  updateFeatureMap(feature_map, l2, tsosAtIP, outerTkStateOutside);
359 
360  if (useRegressor_) {
361  // Use regressor
362  evaluateRegressor(feature_map,
364  metadata_.get_child("HB"),
366  metadata_.get_child("HLIP"),
368  metadata_.get_child("HLMuS"),
369  strPars,
370  dnnSuccess);
371  } else {
372  // Use classifier
373  bool isBarrel = absL2muonEta < etaSplitForDnn_;
374  const pt::ptree& tr = isBarrel ? metadata_.get_child("barrel") : metadata_.get_child("endcap");
375  tensorflow::Session* tf = isBarrel ? tf_session_barrel_ : tf_session_endcap_;
376  evaluateClassifier(feature_map, tf, tr, strPars, dnnSuccess);
377  }
378  if (!dnnSuccess)
379  break;
380 
381  maxHitSeeds = 0;
382  maxHitDoubletSeeds = strPars.nHBd;
383  maxHitlessSeedsIP = strPars.nHLIP;
384  maxHitlessSeedsMuS = strPars.nHLMuS;
385  errorSFHitless = strPars.sf;
386  }
387 
388  numSeedsMade = 0;
389  hitlessSeedsMadeIP = 0;
390  hitlessSeedsMadeMuS = 0;
391  hitSeedsMade = 0;
392  hitDoubletSeedsMade = 0;
393 
394  auto createSeeds = [&](auto const& layers) {
395  for (auto const& layer : boost::adaptors::reverse(layers)) {
396  if (hitlessSeedsMadeIP < maxHitlessSeedsIP && numSeedsMade < maxSeeds_)
398  tsosAtIP,
399  *(propagatorAlong.get()),
400  estimator,
401  errorSFHitless,
402  hitlessSeedsMadeIP,
403  numSeedsMade,
404  out);
405 
406  if (outerTkStateInside.isValid() && outerTkStateOutside.isValid() && hitlessSeedsMadeMuS < maxHitlessSeedsMuS &&
407  numSeedsMade < maxSeeds_)
409  outerTkStateOutside,
410  *(propagatorOpposite.get()),
411  estimator,
412  errorSFHitless,
413  hitlessSeedsMadeMuS,
414  numSeedsMade,
415  out);
416 
417  if (hitSeedsMade < maxHitSeeds && numSeedsMade < maxSeeds_)
419  tsosAtIP,
420  *(propagatorAlong.get()),
421  estimator,
423  hitSeedsMade,
424  numSeedsMade,
425  maxHitSeeds,
426  layerCount,
427  out);
428 
429  if (hitDoubletSeedsMade < maxHitDoubletSeeds && numSeedsMade < maxSeeds_)
431  tsosAtIP,
432  *(propagatorAlong.get()),
433  estimator,
435  navSchool,
436  hitDoubletSeedsMade,
437  numSeedsMade,
438  maxHitDoubletSeeds,
439  layerCount,
440  out);
441  };
442  };
443 
444  // BARREL
445  if (absL2muonEta < maxEtaForTOB_) {
446  layerCount = 0;
447  createSeeds(tob);
448  LogTrace("TSGForOIDNN") << "TSGForOIDNN:::produce: NumSeedsMade = " << numSeedsMade
449  << " , layerCount = " << layerCount;
450  }
451 
452  // Reset number of seeds if in overlap region
453  if (absL2muonEta > minEtaForTEC_ && absL2muonEta < maxEtaForTOB_) {
454  numSeedsMade = 0;
455  hitlessSeedsMadeIP = 0;
456  hitlessSeedsMadeMuS = 0;
457  hitSeedsMade = 0;
458  hitDoubletSeedsMade = 0;
459  }
460 
461  // ENDCAP+
462  if (l2muonEta > minEtaForTEC_) {
463  layerCount = 0;
464  createSeeds(tecPositive);
465  LogTrace("TSGForOIDNN") << "TSGForOIDNN:::produce: NumSeedsMade = " << numSeedsMade
466  << " , layerCount = " << layerCount;
467  }
468 
469  // ENDCAP-
470  if (l2muonEta < -minEtaForTEC_) {
471  layerCount = 0;
472  createSeeds(tecNegative);
473  LogTrace("TSGForOIDNN") << "TSGForOIDNN:::produce: NumSeedsMade = " << numSeedsMade
474  << " , layerCount = " << layerCount;
475  }
476 
477  for (std::vector<TrajectorySeed>::iterator it = out.begin(); it != out.end(); ++it) {
478  result->push_back(*it);
479  }
480 
481  } // L2Collection
482 
483  edm::LogInfo(theCategory_) << "TSGForOIDNN::produce: number of seeds made: " << result->size();
484 
485  iEvent.put(std::move(result));
486 }
const unsigned int maxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOIDNN.cc:64
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
tensorflow::Session * tf_session_HLMuS_
Definition: TSGForOIDNN.cc:111
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
tuple propagatorAlong
tensorflow::Session * tf_session_HB_
Definition: TSGForOIDNN.cc:107
tuple measurementTracker
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
tensorflow::Session * tf_session_endcap_
Definition: TSGForOIDNN.cc:100
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
Definition: TSGForOIDNN.cc:78
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
bool isThere(GeomDetEnumerators::SubDetector subdet) const
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
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:784
const double fixedErrorRescalingForHitless_
Rescale L2 parameter uncertainties (fixed error vs pT, eta)
Definition: TSGForOIDNN.cc:74
const std::string theCategory_
Definition: TSGForOIDNN.cc:61
const edm::ESGetToken< Propagator, TrackingComponentsRecord > t_propagatorOppositeH_
Definition: TSGForOIDNN.cc:54
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
def move
Definition: eostools.py:511
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
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
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:849
const double etaSplitForDnn_
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 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:491
Log< level::Info, false > LogInfo
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:906
GlobalPoint position() const
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:525
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
tuple propagatorOpposite
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 &quot;max..Seeds&quot; parameters.
Definition: TSGForOIDNN.cc:89
pt::ptree metadata_
Definition: TSGForOIDNN.cc:115
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > t_tmpTkGeometryH_
Definition: TSGForOIDNN.cc:55
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
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:597
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
tensorflow::Session * tf_session_barrel_
Definition: TSGForOIDNN.cc:98
tensorflow::Session * tf_session_HLIP_
Definition: TSGForOIDNN.cc:109
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 784 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().

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

Member Data Documentation

const std::string TSGForOIDNN::dnnMetadataPath_
private

DNN metadata.

Definition at line 114 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

std::string TSGForOIDNN::dnnModelPath_barrel_
private

Definition at line 95 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

std::string TSGForOIDNN::dnnModelPath_endcap_
private

Definition at line 96 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

std::string TSGForOIDNN::dnnModelPath_HB_
private

Settings for regressor.

Definition at line 103 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

std::string TSGForOIDNN::dnnModelPath_HLIP_
private

Definition at line 104 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

std::string TSGForOIDNN::dnnModelPath_HLMuS_
private

Definition at line 105 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

const std::string TSGForOIDNN::estimatorName_
private

Estimator used to find dets and TrajectoryMeasurements.

Definition at line 76 of file TSGForOIDNN.cc.

const double TSGForOIDNN::etaSplitForDnn_
private

Settings for classifier.

Definition at line 94 of file TSGForOIDNN.cc.

Referenced by produce().

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().

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().

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

Definition at line 97 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

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

Definition at line 99 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

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

Definition at line 106 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

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

Definition at line 108 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

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

Definition at line 110 of file TSGForOIDNN.cc.

Referenced by TSGForOIDNN().

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().

const unsigned int TSGForOIDNN::maxHitDoubletSeeds_
private

Definition at line 86 of file TSGForOIDNN.cc.

Referenced by produce().

const unsigned int TSGForOIDNN::maxHitlessSeeds_
private

Maximum number of hitless seeds for each L2.

Definition at line 68 of file TSGForOIDNN.cc.

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().

const unsigned int TSGForOIDNN::maxHitlessSeedsMuS_
private

Definition at line 85 of file TSGForOIDNN.cc.

Referenced by produce().

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().

const unsigned int TSGForOIDNN::maxSeeds_
private

Maximum number of seeds for each L2.

Definition at line 64 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 60 of file TSGForOIDNN.cc.

Referenced by produce().

pt::ptree TSGForOIDNN::metadata_
private

Definition at line 115 of file TSGForOIDNN.cc.

Referenced by produce(), and TSGForOIDNN().

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().

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().

const unsigned int TSGForOIDNN::numOfLayersToTry_
private

How many layers to try.

Definition at line 70 of file TSGForOIDNN.cc.

Referenced by makeSeedsFromHits().

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

Labels for input collections.

Definition at line 49 of file TSGForOIDNN.cc.

Referenced by produce().

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

Tokens for ESHandle.

Definition at line 51 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 56 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 52 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 57 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 53 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 54 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 58 of file TSGForOIDNN.cc.

Referenced by produce().

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

Definition at line 55 of file TSGForOIDNN.cc.

Referenced by produce().

tensorflow::Session* TSGForOIDNN::tf_session_barrel_
private

Definition at line 98 of file TSGForOIDNN.cc.

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

tensorflow::Session* TSGForOIDNN::tf_session_endcap_
private

Definition at line 100 of file TSGForOIDNN.cc.

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

tensorflow::Session* TSGForOIDNN::tf_session_HB_
private

Definition at line 107 of file TSGForOIDNN.cc.

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

tensorflow::Session* TSGForOIDNN::tf_session_HLIP_
private

Definition at line 109 of file TSGForOIDNN.cc.

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

tensorflow::Session* TSGForOIDNN::tf_session_HLMuS_
private

Definition at line 111 of file TSGForOIDNN.cc.

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

const std::string TSGForOIDNN::theCategory_
private

Definition at line 61 of file TSGForOIDNN.cc.

Referenced by makeSeedsWithoutHits(), and produce().

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

Definition at line 59 of file TSGForOIDNN.cc.

Referenced by makeSeedsFromHitDoublets(), and makeSeedsFromHits().

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().