CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
HITrackClusterRemover Class Reference
Inheritance diagram for HITrackClusterRemover:
edm::stream::EDProducer<>

Classes

struct  ParamBlock
 

Public Member Functions

 HITrackClusterRemover (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HITrackClusterRemover () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

typedef edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
 
typedef edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
 

Private Member Functions

template<typename T >
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)
 
void mergeOld (reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
 
void process (const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg)
 
void process (const OmniClusterRef &cluRef, SiStripDetId &detid, bool fromTrack)
 
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)
 
float sensorThickness (const SiStripDetId &detid) const
 

Private Attributes

bool clusterWasteSolution_
 
std::vector< bool > collectedPixels_
 
std::vector< bool > collectedStrips_
 
bool doPixel_
 
bool doPixelChargeCheck_
 
bool doStrip_
 
bool doStripChargeCheck_
 
bool doTracks_
 
bool filterTracks_
 
bool mergeOld_
 
int minNumberOfLayersWithMeasBeforeFiltering_
 
edm::EDGetTokenT< PixelMaskContaineroldPxlMaskToken_
 
edm::EDGetTokenT< reco::ClusterRemovalInfooldRemovalInfo_
 
edm::EDGetTokenT< StripMaskContaineroldStrMaskToken_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
 
ParamBlock pblocks_ [NumberOfParamBlocks]
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
 
std::string pixelRecHits_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::EDGetTokenT< SiStripRecHit2DCollectionrphiRecHitToken_
 
edm::EDGetTokenT< SiStripRecHit2DCollectionstereoRecHitToken_
 
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
 
std::string stripRecHits_
 
std::vector< uint8_t > strips
 
edm::ProductID stripSourceProdID
 
reco::TrackBase::TrackQuality trackQuality_
 
edm::EDGetTokenT< reco::TrackCollectiontracks_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
 

Static Private Attributes

static const unsigned int NumberOfParamBlocks = 6
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 41 of file HITrackClusterRemover.cc.

Member Typedef Documentation

◆ PixelMaskContainer

Definition at line 71 of file HITrackClusterRemover.cc.

◆ StripMaskContainer

Definition at line 72 of file HITrackClusterRemover.cc.

Constructor & Destructor Documentation

◆ HITrackClusterRemover()

HITrackClusterRemover::HITrackClusterRemover ( const edm::ParameterSet iConfig)

Definition at line 145 of file HITrackClusterRemover.cc.

References cms::cuda::assert(), clusterWasteSolution_, doPixel_, doPixelChargeCheck_, doStrip_, doStripChargeCheck_, doTracks_, Exception, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), ntuplemaker::fill, filterTracks_, edm::ParameterSet::getParameter(), mps_fire::i, ProducerED_cfi::InputTag, label, mergeOld_, minNumberOfLayersWithMeasBeforeFiltering_, NumberOfParamBlocks, oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, overrideTrkQuals_, pblocks_, pixelClusters_, reco::TrackBase::qualityByName(), readPSet(), rphiRecHitToken_, stereoRecHitToken_, AlCaHLTBitMon_QueryRunRegistry::string, stripClusters_, stripRecHits_, trackQuality_, tracks_, and reco::TrackBase::undefQuality.

