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
TrackClusterRemover Class Reference
Inheritance diagram for TrackClusterRemover:
edm::EDProducer 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
 
 TrackClusterRemover (const edm::ParameterSet &iConfig)
 
 ~TrackClusterRemover ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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
 
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, bool fromTrack)
 
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 doPixelChargeCheck_
 
bool doStrip_
 
bool doStripChargeCheck_
 
bool doTracks_
 
bool filterTracks_
 
bool mergeOld_
 
int minNumberOfLayersWithMeasBeforeFiltering_
 
edm::EDGetTokenT
< PixelMaskContainer
oldPxlMaskToken_
 
edm::EDGetTokenT
< reco::ClusterRemovalInfo
oldRemovalInfo_
 
edm::EDGetTokenT
< StripMaskContainer
oldStrMaskToken_
 
std::vector< edm::EDGetTokenT
< edm::ValueMap< int > > > 
overrideTrkQuals_
 
ParamBlock pblocks_ [NumberOfParamBlocks]
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiPixelCluster > > 
pixelClusters_
 
std::string pixelRecHits_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::EDGetTokenT
< SiStripRecHit2DCollection
rphiRecHitToken_
 
edm::EDGetTokenT
< SiStripRecHit2DCollection
stereoRecHitToken_
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiStripCluster > > 
stripClusters_
 
std::string stripRecHits_
 
std::vector< uint8_t > strips
 
edm::ProductID stripSourceProdID
 
reco::TrackBase::TrackQuality trackQuality_
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
trajectories_
 

Static Private Attributes

static const unsigned int NumberOfParamBlocks = 6
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
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 37 of file TrackClusterRemover.cc.

Member Typedef Documentation

Definition at line 65 of file TrackClusterRemover.cc.

Definition at line 66 of file TrackClusterRemover.cc.

Constructor & Destructor Documentation

TrackClusterRemover::TrackClusterRemover ( const edm::ParameterSet iConfig)

Definition at line 132 of file TrackClusterRemover.cc.

References clusterWasteSolution_, edm::EDConsumerBase::consumes(), doPixel_, doPixelChargeCheck_, doStrip_, doStripChargeCheck_, doTracks_, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), lumiContext::fill, filterTracks_, edm::ParameterSet::getParameter(), i, mergeOld_, minNumberOfLayersWithMeasBeforeFiltering_, NumberOfParamBlocks, oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, overrideTrkQuals_, pblocks_, pixelClusters_, reco::TrackBase::qualityByName(), readPSet(), rphiRecHitToken_, stereoRecHitToken_, AlCaHLTBitMon_QueryRunRegistry::string, stripClusters_, stripRecHits_, trackQuality_, trajectories_, and reco::TrackBase::undefQuality.

