52 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
80 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
90 std::auto_ptr<edmNew::DetSetVector<T> >
112 using namespace reco;
116 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
118 if (iConfig.
exists(name)) {
121 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
123 pblocks_[id1] = pblock;
124 if (id2 != -1) pblocks_[id2] = pblock;
125 if (id3 != -1) pblocks_[id3] = pblock;
126 if (id4 != -1) pblocks_[id4] = pblock;
127 if (id5 != -1) pblocks_[id5] = pblock;
128 if (id6 != -1) pblocks_[id6] = pblock;
134 doTracks_(iConfig.exists(
"trajectories")),
135 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
136 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
137 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
138 clusterWasteSolution_(
true),
139 doStripChargeCheck_(iConfig.existsAs<bool>(
"doStripChargeCheck") ? iConfig.getParameter<bool>(
"doStripChargeCheck") :
false),
140 doPixelChargeCheck_(iConfig.existsAs<bool>(
"doPixelChargeCheck") ? iConfig.getParameter<bool>(
"doPixelChargeCheck") :
false),
141 stripRecHits_(doStripChargeCheck_ ? iConfig.getParameter<std::
string>(
"stripRecHits") : std::
string(
"siStripMatchedRecHits")),
142 pixelRecHits_(doPixelChargeCheck_ ? iConfig.getParameter<std::
string>(
"pixelRecHits") : std::
string(
"siPixelRecHits"))
144 if (iConfig.
exists(
"overrideTrkQuals"))
146 if (iConfig.
exists(
"clusterLessSolution"))
149 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Charge check asked without cluster collection ";
151 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Pixel cluster charge check not yet implemented";
165 readPSet(iConfig,
"Strip" ,2,3,4,5);
166 readPSet(iConfig,
"StripInner" ,2,3);
167 readPSet(iConfig,
"StripOuter" ,4,5);
174 bool usingCharge =
false;
176 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
177 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
178 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
183 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
184 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
188 if (iConfig.
exists(
"TrackQuality")){
192 iConfig.
getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") : 0;
220 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
221 refs[
i] = oldRefs[refs[
i]];
227 auto_ptr<edmNew::DetSetVector<T> >
233 auto_ptr<DSV>
output(
new DSV());
234 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
236 unsigned int countOld=0;
237 unsigned int countNew=0;
240 const T * firstOffset = & oldClusters.
data().front();
241 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
244 if (oldDS.empty())
continue;
246 uint32_t
id = oldDS.detId();
247 DSF outds(*output,
id);
249 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
250 uint32_t
index = ((&*it) - firstOffset);
253 outds.push_back(*it);
255 refs.push_back(index);
260 if (outds.empty()) outds.abort();
263 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
280 SiStripRecHit2D::ClusterRef cluster = ocluster.
cluster_strip();
282 "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
283 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
290 for( std::vector<uint8_t>::const_iterator iAmp = cluster->amplitudes().begin(); iAmp != cluster->amplitudes().end(); ++iAmp){
295 strips[cluster.key()] =
false;
310 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
317 SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
320 "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
321 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
330 pixels[cluster.key()] =
false;
339 const type_info &hitType =
typeid(*hit);
340 if (hitType ==
typeid(SiStripRecHit2D)) {
341 const SiStripRecHit2D *stripHit =
static_cast<const SiStripRecHit2D *
>(hit);
344 else if (hitType ==
typeid(SiStripRecHit1D)) {
345 const SiStripRecHit1D *hit1D =
static_cast<const SiStripRecHit1D *
>(hit);
347 }
else if (hitType ==
typeid(SiStripMatchedRecHit2D)) {
348 const SiStripMatchedRecHit2D *matchHit =
static_cast<const SiStripMatchedRecHit2D *
>(hit);
352 }
else if (hitType ==
typeid(ProjectedSiStripRecHit2D)) {
353 const ProjectedSiStripRecHit2D *projHit =
static_cast<const ProjectedSiStripRecHit2D *
>(hit);
355 process(projHit->originalHit().omniClusterRef(),
detid,
true);
356 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
374 ProductID pixelOldProdID, stripOldProdID;
390 auto_ptr<ClusterRemovalInfo> cri;
401 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
402 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
404 cri->getOldClustersFrom(*oldRemovalInfo);
406 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
407 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
413 throw cms::Exception(
"Inconsistent Data") <<
"TrackClusterRemover: " <<
414 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
415 "\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to " <<
416 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
417 "NOTA BENE: when running TrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
435 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
448 std::vector<Handle<edm::ValueMap<int> > > quals;
456 for ( ; asst!=trajectories_totrack->end();++asst){
457 const Track & track = *(asst->val);
460 if ( quals.size()!=0) {
461 int qual=(*(quals[0]))[asst->val];
462 if ( qual < 0 ) {goodTk=
false;}
469 if ( !goodTk)
continue;
473 const vector<TrajectoryMeasurement> &tms = tj.
measurements();
474 vector<TrajectoryMeasurement>::const_iterator itm, endtm;
475 for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
478 process( hit, itm->estimate() );
488 recHit = rphiRecHits->begin(); recHit!= rphiRecHits->end(); recHit++){
496 recHit = stereoRecHits->begin(); recHit!= stereoRecHits->end(); recHit++){
508 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
509 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
512 cri->setNewPixelClusters(newPixels);
515 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
516 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
519 cri->setNewStripClusters(newStrips);
536 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
540 iEvent.
put( removedStripClusterMask );
542 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
545 iEvent.
put( removedPixelClusterMask );
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) 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
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
ParamBlock pblocks_[NumberOfParamBlocks]
std::vector< data_type > DataContainer
friend struct const_iterator
ParamBlock(const edm::ParameterSet &iConfig)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void process(const TrackingRecHit *hit, float chi2)
const char * productInstance
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)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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.
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
int minNumberOfLayersWithMeasBeforeFiltering_
int trackerLayersWithMeasurement() const
ClusterStripRef cluster_strip() const
data_type const * data(size_t cell) const
float sensorThickness(const SiStripDetId &detid) const
std::vector< uint8_t > pixels
float minGoodPixelCharge_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
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 clusterWasteSolution_
std::string pixelRecHits_
Detector identifier class for the strip tracker.
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
static TrackQuality qualityByName(const std::string &name)
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
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.
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
edm::EDGetTokenT< TrajTrackAssociationCollection > trajectories_
std::string stripRecHits_
edm::ProductID pixelSourceProdID
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
ModuleGeometry moduleGeometry() const
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
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)
const_iterator begin(bool update=false) const