146  : tTrackerGeom_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),
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")) {
160  mergeOld_ = mergeOld_ && !iConfig.getParameter<InputTag>("oldClusterRemovalInfo").label().empty();
161  if (iConfig.exists("overrideTrkQuals"))
162  overrideTrkQuals_.push_back(consumes<edm::ValueMap<int> >(iConfig.getParameter<InputTag>("overrideTrkQuals")));
163  if (iConfig.exists("clusterLessSolution"))
164  clusterWasteSolution_ = !iConfig.getParameter<bool>("clusterLessSolution");
166  throw cms::Exception("Configuration Error")
167  << "HITrackClusterRemover: Charge check asked without cluster collection ";
169  throw cms::Exception("Configuration Error")
170  << "HITrackClusterRemover: Pixel cluster charge check not yet implemented";
171 
173  produces<edmNew::DetSetVector<SiPixelCluster> >();
175  produces<edmNew::DetSetVector<SiStripCluster> >();
177  produces<ClusterRemovalInfo>();
178 
180 
181  fill(pblocks_, pblocks_ + NumberOfParamBlocks, ParamBlock());
182  readPSet(iConfig, "Common", -1);
183  if (doPixel_) {
184  readPSet(iConfig, "Pixel", 0, 1);
185  readPSet(iConfig, "PXB", 0);
186  readPSet(iConfig, "PXE", 1);
187  }
188  if (doStrip_) {
189  readPSet(iConfig, "Strip", 2, 3, 4, 5);
190  readPSet(iConfig, "StripInner", 2, 3);
191  readPSet(iConfig, "StripOuter", 4, 5);
192  readPSet(iConfig, "TIB", 2);
193  readPSet(iConfig, "TID", 3);
194  readPSet(iConfig, "TOB", 4);
195  readPSet(iConfig, "TEC", 5);
196  }
197 
198  bool usingCharge = false;
199  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
200  if (!pblocks_[i].isSet_)
201  throw cms::Exception("Configuration Error")
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.";
206  }
207  }
208 
209  if (!clusterWasteSolution_) {
210  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
211  produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
212  }
214  filterTracks_ = false;
215  if (iConfig.exists("TrackQuality")) {
216  filterTracks_ = true;
219  iConfig.existsAs<int>("minNumberOfLayersWithMeasBeforeFiltering")
220  ? iConfig.getParameter<int>("minNumberOfLayersWithMeasBeforeFiltering")
221  : 0;
222  }
223 
224  if (doTracks_)
225  tracks_ = consumes<reco::TrackCollection>(iConfig.getParameter<InputTag>("trajectories"));
226  if (doPixel_)
227  pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
228  if (doStrip_)
229  stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<InputTag>("stripClusters"));
230  if (mergeOld_) {
231  oldRemovalInfo_ = consumes<ClusterRemovalInfo>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
232  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
233  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
234  }
235 
236  if (doStripChargeCheck_) {
237  rphiRecHitToken_ = consumes<SiStripRecHit2DCollection>(InputTag(stripRecHits_, "rphiRecHit"));
238  stereoRecHitToken_ = consumes<SiStripRecHit2DCollection>(InputTag(stripRecHits_, "stereoRecHit"));
239  }
240  // if(doPixelChargeCheck_) pixelRecHitsToken_ = consumes<SiPixelRecHitCollection>(InputTag(pixelRecHits_));
241 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
bool exists(std::string const &parameterName) const
checks if a parameter exists
static const unsigned int NumberOfParamBlocks
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
assert(be >=bs)
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
char const * label
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< reco::TrackCollection > tracks_
reco::TrackBase::TrackQuality trackQuality_
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)
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_

◆ ~HITrackClusterRemover()

HITrackClusterRemover::~HITrackClusterRemover ( )
override

Definition at line 243 of file HITrackClusterRemover.cc.

243 {}

Member Function Documentation

◆ cleanup()

