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
 
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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 29 of file MkFitProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file MkFitProducer.cc.

References backwardFitInCMSSW_, newFWLiteAna::build, buildFunction_, Exception, geomToken_, edm::ParameterSet::getParameter(), mkFitSilent_, putToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

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 }
edm::EDPutTokenT< MkFitOutputWrapper > putToken_
std::function< double(mkfit::Event &, mkfit::MkBuilder &)> buildFunction_
bool backwardFitInCMSSW_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
edm::EDGetTokenT< MkFitInputWrapper > hitsSeedsToken_
MkFitProducer::~MkFitProducer ( )
overridedefault

Member Function Documentation

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 }
void MkFitProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 90 of file MkFitProducer.cc.

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

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 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void MkFitProducer::produce ( edm::StreamID  iID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 111 of file MkFitProducer.cc.

References buildFunction_, DEFINE_FWK_MODULE, edm::Event::emplace(), ev, edm::EventID::event(), Exception, relativeConstraints::geom, geomToken_, edm::Event::get(), edm::EventSetup::getData(), hitsSeedsToken_, edm::EventBase::id(), eostools::move(), nlayers, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, and putToken_.

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 }
EventNumber_t event() const
Definition: EventID.h:40
edm::EDPutTokenT< MkFitOutputWrapper > putToken_
bool ev
bool getData(T &iHolder) const
Definition: EventSetup.h:113
std::function< double(mkfit::Event &, mkfit::MkBuilder &)> buildFunction_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:334
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
edm::EDGetTokenT< MkFitInputWrapper > hitsSeedsToken_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:421
edm::EventID id() const
Definition: EventBase.h:59
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool MkFitProducer::backwardFitInCMSSW_
private

Definition at line 45 of file MkFitProducer.cc.

Referenced by MkFitProducer().

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

Definition at line 44 of file MkFitProducer.cc.

Referenced by MkFitProducer(), and produce().

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

Definition at line 42 of file MkFitProducer.cc.

Referenced by MkFitProducer(), and produce().

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

Definition at line 41 of file MkFitProducer.cc.

Referenced by produce().

bool MkFitProducer::mkFitSilent_
private

Definition at line 46 of file MkFitProducer.cc.

Referenced by MkFitProducer().

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

Definition at line 43 of file MkFitProducer.cc.

Referenced by MkFitProducer(), and produce().