CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
MkFitSeedConverter Class Reference
Inheritance diagram for MkFitSeedConverter:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MkFitSeedConverter (edm::ParameterSet const &iConfig)
 
 ~MkFitSeedConverter () override=default
 
- 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 Types

using SMatrixSym33 = ROOT::Math::SMatrix< float, 3, 3, ROOT::Math::MatRepSym< float, 3 > >
 
using SMatrixSym66 = ROOT::Math::SMatrix< float, 6, 6, ROOT::Math::MatRepSym< float, 6 > >
 
using SVector3 = ROOT::Math::SVector< float, 3 >
 

Private Member Functions

mkfit::TrackVec convertSeeds (const edm::View< TrajectorySeed > &seeds, const TrackerTopology &ttopo, const TransientTrackingRecHitBuilder &ttrhBuilder, const MagneticField &mf, const MkFitGeometry &mkFitGeom) const
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

const unsigned int maxNSeeds_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmfToken_
 
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecordmkFitGeomToken_
 
const edm::EDPutTokenT< MkFitSeedWrapperputToken_
 
const edm::EDGetTokenT< edm::View< TrajectorySeed > > seedToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdttopoToken_
 
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordttrhBuilderToken_
 

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

Definition at line 37 of file MkFitSeedConverter.cc.

Member Typedef Documentation

◆ SMatrixSym33

using MkFitSeedConverter::SMatrixSym33 = ROOT::Math::SMatrix<float, 3, 3, ROOT::Math::MatRepSym<float, 3> >
private

Definition at line 54 of file MkFitSeedConverter.cc.

◆ SMatrixSym66

using MkFitSeedConverter::SMatrixSym66 = ROOT::Math::SMatrix<float, 6, 6, ROOT::Math::MatRepSym<float, 6> >
private

Definition at line 55 of file MkFitSeedConverter.cc.

◆ SVector3

using MkFitSeedConverter::SVector3 = ROOT::Math::SVector<float, 3>
private

Definition at line 53 of file MkFitSeedConverter.cc.

Constructor & Destructor Documentation

◆ MkFitSeedConverter()

MkFitSeedConverter::MkFitSeedConverter ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 66 of file MkFitSeedConverter.cc.

References edm::ParameterSet::getParameter().

67  : seedToken_{consumes<edm::View<TrajectorySeed>>(iConfig.getParameter<edm::InputTag>("seeds"))},
68  ttrhBuilderToken_{esConsumes<TransientTrackingRecHitBuilder, TransientRecHitRecord>(
69  iConfig.getParameter<edm::ESInputTag>("ttrhBuilder"))},
70  ttopoToken_{esConsumes<TrackerTopology, TrackerTopologyRcd>()},
71  mkFitGeomToken_{esConsumes<MkFitGeometry, TrackerRecoGeometryRecord>()},
72  mfToken_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
73  putToken_{produces<MkFitSeedWrapper>()},
74  maxNSeeds_{iConfig.getParameter<unsigned int>("maxNSeeds")} {}
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord > mkFitGeomToken_
const edm::EDGetTokenT< edm::View< TrajectorySeed > > seedToken_
const unsigned int maxNSeeds_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > ttrhBuilderToken_
const edm::EDPutTokenT< MkFitSeedWrapper > putToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_

◆ ~MkFitSeedConverter()

MkFitSeedConverter::~MkFitSeedConverter ( )
overridedefault

Member Function Documentation

◆ convertSeeds()

mkfit::TrackVec MkFitSeedConverter::convertSeeds ( const edm::View< TrajectorySeed > &  seeds,
const TrackerTopology ttopo,
const TransientTrackingRecHitBuilder ttrhBuilder,
const MagneticField mf,
const MkFitGeometry mkFitGeom 
) const
private

Definition at line 95 of file MkFitSeedConverter.cc.