template<typename T >
std::unique_ptr< edmNew::DetSetVector< T > > HITrackClusterRemover::cleanup ( const edmNew::DetSetVector< T > &  oldClusters,
const std::vector< uint8_t > &  isGood,
reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 252 of file HITrackClusterRemover.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::data(), edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::end(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, mergeOld(), convertSQLitetoXML_cfg::output, and edmNew::DetSetVector< T >::size().

Referenced by produce().

256  {
257  typedef typename edmNew::DetSetVector<T> DSV;
258  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
259  typedef typename edmNew::DetSet<T> DS;
260  auto output = std::make_unique<DSV>();
261  output->reserve(oldClusters.size(), oldClusters.dataSize());
262 
263  // cluster removal loop
264  const T *firstOffset = &oldClusters.data().front();
265  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
266  DS oldDS = *itdet;
267 
268  if (oldDS.empty())
269  continue; // skip empty detsets
270 
271  uint32_t id = oldDS.detId();
272  DSF outds(*output, id);
273 
274  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
275  uint32_t index = ((&*it) - firstOffset);
276  if (isGood[index]) {
277  outds.push_back(*it);
278  refs.push_back(index);
279  //std::cout << "HITrackClusterRemover::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
280  }
281  }
282  if (outds.empty())
283  outds.abort(); // not write in an empty DSV
284  }
285 
286  if (oldRefs != nullptr)
287  mergeOld(refs, *oldRefs);
288  return output;
289 }
size_type dataSize() const
data_type const * data(size_t cell) const
const_iterator end(bool update=false) const
const_iterator begin(bool update=false) const
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
size_type size() const
Definition: output.py:1
long double T

◆ mergeOld()

void HITrackClusterRemover::mergeOld ( reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 245 of file HITrackClusterRemover.cc.

References mps_fire::i, and dqmiodumpmetadata::n.

Referenced by cleanup().

245  {
246  for (size_t i = 0, n = refs.size(); i < n; ++i) {
247  refs[i] = oldRefs[refs[i]];
248  }
249 }

◆ process() [1/2]

void HITrackClusterRemover::process ( const TrackingRecHit hit,
unsigned char  chi2,
const TrackerGeometry tg 
)
inlineprivate

Definition at line 331 of file HITrackClusterRemover.cc.

References cms::cuda::assert(), nano_mu_local_reco_cff::chi2, SiPixelRecHit::cluster(), clusterWasteSolution_, collectedPixels_, doPixel_, doStrip_, Exception, TrackerGeometry::geomDetSubDetector(), edm::Ref< C, T, F >::id(), GeomDetEnumerators::isTrackerPixel(), edm::Ref< C, T, F >::key(), HITrackClusterRemover::ParamBlock::maxSize_, SiStripMatchedRecHit2D::monoClusterRef(), NumberOfParamBlocks, TrackerSingleRecHit::omniClusterRef(), ProjectedSiStripRecHit2D::originalHit(), pblocks_, pixels, pixelSourceProdID, DetId::rawId(), SiStripMatchedRecHit2D::stereoClusterRef(), DetId::subdetId(), and Traj2TrackHits::toChi2x5().

Referenced by produce().

331  {
332  SiStripDetId detid = hit->geographicalId();
333  uint32_t subdet = detid.subdetId();
334 
335  assert((subdet > 0) && (subdet <= NumberOfParamBlocks));
336 
337  // chi2 cut
338  if (chi2 > Traj2TrackHits::toChi2x5(pblocks_[subdet - 1].maxChi2_))
339  return;
340 
342  if (!doPixel_)
343  return;
344  // this is a pixel, and i *know* it is
345  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
346 
347  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
348 
349  if (cluster.id() != pixelSourceProdID)
350  throw cms::Exception("Inconsistent Data")
351  << "HITrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id()
352  << " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
353 
354  assert(cluster.id() == pixelSourceProdID);
355  //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
356 
357  // if requested, cut on cluster size
358  if (pblocks_[subdet - 1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet - 1].maxSize_))
359  return;
360 
361  // mark as used
362  pixels[cluster.key()] = false;
363 
364  //if(!clusterWasteSolution_) collectedPixel[detid.rawId()].insert(cluster);
365  assert(collectedPixels_.size() > cluster.key());
366  //assert(detid.rawId() == cluster->geographicalId()); //This condition fails
368  collectedPixels_[cluster.key()] = true;
369 
370  } else { // aka Strip
371  if (!doStrip_)
372  return;
373  const type_info &hitType = typeid(*hit);
374  if (hitType == typeid(SiStripRecHit2D)) {
375  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
376  //DBG// cout << "Plain RecHit 2D: " << endl;
377  process(stripHit->omniClusterRef(), detid, true);
378  } else if (hitType == typeid(SiStripRecHit1D)) {
379  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
380  process(hit1D->omniClusterRef(), detid, true);
381  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
382  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
383  //DBG// cout << "Matched RecHit 2D: " << endl;
384  process(matchHit->monoClusterRef(), detid, true);
385  process(matchHit->stereoClusterRef(), detid, true);
386  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
387  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
388  //DBG// cout << "Projected RecHit 2D: " << endl;
389  process(projHit->originalHit().omniClusterRef(), detid, true);
390  } else
391  throw cms::Exception("NOT IMPLEMENTED")
392  << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
393  }
394 }
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
void process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg)
static unsigned char toChi2x5(float chi2)
OmniClusterRef const & stereoClusterRef() const
OmniClusterRef const & omniClusterRef() const
static const unsigned int NumberOfParamBlocks
assert(be >=bs)
OmniClusterRef const & monoClusterRef() const
key_type key() const
Accessor for product key.
Definition: Ref.h:250
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
ParamBlock pblocks_[NumberOfParamBlocks]
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
SiStripRecHit2D originalHit() const
std::vector< uint8_t > pixels
std::vector< bool > collectedPixels_
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Our base class.
Definition: SiPixelRecHit.h:23

