CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

template<typename T >
auto_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 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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

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

Private Member Functions

template<typename T >
std::auto_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)
 
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
< PixelMaskContainer
oldPxlMaskToken_
 
edm::EDGetTokenT
< reco::ClusterRemovalInfo
oldRemovalInfo_
 
edm::EDGetTokenT
< StripMaskContainer
oldStrMaskToken_
 
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
< TrajectorySeedCollection
trajectories_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 38 of file SeedClusterRemover.cc.

Member Typedef Documentation

Definition at line 61 of file SeedClusterRemover.cc.

Definition at line 62 of file SeedClusterRemover.cc.

Constructor & Destructor Documentation

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

Definition at line 122 of file SeedClusterRemover.cc.

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

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

Definition at line 183 of file SeedClusterRemover.cc.

184 {
185 }

Member Function Documentation

template<typename T >
std::auto_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

Referenced by produce().

template<typename T >
auto_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 
)

Definition at line 198 of file SeedClusterRemover.cc.

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

199  {
200  typedef typename edmNew::DetSetVector<T> DSV;
201  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
202  typedef typename edmNew::DetSet<T> DS;
203  auto_ptr<DSV> output(new DSV());
204  output->reserve(oldClusters.size(), oldClusters.dataSize());
205 
206  unsigned int countOld=0;
207  unsigned int countNew=0;
208 
209  // cluster removal loop
210  const T * firstOffset = & oldClusters.data().front();
211  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
212  DS oldDS = *itdet;
213 
214  if (oldDS.empty()) continue; // skip empty detsets
215 
216  uint32_t id = oldDS.detId();
217  DSF outds(*output, id);
218 
219  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
220  uint32_t index = ((&*it) - firstOffset);
221  countOld++;
222  if (isGood[index]) {
223  outds.push_back(*it);
224  countNew++;
225  refs.push_back(index);
226  //std::cout << "SeedClusterRemover::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
227  }
228 
229  }
230  if (outds.empty()) outds.abort(); // not write in an empty DSV
231  }
232 
233  if (oldRefs != 0) mergeOld(refs, *oldRefs);
234  return output;
235 }
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 187 of file SeedClusterRemover.cc.

References i, and n.

Referenced by cleanup().

189 {
190  for (size_t i = 0, n = refs.size(); i < n; ++i) {
191  refs[i] = oldRefs[refs[i]];
192  }
193 }
int i
Definition: DBlmapReader.cc:9
void SeedClusterRemover::process ( const TrackingRecHit hit,
float  chi2 
)
inlineprivate

Definition at line 255 of file SeedClusterRemover.cc.

References SiPixelRecHit::cluster(), clusterWasteSolution_, collectedPixels_, cond::rpcobgas::detid, doPixel_, doStrip_, edm::hlt::Exception, TrackingRecHit::geographicalId(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), SeedClusterRemover::ParamBlock::maxSize_, SiStripMatchedRecHit2D::monoClusterRef(), NumberOfParamBlocks, TrackerSingleRecHit::omniClusterRef(), ProjectedSiStripRecHit2D::originalHit(), pblocks_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixels, pixelSourceProdID, DetId::rawId(), SiStripMatchedRecHit2D::stereoClusterRef(), and DetId::subdetId().

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

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

Definition at line 238 of file SeedClusterRemover.cc.

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

Referenced by ConfigBuilder.ConfigBuilder::__init__(), ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::anyOf(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HARVESTING(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

238  {
239  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
240  if (cluster.id() != stripSourceProdID) throw cms::Exception("Inconsistent Data") <<
241  "SeedClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
242  " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
243 
244  assert(cluster.id() == stripSourceProdID);
245  if (pblocks_[subdet-1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet-1].maxSize_)) return;
246 
247  strips[cluster.key()] = false;
248  //if (!clusterWasteSolution_) collectedStrip[hit->geographicalId()].insert(cluster);
249  assert(collectedStrips_.size() > cluster.key());
250  //assert(hit->geographicalId() == cluster->geographicalId()); //This condition fails
251  if (!clusterWasteSolution_) collectedStrips_[cluster.key()]=true;
252 }
key_type key() const
Accessor for product key.
Definition: Ref.h:266
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
std::vector< bool > collectedStrips_
ParamBlock pblocks_[NumberOfParamBlocks]
edm::ProductID stripSourceProdID
std::vector< uint8_t > strips
void SeedClusterRemover::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 324 of file SeedClusterRemover.cc.

References cleanup(), clusterWasteSolution_, collectedPixels_, collectedStrips_, prof2calltree::count, doPixel_, doStrip_, edm::hlt::Exception, lumiContext::fill, edm::Event::getByToken(), edm::HandleBase::id(), tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), LogDebug, mergeOld_, oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, clustersummaryproducer_cfg::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::EDConsumerBase::Labels::productInstance, edm::Event::put(), edm::ProductID::reset(), fileCollector::seed, clustersummaryproducer_cfg::stripClusters, stripClusters_, strips, stripSourceProdID, and trajectories_.

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

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

Referenced by SeedClusterRemover().

106 {
107  if (iConfig.exists(name)) {
108  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
109  if (id1 == -1) {
111  } else {
112  pblocks_[id1] = pblock;
113  if (id2 != -1) pblocks_[id2] = pblock;
114  if (id3 != -1) pblocks_[id3] = pblock;
115  if (id4 != -1) pblocks_[id4] = pblock;
116  if (id5 != -1) pblocks_[id5] = pblock;
117  if (id6 != -1) pblocks_[id6] = pblock;
118  }
119  }
120 }
T getParameter(std::string const &) const
string fill
Definition: lumiContext.py:319
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 91 of file SeedClusterRemover.cc.

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

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

Definition at line 95 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 94 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

bool SeedClusterRemover::doPixel_
private

Definition at line 59 of file SeedClusterRemover.cc.

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

bool SeedClusterRemover::doStrip_
private

Definition at line 59 of file SeedClusterRemover.cc.

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

bool SeedClusterRemover::filterTracks_
private

Definition at line 92 of file SeedClusterRemover.cc.

Referenced by SeedClusterRemover().

bool SeedClusterRemover::mergeOld_
private

Definition at line 60 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

const unsigned int SeedClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 57 of file SeedClusterRemover.cc.

Referenced by process(), and SeedClusterRemover().

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

Definition at line 66 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 65 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 67 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

ParamBlock SeedClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 72 of file SeedClusterRemover.cc.

Referenced by process(), and SeedClusterRemover().

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

Definition at line 63 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 76 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID SeedClusterRemover::pixelSourceProdID
private

Definition at line 77 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 64 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().

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

Definition at line 76 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID SeedClusterRemover::stripSourceProdID
private

Definition at line 77 of file SeedClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 93 of file SeedClusterRemover.cc.

Referenced by SeedClusterRemover().

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

Definition at line 68 of file SeedClusterRemover.cc.

Referenced by produce(), and SeedClusterRemover().