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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  ParamBlock
 

Public Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 SeedClusterRemover (const edm::ParameterSet &iConfig)
 
 ~SeedClusterRemover ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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, 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

bool clusterWasteSolution_
 
std::vector< bool > collectedPixels_
 
std::vector< bool > collectedStrips_
 
bool doPixel_
 
bool doStrip_
 
bool filterTracks_
 
bool mergeOld_
 
edm::EDGetTokenT< PixelMaskContaineroldPxlMaskToken_
 
edm::EDGetTokenT< reco::ClusterRemovalInfooldRemovalInfo_
 
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
 
reco::TrackBase::TrackQuality trackQuality_
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 41 of file SeedClusterRemover.cc.

Member Typedef Documentation

Definition at line 64 of file SeedClusterRemover.cc.

Definition at line 65 of file SeedClusterRemover.cc.

Constructor & Destructor Documentation

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

Definition at line 125 of file SeedClusterRemover.cc.

References clusterWasteSolution_, doPixel_, doStrip_, Exception, edm::ParameterSet::exists(), lumiContext::fill, filterTracks_, edm::ParameterSet::getParameter(), mps_fire::i, mergeOld_, NumberOfParamBlocks, oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, pblocks_, pixelClusters_, reco::TrackBase::qualityByName(), readPSet(), AlCaHLTBitMon_QueryRunRegistry::string, stripClusters_, trackQuality_, trajectories_, and reco::TrackBase::undefQuality.

125  :
126  doStrip_(iConfig.existsAs<bool>("doStrip") ? iConfig.getParameter<bool>("doStrip") : true),
127  doPixel_(iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true),
128  mergeOld_(iConfig.exists("oldClusterRemovalInfo")),
130 {
131 // if (iConfig.exists("overrideTrkQuals"))
132 // overrideTrkQuals_.push_back(iConfig.getParameter<edm::InputTag>("overrideTrkQuals"));
133  if (iConfig.exists("clusterLessSolution"))
134  clusterWasteSolution_=!iConfig.getParameter<bool>("clusterLessSolution");
135  if (doPixel_ && clusterWasteSolution_) produces< edmNew::DetSetVector<SiPixelCluster> >();
136  if (doStrip_ && clusterWasteSolution_) produces< edmNew::DetSetVector<SiStripCluster> >();
137  if (clusterWasteSolution_) produces< ClusterRemovalInfo >();
138 
139  fill(pblocks_, pblocks_+NumberOfParamBlocks, ParamBlock());
140  readPSet(iConfig, "Common",-1);
141  if (doPixel_) {
142  readPSet(iConfig, "Pixel" ,0,1);
143  readPSet(iConfig, "PXB" ,0);
144  readPSet(iConfig, "PXE" ,1);
145  }
146  if (doStrip_) {
147  readPSet(iConfig, "Strip" ,2,3,4,5);
148  readPSet(iConfig, "StripInner" ,2,3);
149  readPSet(iConfig, "StripOuter" ,4,5);
150  readPSet(iConfig, "TIB" ,2);
151  readPSet(iConfig, "TID" ,3);
152  readPSet(iConfig, "TOB" ,4);
153  readPSet(iConfig, "TEC" ,5);
154  }
155 
156  bool usingCharge = false;
157  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
158  if (!pblocks_[i].isSet_) throw cms::Exception("Configuration Error") << "SeedClusterRemover: Missing configuration for detector with subDetID = " << (i+1);
159  if (pblocks_[i].usesCharge_ && !usingCharge) {
160  throw cms::Exception("Configuration Error") << "SeedClusterRemover: Configuration for subDetID = " << (i+1) << " uses cluster charge, which is not enabled.";
161  }
162  }
163 
164  if (!clusterWasteSolution_){
165  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
166  produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
167  }
169  filterTracks_=false;
170  if (iConfig.exists("TrackQuality")){
171  filterTracks_=true;
172  trackQuality_=reco::TrackBase::qualityByName(iConfig.getParameter<std::string>("TrackQuality"));
173  }
174 
175  trajectories_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<InputTag>("trajectories"));
176  if (doPixel_) pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
177  if (doStrip_) stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<InputTag>("stripClusters"));
178  if (mergeOld_) {
179  oldRemovalInfo_ = consumes<ClusterRemovalInfo>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
180  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
181  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
182  }
183 }
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
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_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
reco::TrackBase::TrackQuality trackQuality_
SeedClusterRemover::~SeedClusterRemover ( )

