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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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, 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
< 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
 
- 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(), 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;
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
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: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:123
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::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 201 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().

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_ptr<DSV> output(new 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 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 }
int i
Definition: DBlmapReader.cc:9
void SeedClusterRemover::process ( const TrackingRecHit hit,
float  chi2,
const TrackerGeometry tg 
)
inlineprivate

Definition at line 258 of file SeedClusterRemover.cc.

References assert(), SiPixelRecHit::cluster(), clusterWasteSolution_, collectedPixels_, cond::rpcobgas::detid, 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_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
assert(m_qm.get())
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

Definition at line 241 of file SeedClusterRemover.cc.

References assert(), 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::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

241  {
242  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
243  if (cluster.id() != stripSourceProdID) throw cms::Exception("Inconsistent Data") <<
244  "SeedClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
245  " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
246 
247  assert(cluster.id() == stripSourceProdID);
248  if (pblocks_[subdet-1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet-1].maxSize_)) return;
249 
250  strips[cluster.key()] = false;
251  //if (!clusterWasteSolution_) collectedStrip[hit->geographicalId()].insert(cluster);
252  assert(collectedStrips_.size() > cluster.key());
253  //assert(hit->geographicalId() == cluster->geographicalId()); //This condition fails
254  if (!clusterWasteSolution_) collectedStrips_[cluster.key()]=true;
255 }
assert(m_qm.get())
key_type key() const
Accessor for product key.
Definition: Ref.h:264
ProductID id() const
Accessor for product ID.
Definition: Ref.h:258
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 327 of file SeedClusterRemover.cc.

References assert(), cleanup(), clusterWasteSolution_, collectedPixels_, collectedStrips_, prof2calltree::count, doPixel_, doStrip_, Exception, lumiContext::fill, edm::EventSetup::get(), edm::Event::getByToken(), edm::HandleBase::id(), HLT_25ns14e33_v1_cff::labels, edm::EDConsumerBase::labelsForToken(), LogDebug, mergeOld_, oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, HLT_25ns14e33_v1_cff::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::ESHandle< class >::product(), edm::ProductLabels::productInstance, edm::Event::put(), edm::ProductID::reset(), fileCollector::seed, HLT_25ns14e33_v1_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  auto_ptr<ClusterRemovalInfo> cri;
350  if (doStrip_ && doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters, stripClusters));
351  else if (doStrip_) cri.reset(new ClusterRemovalInfo(stripClusters));
352  else if (doPixel_) cri.reset(new 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 
419  auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters = cleanup(*pixelClusters, pixels,
420  cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
421  OrphanHandle<edmNew::DetSetVector<SiPixelCluster> > newPixels = iEvent.put(newPixelClusters);
422 //DBG// std::cout << "SeedClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
423  cri->setNewPixelClusters(newPixels);
424  }
426  auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters = cleanup(*stripClusters, strips,
427  cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
428  OrphanHandle<edmNew::DetSetVector<SiStripCluster> > newStrips = iEvent.put(newStripClusters);
429 //DBG// std::cout << "SeedClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
430  cri->setNewStripClusters(newStrips);
431  }
432 
433 
434  if (clusterWasteSolution_) {
435  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
436  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
437  // edm::LogWarning("SeedClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
438  iEvent.put(cri);
439  }
440 
441  pixels.clear(); strips.clear();
442 
443  if (!clusterWasteSolution_){
444  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
445  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
446 
447  std::auto_ptr<StripMaskContainer> removedStripClusterMask(
449  LogDebug("SeedClusterRemover")<<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true);
450  iEvent.put( removedStripClusterMask );
451 
452  std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
454  LogDebug("SeedClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
455  iEvent.put( removedPixelClusterMask );
456 
457  }
458  collectedStrips_.clear();
459  collectedPixels_.clear();
460 
461 }
#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:457
assert(m_qm.get())
std::vector< bool > collectedStrips_
edm::ProductID pixelSourceProdID
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
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
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
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)
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
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, and edm::ParameterSet::getParameter().

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
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 94 of file SeedClusterRemover.cc.

Referenced by 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 process(), 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(), 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 process(), 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 process(), and produce().

edm::ProductID SeedClusterRemover::stripSourceProdID
private

Definition at line 80 of file SeedClusterRemover.cc.

Referenced by process(), 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().