CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
SeedClusterRemover Class Reference
Inheritance diagram for SeedClusterRemover:
edm::stream::EDProducer<>

Classes

struct  ParamBlock
 

Public Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 SeedClusterRemover (const edm::ParameterSet &iConfig)
 
- 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

void process (const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
 
void process (const OmniClusterRef &cluRef, uint32_t subdet)
 
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)
 

Private Attributes

std::vector< bool > collectedPixels_
 
std::vector< bool > collectedStrips_
 
bool doPixel_
 
bool doStrip_
 
bool mergeOld_
 
edm::EDGetTokenT< PixelMaskContaineroldPxlMaskToken_
 
edm::EDGetTokenT< StripMaskContaineroldStrMaskToken_
 
ParamBlock pblocks_ [NumberOfParamBlocks]
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
 
std::vector< uint8_t > strips
 
edm::ProductID stripSourceProdID
 
edm::EDGetTokenT< TrajectorySeedCollectiontrajectories_
 
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 35 of file SeedClusterRemover.cc.

Member Typedef Documentation

◆ PixelMaskContainer

Definition at line 60 of file SeedClusterRemover.cc.

◆ StripMaskContainer

Definition at line 61 of file SeedClusterRemover.cc.

Constructor & Destructor Documentation

◆ SeedClusterRemover()

SeedClusterRemover::SeedClusterRemover ( const edm::ParameterSet iConfig)

Definition at line 113 of file SeedClusterRemover.cc.

References doPixel_, doStrip_, Exception, EcalPhiSymFlatTableProducers_cfi::fill, edm::ParameterSet::getParameter(), mps_fire::i, mergeOld_, NumberOfParamBlocks, oldPxlMaskToken_, oldStrMaskToken_, pblocks_, pixelClusters_, readPSet(), stripClusters_, and trajectories_.

114  : tTrackerGeom_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),
115  doStrip_(iConfig.existsAs<bool>("doStrip") ? iConfig.getParameter<bool>("doStrip") : true),
116  doPixel_(iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true),
117  mergeOld_(iConfig.exists("oldClusterRemovalInfo")) {
118  fill(pblocks_, pblocks_ + NumberOfParamBlocks, ParamBlock());
119  readPSet(iConfig, "Common", -1);
120  if (doPixel_) {
121  readPSet(iConfig, "Pixel", 0, 1);
122  readPSet(iConfig, "PXB", 0);
123  readPSet(iConfig, "PXE", 1);
124  }
125  if (doStrip_) {
126  readPSet(iConfig, "Strip", 2, 3, 4, 5);
127  readPSet(iConfig, "StripInner", 2, 3);
128  readPSet(iConfig, "StripOuter", 4, 5);
129  readPSet(iConfig, "TIB", 2);
130  readPSet(iConfig, "TID", 3);
131  readPSet(iConfig, "TOB", 4);
132  readPSet(iConfig, "TEC", 5);
133  }
134 
135  bool usingCharge = false;
136  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
137  if (!pblocks_[i].isSet_)
138  throw cms::Exception("Configuration Error")
139  << "SeedClusterRemover: Missing configuration for detector with subDetID = " << (i + 1);
140  if (pblocks_[i].usesCharge_ && !usingCharge) {
141  throw cms::Exception("Configuration Error") << "SeedClusterRemover: Configuration for subDetID = " << (i + 1)
142  << " uses cluster charge, which is not enabled.";
143  }
144  }
145 
146  trajectories_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<InputTag>("trajectories"));
147  if (doPixel_)
148  pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
149  if (doStrip_)
150  stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<InputTag>("stripClusters"));
151  if (mergeOld_) {
152  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
153  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
154  }
155 
156  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
157  produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
158 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static const unsigned int NumberOfParamBlocks
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
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)
ParamBlock pblocks_[NumberOfParamBlocks]
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_

Member Function Documentation

◆ process() [1/2]

void SeedClusterRemover::process ( const TrackingRecHit hit,
float  chi2,
const TrackerGeometry tg 
)
inlineprivate

Definition at line 176 of file SeedClusterRemover.cc.

References cms::cuda::assert(), isoTrack_cff::chi2, SiPixelRecHit::cluster(), collectedPixels_, ALCARECOPPSCalTrackBasedSel_cff::detid, doPixel_, doStrip_, Exception, TrackerGeometry::geomDetSubDetector(), edm::Ref< C, T, F >::id(), GeomDetEnumerators::isTrackerPixel(), edm::Ref< C, T, F >::key(), SeedClusterRemover::ParamBlock::maxSize_, SiStripMatchedRecHit2D::monoClusterRef(), NumberOfParamBlocks, TrackerSingleRecHit::omniClusterRef(), ProjectedSiStripRecHit2D::originalHit(), pblocks_, pixels, pixelSourceProdID, and SiStripMatchedRecHit2D::stereoClusterRef().

Referenced by produce().