Definition at line 186 of file SeedClusterRemover.cc.

187 {
188 }

Member Function Documentation

template<typename T >
std::unique_ptr< edmNew::DetSetVector< T > > SeedClusterRemover::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 201 of file SeedClusterRemover.cc.

References edmNew::DetSetVector< T >::begin(), OmniClusterRef::cluster_strip(), clusterWasteSolution_, collectedStrips_, edmNew::DetSetVector< T >::data(), edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::end(), edm::Ref< C, T, F >::id(), diffTreeTool::index, edm::Ref< C, T, F >::key(), SeedClusterRemover::ParamBlock::maxSize_, mergeOld(), convertSQLitetoXML_cfg::output, pblocks_, process(), edmNew::DetSetVector< T >::size(), strips, and stripSourceProdID.

Referenced by produce().

202  {
203  typedef typename edmNew::DetSetVector<T> DSV;
204  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
205  typedef typename edmNew::DetSet<T> DS;
206  auto output = std::make_unique<DSV>();
207  output->reserve(oldClusters.size(), oldClusters.dataSize());
208 
209  unsigned int countOld=0;
210  unsigned int countNew=0;
211 
212  // cluster removal loop
213  const T * firstOffset = & oldClusters.data().front();
214  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
215  DS oldDS = *itdet;
216 
217  if (oldDS.empty()) continue; // skip empty detsets
218 
219  uint32_t id = oldDS.detId();
220  DSF outds(*output, id);
221 
222  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
223  uint32_t index = ((&*it) - firstOffset);
224  countOld++;
225  if (isGood[index]) {
226  outds.push_back(*it);
227  countNew++;
228  refs.push_back(index);
229  //std::cout << "SeedClusterRemover::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
230  }
231 
232  }
233  if (outds.empty()) outds.abort(); // not write in an empty DSV
234  }
235 
236  if (oldRefs != 0) mergeOld(refs, *oldRefs);
237  return output;
238 }
const_iterator end(bool update=false) const
size_type dataSize() const
data_type const * data(size_t cell) const
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
size_type size() const
long double T
const_iterator begin(bool update=false) const
void SeedClusterRemover::mergeOld ( reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 190 of file SeedClusterRemover.cc.

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

Referenced by cleanup().

192 {
193  for (size_t i = 0, n = refs.size(); i < n; ++i) {
194  refs[i] = oldRefs[refs[i]];
195  }
196 }
void SeedClusterRemover::process ( const TrackingRecHit hit,
float  chi2,
const TrackerGeometry tg 
)
inlineprivate

Definition at line 258 of file SeedClusterRemover.cc.

References SiPixelRecHit::cluster(), clusterWasteSolution_, 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(), cleanup(), 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(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

258  {
259  DetId detid = hit->geographicalId();
260  uint32_t subdet = detid.subdetId();
261 
262  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
263 
264  // chi2 cut
265  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
266 
268  if (!doPixel_) return;
269  // this is a pixel, and i *know* it is
270  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
271 
272  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
273 
274  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
275  "SeedClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
276  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
277 
278  assert(cluster.id() == pixelSourceProdID);
279 //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
280 
281  // if requested, cut on cluster size
282  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
283 
284  // mark as used
285  pixels[cluster.key()] = false;
286 
287  //if(!clusterWasteSolution_) collectedPixel[detid.rawId()].insert(cluster);
288  assert(collectedPixels_.size() > cluster.key());
289  //assert(detid.rawId() == cluster->geographicalId()); //This condition fails
290  if(!clusterWasteSolution_) collectedPixels_[cluster.key()]=true;
291 
292  } else { // aka Strip
293  if (!doStrip_) return;
294  const type_info &hitType = typeid(*hit);
295  if (hitType == typeid(SiStripRecHit2D)) {
296  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
297 //DBG// cout << "Plain RecHit 2D: " << endl;
298  process(stripHit->omniClusterRef(),subdet);}
299  else if (hitType == typeid(SiStripRecHit1D)) {
300  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
301  process(hit1D->omniClusterRef(),subdet);
302  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
303  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
304 //DBG// cout << "Matched RecHit 2D: " << endl;
305  process(matchHit->monoClusterRef(),subdet);
306  process(matchHit->stereoClusterRef(),subdet);
307  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
308  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
309 //DBG// cout << "Projected RecHit 2D: " << endl;
310  process(projHit->originalHit().omniClusterRef(),subdet);
311  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
312  }
313 }
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:264
ProductID id() const
Accessor for product ID.
Definition: Ref.h:258
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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:37
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)
bool isTrackerPixel(const GeomDetEnumerators::SubDetector m)
std::vector< bool > collectedPixels_
std::vector< uint8_t > pixels
DetId geographicalId() const
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 327 of file SeedClusterRemover.cc.

References cleanup(), clusterWasteSolution_, collectedPixels_, collectedStrips_, edm::ContainerMask< T >::copyMaskTo(), KineDebug3::count(), DEFINE_FWK_MODULE, doPixel_, doStrip_, Exception, lumiContext::fill, edm::EventSetup::get(), edm::Event::getByToken(), hfClusterShapes_cfi::hits, edm::ProductID::id(), edm::HandleBase::id(), tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), LogDebug, mergeOld_, eostools::move(), oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, hiDetachedTripletStep_cff::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::ESHandle< T >::product(), edm::ProductLabels::productInstance, edm::Event::put(), SurveyInfoScenario_cff::seed, edm::ContainerMask< T >::size(), hiDetachedTripletStep_cff::stripClusters, stripClusters_, strips, stripSourceProdID, and trajectories_.

