34 ~TrackClusterRemover()
override {}
43 using QualityMaskCollection = std::vector<unsigned char>;
45 const unsigned char maxChi2x5_;
71 desc.
add<
double>(
"maxChi2", 30.);
72 desc.add<
int>(
"minNumberOfLayersWithMeasBeforeFiltering", 0);
76 descriptions.add(
"trackClusterRemover", desc);
80 : maxChi2x5_(
Traj2TrackHits::toChi2x5(iConfig.getParameter<double>(
"maxChi2"))),
82 iConfig.getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")),
83 trackQuality_(
reco::TrackBase::qualityByName(iConfig.getParameter<
std::
string>(
"TrackQuality"))),
85 trajectories_(iConfig.getParameter<
edm::
InputTag>(
"trajectories"), consumesCollector())
93 <<
"Configuration Error: TrackClusterRemover used without input cluster collections";
95 pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(
pixelClusters);
96 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster>>>();
99 stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster>>(
stripClusters);
100 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster>>>();
108 if (!classifier.label().empty())
109 srcQuals = consumes<QualityMaskCollection>(classifier);
120 if (!pixelClusters_.isUninitialized())
123 if (!stripClusters_.isUninitialized())
126 std::vector<bool> collectedStrips;
127 std::vector<bool> collectedPixels;
129 if (!oldPxlMaskToken_.isUninitialized()) {
132 iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
133 iEvent.getByToken(oldStrMaskToken_, oldStrMask);
134 LogDebug(
"TrackClusterRemover") <<
"to merge in, " << oldStrMask->size() <<
" strp, " << oldPxlMask->size()
138 oldStrMask->copyMaskTo(collectedStrips);
139 oldPxlMask->copyMaskTo(collectedPixels);
140 if (!stripClusters_.isUninitialized()) {
147 if (!stripClusters_.isUninitialized())
149 if (!pixelClusters_.isUninitialized())
155 unsigned char qualMask = ~0;
157 qualMask = 1 << trackQuality_;
164 QualityMaskCollection oldStyle;
165 QualityMaskCollection
const* pquals =
nullptr;
167 if (!overrideTrkQuals_.isUninitialized()) {
169 iEvent.getByToken(overrideTrkQuals_, quals);
172 oldStyle.resize(
s, 0);
173 for (
auto i = 0
U;
i <
s; ++
i)
174 if ((*quals).get(
i) > 0)
175 oldStyle[
i] = (255) & (*quals).get(
i);
179 if (!srcQuals.isUninitialized()) {
181 iEvent.getByToken(srcQuals, hqual);
185 for (
auto i = 0
U;
i <
s; ++
i) {
187 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask :
track.quality(trackQuality_);
193 auto const& chi2sX5 =
track.extra()->chi2sX5();
195 auto hb =
track.recHitsBegin();
196 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++) {
201 if (chi2sX5[
h] > maxChi2x5_)
203 auto const& thit = reinterpret_cast<BaseTrackerRecHit const&>(
hit);
204 auto const& cluster = thit.firstClusterRef();
205 if (!stripClusters_.isUninitialized() && cluster.isStrip())
206 collectedStrips[cluster.key()] =
true;
207 if (!pixelClusters_.isUninitialized() && cluster.isPixel())
208 collectedPixels[cluster.key()] =
true;
210 collectedStrips[reinterpret_cast<SiStripMatchedRecHit2D const&>(
hit).stereoClusterRef().key()] =
true;
215 if (!stripClusters_.isUninitialized()) {
216 auto removedStripClusterMask = std::make_unique<StripMaskContainer>(
218 LogDebug(
"TrackClusterRemover") <<
"total strip to skip: "
219 <<
std::count(collectedStrips.begin(), collectedStrips.end(),
true);
223 if (!pixelClusters_.isUninitialized()) {
224 auto removedPixelClusterMask = std::make_unique<PixelMaskContainer>(
226 LogDebug(
"TrackClusterRemover") <<
"total pxl to skip: "
227 <<
std::count(collectedPixels.begin(), collectedPixels.end(),
true);