51 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
72 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
82 std::auto_ptr<edmNew::DetSetVector<T> >
101 using namespace reco;
105 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
107 if (iConfig.
exists(name)) {
110 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
112 pblocks_[id1] = pblock;
113 if (id2 != -1) pblocks_[id2] = pblock;
114 if (id3 != -1) pblocks_[id3] = pblock;
115 if (id4 != -1) pblocks_[id4] = pblock;
116 if (id5 != -1) pblocks_[id5] = pblock;
117 if (id6 != -1) pblocks_[id6] = pblock;
123 doTracks_(iConfig.exists(
"trajectories")),
124 trajectories_(doTracks_ ? iConfig.getParameter<
InputTag>(
"trajectories") :
InputTag(
"NONE")),
125 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
126 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
127 stripClusters_(doStrip_ ? iConfig.getParameter<
InputTag>(
"stripClusters") :
InputTag(
"NONE")),
128 pixelClusters_(doPixel_ ? iConfig.getParameter<
InputTag>(
"pixelClusters") :
InputTag(
"NONE")),
129 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
130 oldRemovalInfo_(mergeOld_ ? iConfig.getParameter<
InputTag>(
"oldClusterRemovalInfo") :
InputTag(
"NONE")),
131 clusterWasteSolution_(
true),
132 doStripChargeCheck_(iConfig.existsAs<bool>(
"doStripChargeCheck") ? iConfig.getParameter<bool>(
"doStripChargeCheck") :
false),
133 doPixelChargeCheck_(iConfig.existsAs<bool>(
"doPixelChargeCheck") ? iConfig.getParameter<bool>(
"doPixelChargeCheck") :
false),
134 stripRecHits_(doStripChargeCheck_ ? iConfig.getParameter<std::
string>(
"stripRecHits") : std::
string(
"siStripMatchedRecHits")),
135 pixelRecHits_(doPixelChargeCheck_ ? iConfig.getParameter<std::
string>(
"pixelRecHits") : std::
string(
"siPixelRecHits"))
137 if (iConfig.
exists(
"overrideTrkQuals"))
139 if (iConfig.
exists(
"clusterLessSolution"))
142 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Charge check asked without cluster collection ";
144 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Pixel cluster charge check not yet implemented";
158 readPSet(iConfig,
"Strip" ,2,3,4,5);
159 readPSet(iConfig,
"StripInner" ,2,3);
160 readPSet(iConfig,
"StripOuter" ,4,5);
167 bool usingCharge =
false;
169 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
170 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
171 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
176 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
177 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
181 if (iConfig.
exists(
"TrackQuality")){
185 iConfig.
getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") : 0;
198 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
199 refs[
i] = oldRefs[refs[
i]];
205 auto_ptr<edmNew::DetSetVector<T> >
211 auto_ptr<DSV>
output(
new DSV());
212 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
214 unsigned int countOld=0;
215 unsigned int countNew=0;
218 const T * firstOffset = & oldClusters.
data().front();
219 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
222 if (oldDS.empty())
continue;
224 uint32_t
id = oldDS.detId();
225 DSF outds(*output,
id);
227 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
228 uint32_t
index = ((&*it) - firstOffset);
231 outds.push_back(*it);
233 refs.push_back(index);
238 if (outds.empty()) outds.abort();
241 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
247 SiStripRecHit2D::ClusterRef cluster = ocluster.
cluster_strip();
249 "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
250 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
256 for( std::vector<uint8_t>::const_iterator iAmp = cluster->amplitudes().begin(); iAmp != cluster->amplitudes().end(); ++iAmp){
259 if (
pblocks_[subdet-1].cutOnStripCharge_ && clusCharge >
pblocks_[subdet-1].minGoodStripCharge_)
return;
261 strips[cluster.key()] =
false;
276 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
283 SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
286 "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
287 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
296 pixels[cluster.key()] =
false;
305 const type_info &hitType =
typeid(*hit);
306 if (hitType ==
typeid(SiStripRecHit2D)) {
307 const SiStripRecHit2D *stripHit =
static_cast<const SiStripRecHit2D *
>(hit);
309 process(stripHit->omniClusterRef(),subdet,
true);}
310 else if (hitType ==
typeid(SiStripRecHit1D)) {
311 const SiStripRecHit1D *hit1D =
static_cast<const SiStripRecHit1D *
>(hit);
312 process(hit1D->omniClusterRef(),subdet,
true);
313 }
else if (hitType ==
typeid(SiStripMatchedRecHit2D)) {
314 const SiStripMatchedRecHit2D *matchHit =
static_cast<const SiStripMatchedRecHit2D *
>(hit);
316 process(matchHit->monoClusterRef(),subdet,
true);
317 process(matchHit->stereoClusterRef(),subdet,
true);
322 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
340 ProductID pixelOldProdID, stripOldProdID;
356 auto_ptr<ClusterRemovalInfo> cri;
367 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
368 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
370 cri->getOldClustersFrom(*oldRemovalInfo);
372 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
373 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
376 throw cms::Exception(
"Inconsistent Data") <<
"TrackClusterRemover: " <<
377 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
378 "\t but the *old* ClusterRemovalInfo " <<
oldRemovalInfo_.
encode() <<
" refers as 'new product ids' to " <<
379 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
380 "NOTA BENE: when running TrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
400 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
413 std::vector<Handle<edm::ValueMap<int> > > quals;
421 for ( ; asst!=trajectories_totrack->end();++asst){
425 if ( quals.size()!=0) {
426 int qual=(*(quals[0]))[asst->
val];
427 if ( qual < 0 ) {goodTk=
false;}
434 if ( !goodTk)
continue;
438 const vector<TrajectoryMeasurement> &tms = tj.
measurements();
439 vector<TrajectoryMeasurement>::const_iterator itm, endtm;
440 for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
443 process( hit, itm->estimate() );
453 recHit = rphiRecHits->begin(); recHit!= rphiRecHits->end(); recHit++){
456 process(recHit->omniClusterRef(),subdet,
false);
462 recHit = stereoRecHits->begin(); recHit!= stereoRecHits->end(); recHit++){
465 process(recHit->omniClusterRef(),subdet,
false);
475 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
476 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
479 cri->setNewPixelClusters(newPixels);
482 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
483 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
486 cri->setNewStripClusters(newStrips);
503 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
506 iEvent.
put( removedStripClusterMask );
508 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
511 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
edm::InputTag stripClusters_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
size_type dataSize() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
std::vector< data_type > DataContainer
edm::InputTag pixelClusters_
ParamBlock(const edm::ParameterSet &iConfig)
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void process(const TrackingRecHit *hit, float chi2)
reco::TrackBase::TrackQuality trackQuality_
void readPSet(const edm::ParameterSet &iConfig, const std::string &name, int id1=-1, int id2=-1, int id3=-1, int id4=-1, int id5=-1, int id6=-1)
TrackClusterRemover(const edm::ParameterSet &iConfig)
edm::InputTag oldRemovalInfo_
float minGoodStripCharge_
uint32_t rawId() const
get the raw id
DataContainer const & measurements() const
edm::ProductID stripSourceProdID
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
int minNumberOfLayersWithMeasBeforeFiltering_
int trackerLayersWithMeasurement() const
ClusterStripRef cluster_strip() const
data_type const * data(size_t cell) const
std::vector< uint8_t > pixels
float minGoodPixelCharge_
const_iterator end() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< uint32_t > Indices
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool clusterWasteSolution_
std::string pixelRecHits_
static TrackQuality qualityByName(const std::string &name)
edm::InputTag trajectories_
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
std::vector< uint8_t > strips
std::vector< bool > collectedStrips_
bool quality(const TrackQuality) const
Track quality.
std::vector< edm::InputTag > overrideTrkQuals_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
std::string stripRecHits_
edm::ProductID pixelSourceProdID
DetId geographicalId() const
const SiStripRecHit2D & originalHit() const
std::vector< bool > collectedPixels_
std::auto_ptr< edmNew::DetSetVector< T > > cleanup(const edmNew::DetSetVector< T > &oldClusters, const std::vector< uint8_t > &isGood, reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices *oldRefs)