◆ process() [2/2]

void HITrackClusterRemover::process ( const OmniClusterRef cluRef,
SiStripDetId detid,
bool  fromTrack 
)
inlineprivate

Definition at line 305 of file HITrackClusterRemover.cc.

References cms::cuda::assert(), OmniClusterRef::cluster_strip(), clusterWasteSolution_, collectedStrips_, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), HITrackClusterRemover::ParamBlock::maxSize_, HITrackClusterRemover::ParamBlock::minGoodStripCharge_, pblocks_, sensorThickness(), strips, stripSourceProdID, and DetId::subdetId().

305  {
306  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
307  if (cluster.id() != stripSourceProdID)
308  throw cms::Exception("Inconsistent Data")
309  << "HITrackClusterRemover: strip cluster ref from Product ID = " << cluster.id()
310  << " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
311 
312  uint32_t subdet = detid.subdetId();
313  assert(cluster.id() == stripSourceProdID);
314  if (pblocks_[subdet - 1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet - 1].maxSize_))
315  return;
316  if (!fromTrack) {
317  if (pblocks_[subdet - 1].cutOnStripCharge_ &&
318  (cluster->charge() > (pblocks_[subdet - 1].minGoodStripCharge_ * sensorThickness(detid))))
319  return;
320  }
321 
322  if (collectedStrips_.size() <= cluster.key())
323  edm::LogError("BadCollectionSize") << collectedStrips_.size() << " is smaller than " << cluster.key();
324 
325  assert(collectedStrips_.size() > cluster.key());
326  strips[cluster.key()] = false;
328  collectedStrips_[cluster.key()] = true;
329 }
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
std::vector< uint8_t > strips
assert(be >=bs)
key_type key() const
Accessor for product key.
Definition: Ref.h:250
float sensorThickness(const SiStripDetId &detid) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
ParamBlock pblocks_[NumberOfParamBlocks]
std::vector< bool > collectedStrips_

◆ produce()

void HITrackClusterRemover::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 406 of file HITrackClusterRemover.cc.

