39 ~TrackClusterRemoverPhase2(){}
48 using QualityMaskCollection = std::vector<unsigned char>;
50 const unsigned char maxChi2_;
51 const int minNumberOfLayersWithMeasBeforeFiltering_;
78 desc.
add<
double>(
"maxChi2",30.);
79 desc.add<
int>(
"minNumberOfLayersWithMeasBeforeFiltering",0);
83 descriptions.add(
"phase2trackClusterRemover", desc);
87 TrackClusterRemoverPhase2::TrackClusterRemoverPhase2(
const edm::ParameterSet& iConfig) :
88 maxChi2_(
Traj2TrackHits::toChi2x5(iConfig.getParameter<double>(
"maxChi2"))),
89 minNumberOfLayersWithMeasBeforeFiltering_(iConfig.getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")),
90 trackQuality_(
reco::TrackBase::qualityByName(iConfig.getParameter<
std::
string>(
"TrackQuality"))),
92 tracks_(iConfig.getParameter<
edm::InputTag>(
"trajectories"),consumesCollector()),
93 pixelClusters_(consumes<
edmNew::DetSetVector<
SiPixelCluster> >(iConfig.getParameter<
edm::InputTag>(
"phase2pixelClusters"))),
97 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
98 produces<edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D> > >();
102 if ( !overrideTrkQuals.label().empty() )
106 if ( !classifier.label().empty())
107 srcQuals = consumes<QualityMaskCollection>(classifier);
124 iEvent.
getByToken(pixelClusters_, pixelClusters);
126 iEvent.
getByToken(phase2OTClusters_, phase2OTClusters);
129 std::vector<bool> collectedPixels;
130 std::vector<bool> collectedPhase2OTs;
132 if(!oldPxlMaskToken_.isUninitialized()) {
136 iEvent.
getByToken(oldPxlMaskToken_ ,oldPxlMask);
137 iEvent.
getByToken(oldPh2OTMaskToken_ ,oldPh2OTMask);
138 LogDebug(
"TrackClusterRemoverPhase2")<<
"to merge in, "<<oldPxlMask->size()<<
" phase2 pixel and " << oldPh2OTMask->size() <<
" phase2 OT";
139 oldPxlMask->copyMaskTo(collectedPixels);
140 oldPh2OTMask->copyMaskTo(collectedPhase2OTs);
141 assert(phase2OTClusters->dataSize() >= collectedPhase2OTs.size());
142 collectedPhase2OTs.resize(phase2OTClusters->dataSize(),
false);
146 collectedPixels.resize(pixelClusters->dataSize(),
false);
147 collectedPhase2OTs.resize(phase2OTClusters->dataSize(),
false);
154 unsigned char qualMask = ~0;
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()) {
180 for (
auto i=0
U;
i<
s; ++
i){
183 bool goodTk = (pquals) ? (*pquals)[
i] & qualMask : track.
quality(trackQuality_);
184 if ( !goodTk)
continue;
186 auto const & chi2sX5 = track.
extra()->chi2sX5();
191 if (!
hit->isValid())
continue;
192 if ( chi2sX5[
h] > maxChi2_ )
continue;
196 if (cluster.isPixel()) collectedPixels[cluster.key()]=
true;
197 else if (cluster.isPhase2()) collectedPhase2OTs[cluster.key()]=
true;
203 auto removedPixelClusterMask=
205 LogDebug(
"TrackClusterRemoverPhase2")<<
"total pxl to skip: "<<
std::count(collectedPixels.begin(),collectedPixels.end(),
true);
208 auto removedPhase2OTClusterMask=
210 LogDebug(
"TrackClusterRemoverPhase2")<<
"total ph2OT to skip: "<<
std::count(collectedPhase2OTs.begin(),collectedPhase2OTs.end(),
true);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const std::vector< reco::PFCandidatePtr > & tracks_
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)
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