References TransientTrackingRecHitBuilder::build(), mkfit::LayerNumberConverter::convertLayerNumber(), submitPVResolutionJobs::err, Exception, BaseTrackerRecHit::firstClusterRef(), TrajectoryStateOnSurface::globalParameters(), mps_fire::i, cuy::ii, OmniClusterRef::index(), trackerHitRTTI::isFromDet(), TrackerTopology::isStereo(), dqmiolumiharvest::j, TrackerTopology::layer(), MkFitGeometry::layerNumberConverter(), LogTrace, maxNSeeds_, PosEndcap, GlobalTrajectoryParameters::position(), rpcPointValidation_cfi::recHit, runTheMatrix::ret, fileCollector::seed, DetachedQuadStep_cff::seeds, TrackerTopology::side(), and trajectoryStateTransform::transientState().

Referenced by produce().

99  {
101  if (seeds.size() > maxNSeeds_) {
102  edm::LogError("TooManySeeds") << "Exceeded maximum number of seeds! maxNSeeds=" << maxNSeeds_
103  << " nSeed=" << seeds.size();
104  return ret;
105  }
106  ret.reserve(seeds.size());
107 
108  auto isPlusSide = [&ttopo](const DetId& detid) {
109  return ttopo.side(detid) == static_cast<unsigned>(TrackerDetSide::PosEndcap);
110  };
111 
112  int seed_index = 0;
113  for (const auto& seed : seeds) {
114  auto const& hitRange = seed.recHits();
115  const auto lastRecHit = ttrhBuilder.build(&*(hitRange.end() - 1));
116  const auto tsos = trajectoryStateTransform::transientState(seed.startingState(), lastRecHit->surface(), &mf);
117  const auto& stateGlobal = tsos.globalParameters();
118  const auto& gpos = stateGlobal.position();
119  const auto& gmom = stateGlobal.momentum();
120  SVector3 pos(gpos.x(), gpos.y(), gpos.z());
121  SVector3 mom(gmom.x(), gmom.y(), gmom.z());
122 
123  const auto& cov = tsos.curvilinearError().matrix();
124  SMatrixSym66 err; //fill a sub-matrix, mkfit::TrackState will convert internally
125  for (int i = 0; i < 5; ++i) {
126  for (int j = i; j < 5; ++j) {
127  err.At(i, j) = cov[i][j];
128  }
129  }
130 
131  mkfit::TrackState state(tsos.charge(), pos, mom, err);
132  state.convertFromGlbCurvilinearToCCS();
133  ret.emplace_back(state, 0, seed_index, 0, nullptr);
134  LogTrace("MkFitSeedConverter") << "Inserted seed with index " << seed_index;
135 
136  // Add hits
137  for (auto const& recHit : hitRange) {
139  throw cms::Exception("Assert") << "Encountered a seed with a hit which is not trackerHitRTTI::isFromDet()";
140  }
141  auto& baseTrkRecHit = static_cast<const BaseTrackerRecHit&>(recHit);
142  if (!baseTrkRecHit.isMatched()) {
143  const auto& clusterRef = baseTrkRecHit.firstClusterRef();
144  const auto detId = recHit.geographicalId();
145  const auto ilay = mkFitGeom.layerNumberConverter().convertLayerNumber(
146  detId.subdetId(), ttopo.layer(detId), false, ttopo.isStereo(detId), isPlusSide(detId));
147  LogTrace("MkFitSeedConverter") << " adding hit detid " << detId.rawId() << " index " << clusterRef.index()
148  << " ilay " << ilay;
149  ret.back().addHitIdx(clusterRef.index(), ilay, 0); // per-hit chi2 is not known
150  } else {
151  auto& matched2D = dynamic_cast<const SiStripMatchedRecHit2D&>(recHit);
152  const OmniClusterRef* const clRefs[2] = {&matched2D.monoClusterRef(), &matched2D.stereoClusterRef()};
153  const DetId detIds[2] = {matched2D.monoId(), matched2D.stereoId()};
154  for (int ii = 0; ii < 2; ++ii) {
155  const auto& detId = detIds[ii];
156  const auto ilay = mkFitGeom.layerNumberConverter().convertLayerNumber(
157  detId.subdetId(), ttopo.layer(detId), false, ttopo.isStereo(detId), isPlusSide(detId));
158  LogTrace("MkFitSeedConverter") << " adding matched hit detid " << detId.rawId() << " index "
159  << clRefs[ii]->index() << " ilay " << ilay;
160  ret.back().addHitIdx(clRefs[ii]->index(), ilay, 0); // per-hit chi2 is not known
161  }
162  }
163  }
164  ++seed_index;
165  }
166  return ret;
167 }
bool isFromDet(TrackingRecHit const &hit)
ret
prodAgent to be discontinued
const GlobalTrajectoryParameters & globalParameters() const
const unsigned int maxNSeeds_
unsigned int index() const
bool isStereo(const DetId &id) const
Log< level::Error, false > LogError
unsigned int side(const DetId &id) const
unsigned int layer(const DetId &id) const
#define LogTrace(id)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
ii
Definition: cuy.py:589
mkfit::LayerNumberConverter const & layerNumberConverter() const
Definition: MkFitGeometry.h:33
Definition: DetId.h:17
std::vector< Track > TrackVec
ROOT::Math::SMatrix< float, 6, 6, ROOT::Math::MatRepSym< float, 6 > > SMatrixSym66
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
virtual OmniClusterRef const & firstClusterRef() const =0
ROOT::Math::SVector< double, 3 > SVector3
Definition: V0Fitter.cc:47
int convertLayerNumber(int det, int lay, bool useMatched, int isStereo, bool posZ) const

