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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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_
 

Static Private Attributes

static const unsigned int NumberOfParamBlocks = 6
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 36 of file SeedClusterRemover.cc.

Member Typedef Documentation

Definition at line 59 of file SeedClusterRemover.cc.

Definition at line 60 of file SeedClusterRemover.cc.

Constructor & Destructor Documentation

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

Definition at line 106 of file SeedClusterRemover.cc.

References OmniClusterRef::cluster_strip(), collectedStrips_, doPixel_, doStrip_, Exception, lumiContext::fill, edm::ParameterSet::getParameter(), mps_fire::i, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), SeedClusterRemover::ParamBlock::maxSize_, mergeOld_, NumberOfParamBlocks, oldPxlMaskToken_, oldStrMaskToken_, pblocks_, pixelClusters_, process(), readPSet(), stripClusters_, strips, stripSourceProdID, and trajectories_.

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

Member Function Documentation

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

Definition at line 166 of file SeedClusterRemover.cc.

References SiPixelRecHit::cluster(), collectedPixels_, doPixel_, doStrip_, Exception, TrackingRecHit::geographicalId(), 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, DetId::rawId(), SiStripMatchedRecHit2D::stereoClusterRef(), and DetId::subdetId().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), produce(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), ConfigBuilder.ConfigBuilder::scheduleSequence(), and SeedClusterRemover().

166  {
167  DetId detid = hit->geographicalId();
168  uint32_t subdet = detid.subdetId();
169 
170  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
171 
172  // chi2 cut
173  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
174 
176  if (!doPixel_) return;
177  // this is a pixel, and i *know* it is
178  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
179 
180  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
181 
182  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
183  "SeedClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
184  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
185 
186  assert(cluster.id() == pixelSourceProdID);
187 //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
188 
189  // if requested, cut on cluster size
190  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
191 
192  // mark as used
193  pixels[cluster.key()] = false;
194 
195  assert(collectedPixels_.size() > cluster.key());
196  collectedPixels_[cluster.key()]=true;
197 
198  } else { // aka Strip
199  if (!doStrip_) return;
200  const type_info &hitType = typeid(*hit);
201  if (hitType == typeid(SiStripRecHit2D)) {
202  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
203 //DBG// cout << "Plain RecHit 2D: " << endl;
204  process(stripHit->omniClusterRef(),subdet);}
205  else if (hitType == typeid(SiStripRecHit1D)) {
206  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
207  process(hit1D->omniClusterRef(),subdet);
208  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
209  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
210 //DBG// cout << "Matched RecHit 2D: " << endl;
211  process(matchHit->monoClusterRef(),subdet);
212  process(matchHit->stereoClusterRef(),subdet);
213  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
214  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
215 //DBG// cout << "Projected RecHit 2D: " << endl;
216  process(projHit->originalHit().omniClusterRef(),subdet);
217  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
218  }
219 }
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
static const unsigned int NumberOfParamBlocks
OmniClusterRef const & stereoClusterRef() const
key_type key() const
Accessor for product key.
Definition: Ref.h:265
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
edm::ProductID pixelSourceProdID
ParamBlock pblocks_[NumberOfParamBlocks]
OmniClusterRef const & monoClusterRef() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
SiStripRecHit2D originalHit() const
Definition: DetId.h:18
OmniClusterRef const & omniClusterRef() const
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
std::vector< bool > collectedPixels_
std::vector< uint8_t > pixels
DetId geographicalId() const
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Our base class.
Definition: SiPixelRecHit.h:23
void SeedClusterRemover::process ( const OmniClusterRef cluRef,
uint32_t  subdet 
)
inlineprivate
void SeedClusterRemover::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 223 of file SeedClusterRemover.cc.

