CMS 3D CMS Logo

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

Public Member Functions

std::unique_ptr< mkfit::MkBuilderWrapper > beginStream (edm::StreamID) const override
 
 MkFitProducer (edm::ParameterSet const &iConfig)
 
 ~MkFitProducer () override=default
 
- Public Member Functions inherited from edm::global::EDProducer< edm::StreamCache< mkfit::MkBuilderWrapper > >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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 produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

bool backwardFitInCMSSW_
 
std::function< double(mkfit::Event &, mkfit::MkBuilder &)> buildFunction_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
edm::EDGetTokenT< MkFitInputWrapperhitsSeedsToken_
 
bool mkFitSilent_
 
edm::EDPutTokenT< MkFitOutputWrapperputToken_
 

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
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 29 of file MkFitProducer.cc.

Constructor & Destructor Documentation

◆ MkFitProducer()

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

Definition at line 49 of file MkFitProducer.cc.

50  : hitsSeedsToken_{consumes<MkFitInputWrapper>(iConfig.getParameter<edm::InputTag>("hitsSeeds"))},
51  geomToken_{esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()},
52  putToken_{produces<MkFitOutputWrapper>()},
53  backwardFitInCMSSW_{iConfig.getParameter<bool>("backwardFitInCMSSW")},
54  mkFitSilent_{iConfig.getUntrackedParameter<bool>("mkFitSilent")} {
55  const auto build = iConfig.getParameter<std::string>("buildingRoutine");
56  bool isFV = false;
57  if (build == "bestHit") {
58  buildFunction_ = mkfit::runBuildingTestPlexBestHit;
59  } else if (build == "standard") {
60  buildFunction_ = mkfit::runBuildingTestPlexStandard;
61  } else if (build == "cloneEngine") {
62  buildFunction_ = mkfit::runBuildingTestPlexCloneEngine;
63  } else if (build == "fullVector") {
64  isFV = true;
65  buildFunction_ = mkfit::runBuildingTestPlexFV;
66  } else {
67  throw cms::Exception("Configuration") << "Invalid value for parameter 'buildingRoutine' " << build
68  << ", allowed are bestHit, standard, cloneEngine, fullVector";
69  }
70 
71  const auto seedClean = iConfig.getParameter<std::string>("seedCleaning");
72  auto seedCleanOpt = mkfit::ConfigWrapper::SeedCleaningOpts::noCleaning;
73  if (seedClean == "none") {
74  seedCleanOpt = mkfit::ConfigWrapper::SeedCleaningOpts::noCleaning;
75  } else if (seedClean == "N2") {
76  seedCleanOpt = mkfit::ConfigWrapper::SeedCleaningOpts::cleanSeedsN2;
77  } else {
78  throw cms::Exception("Configuration")
79  << "Invalida value for parameter 'seedCleaning' " << seedClean << ", allowed are none, N2";
80  }
81 
82  auto backwardFitOpt =
83  backwardFitInCMSSW_ ? mkfit::ConfigWrapper::BackwardFit::noFit : mkfit::ConfigWrapper::BackwardFit::toFirstLayer;
84 
85  // TODO: what to do when we have multiple instances of MkFitProducer in a job?
86  mkfit::MkBuilderWrapper::populate(isFV);
87  mkfit::ConfigWrapper::initializeForCMSSW(seedCleanOpt, backwardFitOpt, mkFitSilent_);
88 }

References edm::ParameterSet::getParameter().

◆ ~MkFitProducer()

MkFitProducer::~MkFitProducer ( )
overridedefault

Member Function Documentation

◆ beginStream()

std::unique_ptr< mkfit::MkBuilderWrapper > MkFitProducer::beginStream ( edm::StreamID  iID) const
override

Definition at line 104 of file MkFitProducer.cc.

104  {
105  return std::make_unique<mkfit::MkBuilderWrapper>();
106 }

◆ fillDescriptions()

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

Definition at line 90 of file MkFitProducer.cc.

