21 #include "ConfigWrapper.h"
22 #include "LayerNumberConverter.h"
23 #include "mkFit/buildtestMPlex.h"
24 #include "mkFit/IterationConfig.h"
25 #include "mkFit/MkBuilderWrapper.h"
28 #include "tbb/task_arena.h"
45 void stripClusterChargeCut(
const std::vector<float>& stripClusterCharge, std::vector<bool>& mask)
const;
74 putToken_{produces<MkFitOutputWrapper>()},
75 minGoodStripCharge_{
static_cast<float>(
77 seedCleaning_{
iConfig.getParameter<
bool>(
"seedCleaning")},
78 backwardFitInCMSSW_{
iConfig.getParameter<
bool>(
"backwardFitInCMSSW")},
79 removeDuplicates_{
iConfig.getParameter<
bool>(
"removeDuplicates")},
80 mkFitSilent_{
iConfig.getUntrackedParameter<
bool>(
"mkFitSilent")},
81 limitConcurrency_{
iConfig.getUntrackedParameter<
bool>(
"limitConcurrency")} {
89 if (
build ==
"bestHit") {
91 throw cms::Exception(
"Configuration") <<
"bestHit is temporarily disabled";
92 }
else if (
build ==
"standard") {
94 throw cms::Exception(
"Configuration") <<
"standard is temporarily disabled";
95 }
else if (
build ==
"cloneEngine") {
99 <<
"Invalid value for parameter 'buildingRoutine' " <<
build <<
", allowed are bestHit, standard, cloneEngine";
103 mkfit::MkBuilderWrapper::populate();
104 mkfit::ConfigWrapper::initializeForCMSSW(mkFitSilent_);
116 ->setComment(
"Valid values are: 'bestHit', 'standard', 'cloneEngine'");
118 "ESProduct that has the mkFit configuration parameters for this iteration");
119 desc.
add(
"seedCleaning",
true)->
setComment(
"Clean seeds within mkFit");
120 desc.
add(
"removeDuplicates",
true)->
setComment(
"Run duplicate removal within mkFit");
121 desc.
add(
"backwardFitInCMSSW",
false)
122 ->
setComment(
"Do backward fit (to innermost hit) in CMSSW (true) or mkFit (false)");
123 desc.
addUntracked(
"mkFitSilent",
true)->
setComment(
"Allows to enables printouts from mkFit with 'False'");
126 "Use tbb::task_arena to limit the internal concurrency to 1; useful only for timing studies when measuring "
130 descCCC.
add<
double>(
"value");
131 desc.
add(
"minGoodStripCharge", descCCC);
133 descriptions.
add(
"mkFitProducerDefault", desc);
137 return std::make_unique<mkfit::MkBuilderWrapper>();
141 std::once_flag geometryFlag;
156 const std::vector<bool>* pixelMaskPtr =
nullptr;
157 std::vector<bool> pixelMask;
158 std::vector<bool> stripMask(stripHits.hits().size(),
false);
160 if (not pixelHits.hits().empty()) {
162 pixelMask.resize(pixelContainerMask.size(),
false);
163 if UNLIKELY (pixelContainerMask.refProd().id() != pixelHits.clustersID()) {
164 throw cms::Exception(
"LogicError") <<
"MkFitHitWrapper has pixel cluster ID " << pixelHits.clustersID()
165 <<
" but pixel cluster mask has " << pixelContainerMask.refProd().id();
167 pixelContainerMask.copyMaskTo(pixelMask);
168 pixelMaskPtr = &pixelMask;
171 if (not stripHits.hits().empty()) {
173 if UNLIKELY (stripContainerMask.refProd().id() != stripHits.clustersID()) {
174 throw cms::Exception(
"LogicError") <<
"MkFitHitWrapper has strip cluster ID " << stripHits.clustersID()
175 <<
" but strip cluster mask has " << stripContainerMask.refProd().id();
177 stripContainerMask.copyMaskTo(stripMask);
186 std::call_once(geometryFlag, [
nlayers = mkFitGeom.layerNumberConverter().nLayers()]() {
187 mkfit::ConfigWrapper::setNTotalLayers(
nlayers);
191 auto seeds_mutable =
seeds.seeds();
194 auto lambda = [&]() {
195 mkfit::run_OneIteration(mkFitGeom.trackerInfo(),
198 {pixelMaskPtr, &stripMask},
199 streamCache(iID)->get(),
208 tbb::task_arena arena(1);
211 tbb::this_task_arena::isolate(
std::move(lambda));
218 if (mask.size() != stripClusterCharge.size()) {
219 throw cms::Exception(
"LogicError") <<
"Mask size (" << mask.size() <<
") inconsistent with number of hits ("
220 << stripClusterCharge.size() <<
")";
222 for (
int i = 0,
end = stripClusterCharge.size();
i <
end; ++
i) {
void setComment(std::string const &value)
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > stripMaskToken_
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > pixelMaskToken_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const bool backwardFitInCMSSW_
void stripClusterChargeCut(const std::vector< float > &stripClusterCharge, std::vector< bool > &mask) const
#define DEFINE_FWK_MODULE(type)
const bool removeDuplicates_
const edm::EDPutTokenT< MkFitOutputWrapper > putToken_
constexpr bool isUninitialized() const noexcept
auto const & tracks
cannot be loose
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< std::vector< float > > stripClusterChargeToken_
const bool limitConcurrency_
bool getData(T &iHolder) const
const edm::EDGetTokenT< MkFitHitWrapper > stripHitsToken_
std::function< double(mkfit::Event &, mkfit::MkBuilder &)> buildFunction_
std::unique_ptr< mkfit::MkBuilderWrapper > beginStream(edm::StreamID) const override
bool get(ProductID const &oid, Handle< PROD > &result) const
~MkFitProducer() override=default
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const float minGoodStripCharge_
std::vector< Track > TrackVec
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< MkFitHitWrapper > pixelHitsToken_
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
const edm::ESGetToken< mkfit::IterationConfig, TrackerRecoGeometryRecord > mkFitIterConfigToken_
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord > mkFitGeomToken_
const edm::EDGetTokenT< MkFitEventOfHits > eventOfHitsToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MkFitProducer(edm::ParameterSet const &iConfig)
const edm::EDGetTokenT< MkFitSeedWrapper > seedToken_