28 #include "mkFit/HitStructures.h"
29 #include "mkFit/MkStdSeqs.h"
30 #include "LayerNumberConverter.h"
42 void fill(
const std::vector<const TrackingRecHit*>& hits,
43 mkfit::EventOfHits& eventOfHits,
67 putToken_{produces<MkFitEventOfHits>()},
68 usePixelQualityDB_{
iConfig.getParameter<
bool>(
"usePixelQualityDB")},
69 useStripStripQualityDB_{
iConfig.getParameter<
bool>(
"useStripStripQualityDB")} {
70 if (useStripStripQualityDB_ || usePixelQualityDB_)
72 if (usePixelQualityDB_) {
75 if (useStripStripQualityDB_) {
86 desc.
add(
"usePixelQualityDB",
true)->
setComment(
"Use SiPixelQuality DB information");
87 desc.
add(
"useStripStripQualityDB",
true)->
setComment(
"Use SiStrip quality DB information");
97 auto eventOfHits = std::make_unique<mkfit::EventOfHits>(mkFitGeom.trackerInfo());
98 mkfit::StdSeq::Cmssw_LoadHits_Begin(*eventOfHits, {&pixelHits.hits(), &stripHits.hits()});
101 std::vector<mkfit::DeadVec> deadvectors(mkFitGeom.layerNumberConverter().nLayers());
106 const auto& badPixels = pixelQuality.getBadComponentList();
107 for (
const auto& bp : badPixels) {
108 const DetId detid(bp.DetID);
109 const auto& surf = trackerGeom.idToDet(detid)->surface();
111 const auto ilay = mkFitGeom.mkFitLayerNumber(detid);
112 const auto q1 = isBarrel ? surf.zSpan().first : surf.rSpan().first;
113 const auto q2 = isBarrel ? surf.zSpan().second : surf.rSpan().second;
114 if (bp.errorType == 0)
115 deadvectors[ilay].push_back({surf.phiSpan().first, surf.phiSpan().second, q1, q2});
121 const auto& badStrips = siStripQuality.getBadComponentList();
122 for (
const auto&
bs : badStrips) {
124 const auto& surf = trackerGeom.idToDet(detid)->surface();
126 const auto ilay = mkFitGeom.mkFitLayerNumber(detid);
127 const auto q1 = isBarrel ? surf.zSpan().first : surf.rSpan().first;
128 const auto q2 = isBarrel ? surf.zSpan().second : surf.rSpan().second;
130 deadvectors[ilay].push_back({surf.phiSpan().first, surf.phiSpan().second, q1, q2});
132 auto const& topo =
dynamic_cast<const StripTopology&
>(trackerGeom.idToDet(detid)->topology());
136 auto addRangeAPV = [&topo, &surf, &q1, &q2](
int first,
int last, mkfit::DeadVec& dv) {
138 auto const lastPoint = surf.toGlobal(topo.localPosition((last + 1) * sistrip::STRIPS_PER_APV));
139 float phi1 = firstPoint.phi();
140 float phi2 = lastPoint.phi();
144 <<
"insert bad range " << first <<
" to " << last <<
" " << phi1 <<
" " << phi2;
145 dv.push_back({phi1, phi2, q1, q2});
149 for (
int apv = 0; apv < nApvs; ++apv) {
150 const bool isBad =
bs.BadApvs & (1 << apv);
152 LogTrace(
"SiStripBadComponents") <<
"bad apv " << apv <<
" on " <<
bs.detid;
156 }
else if (lastApv + 1 == apv)
159 if (apv + 1 == nApvs)
160 addRangeAPV(firstApv, lastApv, deadvectors[ilay]);
161 }
else if (firstApv != -1) {
162 addRangeAPV(firstApv, lastApv, deadvectors[ilay]);
171 mkfit::StdSeq::LoadDeads(*eventOfHits, deadvectors);
177 mkfit::StdSeq::Cmssw_LoadHits_End(*eventOfHits);
180 eventOfHits->SetBeamSpot(
187 mkfit::EventOfHits& eventOfHits,
189 for (
int i = 0,
end = hits.size();
i <
end; ++
i) {
190 const auto*
hit = hits[
i];
191 if (
hit !=
nullptr) {
193 eventOfHits[ilay].RegisterHit(
i);
constexpr double deltaPhi(double phi1, double phi2)
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
MkFitEventOfHitsProducer(edm::ParameterSet const &iConfig)
~MkFitEventOfHitsProducer() override=default
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
const bool usePixelQualityDB_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool getData(T &iHolder) const
const edm::EDPutTokenT< MkFitEventOfHits > putToken_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
const bool useStripStripQualityDB_
bool get(ProductID const &oid, Handle< PROD > &result) const
const edm::EDGetTokenT< MkFitHitWrapper > stripHitsToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
pixelQualityToken_(iC.esConsumes())
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
const edm::EDGetTokenT< MkFitClusterIndexToHit > pixelClusterIndexToHitToken_
int mkFitLayerNumber(DetId detId) const
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord > mkFitGeomToken_
const edm::EDGetTokenT< MkFitClusterIndexToHit > stripClusterIndexToHitToken_
Constants and enumerated types for FED/FEC systems.
const edm::EDGetTokenT< MkFitHitWrapper > pixelHitsToken_
T getParameter(std::string const &) const
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
static const uint16_t STRIPS_PER_APV
void fill(const std::vector< const TrackingRecHit * > &hits, mkfit::EventOfHits &eventOfHits, const MkFitGeometry &mkFitGeom) const