References collectedPixels_, collectedStrips_, edm::ContainerMask< T >::copyMaskTo(), KineDebug3::count(), DEFINE_FWK_MODULE, doPixel_, doStrip_, lumiContext::fill, edm::EventSetup::get(), edm::Event::getByToken(), hfClusterShapes_cfi::hits, edm::HandleBase::id(), LogDebug, mergeOld_, oldPxlMaskToken_, oldStrMaskToken_, HiRegitMuonDetachedTripletStep_cff::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::ESHandle< T >::product(), edm::Event::put(), SurveyInfoScenario_cff::seed, edm::ContainerMask< T >::size(), HiRegitMuonDetachedTripletStep_cff::stripClusters, stripClusters_, strips, stripSourceProdID, and trajectories_.

224 {
225 
227  iSetup.get<TrackerDigiGeometryRecord>().get("",tgh); //is it correct to use "" ?
228 
230  if (doPixel_) {
231  iEvent.getByToken(pixelClusters_, pixelClusters);
232  pixelSourceProdID = pixelClusters.id();
233  }
234  //DBG// std::cout << "SeedClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
235 
237  if (doStrip_) {
238  iEvent.getByToken(stripClusters_, stripClusters);
239  stripSourceProdID = stripClusters.id();
240  }
241  //DBG// std::cout << "SeedClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
242 
243 
244  if (doStrip_) {
245  strips.resize(stripClusters->dataSize()); fill(strips.begin(), strips.end(), true);
246  }
247  if (doPixel_) {
248  pixels.resize(pixelClusters->dataSize()); fill(pixels.begin(), pixels.end(), true);
249  }
250  if(mergeOld_) {
253  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
254  iEvent.getByToken(oldStrMaskToken_ ,oldStrMask);
255  LogDebug("SeedClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
256  oldStrMask->copyMaskTo(collectedStrips_);
257  oldPxlMask->copyMaskTo(collectedPixels_);
258  assert(stripClusters->dataSize()>=collectedStrips_.size());
259  collectedStrips_.resize(stripClusters->dataSize(),false); // for ondemand
260  }else {
261  collectedStrips_.resize(stripClusters->dataSize(), false);
262  collectedPixels_.resize(pixelClusters->dataSize(), false);
263  }
264 
265 
267  iEvent.getByToken(trajectories_,seeds);
268 
269  for (auto const & seed : (*seeds) ){
270  auto hits=seed.recHits();
271  auto hit=hits.first;
272  for (;hit!=hits.second;++hit){
273  if (!hit->isValid()) continue;
274  process( &(*hit), 0. , tgh.product());
275  }
276  }
277 
278 
279  pixels.clear(); strips.clear();
280 
281 
282  LogDebug("SeedClusterRemover")<<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true);
283  iEvent.put(std::make_unique<StripMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),collectedStrips_));
284 
285  LogDebug("SeedClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
286  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),collectedPixels_));
287 
288  collectedStrips_.clear();
289  collectedPixels_.clear();
290 
291 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:91
std::vector< bool > collectedStrips_
edm::ProductID pixelSourceProdID
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
size_t size() const
Definition: ContainerMask.h:55
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::ProductID stripSourceProdID
const T & get() const
Definition: EventSetup.h:59
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
T const * product() const
Definition: ESHandle.h:86
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 88 of file SeedClusterRemover.cc.

References edm::ParameterSet::exists(), lumiContext::fill, edm::ParameterSet::getParameter(), globals_cff::id1, globals_cff::id2, NumberOfParamBlocks, and pblocks_.

Referenced by SeedClusterRemover().

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

Member Data Documentation

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

Definition at line 80 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 79 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

bool SeedClusterRemover::doPixel_
private

Definition at line 56 of file SeedClusterRemover.cc.

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

bool SeedClusterRemover::doStrip_
private

Definition at line 56 of file SeedClusterRemover.cc.

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

bool SeedClusterRemover::mergeOld_
private

Definition at line 57 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

const unsigned int SeedClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 54 of file SeedClusterRemover.cc.

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

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

Definition at line 63 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 64 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

ParamBlock SeedClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 68 of file SeedClusterRemover.cc.

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

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

Definition at line 61 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 72 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID SeedClusterRemover::pixelSourceProdID
private

Definition at line 73 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 62 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 72 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

edm::ProductID SeedClusterRemover::stripSourceProdID
private

Definition at line 73 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 65 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().