132  :
133  doTracks_(iConfig.exists("trajectories")),
134  doStrip_(iConfig.existsAs<bool>("doStrip") ? iConfig.getParameter<bool>("doStrip") : true),
135  doPixel_(iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true),
136  mergeOld_(iConfig.exists("oldClusterRemovalInfo")),
137  clusterWasteSolution_(true),
138  doStripChargeCheck_(iConfig.existsAs<bool>("doStripChargeCheck") ? iConfig.getParameter<bool>("doStripChargeCheck") : false),
139  doPixelChargeCheck_(iConfig.existsAs<bool>("doPixelChargeCheck") ? iConfig.getParameter<bool>("doPixelChargeCheck") : false),
140  stripRecHits_(doStripChargeCheck_ ? iConfig.getParameter<std::string>("stripRecHits") : std::string("siStripMatchedRecHits")),
141  pixelRecHits_(doPixelChargeCheck_ ? iConfig.getParameter<std::string>("pixelRecHits") : std::string("siPixelRecHits"))
142 {
143  if (iConfig.exists("overrideTrkQuals"))
144  overrideTrkQuals_.push_back(consumes<edm::ValueMap<int> >(iConfig.getParameter<InputTag>("overrideTrkQuals")));
145  if (iConfig.exists("clusterLessSolution"))
146  clusterWasteSolution_=!iConfig.getParameter<bool>("clusterLessSolution");
148  throw cms::Exception("Configuration Error") << "TrackClusterRemover: Charge check asked without cluster collection ";
150  throw cms::Exception("Configuration Error") << "TrackClusterRemover: Pixel cluster charge check not yet implemented";
151 
152  if (doPixel_ && clusterWasteSolution_) produces< edmNew::DetSetVector<SiPixelCluster> >();
153  if (doStrip_ && clusterWasteSolution_) produces< edmNew::DetSetVector<SiStripCluster> >();
154  if (clusterWasteSolution_) produces< ClusterRemovalInfo >();
155 
156  fill(pblocks_, pblocks_+NumberOfParamBlocks, ParamBlock());
157  readPSet(iConfig, "Common",-1);
158  if (doPixel_) {
159  readPSet(iConfig, "Pixel" ,0,1);
160  readPSet(iConfig, "PXB" ,0);
161  readPSet(iConfig, "PXE" ,1);
162  }
163  if (doStrip_) {
164  readPSet(iConfig, "Strip" ,2,3,4,5);
165  readPSet(iConfig, "StripInner" ,2,3);
166  readPSet(iConfig, "StripOuter" ,4,5);
167  readPSet(iConfig, "TIB" ,2);
168  readPSet(iConfig, "TID" ,3);
169  readPSet(iConfig, "TOB" ,4);
170  readPSet(iConfig, "TEC" ,5);
171  }
172 
173  bool usingCharge = false;
174  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
175  if (!pblocks_[i].isSet_) throw cms::Exception("Configuration Error") << "TrackClusterRemover: Missing configuration for detector with subDetID = " << (i+1);
176  if (pblocks_[i].usesCharge_ && !usingCharge) {
177  throw cms::Exception("Configuration Error") << "TrackClusterRemover: Configuration for subDetID = " << (i+1) << " uses cluster charge, which is not enabled.";
178  }
179  }
180 
181  if (!clusterWasteSolution_){
182  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
183  produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
184  }
186  filterTracks_=false;
187  if (iConfig.exists("TrackQuality")){
188  filterTracks_=true;
190  minNumberOfLayersWithMeasBeforeFiltering_ = iConfig.existsAs<int>("minNumberOfLayersWithMeasBeforeFiltering") ?
191  iConfig.getParameter<int>("minNumberOfLayersWithMeasBeforeFiltering") : 0;
192  }
193 
194  if (doTracks_) trajectories_ = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<InputTag>("trajectories"));
195  if (doPixel_) pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
196  if (doStrip_) stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<InputTag>("stripClusters"));
197  if (mergeOld_) {
198  oldRemovalInfo_ = consumes<ClusterRemovalInfo>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
199  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
200  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
201  }
202 
203  if (doStripChargeCheck_) {
204  rphiRecHitToken_ = consumes<SiStripRecHit2DCollection>(InputTag(stripRecHits_,"rphiRecHit"));
205  stereoRecHitToken_ = consumes<SiStripRecHit2DCollection>(InputTag(stripRecHits_,"stereoRecHit"));
206  }
207 // if(doPixelChargeCheck_) pixelRecHitsToken_ = consumes<SiPixelRecHitCollection>(InputTag(pixelRecHits_));
208 
209 }
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
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
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
ParamBlock pblocks_[NumberOfParamBlocks]
bool exists(std::string const &parameterName) const
checks if a parameter exists
reco::TrackBase::TrackQuality trackQuality_
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)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
edm::EDGetTokenT< TrajTrackAssociationCollection > trajectories_
TrackClusterRemover::~TrackClusterRemover ( )

Definition at line 212 of file TrackClusterRemover.cc.

213 {
214 }

Member Function Documentation

template<typename T >
std::auto_ptr<edmNew::DetSetVector<T> > TrackClusterRemover::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> > TrackClusterRemover::cleanup ( const edmNew::DetSetVector< T > &  oldClusters,
const std::vector< uint8_t > &  isGood,
reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)

Definition at line 227 of file TrackClusterRemover.cc.

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