176  {
177  DetId detid = hit->geographicalId();
178  uint32_t subdet = detid.subdetId();
179 
180  assert((subdet > 0) && (subdet <= NumberOfParamBlocks));
181 
182  // chi2 cut
183  if (chi2 > pblocks_[subdet - 1].maxChi2_)
184  return;
185 
187  if (!doPixel_)
188  return;
189  // this is a pixel, and i *know* it is
190  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
191 
192  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
193 
194  if (cluster.id() != pixelSourceProdID)
195  throw cms::Exception("Inconsistent Data")
196  << "SeedClusterRemover: pixel cluster ref from Product ID = " << cluster.id()
197  << " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
198 
199  assert(cluster.id() == pixelSourceProdID);
200  //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
201 
202  // if requested, cut on cluster size
203  if (pblocks_[subdet - 1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet - 1].maxSize_))
204  return;
205 
206  // mark as used
207  pixels[cluster.key()] = false;
208 
209  assert(collectedPixels_.size() > cluster.key());
210  collectedPixels_[cluster.key()] = true;
211 
212  } else { // aka Strip
213  if (!doStrip_)
214  return;
215  const type_info &hitType = typeid(*hit);
216  if (hitType == typeid(SiStripRecHit2D)) {
217  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
218  //DBG// cout << "Plain RecHit 2D: " << endl;
219  process(stripHit->omniClusterRef(), subdet);
220  } else if (hitType == typeid(SiStripRecHit1D)) {
221  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
222  process(hit1D->omniClusterRef(), subdet);
223  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
224  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
225  //DBG// cout << "Matched RecHit 2D: " << endl;
226  process(matchHit->monoClusterRef(), subdet);
227  process(matchHit->stereoClusterRef(), subdet);
228  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
229  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
230  //DBG// cout << "Projected RecHit 2D: " << endl;
231  process(projHit->originalHit().omniClusterRef(), subdet);
232  } else
233  throw cms::Exception("NOT IMPLEMENTED")
234  << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
235  }
236 }
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
ProductID id() const
Accessor for product ID.
Definition: Ref.h:238
static const unsigned int NumberOfParamBlocks
OmniClusterRef const & stereoClusterRef() const
OmniClusterRef const & omniClusterRef() const
assert(be >=bs)
OmniClusterRef const & monoClusterRef() const
key_type key() const
Accessor for product key.
Definition: Ref.h:244
edm::ProductID pixelSourceProdID
ParamBlock pblocks_[NumberOfParamBlocks]
Definition: DetId.h:17
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
SiStripRecHit2D originalHit() const
std::vector< bool > collectedPixels_
std::vector< uint8_t > pixels
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Our base class.
Definition: SiPixelRecHit.h:23

◆ process() [2/2]

void SeedClusterRemover::process ( const OmniClusterRef cluRef,
uint32_t  subdet 
)
inlineprivate

Definition at line 160 of file SeedClusterRemover.cc.

References cms::cuda::assert(), OmniClusterRef::cluster_strip(), collectedStrips_, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), SeedClusterRemover::ParamBlock::maxSize_, pblocks_, strips, and stripSourceProdID.

160  {
161  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
162  if (cluster.id() != stripSourceProdID)
163  throw cms::Exception("Inconsistent Data")
164  << "SeedClusterRemover: strip cluster ref from Product ID = " << cluster.id()
165  << " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
166 
167  assert(cluster.id() == stripSourceProdID);
168  if (pblocks_[subdet - 1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet - 1].maxSize_))
169  return;
170 
171  strips[cluster.key()] = false;
172  assert(collectedStrips_.size() > cluster.key());
173  collectedStrips_[cluster.key()] = true;
174 }
ProductID id() const
Accessor for product ID.
Definition: Ref.h:238
assert(be >=bs)
key_type key() const
Accessor for product key.
Definition: Ref.h:244
std::vector< bool > collectedStrips_
ParamBlock pblocks_[NumberOfParamBlocks]
edm::ProductID stripSourceProdID
std::vector< uint8_t > strips

◆ produce()

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

Definition at line 238 of file SeedClusterRemover.cc.

References cms::cuda::assert(), collectedPixels_, collectedStrips_, edm::ContainerMask< T >::copyMaskTo(), submitPVResolutionJobs::count, doPixel_, doStrip_, EcalPhiSymFlatTableProducers_cfi::fill, edm::EventSetup::getData(), iEvent, LogDebug, mergeOld_, oldPxlMaskToken_, oldStrMaskToken_, DQMOffline_LumiMonitoring_cff::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), fileCollector::seed, HLT_2024v14_cff::seeds, edm::ContainerMask< T >::size(), HLT_2024v14_cff::stripClusters, stripClusters_, strips, stripSourceProdID, trajectories_, and tTrackerGeom_.