◆ fillDescriptions()

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

Definition at line 76 of file MkFitSeedConverter.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and mitigatedMETSequence_cff::U.

76  {
78 
79  desc.add("seeds", edm::InputTag{"initialStepSeeds"});
80  desc.add("ttrhBuilder", edm::ESInputTag{"", "WithTrackAngle"});
81  desc.add("maxNSeeds", 500000U);
82 
83  descriptions.addWithDefaultLabel(desc);
84 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 86 of file MkFitSeedConverter.cc.

References convertSeeds(), edm::EventSetup::getData(), iEvent, mfToken_, mkFitGeomToken_, putToken_, seedToken_, ttopoToken_, and ttrhBuilderToken_.

86  {
87  iEvent.emplace(putToken_,
89  iSetup.getData(ttopoToken_),
90  iSetup.getData(ttrhBuilderToken_),
91  iSetup.getData(mfToken_),
92  iSetup.getData(mkFitGeomToken_)));
93 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord > mkFitGeomToken_
const edm::EDGetTokenT< edm::View< TrajectorySeed > > seedToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
mkfit::TrackVec convertSeeds(const edm::View< TrajectorySeed > &seeds, const TrackerTopology &ttopo, const TransientTrackingRecHitBuilder &ttrhBuilder, const MagneticField &mf, const MkFitGeometry &mkFitGeom) const
int iEvent
Definition: GenABIO.cc:224
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > ttrhBuilderToken_
const edm::EDPutTokenT< MkFitSeedWrapper > putToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_

Member Data Documentation

◆ maxNSeeds_

const unsigned int MkFitSeedConverter::maxNSeeds_
private

Definition at line 63 of file MkFitSeedConverter.cc.

Referenced by convertSeeds().

◆ mfToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> MkFitSeedConverter::mfToken_
private

Definition at line 61 of file MkFitSeedConverter.cc.

Referenced by produce().

◆ mkFitGeomToken_

const edm::ESGetToken<MkFitGeometry, TrackerRecoGeometryRecord> MkFitSeedConverter::mkFitGeomToken_
private

Definition at line 60 of file MkFitSeedConverter.cc.

Referenced by produce().

◆ putToken_

const edm::EDPutTokenT<MkFitSeedWrapper> MkFitSeedConverter::putToken_
private

Definition at line 62 of file MkFitSeedConverter.cc.

Referenced by produce().

◆ seedToken_

const edm::EDGetTokenT<edm::View<TrajectorySeed> > MkFitSeedConverter::seedToken_
private

Definition at line 57 of file MkFitSeedConverter.cc.

Referenced by produce().

◆ ttopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> MkFitSeedConverter::ttopoToken_
private

Definition at line 59 of file MkFitSeedConverter.cc.

Referenced by produce().

◆ ttrhBuilderToken_

const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> MkFitSeedConverter::ttrhBuilderToken_
private

Definition at line 58 of file MkFitSeedConverter.cc.

Referenced by produce().