63 std::unique_ptr<edmNew::DetSetVector<T> >
85 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
88 if (iConfig.
exists(
"clusterLessSolution"))
95 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
96 produces<edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D> > >();
100 if (iConfig.
exists(
"TrackQuality")){
123 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
124 refs[
i] = oldRefs[refs[
i]];
130 std::unique_ptr<edmNew::DetSetVector<T> >
136 auto output = std::make_unique<DSV>();
139 unsigned int countOld=0;
140 unsigned int countNew=0;
143 const T * firstOffset = & oldClusters.
data().front();
144 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
147 if (oldDS.empty())
continue;
149 uint32_t
id = oldDS.detId();
152 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
153 uint32_t
index = ((&*it) - firstOffset);
156 outds.push_back(*it);
158 refs.push_back(index);
159 LogDebug(
"SeedClusterRemoverPhase2") <<
"SeedClusterRemoverPhase2::cleanup " <<
typeid(
T).
name() <<
" reference " << index <<
" to " << (refs.size() - 1);
163 if (outds.empty()) outds.abort();
166 if (oldRefs !=
nullptr)
mergeOld(refs, *oldRefs);
180 const type_info &hitType =
typeid(*hit);
187 LogDebug(
"SeedClusterRemoverPhase2") <<
"Plain Pixel RecHit in det " << detid.
rawId();
190 "SeedClusterRemoverPhase2: pixel cluster ref from Product ID = " << cluster.
id() <<
191 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
206 LogDebug(
"SeedClusterRemoverPhase2") <<
"Plain Phase2TrackerRecHit1D in det " << detid.
rawId();
210 "SeedClusterRemoverPhase2: strip cluster ref from Product ID = " << cluster.
id() <<
215 OTs[cluster.
key()] =
false;
219 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"I received a hit that was neither SiPixelRecHit nor Phase2TrackerRecHit1D but " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
227 ProductID pixelOldProdID, stripOldProdID;
246 std::unique_ptr<ClusterRemovalInfo> cri;
257 if ( (oldRemovalInfo->stripNewRefProd().id() == phase2OTClusters.
id()) &&
258 (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.
id()) ) {
260 cri->getOldClustersFrom(*oldRemovalInfo);
262 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
263 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
268 throw cms::Exception(
"Inconsistent Data") <<
"SeedClusterRemoverPhase2: " <<
269 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << phase2OTClusters.
id() <<
"] \n" <<
270 "\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to " <<
271 "[pixel: " << oldRemovalInfo->pixelNewRefProd().id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().id() <<
"]\n" <<
272 "NOTA BENE: when running SeedClusterRemoverPhase2 with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
280 OTs.resize(phase2OTClusters->dataSize());
fill(
OTs.begin(),
OTs.end(),
true);
290 LogDebug(
"SeedClusterRemoverPhase2") <<
"to merge in, "<<oldPh2OTMask->
size()<<
" strp and "<<oldPxlMask->
size()<<
" pxl";
304 TrajectorySeedCollection::const_iterator
seed=seeds->begin();
306 for (;seed!=seeds->end();++
seed){
309 for (;hit!=hits.second;++hit){
310 if (!hit->isValid())
continue;
319 LogDebug(
"SeedClusterRemoverPhase2") <<
"SeedClusterRemoverPhase2: Wrote pixel " << newPixels.
id() <<
" from " <<
pixelSourceProdID ;
320 cri->setNewPixelClusters(newPixels);
324 iEvent.
put(
cleanup(*phase2OTClusters,
OTs, cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() :
nullptr));
326 cri->setNewPhase2OTClusters(newOuterTrackers);
std::vector< bool > collectedPixels_
std::vector< bool > collectedOuterTrackers_
T getParameter(std::string const &) const
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
size_type dataSize() const
edm::ProductID outerTrackerSourceProdID
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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
~SeedClusterRemoverPhase2() override
key_type key() const
Accessor for product key.
edm::ContainerMask< edmNew::DetSetVector< Phase2TrackerCluster1D > > Phase2OTMaskContainer
void copyMaskTo(std::vector< bool > &) const
ProductID id() const
Accessor for product ID.
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
uint32_t rawId() const
get the raw id
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
std::vector< uint8_t > pixels
recHitContainer::const_iterator const_iterator
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
data_type const * data(size_t cell) const
std::pair< const_iterator, const_iterator > range
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
edm::ProductID pixelSourceProdID
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< uint32_t > Indices
std::vector< uint8_t > OTs
static TrackQuality qualityByName(const std::string &name)
SeedClusterRemoverPhase2(const edm::ParameterSet &iConfig)
ClusterRef cluster() const
edm::EDGetTokenT< Phase2OTMaskContainer > oldPh2OTMaskToken_
bool clusterWasteSolution_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
char const * productInstance
reco::TrackBase::TrackQuality trackQuality_
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > phase2OTClusters_
DetId geographicalId() const
T const * product() const
const_iterator begin(bool update=false) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override