50 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
74 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
84 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 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
124 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
125 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
126 clusterWasteSolution_(
true)
130 if (iConfig.
exists(
"clusterLessSolution"))
144 readPSet(iConfig,
"Strip" ,2,3,4,5);
145 readPSet(iConfig,
"StripInner" ,2,3);
146 readPSet(iConfig,
"StripOuter" ,4,5);
153 bool usingCharge =
false;
155 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"SeedClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
156 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
157 throw cms::Exception(
"Configuration Error") <<
"SeedClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
162 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
163 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
167 if (iConfig.
exists(
"TrackQuality")){
190 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
191 refs[
i] = oldRefs[refs[
i]];
197 auto_ptr<edmNew::DetSetVector<T> >
203 auto_ptr<DSV>
output(
new DSV());
204 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
206 unsigned int countOld=0;
207 unsigned int countNew=0;
210 const T * firstOffset = & oldClusters.
data().front();
211 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
214 if (oldDS.empty())
continue;
216 uint32_t
id = oldDS.detId();
217 DSF outds(*output,
id);
219 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
220 uint32_t
index = ((&*it) - firstOffset);
223 outds.push_back(*it);
225 refs.push_back(index);
230 if (outds.empty()) outds.abort();
233 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
239 SiStripRecHit2D::ClusterRef cluster = ocluster.
cluster_strip();
241 "SeedClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
242 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
247 strips[cluster.key()] =
false;
262 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
269 SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
272 "SeedClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
273 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
282 pixels[cluster.key()] =
false;
291 const type_info &hitType =
typeid(*hit);
292 if (hitType ==
typeid(SiStripRecHit2D)) {
293 const SiStripRecHit2D *stripHit =
static_cast<const SiStripRecHit2D *
>(hit);
295 process(stripHit->omniClusterRef(),subdet);}
296 else if (hitType ==
typeid(SiStripRecHit1D)) {
297 const SiStripRecHit1D *hit1D =
static_cast<const SiStripRecHit1D *
>(hit);
298 process(hit1D->omniClusterRef(),subdet);
299 }
else if (hitType ==
typeid(SiStripMatchedRecHit2D)) {
300 const SiStripMatchedRecHit2D *matchHit =
static_cast<const SiStripMatchedRecHit2D *
>(hit);
302 process(matchHit->monoClusterRef(),subdet);
303 process(matchHit->stereoClusterRef(),subdet);
304 }
else if (hitType ==
typeid(ProjectedSiStripRecHit2D)) {
305 const ProjectedSiStripRecHit2D *projHit =
static_cast<const ProjectedSiStripRecHit2D *
>(hit);
307 process(projHit->originalHit().omniClusterRef(),subdet);
308 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
326 ProductID pixelOldProdID, stripOldProdID;
342 auto_ptr<ClusterRemovalInfo> cri;
353 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
354 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
356 cri->getOldClustersFrom(*oldRemovalInfo);
358 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
359 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
364 throw cms::Exception(
"Inconsistent Data") <<
"SeedClusterRemover: " <<
365 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
366 "\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to " <<
367 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
368 "NOTA BENE: when running SeedClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
386 LogDebug(
"SeedClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
398 TrajectorySeedCollection::const_iterator
seed=seeds->begin();
400 for (;seed!=seeds->end();++
seed){
403 for (;hit!=hits.second;++hit){
404 if (!hit->isValid())
continue;
411 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
412 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
415 cri->setNewPixelClusters(newPixels);
418 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
419 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
422 cri->setNewStripClusters(newStrips);
439 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
442 iEvent.
put( removedStripClusterMask );
444 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
447 iEvent.
put( removedPixelClusterMask );
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
T getParameter(std::string const &) const
const_iterator end(bool update=false) const
size_type dataSize() const
static const unsigned int NumberOfParamBlocks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void process(const TrackingRecHit *hit, float chi2)
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
SeedClusterRemover(const edm::ParameterSet &iConfig)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
const char * productInstance
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
uint32_t rawId() const
get the raw id
std::vector< bool > collectedStrips_
edm::ProductID pixelSourceProdID
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
recHitContainer::const_iterator const_iterator
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)
ClusterStripRef cluster_strip() const
ParamBlock pblocks_[NumberOfParamBlocks]
data_type const * data(size_t cell) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
std::pair< const_iterator, const_iterator > range
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
bool clusterWasteSolution_
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< uint32_t > Indices
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::ProductID stripSourceProdID
static TrackQuality qualityByName(const std::string &name)
ParamBlock(const edm::ParameterSet &iConfig)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
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)
std::vector< uint8_t > strips
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
std::vector< bool > collectedPixels_
std::vector< uint8_t > pixels
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
reco::TrackBase::TrackQuality trackQuality_
const_iterator begin(bool update=false) const