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>>>();
100 if (!overrideTrkQuals.label().empty())
104 if (!classifier.label().empty())
105 srcQuals = consumes<QualityMaskCollection>(classifier);
116 iEvent.
getByToken(pixelClusters_, pixelClusters);
118 iEvent.
getByToken(phase2OTClusters_, phase2OTClusters);
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);
132 assert(phase2OTClusters->dataSize() >= collectedPhase2OTs.size());
133 collectedPhase2OTs.resize(phase2OTClusters->dataSize(),
false);
136 collectedPixels.resize(pixelClusters->dataSize(),
false);
137 collectedPhase2OTs.resize(phase2OTClusters->dataSize(),
false);
142 unsigned char qualMask = ~0;
144 qualMask = 1 << trackQuality_;
146 auto const&
tracks = tracks_.tracks(iEvent);
149 QualityMaskCollection oldStyle;
150 QualityMaskCollection
const* pquals =
nullptr;
152 if (!overrideTrkQuals_.isUninitialized()) {
155 assert(
s == (*quals).size());
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()) {
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();
181 auto hit = *(hb +
h);
184 if (chi2sX5[
h] > maxChi2_)
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);
T getParameter(std::string const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const TrackExtraRef & extra() const
reference to "extra" object
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
int trackerLayersWithMeasurement() const
virtual void produce(StreamID, Event &, EventSetup const &) const =0
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
#define DEFINE_FWK_MODULE(type)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T const * product() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
minNumberOfLayersWithMeasBeforeFiltering_
bool quality(const TrackQuality) const
Track quality.
Pixel cluster – collection of neighboring pixels above threshold.