53 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
77 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
87 std::unique_ptr<edmNew::DetSetVector<T> >
104 using namespace reco;
108 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
110 if (iConfig.
exists(name)) {
116 if (id2 != -1)
pblocks_[id2] = pblock;
117 if (id3 != -1)
pblocks_[id3] = pblock;
118 if (id4 != -1)
pblocks_[id4] = pblock;
119 if (id5 != -1)
pblocks_[id5] = pblock;
120 if (id6 != -1)
pblocks_[id6] = pblock;
126 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
127 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
128 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
133 if (iConfig.
exists(
"clusterLessSolution"))
147 readPSet(iConfig,
"Strip" ,2,3,4,5);
148 readPSet(iConfig,
"StripInner" ,2,3);
149 readPSet(iConfig,
"StripOuter" ,4,5);
156 bool usingCharge =
false;
158 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"SeedClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
159 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
160 throw cms::Exception(
"Configuration Error") <<
"SeedClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
165 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
166 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
170 if (iConfig.
exists(
"TrackQuality")){
193 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
194 refs[
i] = oldRefs[refs[
i]];
200 std::unique_ptr<edmNew::DetSetVector<T> >
206 auto output = std::make_unique<DSV>();
209 unsigned int countOld=0;
210 unsigned int countNew=0;
213 const T * firstOffset = & oldClusters.
data().front();
214 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
217 if (oldDS.empty())
continue;
219 uint32_t
id = oldDS.detId();
222 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
223 uint32_t
index = ((&*it) - firstOffset);
226 outds.push_back(*it);
228 refs.push_back(index);
233 if (outds.empty()) outds.abort();
236 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
244 "SeedClusterRemover: strip cluster ref from Product ID = " << cluster.
id() <<
245 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
265 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
275 "SeedClusterRemover: pixel cluster ref from Product ID = " << cluster.
id() <<
276 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
294 const type_info &hitType =
typeid(*hit);
311 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
329 ProductID pixelOldProdID, stripOldProdID;
348 std::unique_ptr<ClusterRemovalInfo> cri;
359 if ( (oldRemovalInfo->stripNewRefProd().id() == stripClusters.
id()) &&
360 (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.
id()) ) {
362 cri->getOldClustersFrom(*oldRemovalInfo);
364 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
365 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
370 throw cms::Exception(
"Inconsistent Data") <<
"SeedClusterRemover: " <<
371 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
372 "\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to " <<
373 "[pixel: " << oldRemovalInfo->pixelNewRefProd().id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().id() <<
"]\n" <<
374 "NOTA BENE: when running SeedClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
392 LogDebug(
"SeedClusterRemover")<<
"to merge in, "<<oldStrMask->
size()<<
" strp and "<<oldPxlMask->
size()<<
" pxl";
406 TrajectorySeedCollection::const_iterator
seed=seeds->begin();
408 for (;seed!=seeds->end();++
seed){
411 for (;hit!=hits.second;++hit){
412 if (!hit->isValid())
continue;
422 cri->setNewPixelClusters(newPixels);
428 cri->setNewStripClusters(newStrips);
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
T getParameter(std::string const &) const
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
size_type dataSize() const
static const unsigned int NumberOfParamBlocks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
OmniClusterRef const & stereoClusterRef() const
SeedClusterRemover(const edm::ParameterSet &iConfig)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
key_type key() const
Accessor for product key.
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void copyMaskTo(std::vector< bool > &) const
ProductID id() const
Accessor for product ID.
uint32_t rawId() const
get the raw id
std::vector< bool > collectedStrips_
edm::ProductID pixelSourceProdID
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)
OmniClusterRef const & monoClusterRef() const
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
SiStripRecHit2D originalHit() const
OmniClusterRef const & omniClusterRef() const
static TrackQuality qualityByName(const std::string &name)
ParamBlock(const edm::ParameterSet &iConfig)
ClusterRef cluster() const
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
bool isTrackerPixel(const GeomDetEnumerators::SubDetector m)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
char const * productInstance
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
std::unique_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)
reco::TrackBase::TrackQuality trackQuality_
T const * product() const
const_iterator begin(bool update=false) const