228  {
229  typedef typename edmNew::DetSetVector<T> DSV;
230  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
231  typedef typename edmNew::DetSet<T> DS;
232  auto_ptr<DSV> output(new DSV());
233  output->reserve(oldClusters.size(), oldClusters.dataSize());
234 
235  unsigned int countOld=0;
236  unsigned int countNew=0;
237 
238  // cluster removal loop
239  const T * firstOffset = & oldClusters.data().front();
240  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
241  DS oldDS = *itdet;
242 
243  if (oldDS.empty()) continue; // skip empty detsets
244 
245  uint32_t id = oldDS.detId();
246  DSF outds(*output, id);
247 
248  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
249  uint32_t index = ((&*it) - firstOffset);
250  countOld++;
251  if (isGood[index]) {
252  outds.push_back(*it);
253  countNew++;
254  refs.push_back(index);
255  //std::cout << "TrackClusterRemover::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
256  }
257 
258  }
259  if (outds.empty()) outds.abort(); // not write in an empty DSV
260  }
261 
262  if (oldRefs != 0) mergeOld(refs, *oldRefs);
263  return output;
264 }
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
const_iterator end(bool update=true) const
const_iterator begin(bool update=true) const
long double T
void TrackClusterRemover::mergeOld ( reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 216 of file TrackClusterRemover.cc.

References i, and n.

Referenced by cleanup().

218 {
219  for (size_t i = 0, n = refs.size(); i < n; ++i) {
220  refs[i] = oldRefs[refs[i]];
221  }
222 }
int i
Definition: DBlmapReader.cc:9
void TrackClusterRemover::process ( const TrackingRecHit hit,
float  chi2 
)
inlineprivate

Definition at line 290 of file TrackClusterRemover.cc.

References clusterWasteSolution_, collectedPixels_, cond::rpcobgas::detid, doPixel_, doStrip_, edm::hlt::Exception, TrackingRecHit::geographicalId(), TrackClusterRemover::ParamBlock::maxSize_, NumberOfParamBlocks, ProjectedSiStripRecHit2D::originalHit(), pblocks_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixels, pixelSourceProdID, DetId::rawId(), and DetId::subdetId().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), produce(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

290  {
291  DetId detid = hit->geographicalId();
292  uint32_t subdet = detid.subdetId();
293 
294  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
295 
296  // chi2 cut
297  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
298 
299  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
300  if (!doPixel_) return;
301  // this is a pixel, and i *know* it is
302  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
303 
304  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
305 
306  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
307  "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
308  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
309 
310  assert(cluster.id() == pixelSourceProdID);
311 //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
312 
313  // if requested, cut on cluster size
314  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
315 
316  // mark as used
317  pixels[cluster.key()] = false;
318 
319  //if(!clusterWasteSolution_) collectedPixel[detid.rawId()].insert(cluster);
320  assert(collectedPixels_.size() > cluster.key());
321  //assert(detid.rawId() == cluster->geographicalId()); //This condition fails
322  if(!clusterWasteSolution_) collectedPixels_[cluster.key()]=true;
323 
324  } else { // aka Strip
325  if (!doStrip_) return;
326  const type_info &hitType = typeid(*hit);
327  if (hitType == typeid(SiStripRecHit2D)) {
328  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
329 //DBG// cout << "Plain RecHit 2D: " << endl;
330  process(stripHit->omniClusterRef(),subdet, true);}
331  else if (hitType == typeid(SiStripRecHit1D)) {
332  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
333  process(hit1D->omniClusterRef(),subdet, true);
334  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
335  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
336 //DBG// cout << "Matched RecHit 2D: " << endl;
337  process(matchHit->monoClusterRef(),subdet, true);
338  process(matchHit->stereoClusterRef(),subdet, true);
339  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
340  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
341 //DBG// cout << "Projected RecHit 2D: " << endl;
342  process(projHit->originalHit().omniClusterRef(),subdet, true);
343  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
344  }
345 }
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
void process(const TrackingRecHit *hit, float chi2)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< uint8_t > pixels
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
edm::ProductID pixelSourceProdID
DetId geographicalId() const
const SiStripRecHit2D & originalHit() const
std::vector< bool > collectedPixels_
Pixel Reconstructed Hit.
void TrackClusterRemover::process ( const OmniClusterRef cluRef,
uint32_t  subdet,
bool  fromTrack 
)
inlineprivate

Definition at line 267 of file TrackClusterRemover.cc.

References OmniClusterRef::cluster_strip(), clusterWasteSolution_, collectedStrips_, TrackClusterRemover::ParamBlock::maxSize_, pblocks_, strips, and stripSourceProdID.

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

267  {
268  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
269  if (cluster.id() != stripSourceProdID) throw cms::Exception("Inconsistent Data") <<
270  "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
271  " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
272 
273  assert(cluster.id() == stripSourceProdID);
274  if (pblocks_[subdet-1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet-1].maxSize_)) return;
275  if (!fromTrack) {
276  int clusCharge=0;
277  for( std::vector<uint8_t>::const_iterator iAmp = cluster->amplitudes().begin(); iAmp != cluster->amplitudes().end(); ++iAmp){
278  clusCharge += *iAmp;
279  }
280  if (pblocks_[subdet-1].cutOnStripCharge_ && clusCharge > pblocks_[subdet-1].minGoodStripCharge_) return;
281  }
282  strips[cluster.key()] = false;
283  //if (!clusterWasteSolution_) collectedStrip[hit->geographicalId()].insert(cluster);
284  assert(collectedStrips_.size() > cluster.key());
285  //assert(hit->geographicalId() == cluster->geographicalId()); //This condition fails
286  if (!clusterWasteSolution_) collectedStrips_[cluster.key()]=true;
287 }
ParamBlock pblocks_[NumberOfParamBlocks]
edm::ProductID stripSourceProdID
std::vector< uint8_t > strips
std::vector< bool > collectedStrips_
void TrackClusterRemover::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 359 of file TrackClusterRemover.cc.

