40 ~TrackClusterRemoverPhase2()
override {}
49 using QualityMaskCollection = std::vector<unsigned char>;
51 const unsigned char maxChi2_;
77 desc.add<
double>(
"maxChi2", 30.);
78 desc.add<
int>(
"minNumberOfLayersWithMeasBeforeFiltering", 0);
82 descriptions.add(
"phase2trackClusterRemover",
desc);
85 TrackClusterRemoverPhase2::TrackClusterRemoverPhase2(
const edm::ParameterSet& iConfig)
86 : maxChi2_(
Traj2TrackHits::toChi2x5(iConfig.getParameter<double>(
"maxChi2"))),
88 iConfig.getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")),
91 tracks_(iConfig.getParameter<
edm::
InputTag>(
"trajectories"), consumesCollector()),
95 iConfig.getParameter<
edm::
InputTag>(
"phase2OTClusters"))) {
96 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster>>>();
97 produces<edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D>>>();
105 if (!classifier.label().empty())
106 srcQuals = consumes<QualityMaskCollection>(classifier);
121 std::vector<bool> collectedPixels;
122 std::vector<bool> collectedPhase2OTs;
124 if (!oldPxlMaskToken_.isUninitialized()) {
127 iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
128 iEvent.getByToken(oldPh2OTMaskToken_, oldPh2OTMask);
129 LogDebug(
"TrackClusterRemoverPhase2")
130 <<
"to merge in, " << oldPxlMask->size() <<
" phase2 pixel and " << oldPh2OTMask->size() <<
" phase2 OT";
131 oldPxlMask->copyMaskTo(collectedPixels);
132 oldPh2OTMask->copyMaskTo(collectedPhase2OTs);
143 unsigned char qualMask = ~0;
145 qualMask = 1 << trackQuality_;
150 QualityMaskCollection oldStyle;
151 QualityMaskCollection
const* pquals =
nullptr;
153 if (!overrideTrkQuals_.isUninitialized()) {
155 iEvent.getByToken(overrideTrkQuals_, quals);
158 oldStyle.resize(
s, 0);
159 for (
auto i = 0
U;
i <
s; ++
i)
160 if ((*quals).get(
i) > 0)
161 oldStyle[
i] = (255) & (*quals).get(
i);
165 if (!srcQuals.isUninitialized()) {
167 iEvent.getByToken(srcQuals, hqual);
171 for (
auto i = 0
U;
i <
s; ++
i) {
173 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask :
track.quality(trackQuality_);
178 auto const& chi2sX5 =
track.extra()->chi2sX5();
180 auto hb =
track.recHitsBegin();
181 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++) {
182 auto const hit = *(
hb +
h);
185 if (chi2sX5[
h] > maxChi2_)
188 auto const& cluster = thit.firstClusterRef();
190 if (cluster.isPixel())
191 collectedPixels[cluster.key()] =
true;
192 else if (cluster.isPhase2())
193 collectedPhase2OTs[cluster.key()] =
true;
197 if (pVectorHits !=
nullptr) {
198 auto const& vectorHit = *pVectorHits;
199 auto const& lowCluster = vectorHit.lowerClusterRef();
200 auto const& uppCluster = vectorHit.upperClusterRef();
201 LogTrace(
"TrackClusterRemoverPhase2")
202 <<
"masking a VHit with lowCluster key: " << lowCluster.key() <<
" and upper key: " << uppCluster.key();
203 if (lowCluster.isPhase2())
204 collectedPhase2OTs[lowCluster.key()] =
true;
205 if (uppCluster.isPhase2())
206 collectedPhase2OTs[uppCluster.key()] =
true;
208 LogTrace(
"TrackClusterRemoverPhase2") <<
"it is not a VHit.";
213 auto removedPixelClusterMask = std::make_unique<PixelMaskContainer>(
215 LogDebug(
"TrackClusterRemoverPhase2")
216 <<
"total pxl to skip: " <<
std::count(collectedPixels.begin(), collectedPixels.end(),
true);
219 auto removedPhase2OTClusterMask = std::make_unique<Phase2OTMaskContainer>(
221 LogDebug(
"TrackClusterRemoverPhase2")
222 <<
"total ph2OT to skip: " <<
std::count(collectedPhase2OTs.begin(), collectedPhase2OTs.end(),
true);
T getParameter(std::string const &) const
Quality qualityByName(std::string const &name)
TrackQuality
track quality
T const * product() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
auto const & tracks
cannot be loose
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
minNumberOfLayersWithMeasBeforeFiltering_
Pixel cluster – collection of neighboring pixels above threshold.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.