328 {
329  ProductID pixelOldProdID, stripOldProdID;
330 
332  iSetup.get<TrackerDigiGeometryRecord>().get("",tgh); //is it correct to use "" ?
333 
335  if (doPixel_) {
336  iEvent.getByToken(pixelClusters_, pixelClusters);
337  pixelSourceProdID = pixelClusters.id();
338  }
339 //DBG// std::cout << "SeedClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
340 
342  if (doStrip_) {
343  iEvent.getByToken(stripClusters_, stripClusters);
344  stripSourceProdID = stripClusters.id();
345  }
346 //DBG// std::cout << "SeedClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
347 
348  std::unique_ptr<ClusterRemovalInfo> cri;
350  if (doStrip_ && doPixel_) cri = std::make_unique<ClusterRemovalInfo>(pixelClusters, stripClusters);
351  else if (doStrip_) cri = std::make_unique<ClusterRemovalInfo>(stripClusters);
352  else if (doPixel_) cri = std::make_unique<ClusterRemovalInfo>(pixelClusters);
353  }
354 
355  Handle<ClusterRemovalInfo> oldRemovalInfo;
357  iEvent.getByToken(oldRemovalInfo_, oldRemovalInfo);
358  // Check ProductIDs
359  if ( (oldRemovalInfo->stripNewRefProd().id() == stripClusters.id()) &&
360  (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.id()) ) {
361 
362  cri->getOldClustersFrom(*oldRemovalInfo);
363 
364  pixelOldProdID = oldRemovalInfo->pixelRefProd().id();
365  stripOldProdID = oldRemovalInfo->stripRefProd().id();
366 
367  } else {
370  throw cms::Exception("Inconsistent Data") << "SeedClusterRemover: " <<
371  "Input collection product IDs are [pixel: " << pixelClusters.id() << ", strip: " << stripClusters.id() << "] \n" <<
372  "\t but the *old* ClusterRemovalInfo " << labels.productInstance << " refers as 'new product ids' to " <<
373  "[pixel: " << oldRemovalInfo->pixelNewRefProd().id() << ", strip: " << oldRemovalInfo->stripNewRefProd().id() << "]\n" <<
374  "NOTA BENE: when running SeedClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
375  }
376  } else { // then Old == Source
377  pixelOldProdID = pixelSourceProdID;
378  stripOldProdID = stripSourceProdID;
379  }
380 
381  if (doStrip_) {
382  strips.resize(stripClusters->dataSize()); fill(strips.begin(), strips.end(), true);
383  }
384  if (doPixel_) {
385  pixels.resize(pixelClusters->dataSize()); fill(pixels.begin(), pixels.end(), true);
386  }
387  if(mergeOld_) {
390  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
391  iEvent.getByToken(oldStrMaskToken_ ,oldStrMask);
392  LogDebug("SeedClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
393  oldStrMask->copyMaskTo(collectedStrips_);
394  oldPxlMask->copyMaskTo(collectedPixels_);
395  assert(stripClusters->dataSize()>=collectedStrips_.size());
396  collectedStrips_.resize(stripClusters->dataSize(),false); // for ondemand
397  }else {
398  collectedStrips_.resize(stripClusters->dataSize(), false);
399  collectedPixels_.resize(pixelClusters->dataSize(), false);
400  }
401 
402 
404  iEvent.getByToken(trajectories_,seeds);
405 
406  TrajectorySeedCollection::const_iterator seed=seeds->begin();
407 
408  for (;seed!=seeds->end();++seed){
409  TrajectorySeed::range hits=seed->recHits();
411  for (;hit!=hits.second;++hit){
412  if (!hit->isValid()) continue;
413  process( &(*hit), 0. , tgh.product());
414  }
415  }
416 
417 
420  iEvent.put(cleanup(*pixelClusters, pixels, cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0));
421 //DBG// std::cout << "SeedClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
422  cri->setNewPixelClusters(newPixels);
423  }
426  iEvent.put(cleanup(*stripClusters, strips, cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : 0));
427 //DBG// std::cout << "SeedClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
428  cri->setNewStripClusters(newStrips);
429  }
430 
431 
432  if (clusterWasteSolution_) {
433  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
434  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
435  // edm::LogWarning("SeedClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
436  iEvent.put(std::move(cri));
437  }
438 
439  pixels.clear(); strips.clear();
440 
441  if (!clusterWasteSolution_){
442  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
443  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
444 
445  LogDebug("SeedClusterRemover")<<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true);
446  iEvent.put(std::make_unique<StripMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),collectedStrips_));
447 
448  LogDebug("SeedClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
449  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),collectedPixels_));
450 
451  }
452  collectedStrips_.clear();
453  collectedPixels_.clear();
454 
455 }
#define LogDebug(id)
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:90
std::vector< bool > collectedStrips_
edm::ProductID pixelSourceProdID
recHitContainer::const_iterator const_iterator
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
std::pair< const_iterator, const_iterator > range
size_t size() const
Definition: ContainerMask.h:54
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::ProductID stripSourceProdID
const T & get() const
Definition: EventSetup.h:56
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
char const * productInstance
Definition: ProductLabels.h:6
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
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)
ProductIndex id() const
Definition: ProductID.h:38
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
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 107 of file SeedClusterRemover.cc.

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

