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>>>();
98 if (!stripClusters.
label().empty()) {
99 stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster>>(
stripClusters);
100 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster>>>();
104 if (!overrideTrkQuals.label().empty())
108 if (!classifier.label().empty())
109 srcQuals = consumes<QualityMaskCollection>(classifier);
120 if (!pixelClusters_.isUninitialized())
121 iEvent.
getByToken(pixelClusters_, pixelClusters);
123 if (!stripClusters_.isUninitialized())
124 iEvent.
getByToken(stripClusters_, stripClusters);
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()) {
141 assert(stripClusters->dataSize() >= collectedStrips.size());
142 collectedStrips.resize(stripClusters->dataSize(),
false);
147 if (!stripClusters_.isUninitialized())
148 collectedStrips.resize(stripClusters->dataSize(),
false);
149 if (!pixelClusters_.isUninitialized())
150 collectedPixels.resize(pixelClusters->dataSize(),
false);
155 unsigned char qualMask = ~0;
157 qualMask = 1 << trackQuality_;
159 auto const&
tracks = trajectories_.tracks(iEvent);
164 QualityMaskCollection oldStyle;
165 QualityMaskCollection
const* pquals =
nullptr;
167 if (!overrideTrkQuals_.isUninitialized()) {
170 assert(
s == (*quals).size());
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()) {
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();
201 if (chi2sX5[
h] > maxChi2x5_)
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;
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);
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 isFromDet(TrackingRecHit const &hit)
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)
bool isMatched(TrackingRecHit const &hit)
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.