CMS 3D CMS Logo

HITrackClusterRemover.cc
Go to the documentation of this file.
7 
24 
26 
30 
35 
37 
38 //
39 // class decleration
40 //
41 
43 public:
45  ~HITrackClusterRemover() override;
46  void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override;
47 
48 private:
49  struct ParamBlock {
51  ParamBlock(const edm::ParameterSet &iConfig)
52  : isSet_(true),
53  usesCharge_(iConfig.exists("maxCharge")),
54  usesSize_(iConfig.exists("maxSize")),
55  cutOnPixelCharge_(iConfig.exists("minGoodPixelCharge")),
56  cutOnStripCharge_(iConfig.exists("minGoodStripCharge")),
57  maxChi2_(iConfig.getParameter<double>("maxChi2")),
58  maxCharge_(usesCharge_ ? iConfig.getParameter<double>("maxCharge") : 0),
59  minGoodPixelCharge_(cutOnPixelCharge_ ? iConfig.getParameter<double>("minGoodPixelCharge") : 0),
60  minGoodStripCharge_(cutOnStripCharge_ ? iConfig.getParameter<double>("minGoodStripCharge") : 0),
61  maxSize_(usesSize_ ? iConfig.getParameter<uint32_t>("maxSize") : 0) {}
64  size_t maxSize_;
65  };
66  static const unsigned int NumberOfParamBlocks = 6;
67 
68  bool doTracks_;
70  bool mergeOld_;
79  std::vector<edm::EDGetTokenT<edm::ValueMap<int> > > overrideTrkQuals_;
81  // edm::EDGetTokenT<SiPixelRecHitCollection> pixelRecHitsToken_;
82 
84  void readPSet(const edm::ParameterSet &iConfig,
85  const std::string &name,
86  int id1 = -1,
87  int id2 = -1,
88  int id3 = -1,
89  int id4 = -1,
90  int id5 = -1,
91  int id6 = -1);
92 
93  std::vector<uint8_t> pixels, strips; // avoid unneed alloc/dealloc of this
94  edm::ProductID pixelSourceProdID, stripSourceProdID; // ProdIDs refs must point to (for consistency tests)
95 
96  inline void process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg);
97  inline void process(const OmniClusterRef &cluRef, SiStripDetId &detid, bool fromTrack);
98 
99  template <typename T>
100  std::unique_ptr<edmNew::DetSetVector<T> > cleanup(const edmNew::DetSetVector<T> &oldClusters,
101  const std::vector<uint8_t> &isGood,
103  const reco::ClusterRemovalInfo::Indices *oldRefs);
104 
105  // Carries in full removal info about a given det from oldRefs
107 
113  std::vector<bool> collectedStrips_;
114  std::vector<bool> collectedPixels_;
115 
116  float sensorThickness(const SiStripDetId &detid) const;
117 };
118 
119 using namespace std;
120 using namespace edm;
121 using namespace reco;
122 
124  const edm::ParameterSet &iConfig, const std::string &name, int id1, int id2, int id3, int id4, int id5, int id6) {
125  if (iConfig.exists(name)) {
126  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
127  if (id1 == -1) {
128  fill(pblocks_, pblocks_ + NumberOfParamBlocks, pblock);
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 }
144 
146  : doTracks_(iConfig.exists("trajectories")),
147  doStrip_(iConfig.existsAs<bool>("doStrip") ? iConfig.getParameter<bool>("doStrip") : true),
148  doPixel_(iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true),
149  mergeOld_(iConfig.exists("oldClusterRemovalInfo")),
150  clusterWasteSolution_(true),
151  doStripChargeCheck_(
152  iConfig.existsAs<bool>("doStripChargeCheck") ? iConfig.getParameter<bool>("doStripChargeCheck") : false),
153  doPixelChargeCheck_(
154  iConfig.existsAs<bool>("doPixelChargeCheck") ? iConfig.getParameter<bool>("doPixelChargeCheck") : false),
155  stripRecHits_(doStripChargeCheck_ ? iConfig.getParameter<std::string>("stripRecHits")
156  : std::string("siStripMatchedRecHits")),
157  pixelRecHits_(doPixelChargeCheck_ ? iConfig.getParameter<std::string>("pixelRecHits")
158  : std::string("siPixelRecHits")) {
159  mergeOld_ = mergeOld_ && !iConfig.getParameter<InputTag>("oldClusterRemovalInfo").label().empty();
160  if (iConfig.exists("overrideTrkQuals"))
161  overrideTrkQuals_.push_back(consumes<edm::ValueMap<int> >(iConfig.getParameter<InputTag>("overrideTrkQuals")));
162  if (iConfig.exists("clusterLessSolution"))
163  clusterWasteSolution_ = !iConfig.getParameter<bool>("clusterLessSolution");
165  throw cms::Exception("Configuration Error")
166  << "HITrackClusterRemover: Charge check asked without cluster collection ";
168  throw cms::Exception("Configuration Error")
169  << "HITrackClusterRemover: Pixel cluster charge check not yet implemented";
170 
172  produces<edmNew::DetSetVector<SiPixelCluster> >();
174  produces<edmNew::DetSetVector<SiStripCluster> >();
176  produces<ClusterRemovalInfo>();
177 
179 
181  readPSet(iConfig, "Common", -1);
182  if (doPixel_) {
183  readPSet(iConfig, "Pixel", 0, 1);
184  readPSet(iConfig, "PXB", 0);
185  readPSet(iConfig, "PXE", 1);
186  }
187  if (doStrip_) {
188  readPSet(iConfig, "Strip", 2, 3, 4, 5);
189  readPSet(iConfig, "StripInner", 2, 3);
190  readPSet(iConfig, "StripOuter", 4, 5);
191  readPSet(iConfig, "TIB", 2);
192  readPSet(iConfig, "TID", 3);
193  readPSet(iConfig, "TOB", 4);
194  readPSet(iConfig, "TEC", 5);
195  }
196 
197  bool usingCharge = false;
198  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
199  if (!pblocks_[i].isSet_)
200  throw cms::Exception("Configuration Error")
201  << "HITrackClusterRemover: Missing configuration for detector with subDetID = " << (i + 1);
202  if (pblocks_[i].usesCharge_ && !usingCharge) {
203  throw cms::Exception("Configuration Error") << "HITrackClusterRemover: Configuration for subDetID = " << (i + 1)
204  << " uses cluster charge, which is not enabled.";
205  }
206  }
207 
208  if (!clusterWasteSolution_) {
209  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
210  produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
211  }
213  filterTracks_ = false;
214  if (iConfig.exists("TrackQuality")) {
215  filterTracks_ = true;
218  iConfig.existsAs<int>("minNumberOfLayersWithMeasBeforeFiltering")
219  ? iConfig.getParameter<int>("minNumberOfLayersWithMeasBeforeFiltering")
220  : 0;
221  }
222 
223  if (doTracks_)
224  tracks_ = consumes<reco::TrackCollection>(iConfig.getParameter<InputTag>("trajectories"));
225  if (doPixel_)
226  pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
227  if (doStrip_)
228  stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<InputTag>("stripClusters"));
229  if (mergeOld_) {
230  oldRemovalInfo_ = consumes<ClusterRemovalInfo>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
231  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
232  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
233  }
234 
235  if (doStripChargeCheck_) {
236  rphiRecHitToken_ = consumes<SiStripRecHit2DCollection>(InputTag(stripRecHits_, "rphiRecHit"));
237  stereoRecHitToken_ = consumes<SiStripRecHit2DCollection>(InputTag(stripRecHits_, "stereoRecHit"));
238  }
239  // if(doPixelChargeCheck_) pixelRecHitsToken_ = consumes<SiPixelRecHitCollection>(InputTag(pixelRecHits_));
240 }
241 
243 
245  for (size_t i = 0, n = refs.size(); i < n; ++i) {
246  refs[i] = oldRefs[refs[i]];
247  }
248 }
249 
250 template <typename T>
251 std::unique_ptr<edmNew::DetSetVector<T> > HITrackClusterRemover::cleanup(
252  const edmNew::DetSetVector<T> &oldClusters,
253  const std::vector<uint8_t> &isGood,
255  const reco::ClusterRemovalInfo::Indices *oldRefs) {
256  typedef typename edmNew::DetSetVector<T> DSV;
257  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
258  typedef typename edmNew::DetSet<T> DS;
259  auto output = std::make_unique<DSV>();
260  output->reserve(oldClusters.size(), oldClusters.dataSize());
261 
262  unsigned int countOld = 0;
263  unsigned int countNew = 0;
264 
265  // cluster removal loop
266  const T *firstOffset = &oldClusters.data().front();
267  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
268  DS oldDS = *itdet;
269 
270  if (oldDS.empty())
271  continue; // skip empty detsets
272 
273  uint32_t id = oldDS.detId();
274  DSF outds(*output, id);
275 
276  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
277  uint32_t index = ((&*it) - firstOffset);
278  countOld++;
279  if (isGood[index]) {
280  outds.push_back(*it);
281  countNew++;
282  refs.push_back(index);
283  //std::cout << "HITrackClusterRemover::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
284  }
285  }
286  if (outds.empty())
287  outds.abort(); // not write in an empty DSV
288  }
289 
290  if (oldRefs != nullptr)
291  mergeOld(refs, *oldRefs);
292  return output;
293 }
294 
296  if (detid.subdetId() >= SiStripDetId::TIB) {
297  if (detid.subdetId() == SiStripDetId::TOB)
298  return 0.047;
301  return 0.047;
302  return 0.029; // so it is TEC ring 1-4 or TIB or TOB;
303  } else if (detid.subdetId() == PixelSubdetector::PixelBarrel)
304  return 0.0285;
305  else
306  return 0.027;
307 }
308 
309 void HITrackClusterRemover::process(OmniClusterRef const &ocluster, SiStripDetId &detid, bool fromTrack) {
310  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
311  if (cluster.id() != stripSourceProdID)
312  throw cms::Exception("Inconsistent Data")
313  << "HITrackClusterRemover: strip cluster ref from Product ID = " << cluster.id()
314  << " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
315 
316  uint32_t subdet = detid.subdetId();
317  assert(cluster.id() == stripSourceProdID);
318  if (pblocks_[subdet - 1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet - 1].maxSize_))
319  return;
320  if (!fromTrack) {
321  if (pblocks_[subdet - 1].cutOnStripCharge_ &&
322  (cluster->charge() > (pblocks_[subdet - 1].minGoodStripCharge_ * sensorThickness(detid))))
323  return;
324  }
325 
326  if (collectedStrips_.size() <= cluster.key())
327  edm::LogError("BadCollectionSize") << collectedStrips_.size() << " is smaller than " << cluster.key();
328 
329  assert(collectedStrips_.size() > cluster.key());
330  strips[cluster.key()] = false;
332  collectedStrips_[cluster.key()] = true;
333 }
334 
335 void HITrackClusterRemover::process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg) {
336  SiStripDetId detid = hit->geographicalId();
337  uint32_t subdet = detid.subdetId();
338 
339  assert((subdet > 0) && (subdet <= NumberOfParamBlocks));
340 
341  // chi2 cut
342  if (chi2 > Traj2TrackHits::toChi2x5(pblocks_[subdet - 1].maxChi2_))
343  return;
344 
346  if (!doPixel_)
347  return;
348  // this is a pixel, and i *know* it is
349  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
350 
351  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
352 
353  if (cluster.id() != pixelSourceProdID)
354  throw cms::Exception("Inconsistent Data")
355  << "HITrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id()
356  << " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
357 
358  assert(cluster.id() == pixelSourceProdID);
359  //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
360 
361  // if requested, cut on cluster size
362  if (pblocks_[subdet - 1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet - 1].maxSize_))
363  return;
364 
365  // mark as used
366  pixels[cluster.key()] = false;
367 
368  //if(!clusterWasteSolution_) collectedPixel[detid.rawId()].insert(cluster);
369  assert(collectedPixels_.size() > cluster.key());
370  //assert(detid.rawId() == cluster->geographicalId()); //This condition fails
372  collectedPixels_[cluster.key()] = true;
373 
374  } else { // aka Strip
375  if (!doStrip_)
376  return;
377  const type_info &hitType = typeid(*hit);
378  if (hitType == typeid(SiStripRecHit2D)) {
379  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
380  //DBG// cout << "Plain RecHit 2D: " << endl;
381  process(stripHit->omniClusterRef(), detid, true);
382  } else if (hitType == typeid(SiStripRecHit1D)) {
383  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
384  process(hit1D->omniClusterRef(), detid, true);
385  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
386  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
387  //DBG// cout << "Matched RecHit 2D: " << endl;
388  process(matchHit->monoClusterRef(), detid, true);
389  process(matchHit->stereoClusterRef(), detid, true);
390  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
391  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
392  //DBG// cout << "Projected RecHit 2D: " << endl;
393  process(projHit->originalHit().omniClusterRef(), detid, true);
394  } else
395  throw cms::Exception("NOT IMPLEMENTED")
396  << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
397  }
398 }
399 
400 /* Schematic picture of n-th step Iterative removal
401  * (that os removing clusters after n-th step tracking)
402  * clusters: [ C1 ] -> [ C2 ] -> ... -> [ Cn ] -> [ Cn + 1 ]
403  * ^ ^ ^--- OUTPUT "new" ID
404  * |-- before any removal |----- Source clusters
405  * |-- OUTPUT "old" ID |----- Hits in Traj. point here
406  * | \----- Old ClusterRemovalInfo "new" ID
407  * \-- Old ClusterRemovalInfo "old" ID
408  */
409 
411  ProductID pixelOldProdID, stripOldProdID;
412 
414  iSetup.get<TrackerDigiGeometryRecord>().get(tgh);
415 
417  if (doPixel_) {
418  iEvent.getByToken(pixelClusters_, pixelClusters);
420  }
421  //DBG// std::cout << "HITrackClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
422 
424  if (doStrip_) {
425  iEvent.getByToken(stripClusters_, stripClusters);
427  }
428  //DBG// std::cout << "HITrackClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
429 
430  std::unique_ptr<ClusterRemovalInfo> cri;
431  if (clusterWasteSolution_) {
432  if (doStrip_ && doPixel_)
433  cri = std::make_unique<ClusterRemovalInfo>(pixelClusters, stripClusters);
434  else if (doStrip_)
435  cri = std::make_unique<ClusterRemovalInfo>(stripClusters);
436  else if (doPixel_)
437  cri = std::make_unique<ClusterRemovalInfo>(pixelClusters);
438  }
439 
440  Handle<ClusterRemovalInfo> oldRemovalInfo;
442  iEvent.getByToken(oldRemovalInfo_, oldRemovalInfo);
443  // Check ProductIDs
444  if ((oldRemovalInfo->stripNewRefProd().id() == stripClusters.id()) &&
445  (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.id())) {
446  cri->getOldClustersFrom(*oldRemovalInfo);
447 
448  pixelOldProdID = oldRemovalInfo->pixelRefProd().id();
449  stripOldProdID = oldRemovalInfo->stripRefProd().id();
450 
451  } else {
453  labelsForToken(oldRemovalInfo_, labels);
454  throw cms::Exception("Inconsistent Data")
455  << "HITrackClusterRemover: "
456  << "Input collection product IDs are [pixel: " << pixelClusters.id() << ", strip: " << stripClusters.id()
457  << "] \n"
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";
463  }
464  } else { // then Old == Source
465  pixelOldProdID = pixelSourceProdID;
466  stripOldProdID = stripSourceProdID;
467  }
468 
469  if (doStrip_) {
470  strips.resize(stripClusters->dataSize());
471  fill(strips.begin(), strips.end(), true);
472  }
473  if (doPixel_) {
474  pixels.resize(pixelClusters->dataSize());
475  fill(pixels.begin(), pixels.end(), true);
476  }
477  if (mergeOld_) {
480  iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
481  iEvent.getByToken(oldStrMaskToken_, oldStrMask);
482  LogDebug("HITrackClusterRemover") << "to merge in, " << oldStrMask->size() << " strp and " << oldPxlMask->size()
483  << " pxl";
484  oldStrMask->copyMaskTo(collectedStrips_);
485  oldPxlMask->copyMaskTo(collectedPixels_);
486  assert(stripClusters->dataSize() >= collectedStrips_.size());
487  collectedStrips_.resize(stripClusters->dataSize(), false);
488  } else {
489  collectedStrips_.resize(stripClusters->dataSize(), false);
490  collectedPixels_.resize(pixelClusters->dataSize(), false);
491  }
492 
493  if (doTracks_) {
495  iEvent.getByToken(tracks_, tracks);
496 
497  std::vector<Handle<edm::ValueMap<int> > > quals;
498  if (!overrideTrkQuals_.empty()) {
499  quals.resize(1);
500  iEvent.getByToken(overrideTrkQuals_[0], quals[0]);
501  }
502  int it = 0;
503  for (const auto &track : *tracks) {
504  if (filterTracks_) {
505  bool goodTk = true;
506  if (!quals.empty()) {
507  int qual = (*(quals[0])).get(it++);
508  if (qual < 0) {
509  goodTk = false;
510  }
511  //note that this does not work for some trackquals (goodIterative or undefQuality)
512  else
513  goodTk = (qual & (1 << trackQuality_)) >> trackQuality_;
514  } else
515  goodTk = (track.quality(trackQuality_));
516  if (!goodTk)
517  continue;
518  if (track.hitPattern().trackerLayersWithMeasurement() < minNumberOfLayersWithMeasBeforeFiltering_)
519  continue;
520  }
521  auto const &chi2sX5 = track.extra()->chi2sX5();
522  assert(chi2sX5.size() == track.recHitsSize());
523  auto hb = track.recHitsBegin();
524  for (unsigned int h = 0; h < track.recHitsSize(); h++) {
525  auto hit = *(hb + h);
526  if (!hit->isValid())
527  continue;
528  process(hit, chi2sX5[h], tgh.product());
529  }
530  }
531  }
532 
533  if (doStripChargeCheck_) {
535  iEvent.getByToken(rphiRecHitToken_, rechitsrphi);
536  const SiStripRecHit2DCollection::DataContainer *rphiRecHits = &(rechitsrphi).product()->data();
538  recHit != rphiRecHits->end();
539  recHit++) {
540  SiStripDetId detid = recHit->geographicalId();
541  process(recHit->omniClusterRef(), detid, false);
542  }
544  iEvent.getByToken(stereoRecHitToken_, rechitsstereo);
545  const SiStripRecHit2DCollection::DataContainer *stereoRecHits = &(rechitsstereo).product()->data();
547  recHit != stereoRecHits->end();
548  recHit++) {
549  SiStripDetId detid = recHit->geographicalId();
550  process(recHit->omniClusterRef(), detid, false);
551  }
552  }
553  // if(doPixelChargeCheck_) {
554  // edm::Handle<SiPixelRecHitCollection> pixelrechits;
555  // iEvent.getByToken(pixelRecHitsToken_,pixelrechits);
556  // }
557 
560  cleanup(*pixelClusters, pixels, cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : nullptr));
561  //DBG// std::cout << "HITrackClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
562  cri->setNewPixelClusters(newPixels);
563  }
566  cleanup(*stripClusters, strips, cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : nullptr));
567  //DBG// std::cout << "HITrackClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
568  cri->setNewStripClusters(newStrips);
569  }
570 
571  if (clusterWasteSolution_) {
572  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
573  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
574  // edm::LogWarning("HITrackClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
575  iEvent.put(std::move(cri));
576  }
577 
578  pixels.clear();
579  strips.clear();
580 
581  if (!clusterWasteSolution_) {
582  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
583  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
584 
585  LogDebug("HITrackClusterRemover") << "total strip to skip: "
586  << std::count(collectedStrips_.begin(), collectedStrips_.end(), true);
587  // std::cout << "HITrackClusterRemover " <<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true) <<std::endl;
588  iEvent.put(std::make_unique<StripMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),
590 
591  LogDebug("HITrackClusterRemover") << "total pxl to skip: "
592  << std::count(collectedPixels_.begin(), collectedPixels_.end(), true);
593  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),
595  }
596  collectedStrips_.clear();
597  collectedPixels_.clear();
598 }
599 
edm::RefProd
Definition: EDProductfwd.h:25
ClusterRemovalInfo.h
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Handle.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
electrons_cff.bool
bool
Definition: electrons_cff.py:393
SiStripDetId::moduleGeometry
SiStripModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:109
mps_fire.i
i
Definition: mps_fire.py:428
HITrackClusterRemover::ParamBlock::cutOnPixelCharge_
bool cutOnPixelCharge_
Definition: HITrackClusterRemover.cc:62
HITrackClusterRemover::ParamBlock::maxChi2_
float maxChi2_
Definition: HITrackClusterRemover.cc:63
HITrackClusterRemover::doPixelChargeCheck_
bool doPixelChargeCheck_
Definition: HITrackClusterRemover.cc:108
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
HITrackClusterRemover::pixelClusters_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
Definition: HITrackClusterRemover.cc:73
SiStripModuleGeometry::W7
LumiMonitor_cff.pixelClusters
pixelClusters
Definition: LumiMonitor_cff.py:10
HITrackClusterRemover
Definition: HITrackClusterRemover.cc:42
funct::false
false
Definition: Factorize.h:29
ContainerMask.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
edm::RefProd::id
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:124
TrackerGeometry.h
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
reco::ClusterRemovalInfo::Indices
std::vector< uint32_t > Indices
Definition: ClusterRemovalInfo.h:22
ESHandle.h
HITrackClusterRemover::oldPxlMaskToken_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
Definition: HITrackClusterRemover.cc:77
HITrackClusterRemover::ParamBlock::ParamBlock
ParamBlock(const edm::ParameterSet &iConfig)
Definition: HITrackClusterRemover.cc:51
Traj2TrackHits::toChi2x5
static unsigned char toChi2x5(float chi2)
Definition: Traj2TrackHits.h:25
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edmNew::DetSetVector::size
size_type size() const
Definition: DetSetVectorNew.h:554
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HITrackClusterRemover::pblocks_
ParamBlock pblocks_[NumberOfParamBlocks]
Definition: HITrackClusterRemover.cc:83
HITrackClusterRemover::ParamBlock::maxCharge_
float maxCharge_
Definition: HITrackClusterRemover.cc:63
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
reco::TrackBase::undefQuality
Definition: TrackBase.h:151
globals_cff.id1
id1
Definition: globals_cff.py:33
reco::ClusterRemovalInfo::stripRefProd
const SiStripClusterRefProd & stripRefProd() const
Definition: ClusterRemovalInfo.h:58
SiPixelCluster.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
GeomDetType.h
HITrackClusterRemover::process
void process(const TrackingRecHit *hit, unsigned char chi2, const TrackerGeometry *tg)
Definition: HITrackClusterRemover.cc:335
cms::cuda::assert
assert(be >=bs)
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
EDProducer.h
HITrackClusterRemover::StripMaskContainer
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
Definition: HITrackClusterRemover.cc:72
SiStripDetId.h
edmNew::DetSetVector::begin
const_iterator begin(bool update=false) const
Definition: DetSetVectorNew.h:530
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
edm::ContainerMask
Definition: ContainerMask.h:36
HITrackClusterRemover::trackQuality_
reco::TrackBase::TrackQuality trackQuality_
Definition: HITrackClusterRemover.cc:112
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
edm::Handle
Definition: AssociativeIterator.h:50
SiPixelRecHit::cluster
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
OmniClusterRef
Definition: OmniClusterRef.h:12
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
ProjectedSiStripRecHit2D
Definition: ProjectedSiStripRecHit2D.h:8
HITrackClusterRemover::pixelRecHits_
std::string pixelRecHits_
Definition: HITrackClusterRemover.cc:109
HITrackClusterRemover::ParamBlock::usesCharge_
bool usesCharge_
Definition: HITrackClusterRemover.cc:62
SiStripModuleGeometry::W6
HITrackClusterRemover::strips
std::vector< uint8_t > strips
Definition: HITrackClusterRemover.cc:93
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
HITrackClusterRemover::pixelSourceProdID
edm::ProductID pixelSourceProdID
Definition: HITrackClusterRemover.cc:94
edm::Ref
Definition: AssociativeIterator.h:58
reco::ClusterRemovalInfo::pixelIndices
Indices & pixelIndices()
Definition: ClusterRemovalInfo.h:49
HITrackClusterRemover::readPSet
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)
Definition: HITrackClusterRemover.cc:123
HITrackClusterRemover::stripSourceProdID
edm::ProductID stripSourceProdID
Definition: HITrackClusterRemover.cc:94
HITrackClusterRemover::~HITrackClusterRemover
~HITrackClusterRemover() override
Definition: HITrackClusterRemover.cc:242
MakerMacros.h
h
OmniClusterRef::cluster_strip
ClusterStripRef cluster_strip() const
Definition: OmniClusterRef.h:44
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
TrackFwd.h
SiStripModuleGeometry::W5
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HITrackClusterRemover::ParamBlock::usesSize_
bool usesSize_
Definition: HITrackClusterRemover.cc:62
HITrackClusterRemover::collectedPixels_
std::vector< bool > collectedPixels_
Definition: HITrackClusterRemover.cc:114
HITrackClusterRemover::ParamBlock::isSet_
bool isSet_
Definition: HITrackClusterRemover.cc:62
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
HITrackClusterRemover::collectedStrips_
std::vector< bool > collectedStrips_
Definition: HITrackClusterRemover.cc:113
HITrackClusterRemover::sensorThickness
float sensorThickness(const SiStripDetId &detid) const
Definition: HITrackClusterRemover.cc:295
ProductID.h
edm::ESHandle< TrackerGeometry >
edmNew::DetSet
Definition: DetSetNew.h:22
ProjectedSiStripRecHit2D::originalHit
SiStripRecHit2D originalHit() const
Definition: ProjectedSiStripRecHit2D.h:56
HITrackClusterRemover::minNumberOfLayersWithMeasBeforeFiltering_
int minNumberOfLayersWithMeasBeforeFiltering_
Definition: HITrackClusterRemover.cc:111
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
HITrackClusterRemover::HITrackClusterRemover
HITrackClusterRemover(const edm::ParameterSet &iConfig)
Definition: HITrackClusterRemover.cc:145
HITrackClusterRemover::filterTracks_
bool filterTracks_
Definition: HITrackClusterRemover.cc:110
HITrackClusterRemover::rphiRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
Definition: HITrackClusterRemover.cc:80
HITrackClusterRemover::stripClusters_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
Definition: HITrackClusterRemover.cc:74
Traj2TrackHits.h
SiPixelRecHit.h
edmNew::DetSetVector::dataSize
size_type dataSize() const
Definition: DetSetVectorNew.h:552
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
HITrackClusterRemover::NumberOfParamBlocks
static const unsigned int NumberOfParamBlocks
Definition: HITrackClusterRemover.cc:66
LaserSeedGenerator_cfi.stereoRecHits
stereoRecHits
Definition: LaserSeedGenerator_cfi.py:13
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.stripClusters
stripClusters
Definition: HLT_FULL_cff.py:10080
HITrackClusterRemover::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: HITrackClusterRemover.cc:410
HITrackClusterRemover::tracks_
edm::EDGetTokenT< reco::TrackCollection > tracks_
Definition: HITrackClusterRemover.cc:75
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
funct::true
true
Definition: Factorize.h:173
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
TrackerDigiGeometryRecord.h
SiPixelRecHitCollection.h
HITrackClusterRemover::ParamBlock::cutOnStripCharge_
bool cutOnStripCharge_
Definition: HITrackClusterRemover.cc:62
HITrackClusterRemover::overrideTrkQuals_
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
Definition: HITrackClusterRemover.cc:79
HITrackClusterRemover::doTracks_
bool doTracks_
Definition: HITrackClusterRemover.cc:68
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
TrackerGeometry::geomDetSubDetector
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
Definition: TrackerGeometry.cc:203
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCluster.h
Event.h
HITrackClusterRemover::doStripChargeCheck_
bool doStripChargeCheck_
Definition: HITrackClusterRemover.cc:108
SiStripMatchedRecHit2D::stereoClusterRef
OmniClusterRef const & stereoClusterRef() const
Definition: SiStripMatchedRecHit2D.h:34
HITrackClusterRemover::ParamBlock::minGoodStripCharge_
float minGoodStripCharge_
Definition: HITrackClusterRemover.cc:63
HITrackClusterRemover::oldRemovalInfo_
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
Definition: HITrackClusterRemover.cc:76
HITrackClusterRemover::stripRecHits_
std::string stripRecHits_
Definition: HITrackClusterRemover.cc:109
ModuleDef.h
GeomDetEnumerators::isTrackerPixel
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:68
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripRecHit2DCollection.h
edm::stream::EDProducer
Definition: EDProducer.h:38
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
ProjectedSiStripRecHit2D.h
HITrackClusterRemover::ParamBlock::minGoodPixelCharge_
float minGoodPixelCharge_
Definition: HITrackClusterRemover.cc:63
edm::EventSetup
Definition: EventSetup.h:57
edmNew::DetSetVector::DataContainer
std::vector< data_type > DataContainer
Definition: DetSetVectorNew.h:170
DetSetVector.h
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
reco::ClusterRemovalInfo::stripNewRefProd
const SiStripClusterRefProd & stripNewRefProd() const
Definition: ClusterRemovalInfo.h:61
get
#define get
SiStripMatchedRecHit2D::monoClusterRef
OmniClusterRef const & monoClusterRef() const
Definition: SiStripMatchedRecHit2D.h:35
hcalSimParameters_cfi.hb
hb
Definition: hcalSimParameters_cfi.py:60
edm::ContainerMask::size
size_t size() const
Definition: ContainerMask.h:53
InputTag.h
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripRecHit1D.h
ValueMap.h
reco::ClusterRemovalInfo::pixelRefProd
const SiPixelClusterRefProd & pixelRefProd() const
Definition: ClusterRemovalInfo.h:57
HITrackClusterRemover::oldStrMaskToken_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
Definition: HITrackClusterRemover.cc:78
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
HITrackClusterRemover::ParamBlock::ParamBlock
ParamBlock()
Definition: HITrackClusterRemover.cc:50
HITrackClusterRemover::mergeOld_
bool mergeOld_
Definition: HITrackClusterRemover.cc:70
HITrackClusterRemover::mergeOld
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
Definition: HITrackClusterRemover.cc:244
GeomDet.h
edmNew::DetSetVector
Definition: DetSetNew.h:13
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::OrphanHandle
Definition: EDProductfwd.h:39
edmNew::DetSetVector::data
data_type const * data(size_t cell) const
Definition: DetSetVectorNew.h:560
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
edm::ContainerMask::copyMaskTo
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:87
reco::ClusterRemovalInfo::pixelNewRefProd
const SiPixelClusterRefProd & pixelNewRefProd() const
Definition: ClusterRemovalInfo.h:60
DetId.h
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
edmNew::DetSetVector::end
const_iterator end(bool update=false) const
Definition: DetSetVectorNew.h:535
edm::ValueMap< int >
Exception
Definition: hltDiff.cc:246
reco::ClusterRemovalInfo::stripIndices
Indices & stripIndices()
Definition: ClusterRemovalInfo.h:50
HITrackClusterRemover::cleanup
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)
Definition: HITrackClusterRemover.cc:251
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
HITrackClusterRemover::pixels
std::vector< uint8_t > pixels
Definition: HITrackClusterRemover.cc:93
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HITrackClusterRemover::PixelMaskContainer
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
Definition: HITrackClusterRemover.cc:71
HITrackClusterRemover::stereoRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
Definition: HITrackClusterRemover.cc:80
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
HITrackClusterRemover::doPixel_
bool doPixel_
Definition: HITrackClusterRemover.cc:69
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
HITrackClusterRemover::doStrip_
bool doStrip_
Definition: HITrackClusterRemover.cc:69
cms::Exception
Definition: Exception.h:70
ParameterSet.h
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
SiStripMatchedRecHit2D.h
globals_cff.id2
id2
Definition: globals_cff.py:34
HITrackClusterRemover::clusterWasteSolution_
bool clusterWasteSolution_
Definition: HITrackClusterRemover.cc:108
edm::Event
Definition: Event.h:73
edm::Log
Definition: MessageLogger.h:70
TrackerSingleRecHit::omniClusterRef
OmniClusterRef const & omniClusterRef() const
Definition: TrackerSingleRecHit.h:41
SiStripRecHit2D.h
DetSetVectorNew.h
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
HITrackClusterRemover::ParamBlock::maxSize_
size_t maxSize_
Definition: HITrackClusterRemover.cc:64
HITrackClusterRemover::ParamBlock
Definition: HITrackClusterRemover.cc:49
edm::ProductID
Definition: ProductID.h:27
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::ProductLabels
Definition: ProductLabels.h:4
TrackerGeometry
Definition: TrackerGeometry.h:14
LaserSeedGenerator_cfi.rphiRecHits
rphiRecHits
Definition: LaserSeedGenerator_cfi.py:9