References cleanup(), clusterWasteSolution_, collectedPixels_, collectedStrips_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, prof2calltree::count, cond::rpcobgas::detid, doPixel_, doStrip_, doStripChargeCheck_, doTracks_, edm::hlt::Exception, lumiContext::fill, filterTracks_, edm::Event::getByToken(), reco::TrackBase::hitPattern(), edm::HandleBase::id(), TrackingRecHit::isValid(), tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), LogDebug, Trajectory::measurements(), mergeOld_, minNumberOfLayersWithMeasBeforeFiltering_, oldPxlMaskToken_, oldRemovalInfo_, oldStrMaskToken_, overrideTrkQuals_, clustersummaryproducer_cfg::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::EDConsumerBase::Labels::productInstance, edm::Event::put(), reco::TrackBase::quality(), edm::ProductID::reset(), rphiRecHitToken_, stereoRecHitToken_, clustersummaryproducer_cfg::stripClusters, stripClusters_, strips, stripSourceProdID, DetId::subdetId(), reco::HitPattern::trackerLayersWithMeasurement(), trackQuality_, and trajectories_.

360 {
361  ProductID pixelOldProdID, stripOldProdID;
362 
364  if (doPixel_) {
365  iEvent.getByToken(pixelClusters_, pixelClusters);
366  pixelSourceProdID = pixelClusters.id();
367  }
368 //DBG// std::cout << "TrackClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
369 
371  if (doStrip_) {
372  iEvent.getByToken(stripClusters_, stripClusters);
373  stripSourceProdID = stripClusters.id();
374  }
375 //DBG// std::cout << "TrackClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
376 
377  auto_ptr<ClusterRemovalInfo> cri;
379  if (doStrip_ && doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters, stripClusters));
380  else if (doStrip_) cri.reset(new ClusterRemovalInfo(stripClusters));
381  else if (doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters));
382  }
383 
384  Handle<ClusterRemovalInfo> oldRemovalInfo;
386  iEvent.getByToken(oldRemovalInfo_, oldRemovalInfo);
387  // Check ProductIDs
388  if ( (oldRemovalInfo->stripNewRefProd().id() == stripClusters.id()) &&
389  (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.id()) ) {
390 
391  cri->getOldClustersFrom(*oldRemovalInfo);
392 
393  pixelOldProdID = oldRemovalInfo->pixelRefProd().id();
394  stripOldProdID = oldRemovalInfo->stripRefProd().id();
395 
396  } else {
397 
400  throw cms::Exception("Inconsistent Data") << "TrackClusterRemover: " <<
401  "Input collection product IDs are [pixel: " << pixelClusters.id() << ", strip: " << stripClusters.id() << "] \n" <<
402  "\t but the *old* ClusterRemovalInfo " << labels.productInstance << " refers as 'new product ids' to " <<
403  "[pixel: " << oldRemovalInfo->pixelNewRefProd().id() << ", strip: " << oldRemovalInfo->stripNewRefProd().id() << "]\n" <<
404  "NOTA BENE: when running TrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
405  }
406  } else { // then Old == Source
407  pixelOldProdID = pixelSourceProdID;
408  stripOldProdID = stripSourceProdID;
409  }
410 
411  if (doStrip_) {
412  strips.resize(stripClusters->dataSize()); fill(strips.begin(), strips.end(), true);
413  }
414  if (doPixel_) {
415  pixels.resize(pixelClusters->dataSize()); fill(pixels.begin(), pixels.end(), true);
416  }
417  if(mergeOld_) {
420  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
421  iEvent.getByToken(oldStrMaskToken_ ,oldStrMask);
422  LogDebug("TrackClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
423  oldStrMask->copyMaskTo(collectedStrips_);
424  oldPxlMask->copyMaskTo(collectedPixels_);
425  }else {
426  collectedStrips_.resize(stripClusters->dataSize()); fill(collectedStrips_.begin(), collectedStrips_.end(), false);
427  collectedPixels_.resize(pixelClusters->dataSize()); fill(collectedPixels_.begin(), collectedPixels_.end(), false);
428  }
429 
430  if (doTracks_) {
431 
432  Handle<TrajTrackAssociationCollection> trajectories_totrack;
433  iEvent.getByToken(trajectories_,trajectories_totrack);
434 
435  std::vector<Handle<edm::ValueMap<int> > > quals;
436  if ( overrideTrkQuals_.size() > 0) {
437  quals.resize(1);
438  iEvent.getByToken(overrideTrkQuals_[0],quals[0]);
439  }
440 
441  TrajTrackAssociationCollection::const_iterator asst=trajectories_totrack->begin();
442 
443  for ( ; asst!=trajectories_totrack->end();++asst){
444  const Track & track = *(asst->val);
445  if (filterTracks_) {
446  bool goodTk = true;
447  if ( quals.size()!=0) {
448  int qual=(*(quals[0]))[asst->val];
449  if ( qual < 0 ) {goodTk=false;}
450  //note that this does not work for some trackquals (goodIterative or undefQuality)
451  else
452  goodTk = ( qual & (1<<trackQuality_))>>trackQuality_;
453  }
454  else
455  goodTk=(track.quality(trackQuality_));
456  if ( !goodTk) continue;
458  }
459  const Trajectory &tj = *(asst->key);
460  const vector<TrajectoryMeasurement> &tms = tj.measurements();
461  vector<TrajectoryMeasurement>::const_iterator itm, endtm;
462  for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
463  const TrackingRecHit *hit = itm->recHit()->hit();
464  if (!hit->isValid()) continue;
465  process( hit, itm->estimate() );
466  }
467  }
468  }
469 
470  if (doStripChargeCheck_) {
472  iEvent.getByToken(rphiRecHitToken_, rechitsrphi);
473  const SiStripRecHit2DCollection::DataContainer * rphiRecHits = & (rechitsrphi).product()->data();
475  recHit = rphiRecHits->begin(); recHit!= rphiRecHits->end(); recHit++){
476  DetId detid = recHit->geographicalId();
477  uint32_t subdet = detid.subdetId();
478  process(recHit->omniClusterRef(),subdet,false);
479  }
481  iEvent.getByToken(stereoRecHitToken_, rechitsstereo);
482  const SiStripRecHit2DCollection::DataContainer * stereoRecHits = & (rechitsstereo).product()->data();
484  recHit = stereoRecHits->begin(); recHit!= stereoRecHits->end(); recHit++){
485  DetId detid = recHit->geographicalId();
486  uint32_t subdet = detid.subdetId();
487  process(recHit->omniClusterRef(),subdet,false);
488  }
489 
490  }
491 // if(doPixelChargeCheck_) {
492 // edm::Handle<SiPixelRecHitCollection> pixelrechits;
493 // iEvent.getByToken(pixelRecHitsToken_,pixelrechits);
494 // }
495 
497  auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters = cleanup(*pixelClusters, pixels,
498  cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
499  OrphanHandle<edmNew::DetSetVector<SiPixelCluster> > newPixels = iEvent.put(newPixelClusters);
500 //DBG// std::cout << "TrackClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
501  cri->setNewPixelClusters(newPixels);
502  }
504  auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters = cleanup(*stripClusters, strips,
505  cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
506  OrphanHandle<edmNew::DetSetVector<SiStripCluster> > newStrips = iEvent.put(newStripClusters);
507 //DBG// std::cout << "TrackClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
508  cri->setNewStripClusters(newStrips);
509  }
510 
511 
512  if (clusterWasteSolution_) {
513  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
514  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
515  // edm::LogWarning("TrackClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
516  iEvent.put(cri);
517  }
518 
519  pixels.clear(); strips.clear();
520 
521  if (!clusterWasteSolution_){
522  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
523  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
524 
525  std::auto_ptr<StripMaskContainer> removedStripClusterMask(
527  LogDebug("TrackClusterRemover")<<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true);
528  // std::cout << "TrackClusterRemover " <<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true) <<std::endl;
529  iEvent.put( removedStripClusterMask );
530 
531  std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
533  LogDebug("TrackClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
534  iEvent.put( removedPixelClusterMask );
535 
536  }
537 
538 
539 }
#define LogDebug(id)
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
string fill
Definition: lumiContext.py:319
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
std::vector< data_type > DataContainer
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
void process(const TrackingRecHit *hit, float chi2)
reco::TrackBase::TrackQuality trackQuality_
DataContainer const & measurements() const
Definition: Trajectory.h:215
edm::ProductID stripSourceProdID
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
int trackerLayersWithMeasurement() const
Definition: HitPattern.h:733
std::vector< uint8_t > pixels
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:221
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
void reset()
Definition: ProductID.h:39
Definition: DetId.h:18
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
std::vector< uint8_t > strips
std::vector< bool > collectedStrips_
bool isValid() const
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:375
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
edm::EDGetTokenT< TrajTrackAssociationCollection > trajectories_
edm::ProductID pixelSourceProdID
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
std::vector< bool > collectedPixels_
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 TrackClusterRemover::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 114 of file TrackClusterRemover.cc.

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