References cms::cuda::assert(), cleanup(), clusterWasteSolution_, collectedPixels_, collectedStrips_, edm::ContainerMask< T >::copyMaskTo(), submitPVResolutionJobs::count, doPixel_, doStrip_, doStripChargeCheck_, doTracks_, Exception, ntuplemaker::fill, filterTracks_, edm::EventSetup::getData(), h, hcalSimParameters_cfi::hb, edm::RefProd< C >::id(), iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, SummaryClient_cfi::labels, LogDebug, mergeOld_, minNumberOfLayersWithMeasBeforeFiltering_, eostools::move(), oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, overrideTrkQuals_, DQMOffline_LumiMonitoring_cff::pixelClusters, pixelClusters_, reco::ClusterRemovalInfo::pixelIndices(), reco::ClusterRemovalInfo::pixelNewRefProd(), reco::ClusterRemovalInfo::pixelRefProd(), pixels, pixelSourceProdID, process(), rpcPointValidation_cfi::recHit, HLT_FULL_cff::rphiRecHits, rphiRecHitToken_, edm::ContainerMask< T >::size(), HLT_FULL_cff::stereoRecHits, stereoRecHitToken_, HLT_2024v13_cff::stripClusters, stripClusters_, reco::ClusterRemovalInfo::stripIndices(), reco::ClusterRemovalInfo::stripNewRefProd(), reco::ClusterRemovalInfo::stripRefProd(), strips, stripSourceProdID, HLT_2024v13_cff::track, trackQuality_, DiMuonV_cfg::tracks, tracks_, and tTrackerGeom_.