Referenced by SeedClusterRemover().

109 {
110  if (iConfig.exists(name)) {
111  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
112  if (id1 == -1) {
114  } else {
115  pblocks_[id1] = pblock;
116  if (id2 != -1) pblocks_[id2] = pblock;
117  if (id3 != -1) pblocks_[id3] = pblock;
118  if (id4 != -1) pblocks_[id4] = pblock;
119  if (id5 != -1) pblocks_[id5] = pblock;
120  if (id6 != -1) pblocks_[id6] = pblock;
121  }
122  }
123 }
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

bool SeedClusterRemover::clusterWasteSolution_
private

Definition at line 94 of file SeedClusterRemover.cc.

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

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

Definition at line 98 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 97 of file SeedClusterRemover.cc.

Referenced by cleanup(), and produce().

bool SeedClusterRemover::doPixel_
private

Definition at line 62 of file SeedClusterRemover.cc.

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

bool SeedClusterRemover::doStrip_
private

Definition at line 62 of file SeedClusterRemover.cc.

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

bool SeedClusterRemover::filterTracks_
private

Definition at line 95 of file SeedClusterRemover.cc.

Referenced by SeedClusterRemover().

bool SeedClusterRemover::mergeOld_
private

Definition at line 63 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

const unsigned int SeedClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 60 of file SeedClusterRemover.cc.

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

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

Definition at line 69 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 68 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 70 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

ParamBlock SeedClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 75 of file SeedClusterRemover.cc.

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

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

Definition at line 66 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 79 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID SeedClusterRemover::pixelSourceProdID
private

Definition at line 80 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 67 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 79 of file SeedClusterRemover.cc.

Referenced by cleanup(), and produce().

edm::ProductID SeedClusterRemover::stripSourceProdID
private

Definition at line 80 of file SeedClusterRemover.cc.

Referenced by cleanup(), and produce().

reco::TrackBase::TrackQuality SeedClusterRemover::trackQuality_
private

Definition at line 96 of file SeedClusterRemover.cc.

Referenced by SeedClusterRemover().

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

Definition at line 71 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().