90  {
92 
93  desc.add("hitsSeeds", edm::InputTag("mkFitInputConverter"));
94  desc.add<std::string>("buildingRoutine", "cloneEngine")
95  ->setComment("Valid values are: 'bestHit', 'standard', 'cloneEngine', 'fullVector'");
96  desc.add<std::string>("seedCleaning", "N2")->setComment("Valid values are: 'none', 'N2'");
97  desc.add("backwardFitInCMSSW", false)
98  ->setComment("Do backward fit (to innermost hit) in CMSSW (true) or mkFit (false)");
99  desc.addUntracked("mkFitSilent", true)->setComment("Allows to enables printouts from mkFit with 'False'");
100 
101  descriptions.add("mkFitProducer", desc);
102 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 111 of file MkFitProducer.cc.

111  {
112  const auto& hitsSeeds = iEvent.get(hitsSeedsToken_);
113  const auto& geom = iSetup.getData(geomToken_);
114 
115  if (geom.numberOfLayers(PixelSubdetector::PixelBarrel) != 4 ||
116  geom.numberOfLayers(PixelSubdetector::PixelEndcap) != 3) {
117  throw cms::Exception("Assert") << "For now this code works only with phase1 tracker, you have something else";
118  }
119 
120  // Initialize the number of layers, has to be done exactly once in
121  // the whole program.
122  // TODO: the mechanism needs to be improved...
123  std::call_once(geometryFlag, [nlayers = hitsSeeds.nlayers()]() { mkfit::ConfigWrapper::setNTotalLayers(nlayers); });
124 
125  // CMSSW event ID (64-bit unsigned) does not fit in int
126  // In addition, unique ID requires also lumi and run
127  // But does the event ID really matter within mkFit?
128  mkfit::Event ev(iEvent.id().event());
129 
130  ev.setInputFromCMSSW(hitsSeeds.hits(), hitsSeeds.seeds());
131 
132  tbb::this_task_arena::isolate([&]() { buildFunction_(ev, streamCache(iID)->get()); });
133 
134  iEvent.emplace(putToken_, std::move(ev.candidateTracks_), std::move(ev.fitTracks_));
135 }

References buildFunction_, ev, Exception, relativeConstraints::geom, geomToken_, get, edm::EventSetup::getData(), InitialStep_cff::hitsSeeds, hitsSeedsToken_, iEvent, eostools::move(), nlayers, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, and putToken_.

Member Data Documentation

◆ backwardFitInCMSSW_

bool MkFitProducer::backwardFitInCMSSW_
private

Definition at line 45 of file MkFitProducer.cc.

◆ buildFunction_

std::function<double(mkfit::Event&, mkfit::MkBuilder&)> MkFitProducer::buildFunction_
private

Definition at line 44 of file MkFitProducer.cc.

Referenced by produce().

◆ geomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> MkFitProducer::geomToken_
private

Definition at line 42 of file MkFitProducer.cc.

Referenced by produce().

◆ hitsSeedsToken_

edm::EDGetTokenT<MkFitInputWrapper> MkFitProducer::hitsSeedsToken_
private

Definition at line 41 of file MkFitProducer.cc.

Referenced by produce().

◆ mkFitSilent_

bool MkFitProducer::mkFitSilent_
private

Definition at line 46 of file MkFitProducer.cc.

◆ putToken_

edm::EDPutTokenT<MkFitOutputWrapper> MkFitProducer::putToken_
private

Definition at line 43 of file MkFitProducer.cc.

Referenced by produce().

edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MkFitProducer::mkFitSilent_
bool mkFitSilent_
Definition: MkFitProducer.cc:46
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MkFitProducer::putToken_
edm::EDPutTokenT< MkFitOutputWrapper > putToken_
Definition: MkFitProducer.cc:43
InitialStep_cff.hitsSeeds
hitsSeeds
Definition: InitialStep_cff.py:235
newFWLiteAna.build
build
Definition: newFWLiteAna.py:126
MkFitProducer::buildFunction_
std::function< double(mkfit::Event &, mkfit::MkBuilder &)> buildFunction_
Definition: MkFitProducer.cc:44
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MkFitProducer::backwardFitInCMSSW_
bool backwardFitInCMSSW_
Definition: MkFitProducer.cc:45
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
iEvent
int iEvent
Definition: GenABIO.cc:224
MkFitProducer::geomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: MkFitProducer.cc:42
get
#define get
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
eostools.move
def move(src, dest)
Definition: eostools.py:511
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:246
edm::ParameterDescriptionNode::setComment
void setComment(std::string const &value)
Definition: ParameterDescriptionNode.cc:106
MkFitProducer::hitsSeedsToken_
edm::EDGetTokenT< MkFitInputWrapper > hitsSeedsToken_
Definition: MkFitProducer.cc:41
edm::InputTag
Definition: InputTag.h:15
nlayers
Definition: HIMultiTrackSelector.h:48