406  {
407  ProductID pixelOldProdID, stripOldProdID;
408 
409  const auto &tgh = &iSetup.getData(tTrackerGeom_);
410 
412  if (doPixel_) {
413  iEvent.getByToken(pixelClusters_, pixelClusters);
415  }
416  //DBG// std::cout << "HITrackClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
417 
419  if (doStrip_) {
420  iEvent.getByToken(stripClusters_, stripClusters);
422  }
423  //DBG// std::cout << "HITrackClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
424 
425  std::unique_ptr<ClusterRemovalInfo> cri;
426  if (clusterWasteSolution_) {
427  if (doStrip_ && doPixel_)
428  cri = std::make_unique<ClusterRemovalInfo>(pixelClusters, stripClusters);
429  else if (doStrip_)
430  cri = std::make_unique<ClusterRemovalInfo>(stripClusters);
431  else if (doPixel_)
432  cri = std::make_unique<ClusterRemovalInfo>(pixelClusters);
433  }
434 
435  Handle<ClusterRemovalInfo> oldRemovalInfo;
437  iEvent.getByToken(oldRemovalInfo_, oldRemovalInfo);
438  // Check ProductIDs
439  if ((oldRemovalInfo->stripNewRefProd().id() == stripClusters.id()) &&
440  (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.id())) {
441  cri->getOldClustersFrom(*oldRemovalInfo);
442 
443  pixelOldProdID = oldRemovalInfo->pixelRefProd().id();
444  stripOldProdID = oldRemovalInfo->stripRefProd().id();
445 
446  } else {
448  labelsForToken(oldRemovalInfo_, labels);
449  throw cms::Exception("Inconsistent Data")
450  << "HITrackClusterRemover: "
451  << "Input collection product IDs are [pixel: " << pixelClusters.id() << ", strip: " << stripClusters.id()
452  << "] \n"
453  << "\t but the *old* ClusterRemovalInfo " << labels.productInstance << " refers as 'new product ids' to "
454  << "[pixel: " << oldRemovalInfo->pixelNewRefProd().id()
455  << ", strip: " << oldRemovalInfo->stripNewRefProd().id() << "]\n"
456  << "NOTA BENE: when running HITrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory "
457  "MUST be already re-keyed.\n";
458  }
459  } else { // then Old == Source
460  pixelOldProdID = pixelSourceProdID;
461  stripOldProdID = stripSourceProdID;
462  }
463 
464  if (doStrip_) {
465  strips.resize(stripClusters->dataSize());
466  fill(strips.begin(), strips.end(), true);
467  }
468  if (doPixel_) {
469  pixels.resize(pixelClusters->dataSize());
470  fill(pixels.begin(), pixels.end(), true);
471  }
472  if (mergeOld_) {
475  iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
476  iEvent.getByToken(oldStrMaskToken_, oldStrMask);
477  LogDebug("HITrackClusterRemover") << "to merge in, " << oldStrMask->size() << " strp and " << oldPxlMask->size()
478  << " pxl";
479  oldStrMask->copyMaskTo(collectedStrips_);
480  oldPxlMask->copyMaskTo(collectedPixels_);
481  assert(stripClusters->dataSize() >= collectedStrips_.size());
482  collectedStrips_.resize(stripClusters->dataSize(), false);
483  } else {
484  collectedStrips_.resize(stripClusters->dataSize(), false);
485  collectedPixels_.resize(pixelClusters->dataSize(), false);
486  }
487 
488  if (doTracks_) {
490  iEvent.getByToken(tracks_, tracks);
491 
492  std::vector<Handle<edm::ValueMap<int> > > quals;
493  if (!overrideTrkQuals_.empty()) {
494  quals.resize(1);
495  iEvent.getByToken(overrideTrkQuals_[0], quals[0]);
496  }
497  int it = 0;
498  for (const auto &track : *tracks) {
499  if (filterTracks_) {
500  bool goodTk = true;
501  if (!quals.empty()) {
502  int qual = (*(quals[0])).get(it++);
503  if (qual < 0) {
504  goodTk = false;
505  }
506  //note that this does not work for some trackquals (goodIterative or undefQuality)
507  else
508  goodTk = (qual & (1 << trackQuality_)) >> trackQuality_;
509  } else
510  goodTk = (track.quality(trackQuality_));
511  if (!goodTk)
512  continue;
513  if (track.hitPattern().trackerLayersWithMeasurement() < minNumberOfLayersWithMeasBeforeFiltering_)
514  continue;
515  }
516  auto const &chi2sX5 = track.extra()->chi2sX5();
517  assert(chi2sX5.size() == track.recHitsSize());
518  auto hb = track.recHitsBegin();
519  for (unsigned int h = 0; h < track.recHitsSize(); h++) {
520  auto hit = *(hb + h);
521  if (!hit->isValid())
522  continue;
523  process(hit, chi2sX5[h], tgh);
524  }
525  }
526  }
527 
528  if (doStripChargeCheck_) {
530  iEvent.getByToken(rphiRecHitToken_, rechitsrphi);
531  const SiStripRecHit2DCollection::DataContainer *rphiRecHits = &(rechitsrphi).product()->data();
533  recHit != rphiRecHits->end();
534  recHit++) {
535  SiStripDetId detid = recHit->geographicalId();
536  process(recHit->omniClusterRef(), detid, false);
537  }
539  iEvent.getByToken(stereoRecHitToken_, rechitsstereo);
540  const SiStripRecHit2DCollection::DataContainer *stereoRecHits = &(rechitsstereo).product()->data();
542  recHit != stereoRecHits->end();
543  recHit++) {
544  SiStripDetId detid = recHit->geographicalId();
545  process(recHit->omniClusterRef(), detid, false);
546  }
547  }
548  // if(doPixelChargeCheck_) {
549  // edm::Handle<SiPixelRecHitCollection> pixelrechits;
550  // iEvent.getByToken(pixelRecHitsToken_,pixelrechits);
551  // }
552 
555  cleanup(*pixelClusters, pixels, cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : nullptr));
556  //DBG// std::cout << "HITrackClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
557  cri->setNewPixelClusters(newPixels);
558  }
561  cleanup(*stripClusters, strips, cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : nullptr));
562  //DBG// std::cout << "HITrackClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
563  cri->setNewStripClusters(newStrips);
564  }
565 
566  if (clusterWasteSolution_) {
567  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
568  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
569  // edm::LogWarning("HITrackClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
570  iEvent.put(std::move(cri));
571  }
572 
573  pixels.clear();
574  strips.clear();
575 
576  if (!clusterWasteSolution_) {
577  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
578  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
579 
580  LogDebug("HITrackClusterRemover") << "total strip to skip: "
581  << std::count(collectedStrips_.begin(), collectedStrips_.end(), true);
582  // std::cout << "HITrackClusterRemover " <<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true) <<std::endl;
583  iEvent.put(std::make_unique<StripMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),
585 
586  LogDebug("HITrackClusterRemover") << "total pxl to skip: "
587  << std::count(collectedPixels_.begin(), collectedPixels_.end(), true);
588  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),
590  }
591  collectedStrips_.clear();
592  collectedPixels_.clear();
593 }
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:87
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg)
std::vector< data_type > DataContainer
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
std::vector< uint8_t > strips
assert(be >=bs)
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::TrackCollection > tracks_
reco::TrackBase::TrackQuality trackQuality_
const SiPixelClusterRefProd & pixelNewRefProd() const
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:124
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
std::vector< bool > collectedStrips_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
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)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
std::vector< uint8_t > pixels
size_t size() const
Definition: ContainerMask.h:53
std::vector< bool > collectedPixels_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const SiStripClusterRefProd & stripRefProd() const
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
const SiPixelClusterRefProd & pixelRefProd() const
const SiStripClusterRefProd & stripNewRefProd() const
#define LogDebug(id)

