39 ~TrackClusterRemoverPhase2()
override {}
48 using QualityMaskCollection = std::vector<unsigned char>;
50 const unsigned char maxChi2_;
76 desc.
add<
double>(
"maxChi2", 30.);
77 desc.add<
int>(
"minNumberOfLayersWithMeasBeforeFiltering", 0);
81 descriptions.add(
"phase2trackClusterRemover", desc);
84 TrackClusterRemoverPhase2::TrackClusterRemoverPhase2(
const edm::ParameterSet& iConfig)
85 : maxChi2_(
Traj2TrackHits::toChi2x5(iConfig.getParameter<double>(
"maxChi2"))),
87 iConfig.getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")),
88 trackQuality_(
reco::TrackBase::qualityByName(iConfig.getParameter<
std::
string>(
"TrackQuality"))),
90 tracks_(iConfig.getParameter<
edm::
InputTag>(
"trajectories"), consumesCollector()),
94 iConfig.getParameter<
edm::
InputTag>(
"phase2OTClusters"))) {
95 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster>>>();
96 produces<edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D>>>();
104 if (!classifier.label().empty())
105 srcQuals = consumes<QualityMaskCollection>(classifier);
120 std::vector<bool> collectedPixels;
121 std::vector<bool> collectedPhase2OTs;
123 if (!oldPxlMaskToken_.isUninitialized()) {
126 iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
127 iEvent.getByToken(oldPh2OTMaskToken_, oldPh2OTMask);
128 LogDebug(
"TrackClusterRemoverPhase2")
129 <<
"to merge in, " << oldPxlMask->size() <<
" phase2 pixel and " << oldPh2OTMask->size() <<
" phase2 OT";
130 oldPxlMask->copyMaskTo(collectedPixels);
131 oldPh2OTMask->copyMaskTo(collectedPhase2OTs);
142 unsigned char qualMask = ~0;
144 qualMask = 1 << trackQuality_;
149 QualityMaskCollection oldStyle;
150 QualityMaskCollection
const* pquals =
nullptr;
152 if (!overrideTrkQuals_.isUninitialized()) {
154 iEvent.getByToken(overrideTrkQuals_, quals);
157 oldStyle.resize(
s, 0);
158 for (
auto i = 0
U;
i <
s; ++
i)
159 if ((*quals).get(
i) > 0)
160 oldStyle[
i] = (255) & (*quals).get(
i);
164 if (!srcQuals.isUninitialized()) {
166 iEvent.getByToken(srcQuals, hqual);
170 for (
auto i = 0
U;
i <
s; ++
i) {
172 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask :
track.quality(trackQuality_);
177 auto const& chi2sX5 =
track.extra()->chi2sX5();
179 auto hb =
track.recHitsBegin();
180 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++) {
184 if (chi2sX5[
h] > maxChi2_)
186 auto const& thit = reinterpret_cast<BaseTrackerRecHit const&>(*
hit);
187 auto const& cluster = thit.firstClusterRef();
189 if (cluster.isPixel())
190 collectedPixels[cluster.key()] =
true;
191 else if (cluster.isPhase2())
192 collectedPhase2OTs[cluster.key()] =
true;
196 auto removedPixelClusterMask = std::make_unique<PixelMaskContainer>(
198 LogDebug(
"TrackClusterRemoverPhase2")
199 <<
"total pxl to skip: " <<
std::count(collectedPixels.begin(), collectedPixels.end(),
true);
202 auto removedPhase2OTClusterMask = std::make_unique<Phase2OTMaskContainer>(
204 LogDebug(
"TrackClusterRemoverPhase2")
205 <<
"total ph2OT to skip: " <<
std::count(collectedPhase2OTs.begin(), collectedPhase2OTs.end(),
true);