50 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
68 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
78 std::auto_ptr<edmNew::DetSetVector<T> >
99 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
101 if (iConfig.
exists(name)) {
104 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
106 pblocks_[id1] = pblock;
107 if (id2 != -1) pblocks_[id2] = pblock;
108 if (id3 != -1) pblocks_[id3] = pblock;
109 if (id4 != -1) pblocks_[id4] = pblock;
110 if (id5 != -1) pblocks_[id5] = pblock;
111 if (id6 != -1) pblocks_[id6] = pblock;
117 trajectories_(iConfig.getParameter<
InputTag>(
"trajectories")),
118 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
119 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
120 stripClusters_(doStrip_ ? iConfig.getParameter<
InputTag>(
"stripClusters") :
InputTag(
"NONE")),
121 pixelClusters_(doPixel_ ? iConfig.getParameter<
InputTag>(
"pixelClusters") :
InputTag(
"NONE")),
122 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
123 oldRemovalInfo_(mergeOld_ ? iConfig.getParameter<
InputTag>(
"oldClusterRemovalInfo") :
InputTag(
"NONE")),
124 clusterWasteSolution_(
true)
126 if (iConfig.
exists(
"overrideTrkQuals"))
128 if (iConfig.
exists(
"clusterLessSolution"))
142 readPSet(iConfig,
"Strip" ,2,3,4,5);
143 readPSet(iConfig,
"StripInner" ,2,3);
144 readPSet(iConfig,
"StripOuter" ,4,5);
151 bool usingCharge =
false;
153 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"SeedClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
154 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
155 throw cms::Exception(
"Configuration Error") <<
"SeedClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
160 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
161 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
165 if (iConfig.
exists(
"TrackQuality")){
180 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
181 refs[
i] = oldRefs[refs[
i]];
187 auto_ptr<edmNew::DetSetVector<T> >
193 auto_ptr<DSV>
output(
new DSV());
194 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
196 unsigned int countOld=0;
197 unsigned int countNew=0;
200 const T * firstOffset = & oldClusters.
data().front();
201 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
204 if (oldDS.empty())
continue;
206 uint32_t
id = oldDS.detId();
207 DSF outds(*output,
id);
209 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
210 uint32_t
index = ((&*it) - firstOffset);
213 outds.push_back(*it);
215 refs.push_back(index);
220 if (outds.empty()) outds.abort();
223 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
229 SiStripRecHit2D::ClusterRef cluster = ocluster.
cluster_strip();
231 "SeedClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
232 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
237 strips[cluster.key()] =
false;
252 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
259 SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
262 "SeedClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
263 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
272 pixels[cluster.key()] =
false;
281 const type_info &hitType =
typeid(*hit);
282 if (hitType ==
typeid(SiStripRecHit2D)) {
283 const SiStripRecHit2D *stripHit =
static_cast<const SiStripRecHit2D *
>(hit);
285 process(stripHit->omniClusterRef(),subdet);}
286 else if (hitType ==
typeid(SiStripRecHit1D)) {
287 const SiStripRecHit1D *hit1D =
static_cast<const SiStripRecHit1D *
>(hit);
288 process(hit1D->omniClusterRef(),subdet);
289 }
else if (hitType ==
typeid(SiStripMatchedRecHit2D)) {
290 const SiStripMatchedRecHit2D *matchHit =
static_cast<const SiStripMatchedRecHit2D *
>(hit);
292 process(matchHit->monoClusterRef(),subdet);
293 process(matchHit->stereoClusterRef(),subdet);
298 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
316 ProductID pixelOldProdID, stripOldProdID;
332 auto_ptr<ClusterRemovalInfo> cri;
343 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
344 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
346 cri->getOldClustersFrom(*oldRemovalInfo);
348 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
349 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
352 throw cms::Exception(
"Inconsistent Data") <<
"SeedClusterRemover: " <<
353 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
354 "\t but the *old* ClusterRemovalInfo " <<
oldRemovalInfo_.
encode() <<
" refers as 'new product ids' to " <<
355 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
356 "NOTA BENE: when running SeedClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
376 LogDebug(
"SeedClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
388 TrajectorySeedCollection::const_iterator seed=seeds->begin();
390 for (;seed!=seeds->end();++seed){
393 for (;hit!=hits.second;++hit){
394 if (!hit->isValid())
continue;
401 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
402 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
405 cri->setNewPixelClusters(newPixels);
408 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
409 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
412 cri->setNewStripClusters(newStrips);
429 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
432 iEvent.
put( removedStripClusterMask );
434 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
437 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
const_iterator begin() const
size_type dataSize() const
edm::InputTag oldRemovalInfo_
static const unsigned int NumberOfParamBlocks
void process(const TrackingRecHit *hit, float chi2)
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
edm::InputTag trajectories_
edm::InputTag stripClusters_
SeedClusterRemover(const edm::ParameterSet &iConfig)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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
std::pair< const_iterator, const_iterator > range
bool clusterWasteSolution_
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
const_iterator end() const
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
edm::ProductID stripSourceProdID
static TrackQuality qualityByName(const std::string &name)
ParamBlock(const edm::ParameterSet &iConfig)
std::vector< edm::InputTag > overrideTrkQuals_
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
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::InputTag pixelClusters_
std::vector< bool > collectedPixels_
std::vector< uint8_t > pixels
DetId geographicalId() const
reco::TrackBase::TrackQuality trackQuality_
const SiStripRecHit2D & originalHit() const