◆ readPSet()

void HITrackClusterRemover::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 
)
private

Definition at line 123 of file HITrackClusterRemover.cc.

References edm::ParameterSet::exists(), ntuplemaker::fill, edm::ParameterSet::getParameter(), globals_cff::id1, globals_cff::id2, and Skims_PA_cff::name.

Referenced by HITrackClusterRemover().

124  {
125  if (iConfig.exists(name)) {
126  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
127  if (id1 == -1) {
129  } else {
130  pblocks_[id1] = pblock;
131  if (id2 != -1)
132  pblocks_[id2] = pblock;
133  if (id3 != -1)
134  pblocks_[id3] = pblock;
135  if (id4 != -1)
136  pblocks_[id4] = pblock;
137  if (id5 != -1)
138  pblocks_[id5] = pblock;
139  if (id6 != -1)
140  pblocks_[id6] = pblock;
141  }
142  }
143 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool exists(std::string const &parameterName) const
checks if a parameter exists
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]

◆ sensorThickness()

float HITrackClusterRemover::sensorThickness ( const SiStripDetId detid) const
private

Definition at line 291 of file HITrackClusterRemover.cc.

References SiStripDetId::moduleGeometry(), PixelSubdetector::PixelBarrel, DetId::subdetId(), SiStripDetId::TIB, SiStripDetId::TOB, W5, W6, and W7.

Referenced by process().

291  {
292  if (detid.subdetId() >= SiStripDetId::TIB) {
293  if (detid.subdetId() == SiStripDetId::TOB)
294  return 0.047;
297  return 0.047;
298  return 0.029; // so it is TEC ring 1-4 or TIB or TOB;
299  } else if (detid.subdetId() == PixelSubdetector::PixelBarrel)
300  return 0.0285;
301  else
302  return 0.027;
303 }
SiStripModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:109
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Definition: SiStripDetId.h:39
static constexpr auto TIB
Definition: SiStripDetId.h:37

Member Data Documentation

◆ clusterWasteSolution_

bool HITrackClusterRemover::clusterWasteSolution_
private

Definition at line 108 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), process(), and produce().

◆ collectedPixels_

std::vector<bool> HITrackClusterRemover::collectedPixels_
private

Definition at line 114 of file HITrackClusterRemover.cc.

Referenced by process(), and produce().

◆ collectedStrips_

std::vector<bool> HITrackClusterRemover::collectedStrips_
private

Definition at line 113 of file HITrackClusterRemover.cc.

Referenced by process(), and produce().

◆ doPixel_

