58 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
86 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
96 std::unique_ptr<edmNew::DetSetVector<T> >
118 using namespace reco;
122 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
124 if (iConfig.
exists(name)) {
131 if (id3 != -1)
pblocks_[id3] = pblock;
132 if (id4 != -1)
pblocks_[id4] = pblock;
133 if (id5 != -1)
pblocks_[id5] = pblock;
134 if (id6 != -1)
pblocks_[id6] = pblock;
140 doTracks_(iConfig.exists(
"trajectories")),
143 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
151 if (iConfig.
exists(
"overrideTrkQuals"))
153 if (iConfig.
exists(
"clusterLessSolution"))
156 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Charge check asked without cluster collection ";
158 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Pixel cluster charge check not yet implemented";
175 readPSet(iConfig,
"Strip" ,2,3,4,5);
176 readPSet(iConfig,
"StripInner" ,2,3);
177 readPSet(iConfig,
"StripOuter" ,4,5);
184 bool usingCharge =
false;
186 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
187 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
188 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
193 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
194 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
198 if (iConfig.
exists(
"TrackQuality")){
202 iConfig.
getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") : 0;
230 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
231 refs[
i] = oldRefs[refs[
i]];
237 std::unique_ptr<edmNew::DetSetVector<T> >
243 auto output = std::make_unique<DSV>();
246 unsigned int countOld=0;
247 unsigned int countNew=0;
250 const T * firstOffset = & oldClusters.
data().front();
251 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
254 if (oldDS.empty())
continue;
256 uint32_t
id = oldDS.detId();
259 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
260 uint32_t
index = ((&*it) - firstOffset);
263 outds.push_back(*it);
265 refs.push_back(index);
270 if (outds.empty()) outds.abort();
273 if (oldRefs !=
nullptr)
mergeOld(refs, *oldRefs);
292 "HITrackClusterRemover: strip cluster ref from Product ID = " << cluster.
id() <<
293 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
300 for( std::vector<uint8_t>::const_iterator iAmp = cluster->amplitudes().begin(); iAmp != cluster->amplitudes().end(); ++iAmp){
333 "HITrackClusterRemover: pixel cluster ref from Product ID = " << cluster.
id() <<
334 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
352 const type_info &hitType =
typeid(*hit);
369 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
387 ProductID pixelOldProdID, stripOldProdID;
406 std::unique_ptr<ClusterRemovalInfo> cri;
417 if ( (oldRemovalInfo->stripNewRefProd().id() == stripClusters.
id()) &&
418 (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.
id()) ) {
420 cri->getOldClustersFrom(*oldRemovalInfo);
422 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
423 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
429 throw cms::Exception(
"Inconsistent Data") <<
"HITrackClusterRemover: " <<
430 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
431 "\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to " <<
432 "[pixel: " << oldRemovalInfo->pixelNewRefProd().id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().id() <<
"]\n" <<
433 "NOTA BENE: when running HITrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
451 LogDebug(
"HITrackClusterRemover")<<
"to merge in, "<<oldStrMask->
size()<<
" strp and "<<oldPxlMask->
size()<<
" pxl";
466 std::vector<Handle<edm::ValueMap<int> > > quals;
472 for (
const auto &
track: *tracks) {
475 if ( !quals.empty()) {
476 int qual=(*(quals[0])).
get(it++);
477 if ( qual < 0 ) {goodTk=
false;}
484 if ( !goodTk)
continue;
487 auto const & chi2sX5 =
track.extra()->chi2sX5();
488 assert(chi2sX5.size()==
track.recHitsSize());
489 auto hb =
track.recHitsBegin();
490 for(
unsigned int h=0;
h<
track.recHitsSize();
h++){
492 if (!
hit->isValid())
continue;
526 cri->setNewPixelClusters(newPixels);
531 cri->setNewStripClusters(newStrips);
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
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
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
float minGoodPixelCharge_
void process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< data_type > DataContainer
static unsigned char toChi2x5(float chi2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
OmniClusterRef const & stereoClusterRef() const
HITrackClusterRemover(const edm::ParameterSet &iConfig)
constexpr uint32_t rawId() const
get the raw id
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< uint8_t > strips
static const unsigned int NumberOfParamBlocks
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
key_type key() const
Accessor for product key.
void copyMaskTo(std::vector< bool > &) const
ProductID id() const
Accessor for product ID.
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
std::string stripRecHits_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< reco::TrackCollection > tracks_
reco::TrackBase::TrackQuality trackQuality_
~HITrackClusterRemover() override
ClusterStripRef cluster_strip() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
data_type const * data(size_t cell) const
int minNumberOfLayersWithMeasBeforeFiltering_
float minGoodStripCharge_
bool clusterWasteSolution_
OmniClusterRef const & monoClusterRef() const
std::vector< uint32_t > Indices
std::string pixelRecHits_
ParamBlock pblocks_[NumberOfParamBlocks]
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)
SiStripRecHit2D originalHit() const
Detector identifier class for the strip tracker.
OmniClusterRef const & omniClusterRef() const
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
static TrackQuality qualityByName(const std::string &name)
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
ClusterRef cluster() const
std::vector< bool > collectedStrips_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
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)
char const * productInstance
std::vector< uint8_t > pixels
float sensorThickness(const SiStripDetId &detid) const
ParamBlock(const edm::ParameterSet &iConfig)
DetId geographicalId() const
std::vector< bool > collectedPixels_
ModuleGeometry moduleGeometry() const
edm::ProductID stripSourceProdID
T const * product() const
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
const_iterator begin(bool update=false) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::ProductID pixelSourceProdID