35 ~TrackClusterRemover(){}
44 using QualityMaskCollection = std::vector<unsigned char>;
46 const unsigned char maxChi2x5_;
47 const int minNumberOfLayersWithMeasBeforeFiltering_;
74 desc.
add<
double>(
"maxChi2",30.);
75 desc.add<
int>(
"minNumberOfLayersWithMeasBeforeFiltering",0);
79 descriptions.add(
"trackClusterRemover", desc);
84 maxChi2x5_(
Traj2TrackHits::toChi2x5(iConfig.getParameter<double>(
"maxChi2"))),
85 minNumberOfLayersWithMeasBeforeFiltering_(iConfig.getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")),
86 trackQuality_(
reco::TrackBase::qualityByName(iConfig.getParameter<
std::
string>(
"TrackQuality"))),
88 trajectories_(iConfig.getParameter<
edm::InputTag>(
"trajectories"),consumesCollector()),
89 pixelClusters_(consumes<
edmNew::DetSetVector<
SiPixelCluster> >(iConfig.getParameter<
edm::InputTag>(
"pixelClusters"))),
90 stripClusters_(consumes<
edmNew::DetSetVector<
SiStripCluster> >(iConfig.getParameter<
edm::InputTag>(
"stripClusters")))
93 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
94 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
98 if ( !overrideTrkQuals.label().empty() )
102 if ( !classifier.label().empty())
103 srcQuals = consumes<QualityMaskCollection>(classifier);
120 iEvent.
getByToken(pixelClusters_, pixelClusters);
122 iEvent.
getByToken(stripClusters_, stripClusters);
125 std::vector<bool> collectedStrips;
126 std::vector<bool> collectedPixels;
128 if(!oldPxlMaskToken_.isUninitialized()) {
131 iEvent.
getByToken(oldPxlMaskToken_ ,oldPxlMask);
132 iEvent.
getByToken(oldStrMaskToken_ ,oldStrMask);
133 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp, "<<oldPxlMask->size()<<
" pxl";
135 oldStrMask->copyMaskTo(collectedStrips);
136 oldPxlMask->copyMaskTo(collectedPixels);
137 assert(stripClusters->dataSize()>=collectedStrips.size());
138 collectedStrips.resize(stripClusters->dataSize(),
false);
143 collectedStrips.resize(stripClusters->dataSize(),
false);
144 collectedPixels.resize(pixelClusters->dataSize(),
false);
152 unsigned char qualMask = ~0;
156 auto const &
tracks = trajectories_.tracks(iEvent);
161 QualityMaskCollection oldStyle;
162 QualityMaskCollection
const * pquals=
nullptr;
164 if (!overrideTrkQuals_.isUninitialized()) {
167 assert(
s==(*quals).size());
169 oldStyle.resize(
s,0);
170 for (
auto i=0
U;
i<
s; ++
i)
if ( (*quals).get(
i) > 0 ) oldStyle[
i] = (255)&(*quals).get(
i);
174 if (!srcQuals.isUninitialized()) {
181 for (
auto i=0
U;
i<
s; ++
i){
183 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask : track.
quality(trackQuality_);
184 if ( !goodTk)
continue;
187 auto const & chi2sX5 = track.
extra()->chi2sX5();
193 if (!
hit.isValid())
continue;
194 if ( chi2sX5[
h] > maxChi2x5_ )
continue;
197 if (cluster.isStrip()) collectedStrips[cluster.key()]=
true;
198 else if (cluster.isPixel()) collectedPixels[cluster.key()]=
true;
207 auto removedStripClusterMask =
209 LogDebug(
"TrackClusterRemover")<<
"total strip to skip: "<<
std::count(collectedStrips.begin(),collectedStrips.end(),
true);
213 auto removedPixelClusterMask=
215 LogDebug(
"TrackClusterRemover")<<
"total pxl to skip: "<<
std::count(collectedPixels.begin(),collectedPixels.end(),
true);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const TrackExtraRef & extra() const
reference to "extra" object
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
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)
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)
T const * product() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
bool quality(const TrackQuality) const
Track quality.
Pixel cluster – collection of neighboring pixels above threshold.
virtual OmniClusterRef const & firstClusterRef() const =0