bool HITrackClusterRemover::doPixel_
private

Definition at line 69 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), process(), and produce().

◆ doPixelChargeCheck_

bool HITrackClusterRemover::doPixelChargeCheck_
private

Definition at line 108 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover().

◆ doStrip_

bool HITrackClusterRemover::doStrip_
private

Definition at line 69 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), process(), and produce().

◆ doStripChargeCheck_

bool HITrackClusterRemover::doStripChargeCheck_
private

Definition at line 108 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ doTracks_

bool HITrackClusterRemover::doTracks_
private

Definition at line 68 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ filterTracks_

bool HITrackClusterRemover::filterTracks_
private

Definition at line 110 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ mergeOld_

bool HITrackClusterRemover::mergeOld_
private

Definition at line 70 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ minNumberOfLayersWithMeasBeforeFiltering_

int HITrackClusterRemover::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 111 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ NumberOfParamBlocks

const unsigned int HITrackClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 66 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and process().

◆ oldPxlMaskToken_

edm::EDGetTokenT<PixelMaskContainer> HITrackClusterRemover::oldPxlMaskToken_
private

Definition at line 77 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ oldRemovalInfo_

edm::EDGetTokenT<reco::ClusterRemovalInfo> HITrackClusterRemover::oldRemovalInfo_
private

Definition at line 76 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ oldStrMaskToken_

edm::EDGetTokenT<StripMaskContainer> HITrackClusterRemover::oldStrMaskToken_
private

Definition at line 78 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ overrideTrkQuals_

std::vector<edm::EDGetTokenT<edm::ValueMap<int> > > HITrackClusterRemover::overrideTrkQuals_
private

Definition at line 79 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ pblocks_

ParamBlock HITrackClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 83 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and process().

◆ pixelClusters_

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > HITrackClusterRemover::pixelClusters_
private

Definition at line 73 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ pixelRecHits_

std::string HITrackClusterRemover::pixelRecHits_
private

Definition at line 109 of file HITrackClusterRemover.cc.

◆ pixels

std::vector<uint8_t> HITrackClusterRemover::pixels
private

Definition at line 93 of file HITrackClusterRemover.cc.

Referenced by process(), and produce().

◆ pixelSourceProdID

edm::ProductID HITrackClusterRemover::pixelSourceProdID
private

Definition at line 94 of file HITrackClusterRemover.cc.

Referenced by process(), and produce().

◆ rphiRecHitToken_

edm::EDGetTokenT<SiStripRecHit2DCollection> HITrackClusterRemover::rphiRecHitToken_
private

Definition at line 80 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ stereoRecHitToken_

edm::EDGetTokenT<SiStripRecHit2DCollection> HITrackClusterRemover::stereoRecHitToken_
private

Definition at line 80 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ stripClusters_

edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > HITrackClusterRemover::stripClusters_
private

Definition at line 74 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ stripRecHits_

std::string HITrackClusterRemover::stripRecHits_
private

Definition at line 109 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover().

◆ strips

std::vector<uint8_t> HITrackClusterRemover::strips
private

Definition at line 93 of file HITrackClusterRemover.cc.

Referenced by process(), and produce().

◆ stripSourceProdID

edm::ProductID HITrackClusterRemover::stripSourceProdID
private

Definition at line 94 of file HITrackClusterRemover.cc.

Referenced by process(), and produce().

◆ trackQuality_

reco::TrackBase::TrackQuality HITrackClusterRemover::trackQuality_
private

Definition at line 112 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ tracks_

edm::EDGetTokenT<reco::TrackCollection> HITrackClusterRemover::tracks_
private

Definition at line 75 of file HITrackClusterRemover.cc.

Referenced by HITrackClusterRemover(), and produce().

◆ tTrackerGeom_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> const HITrackClusterRemover::tTrackerGeom_
private

Definition at line 48 of file HITrackClusterRemover.cc.

Referenced by produce().