238  {
239  const auto &tgh = &iSetup.getData(tTrackerGeom_);
240 
242  if (doPixel_) {
243  iEvent.getByToken(pixelClusters_, pixelClusters);
245  }
246  //DBG// std::cout << "SeedClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
247 
249  if (doStrip_) {
250  iEvent.getByToken(stripClusters_, stripClusters);
252  }
253  //DBG// std::cout << "SeedClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
254 
255  if (doStrip_) {
256  strips.resize(stripClusters->dataSize());
257  fill(strips.begin(), strips.end(), true);
258  }
259  if (doPixel_) {
260  pixels.resize(pixelClusters->dataSize());
261  fill(pixels.begin(), pixels.end(), true);
262  }
263  if (mergeOld_) {
266  iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
267  iEvent.getByToken(oldStrMaskToken_, oldStrMask);
268  LogDebug("SeedClusterRemover") << "to merge in, " << oldStrMask->size() << " strp and " << oldPxlMask->size()
269  << " pxl";
270  oldStrMask->copyMaskTo(collectedStrips_);
271  oldPxlMask->copyMaskTo(collectedPixels_);
272  assert(stripClusters->dataSize() >= collectedStrips_.size());
273  collectedStrips_.resize(stripClusters->dataSize(), false); // for ondemand
274  } else {
275  collectedStrips_.resize(stripClusters->dataSize(), false);
276  collectedPixels_.resize(pixelClusters->dataSize(), false);
277  }
278 
280  iEvent.getByToken(trajectories_, seeds);
281 
282  for (auto const &seed : (*seeds)) {
283  for (auto const &hit : seed.recHits()) {
284  if (!hit.isValid())
285  continue;
286  process(&hit, 0., tgh);
287  }
288  }
289 
290  pixels.clear();
291  strips.clear();
292 
293  LogDebug("SeedClusterRemover") << "total strip to skip: "
294  << std::count(collectedStrips_.begin(), collectedStrips_.end(), true);
295  iEvent.put(std::make_unique<StripMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),
297 
298  LogDebug("SeedClusterRemover") << "total pxl to skip: "
299  << std::count(collectedPixels_.begin(), collectedPixels_.end(), true);
300  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),
302 
303  collectedStrips_.clear();
304  collectedPixels_.clear();
305 }
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
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
std::vector< bool > collectedStrips_
edm::ProductID pixelSourceProdID
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::ProductID stripSourceProdID
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
std::vector< uint8_t > strips
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
std::vector< bool > collectedPixels_
std::vector< uint8_t > pixels
size_t size() const
Definition: ContainerMask.h:53
#define LogDebug(id)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_

◆ readPSet()

void SeedClusterRemover::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 91 of file SeedClusterRemover.cc.

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

Referenced by SeedClusterRemover().

92  {
93  if (iConfig.exists(name)) {
94  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
95  if (id1 == -1) {
97  } else {
98  pblocks_[id1] = pblock;
99  if (id2 != -1)
100  pblocks_[id2] = pblock;
101  if (id3 != -1)
102  pblocks_[id3] = pblock;
103  if (id4 != -1)
104  pblocks_[id4] = pblock;
105  if (id5 != -1)
106  pblocks_[id5] = pblock;
107  if (id6 != -1)
108  pblocks_[id6] = pblock;
109  }
110  }
111 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static const unsigned int NumberOfParamBlocks
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParamBlock pblocks_[NumberOfParamBlocks]

Member Data Documentation

◆ collectedPixels_

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

Definition at line 85 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

◆ collectedStrips_

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

Definition at line 84 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

◆ doPixel_

bool SeedClusterRemover::doPixel_
private

Definition at line 57 of file SeedClusterRemover.cc.

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

◆ doStrip_

bool SeedClusterRemover::doStrip_
private

Definition at line 57 of file SeedClusterRemover.cc.

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

◆ mergeOld_

bool SeedClusterRemover::mergeOld_
private

Definition at line 58 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

◆ NumberOfParamBlocks

const unsigned int SeedClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 55 of file SeedClusterRemover.cc.

Referenced by process(), and SeedClusterRemover().

◆ oldPxlMaskToken_

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

Definition at line 64 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

◆ oldStrMaskToken_

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

Definition at line 65 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

◆ pblocks_

ParamBlock SeedClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 68 of file SeedClusterRemover.cc.

Referenced by process(), and SeedClusterRemover().

◆ pixelClusters_

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

Definition at line 62 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

◆ pixels

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

Definition at line 78 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

◆ pixelSourceProdID

edm::ProductID SeedClusterRemover::pixelSourceProdID
private

Definition at line 79 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

◆ stripClusters_

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

Definition at line 63 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

◆ strips

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

Definition at line 78 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

◆ stripSourceProdID

edm::ProductID SeedClusterRemover::stripSourceProdID
private

Definition at line 79 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

◆ trajectories_

edm::EDGetTokenT<TrajectorySeedCollection> SeedClusterRemover::trajectories_
private

Definition at line 66 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

◆ tTrackerGeom_

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

Definition at line 41 of file SeedClusterRemover.cc.

Referenced by produce().