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())
98 pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(
pixelClusters);
99 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
101 if ( !stripClusters.
label().empty() ){
102 stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(
stripClusters);
103 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
107 if ( !overrideTrkQuals.label().empty() )
111 if ( !classifier.label().empty())
112 srcQuals = consumes<QualityMaskCollection>(classifier);
129 if(!pixelClusters_.isUninitialized()) iEvent.
getByToken(pixelClusters_, pixelClusters);
131 if(!stripClusters_.isUninitialized()) iEvent.
getByToken(stripClusters_, stripClusters);
134 std::vector<bool> collectedStrips;
135 std::vector<bool> collectedPixels;
137 if(!oldPxlMaskToken_.isUninitialized()) {
140 iEvent.
getByToken(oldPxlMaskToken_ ,oldPxlMask);
141 iEvent.
getByToken(oldStrMaskToken_ ,oldStrMask);
142 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp, "<<oldPxlMask->size()<<
" pxl";
145 oldStrMask->copyMaskTo(collectedStrips);
146 oldPxlMask->copyMaskTo(collectedPixels);
147 if(!stripClusters_.isUninitialized()){
148 assert(stripClusters->dataSize()>=collectedStrips.size());
149 collectedStrips.resize(stripClusters->dataSize(),
false);
154 if(!stripClusters_.isUninitialized()) collectedStrips.resize(stripClusters->dataSize(),
false);
155 if(!pixelClusters_.isUninitialized()) collectedPixels.resize(pixelClusters->dataSize(),
false);
163 unsigned char qualMask = ~0;
167 auto const &
tracks = trajectories_.tracks(iEvent);
172 QualityMaskCollection oldStyle;
173 QualityMaskCollection
const * pquals=
nullptr;
175 if (!overrideTrkQuals_.isUninitialized()) {
178 assert(
s==(*quals).size());
180 oldStyle.resize(
s,0);
181 for (
auto i=0
U;
i<
s; ++
i)
if ( (*quals).get(
i) > 0 ) oldStyle[
i] = (255)&(*quals).get(
i);
185 if (!srcQuals.isUninitialized()) {
191 for (
auto i=0
U;
i<
s; ++
i){
193 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask : track.
quality(trackQuality_);
194 if ( !goodTk)
continue;
197 auto const & chi2sX5 = track.
extra()->chi2sX5();
203 if (!
hit.isValid())
continue;
204 if ( chi2sX5[
h] > maxChi2x5_ )
continue;
207 if(!stripClusters_.isUninitialized() && cluster.isStrip()) collectedStrips[cluster.key()]=
true;
208 if(!pixelClusters_.isUninitialized() && cluster.isPixel()) collectedPixels[cluster.key()]=
true;
216 if(!stripClusters_.isUninitialized()){
217 auto removedStripClusterMask =
219 LogDebug(
"TrackClusterRemover")<<
"total strip to skip: "<<
std::count(collectedStrips.begin(),collectedStrips.end(),
true);
223 if(!pixelClusters_.isUninitialized()){
224 auto removedPixelClusterMask=
226 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.
virtual OmniClusterRef const & firstClusterRef() const =0