31 ~TrackClusterRemover(){}
43 bool filterTracks_ =
false;
44 int minNumberOfLayersWithMeasBeforeFiltering_=0;
56 std::vector< edm::EDGetTokenT<edm::ValueMap<int> > > overrideTrkQuals_;
64 maxChi2_(iConfig.getParameter<double>(
"maxChi2"))
67 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
68 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
72 pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<
edm::InputTag>(
"pixelClusters"));
73 stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<
edm::InputTag>(
"stripClusters"));
76 if (iConfig.exists(
"overrideTrkQuals")) {
84 if (iConfig.exists(
"TrackQuality")){
87 if ( !trackQuality.empty() ) {
89 minNumberOfLayersWithMeasBeforeFiltering_ = iConfig.existsAs<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") ?
90 iConfig.getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") : 0;
94 if ( iConfig.exists(
"oldClusterRemovalInfo") ) {
96 mergeOld_ = ( (oldClusterRemovalInfo==
edm::InputTag(
"")) ?
false :
true );
101 oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<
edm::InputTag>(
"oldClusterRemovalInfo"));
102 oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<
edm::InputTag>(
"oldClusterRemovalInfo"));
114 iEvent.
getByToken(pixelClusters_, pixelClusters);
116 iEvent.
getByToken(stripClusters_, stripClusters);
119 std::vector<bool> collectedStrips;
120 std::vector<bool> collectedPixels;
125 iEvent.
getByToken(oldPxlMaskToken_ ,oldPxlMask);
126 iEvent.
getByToken(oldStrMaskToken_ ,oldStrMask);
127 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
128 oldStrMask->copyMaskTo(collectedStrips);
129 oldPxlMask->copyMaskTo(collectedPixels);
130 assert(stripClusters->dataSize()>=collectedStrips.size());
131 collectedStrips.resize(stripClusters->dataSize(),
false);
133 collectedStrips.resize(stripClusters->dataSize(),
false);
134 collectedPixels.resize(pixelClusters->dataSize(),
false);
143 iEvent.
getByToken(trajectories_,trajectories_totrack);
145 std::vector<edm::Handle<edm::ValueMap<int> > > quals;
147 if ( overrideTrkQuals_.size() > 0) {
149 iEvent.
getByToken(overrideTrkQuals_[0],quals[0]);
152 for (
auto const & asst : *trajectories_totrack){
156 if ( quals.size()!=0) {
157 int qual=(*(quals[0]))[asst.val];
158 if ( qual < 0 ) {goodTk=
false;}
161 goodTk = ( qual & (1<<trackQuality_))>>trackQuality_;
164 goodTk=(track.
quality(trackQuality_));
165 if ( !goodTk)
continue;
170 for (
auto const & tm : tms) {
171 auto const &
hit = *tm.recHit();
172 if (!
hit.isValid())
continue;
173 if ( tm.estimate() > maxChi2_ )
continue;
175 auto const & cluster = thit.firstClusterRef();
176 if (cluster.isStrip()) collectedStrips[cluster.key()]=
true;
177 else collectedPixels[cluster.key()]=
true;
184 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
186 LogDebug(
"TrackClusterRemover")<<
"total strip to skip: "<<
std::count(collectedStrips.begin(),collectedStrips.end(),
true);
188 iEvent.
put( removedStripClusterMask );
190 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
192 LogDebug(
"TrackClusterRemover")<<
"total pxl to skip: "<<
std::count(collectedPixels.begin(),collectedPixels.end(),
true);
193 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void produce(Event &, EventSetup const &)=0
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
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)
tuple oldClusterRemovalInfo
static TrackQuality qualityByName(const std::string &name)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
bool quality(const TrackQuality) const
Track quality.