Referenced by TrackClusterRemover().

116 {
117  if (iConfig.exists(name)) {
118  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
119  if (id1 == -1) {
121  } else {
122  pblocks_[id1] = pblock;
123  if (id2 != -1) pblocks_[id2] = pblock;
124  if (id3 != -1) pblocks_[id3] = pblock;
125  if (id4 != -1) pblocks_[id4] = pblock;
126  if (id5 != -1) pblocks_[id5] = pblock;
127  if (id6 != -1) pblocks_[id6] = pblock;
128  }
129  }
130 }
T getParameter(std::string const &) const
string fill
Definition: lumiContext.py:319
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
bool exists(std::string const &parameterName) const
checks if a parameter exists

Member Data Documentation

bool TrackClusterRemover::clusterWasteSolution_
private

Definition at line 96 of file TrackClusterRemover.cc.

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

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

Definition at line 102 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 101 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

bool TrackClusterRemover::doPixel_
private

Definition at line 63 of file TrackClusterRemover.cc.

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

bool TrackClusterRemover::doPixelChargeCheck_
private

Definition at line 96 of file TrackClusterRemover.cc.

Referenced by TrackClusterRemover().

bool TrackClusterRemover::doStrip_
private

Definition at line 63 of file TrackClusterRemover.cc.

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

