57 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
101 const std::vector<uint8_t> &isGood,
121 using namespace reco;
125 if (iConfig.
exists(name)) {
128 fill(pblocks_, pblocks_ + NumberOfParamBlocks, pblock);
130 pblocks_[id1] = pblock;
132 pblocks_[id2] = pblock;
134 pblocks_[id3] = pblock;
136 pblocks_[id4] = pblock;
138 pblocks_[id5] = pblock;
140 pblocks_[id6] = pblock;
147 doTracks_(iConfig.exists(
"trajectories")),
148 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
149 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
150 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
151 clusterWasteSolution_(
true),
153 iConfig.existsAs<bool>(
"doStripChargeCheck") ? iConfig.getParameter<bool>(
"doStripChargeCheck") :
false),
155 iConfig.existsAs<bool>(
"doPixelChargeCheck") ? iConfig.getParameter<bool>(
"doPixelChargeCheck") :
false),
156 stripRecHits_(doStripChargeCheck_ ? iConfig.getParameter<std::
string>(
"stripRecHits")
157 : std::
string(
"siStripMatchedRecHits")),
158 pixelRecHits_(doPixelChargeCheck_ ? iConfig.getParameter<std::
string>(
"pixelRecHits")
159 : std::
string(
"siPixelRecHits")) {
161 if (iConfig.
exists(
"overrideTrkQuals"))
163 if (iConfig.
exists(
"clusterLessSolution"))
167 <<
"HITrackClusterRemover: Charge check asked without cluster collection ";
170 <<
"HITrackClusterRemover: Pixel cluster charge check not yet implemented";
173 produces<edmNew::DetSetVector<SiPixelCluster> >();
175 produces<edmNew::DetSetVector<SiStripCluster> >();
177 produces<ClusterRemovalInfo>();
189 readPSet(iConfig,
"Strip", 2, 3, 4, 5);
190 readPSet(iConfig,
"StripInner", 2, 3);
191 readPSet(iConfig,
"StripOuter", 4, 5);
198 bool usingCharge =
false;
202 <<
"HITrackClusterRemover: Missing configuration for detector with subDetID = " << (
i + 1);
203 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
204 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Configuration for subDetID = " << (
i + 1)
205 <<
" uses cluster charge, which is not enabled.";
210 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
211 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
215 if (iConfig.
exists(
"TrackQuality")) {
219 iConfig.
existsAs<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")
220 ? iConfig.
getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering")
246 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
247 refs[
i] = oldRefs[refs[
i]];
251 template <
typename T>
254 const std::vector<uint8_t> &isGood,
260 auto output = std::make_unique<DSV>();
263 unsigned int countOld = 0;
264 unsigned int countNew = 0;
267 const T *firstOffset = &oldClusters.
data().front();
268 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
274 uint32_t
id = oldDS.detId();
277 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
278 uint32_t
index = ((&*it) - firstOffset);
281 outds.push_back(*it);
283 refs.push_back(index);
291 if (oldRefs !=
nullptr)
314 <<
"HITrackClusterRemover: strip cluster ref from Product ID = " << cluster.
id()
315 <<
" does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
322 if (
pblocks_[subdet - 1].cutOnStripCharge_ &&
356 <<
"HITrackClusterRemover: pixel cluster ref from Product ID = " << cluster.
id()
357 <<
" does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
378 const type_info &hitType =
typeid(*hit);
397 <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
412 ProductID pixelOldProdID, stripOldProdID;
430 std::unique_ptr<ClusterRemovalInfo> cri;
444 if ((oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
445 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id())) {
446 cri->getOldClustersFrom(*oldRemovalInfo);
448 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
449 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
455 <<
"HITrackClusterRemover: "
456 <<
"Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id()
458 <<
"\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to "
459 <<
"[pixel: " << oldRemovalInfo->pixelNewRefProd().
id()
460 <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n"
461 <<
"NOTA BENE: when running HITrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory "
462 "MUST be already re-keyed.\n";
470 strips.resize(stripClusters->dataSize());
474 pixels.resize(pixelClusters->dataSize());
482 LogDebug(
"HITrackClusterRemover") <<
"to merge in, " << oldStrMask->size() <<
" strp and " << oldPxlMask->size()
497 std::vector<Handle<edm::ValueMap<int> > > quals;
503 for (
const auto &
track : *tracks) {
506 if (!quals.empty()) {
507 int qual = (*(quals[0])).get(it++);
521 auto const &chi2sX5 =
track.extra()->chi2sX5();
523 auto hb =
track.recHitsBegin();
524 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++) {
525 auto hit = *(hb +
h);
538 recHit != rphiRecHits->end();
541 process(recHit->omniClusterRef(), detid,
false);
547 recHit != stereoRecHits->end();
550 process(recHit->omniClusterRef(), detid,
false);
560 cleanup(*pixelClusters,
pixels, cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() :
nullptr));
562 cri->setNewPixelClusters(newPixels);
566 cleanup(*stripClusters,
strips, cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() :
nullptr));
568 cri->setNewStripClusters(newStrips);
585 LogDebug(
"HITrackClusterRemover") <<
"total strip to skip: "
591 LogDebug(
"HITrackClusterRemover") <<
"total pxl to skip: "
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
float minGoodPixelCharge_
void process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg)
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)
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
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
auto const & tracks
cannot be loose
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
std::string stripRecHits_
bool getData(T &iHolder) const
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
static constexpr auto TOB
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.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
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)
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
ClusterRef cluster() const
T getParameter(std::string const &) const
std::vector< bool > collectedStrips_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
static constexpr auto TIB
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
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
std::vector< uint8_t > pixels
float sensorThickness(const SiStripDetId &detid) const
ParamBlock(const edm::ParameterSet &iConfig)
DetId geographicalId() const
std::vector< bool > collectedPixels_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
edm::ProductID stripSourceProdID
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
SiStripModuleGeometry moduleGeometry() const