21 maskBad128StripBlocks(conf.getParameter<
bool>(
"MaskBadAPVFibers")),
36 desc.add<
bool>(
"useSiStripQuality",
false);
37 desc.add<
bool>(
"MaskBadAPVFibers",
false);
38 desc.add<
bool>(
"doMatching",
true);
62 for (
auto const& DS : *inputhandle) {
69 bool bad128StripBlocks[6];
73 for (
auto const& cluster : DS) {
74 if (
isMasked(cluster, bad128StripBlocks))
82 if (collector.empty())
92 struct CollectorHelper {
95 using CollectorMatched = std::vector<std::unique_ptr<SiStripMatchedRecHit2D>>;
98 Collector& m_collector;
99 CollectorMatched& m_collectorMatched;
101 std::vector<SiStripRecHit2D::ClusterRef::key_type>& m_matchedSteroClusters;
109 CollectorHelper& collector() {
return *
this; }
113 CollectorHelper(Collector& i_collector,
114 CollectorMatched& i_collectorMatched,
116 std::vector<SiStripRecHit2D::ClusterRef::key_type>& i_matchedSteroClusters)
118 m_collector(i_collector),
119 m_collectorMatched(i_collectorMatched),
120 m_fillerRphiUnm(i_fillerRphiUnm),
121 m_matchedSteroClusters(i_matchedSteroClusters) {}
124 if (!m_collectorMatched.empty()) {
125 nmatch += m_collectorMatched.
size();
126 for (
auto const& itm : m_collectorMatched) {
127 m_collector.push_back(*itm);
129 m_matchedSteroClusters.push_back(itm->stereoClusterRef().key());
131 m_collectorMatched.clear();
142 std::vector<std::unique_ptr<SiStripMatchedRecHit2D>> collectorMatched;
149 std::vector<SiStripRecHit2D::ClusterRef::key_type> matchedSteroClusters;
158 if (partnerId == 0) {
160 if (!rphiHits.
empty()) {
171 if (itStereoDet == edStereoDet) {
173 if (!rphiHits.
empty()) {
192 matchedSteroClusters.clear();
195 CollectorHelper chelper(collector, collectorMatched, fillerRphiUnm, matchedSteroClusters);
197 rphiHits.
begin(), rphiHits.
end(), stereoHits.
begin(), stereoHits.
end(), gluedDet, trackdirection, chelper);
198 nmatch += chelper.nmatch;
203 stereoSimpleHits.reserve(stereoHits.
size());
206 stereoSimpleHits.push_back(&*
it);
211 &(*
it), stereoSimpleHits.begin(), stereoSimpleHits.end(), collectorMatched, gluedDet, trackdirection);
212 if (collectorMatched.size() > 0) {
213 nmatch += collectorMatched.size();
214 for (
auto const& itm : collectorMatched) {
215 collector.push_back(*itm);
217 matchedSteroClusters.push_back(itm->stereoClusterRef().key());
219 collectorMatched.clear();
222 fillerRphiUnm.push_back(*
it);
229 if (collector.empty())
233 if (fillerRphiUnm.empty())
234 fillerRphiUnm.abort();
238 std::sort(matchedSteroClusters.begin(), matchedSteroClusters.end());
241 if (!std::binary_search(matchedSteroClusters.begin(), matchedSteroClusters.end(),
it->cluster().key())) {
242 fillerStereoUnm.push_back(*
it);
245 if (fillerStereoUnm.empty())
246 fillerStereoUnm.abort();
257 if (itRPhiDet == edRPhiDet) {
258 if (!stereoHits.
empty()) {
266 edm::LogInfo(
"SiStripRecHitConverter") <<
"found\n" << nmatch <<
" matched RecHits\n";
273 for (
int j = 0;
j < 6;
j++) {
274 bad128StripBlocks[
j] = (badApvs & (1 <<
j));
276 for (
int j = 0;
j < 3;
j++) {
277 if (badFibers & (1 <<
j)) {
278 bad128StripBlocks[2 *
j + 0] =
true;
279 bad128StripBlocks[2 *
j + 1] =
true;
287 if (bad128StripBlocks[cluster.
firstStrip() >> 7]) {
289 bad128StripBlocks[static_cast<int32_t>(cluster.
barycenter() - 0.499999) >> 7]) {
294 bad128StripBlocks[static_cast<int32_t>(cluster.
barycenter() - 0.499999) >> 7]) {
304 if (stripdet ==
nullptr)
305 edm::LogWarning(
"SiStripRecHitConverter") <<
"Detid=" <<
id <<
" not found";
std::pair< LocalPoint, LocalError > LocalValues
unsigned int partnerDetId() const
void push_back(data_type const &d)
edm::ESGetToken< SiStripRecHitMatcher, TkStripCPERecord > matcherToken
T getParameter(std::string const &) const
void initialize(const edm::EventSetup &)
uint16_t firstStrip() const
Local3DVector LocalVector
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
unsigned int stereo() const
stereo
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters <p) const
short getBadFibers(uint32_t detid) const
void run(edm::Handle< edmNew::DetSetVector< SiStripCluster > > input, products &output)
edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > cpeToken
std::unique_ptr< SiStripMatchedRecHit2D > match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection, bool force) const
SiStripRecHitConverterAlgorithm(const edm::ParameterSet &, edm::ConsumesCollector)
const SiStripRecHitMatcher * matcher
data_type const * const_iterator
bool isMasked(const SiStripCluster &cluster, bool bad128StripBlocks[6]) const
static std::string const input
const StripClusterParameterEstimator * parameterestimator
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken
SiStripCluster const & amplitudes() const
const TrackerGeometry * tracker
SiStripMatchedRecHit2D * clone() const override
void fillBad128StripBlocks(const uint32_t detid, bool bad128StripBlocks[6]) const
const TrackerGeomDet * idToDet(DetId) const override
bool useModule(const uint32_t id) const
const SiStripQuality * quality
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void match(products &output, LocalVector trackdirection) const
std::vector< const SiStripRecHit2D * > SimpleHitCollection
SiStripRecHit2DCollection::FastFiller Collector
void doubleMatch(MonoIterator monoRHiter, MonoIterator monoRHend, StereoIterator seconditer, StereoIterator seconditerend, const GluedGeomDet *gluedDet, LocalVector trdir, CollectorHelper &collectorHelper) const
bool maskBad128StripBlocks
Log< level::Warning, false > LogWarning
static void fillPSetDescription(edm::ParameterSetDescription &desc)
bool IsModuleUsable(uint32_t detid) const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken
short getBadApvs(uint32_t detid) const