bool TrackClusterRemover::doStripChargeCheck_
private

Definition at line 96 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::doTracks_
private

Definition at line 62 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::filterTracks_
private

Definition at line 98 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::mergeOld_
private

Definition at line 64 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

int TrackClusterRemover::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 99 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

const unsigned int TrackClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 60 of file TrackClusterRemover.cc.

Referenced by process(), and TrackClusterRemover().

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

Definition at line 71 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 70 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 72 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

std::vector< edm::EDGetTokenT<edm::ValueMap<int> > > TrackClusterRemover::overrideTrkQuals_
private

Definition at line 73 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

ParamBlock TrackClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 77 of file TrackClusterRemover.cc.

Referenced by process(), and TrackClusterRemover().

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

Definition at line 67 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

std::string TrackClusterRemover::pixelRecHits_
private

Definition at line 97 of file TrackClusterRemover.cc.

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

Definition at line 81 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID TrackClusterRemover::pixelSourceProdID
private

Definition at line 82 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::EDGetTokenT<SiStripRecHit2DCollection> TrackClusterRemover::rphiRecHitToken_
private

Definition at line 74 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

edm::EDGetTokenT<SiStripRecHit2DCollection> TrackClusterRemover::stereoRecHitToken_
private

Definition at line 74 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 68 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

std::string TrackClusterRemover::stripRecHits_
private

Definition at line 97 of file TrackClusterRemover.cc.

Referenced by TrackClusterRemover().

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

Definition at line 81 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID TrackClusterRemover::stripSourceProdID
private

Definition at line 82 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

reco::TrackBase::TrackQuality TrackClusterRemover::trackQuality_
private

Definition at line 100 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

edm::EDGetTokenT<TrajTrackAssociationCollection> TrackClusterRemover::trajectories_
private

Definition at line 69 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().