33 ~TrackClusterRemover(){}
42 using QualityMaskCollection = std::vector<unsigned char>;
45 const int minNumberOfLayersWithMeasBeforeFiltering_;
72 desc.
add<
double>(
"maxChi2",30.);
73 desc.add<
int>(
"minNumberOfLayersWithMeasBeforeFiltering",0);
77 descriptions.add(
"trackClusterRemover", desc);
82 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
83 minNumberOfLayersWithMeasBeforeFiltering_(iConfig.getParameter<int>(
"minNumberOfLayersWithMeasBeforeFiltering")),
84 trackQuality_(
reco::TrackBase::qualityByName(iConfig.getParameter<std::
string>(
"TrackQuality"))),
86 trajectories_(iConfig.getParameter<edm::
InputTag>(
"trajectories"),consumesCollector()),
87 pixelClusters_(consumes<edmNew::DetSetVector<
SiPixelCluster> >(iConfig.getParameter<edm::
InputTag>(
"pixelClusters"))),
88 stripClusters_(consumes<edmNew::DetSetVector<
SiStripCluster> >(iConfig.getParameter<edm::
InputTag>(
"stripClusters")))
91 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
92 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
96 if ( !overrideTrkQuals.label().empty() )
100 if ( !classifier.label().empty())
101 srcQuals = consumes<QualityMaskCollection>(classifier);
118 iEvent.
getByToken(pixelClusters_, pixelClusters);
120 iEvent.
getByToken(stripClusters_, stripClusters);
123 std::vector<bool> collectedStrips;
124 std::vector<bool> collectedPixels;
126 if(!oldPxlMaskToken_.isUninitialized()) {
129 iEvent.
getByToken(oldPxlMaskToken_ ,oldPxlMask);
130 iEvent.
getByToken(oldStrMaskToken_ ,oldStrMask);
131 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
133 oldStrMask->copyMaskTo(collectedStrips);
134 oldPxlMask->copyMaskTo(collectedPixels);
135 assert(stripClusters->dataSize()>=collectedStrips.size());
136 collectedStrips.resize(stripClusters->dataSize(),
false);
141 collectedStrips.resize(stripClusters->dataSize(),
false);
142 collectedPixels.resize(pixelClusters->dataSize(),
false);
150 unsigned char qualMask = ~0;
154 auto const &
tracks = trajectories_.tracks(iEvent);
155 auto const & trajs = trajectories_.trajectories(iEvent);
160 QualityMaskCollection oldStyle;
161 QualityMaskCollection
const * pquals=
nullptr;
163 if (!overrideTrkQuals_.isUninitialized()) {
168 oldStyle.resize(
s,0);
169 for (
auto i=0U;
i<
s; ++
i)
if ( (*quals).get(
i) > 0 ) oldStyle[
i] = (255)&(*quals).get(
i);
173 if (!srcQuals.isUninitialized()) {
181 for (
auto i=0U;
i<
s; ++
i){
183 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask : track.
quality(trackQuality_);
184 if ( !goodTk)
continue;
188 for (
auto const & tm : tms) {
189 auto const &
hit = *tm.recHit();
190 if (!
hit.isValid())
continue;
191 if ( tm.estimate() > maxChi2_ )
continue;
193 auto const & cluster = thit.firstClusterRef();
194 if (cluster.isStrip()) collectedStrips[cluster.key()]=
true;
195 else collectedPixels[cluster.key()]=
true;
204 auto removedStripClusterMask =
206 LogDebug(
"TrackClusterRemover")<<
"total strip to skip: "<<
std::count(collectedStrips.begin(),collectedStrips.end(),
true);
210 auto removedPixelClusterMask=
212 LogDebug(
"TrackClusterRemover")<<
"total pxl to skip: "<<
std::count(collectedPixels.begin(),collectedPixels.end(),
true);
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
tuple oldClusterRemovalInfo
int trackerLayersWithMeasurement() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
DataContainer const & measurements() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool isMatched(TrackingRecHit const &hit)
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.
virtual void produce(StreamID, Event &, EventSetup const &) const =0
bool quality(const TrackQuality) const
Track quality.
Pixel cluster – collection of neighboring pixels above threshold.