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::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
 
 TrackClusterRemover (const edm::ParameterSet &iConfig)
 
 ~TrackClusterRemover ()
 
- 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, SiStripDetId &detid, 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)
 
float sensorThickness (const SiStripDetId &detid) const
 

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::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 TrackClusterRemover.cc.

Member Typedef Documentation

Definition at line 66 of file TrackClusterRemover.cc.

Definition at line 67 of file TrackClusterRemover.cc.

Constructor & Destructor Documentation

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

Definition at line 133 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.

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

214 {
215 }

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 228 of file TrackClusterRemover.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().

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

Definition at line 217 of file TrackClusterRemover.cc.

References i, and n.

Referenced by cleanup().

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

Definition at line 303 of file TrackClusterRemover.cc.

References clusterWasteSolution_, collectedPixels_, cond::rpcobgas::detid, doPixel_, doStrip_, edm::hlt::Exception, TrackingRecHit::geographicalId(), TrackClusterRemover::ParamBlock::maxSize_, NumberOfParamBlocks, 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().

303  {
305  uint32_t subdet = detid.subdetId();
306 
307  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
308 
309  // chi2 cut
310  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
311 
312  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
313  if (!doPixel_) return;
314  // this is a pixel, and i *know* it is
315  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
316 
317  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
318 
319  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
320  "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
321  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
322 
323  assert(cluster.id() == pixelSourceProdID);
324 //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
325 
326  // if requested, cut on cluster size
327  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
328 
329  // mark as used
330  pixels[cluster.key()] = false;
331 
332  //if(!clusterWasteSolution_) collectedPixel[detid.rawId()].insert(cluster);
333  assert(collectedPixels_.size() > cluster.key());
334  //assert(detid.rawId() == cluster->geographicalId()); //This condition fails
335  if(!clusterWasteSolution_) collectedPixels_[cluster.key()]=true;
336 
337  } else { // aka Strip
338  if (!doStrip_) return;
339  const type_info &hitType = typeid(*hit);
340  if (hitType == typeid(SiStripRecHit2D)) {
341  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
342 //DBG// cout << "Plain RecHit 2D: " << endl;
343  process(stripHit->omniClusterRef(),detid, true);}
344  else if (hitType == typeid(SiStripRecHit1D)) {
345  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
346  process(hit1D->omniClusterRef(),detid, true);
347  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
348  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
349 //DBG// cout << "Matched RecHit 2D: " << endl;
350  process(matchHit->monoClusterRef(),detid, true);
351  process(matchHit->stereoClusterRef(),detid, true);
352  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
353  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
354 //DBG// cout << "Projected RecHit 2D: " << endl;
355  process(projHit->originalHit().omniClusterRef(),detid, true);
356  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
357  }
358 }
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
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
edm::ProductID pixelSourceProdID
DetId geographicalId() const
std::vector< bool > collectedPixels_
Pixel Reconstructed Hit.
void TrackClusterRemover::process ( const OmniClusterRef cluRef,
SiStripDetId detid,
bool  fromTrack 
)
inlineprivate

Definition at line 279 of file TrackClusterRemover.cc.

References OmniClusterRef::cluster_strip(), clusterWasteSolution_, collectedStrips_, TrackClusterRemover::ParamBlock::maxSize_, pblocks_, sensorThickness(), strips, stripSourceProdID, 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(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

279  {
280  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
281  if (cluster.id() != stripSourceProdID) throw cms::Exception("Inconsistent Data") <<
282  "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
283  " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
284 
285  uint32_t subdet = detid.subdetId();
286  assert(cluster.id() == stripSourceProdID);
287  if (pblocks_[subdet-1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet-1].maxSize_)) return;
288  if (!fromTrack) {
289  int clusCharge=0;
290  for( std::vector<uint8_t>::const_iterator iAmp = cluster->amplitudes().begin(); iAmp != cluster->amplitudes().end(); ++iAmp){
291  clusCharge += *iAmp;
292  }
293  if (pblocks_[subdet-1].cutOnStripCharge_ && (clusCharge > (pblocks_[subdet-1].minGoodStripCharge_*sensorThickness(detid)))) return;
294  }
295  strips[cluster.key()] = false;
296  //if (!clusterWasteSolution_) collectedStrip[hit->geographicalId()].insert(cluster);
297  assert(collectedStrips_.size() > cluster.key());
298  //assert(hit->geographicalId() == cluster->geographicalId()); //This condition fails
299  if (!clusterWasteSolution_) collectedStrips_[cluster.key()]=true;
300 }
ParamBlock pblocks_[NumberOfParamBlocks]
edm::ProductID stripSourceProdID
float sensorThickness(const SiStripDetId &detid) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::vector< uint8_t > strips
std::vector< bool > collectedStrips_
void TrackClusterRemover::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 372 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(), PixelLessLayerPairs4PixelLessTracking_cfi::rphiRecHits, rphiRecHitToken_, PixelLessLayerPairs4PixelLessTracking_cfi::stereoRecHits, stereoRecHitToken_, clustersummaryproducer_cfg::stripClusters, stripClusters_, strips, stripSourceProdID, reco::HitPattern::trackerLayersWithMeasurement(), trackQuality_, and trajectories_.

373 {
374  ProductID pixelOldProdID, stripOldProdID;
375 
377  if (doPixel_) {
378  iEvent.getByToken(pixelClusters_, pixelClusters);
379  pixelSourceProdID = pixelClusters.id();
380  }
381 //DBG// std::cout << "TrackClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
382 
384  if (doStrip_) {
385  iEvent.getByToken(stripClusters_, stripClusters);
386  stripSourceProdID = stripClusters.id();
387  }
388 //DBG// std::cout << "TrackClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
389 
390  auto_ptr<ClusterRemovalInfo> cri;
392  if (doStrip_ && doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters, stripClusters));
393  else if (doStrip_) cri.reset(new ClusterRemovalInfo(stripClusters));
394  else if (doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters));
395  }
396 
397  Handle<ClusterRemovalInfo> oldRemovalInfo;
399  iEvent.getByToken(oldRemovalInfo_, oldRemovalInfo);
400  // Check ProductIDs
401  if ( (oldRemovalInfo->stripNewRefProd().id() == stripClusters.id()) &&
402  (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.id()) ) {
403 
404  cri->getOldClustersFrom(*oldRemovalInfo);
405 
406  pixelOldProdID = oldRemovalInfo->pixelRefProd().id();
407  stripOldProdID = oldRemovalInfo->stripRefProd().id();
408 
409  } else {
410 
413  throw cms::Exception("Inconsistent Data") << "TrackClusterRemover: " <<
414  "Input collection product IDs are [pixel: " << pixelClusters.id() << ", strip: " << stripClusters.id() << "] \n" <<
415  "\t but the *old* ClusterRemovalInfo " << labels.productInstance << " refers as 'new product ids' to " <<
416  "[pixel: " << oldRemovalInfo->pixelNewRefProd().id() << ", strip: " << oldRemovalInfo->stripNewRefProd().id() << "]\n" <<
417  "NOTA BENE: when running TrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
418  }
419  } else { // then Old == Source
420  pixelOldProdID = pixelSourceProdID;
421  stripOldProdID = stripSourceProdID;
422  }
423 
424  if (doStrip_) {
425  strips.resize(stripClusters->dataSize()); fill(strips.begin(), strips.end(), true);
426  }
427  if (doPixel_) {
428  pixels.resize(pixelClusters->dataSize()); fill(pixels.begin(), pixels.end(), true);
429  }
430  if(mergeOld_) {
433  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
434  iEvent.getByToken(oldStrMaskToken_ ,oldStrMask);
435  LogDebug("TrackClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
436  oldStrMask->copyMaskTo(collectedStrips_);
437  oldPxlMask->copyMaskTo(collectedPixels_);
438  }else {
439  collectedStrips_.resize(stripClusters->dataSize()); fill(collectedStrips_.begin(), collectedStrips_.end(), false);
440  collectedPixels_.resize(pixelClusters->dataSize()); fill(collectedPixels_.begin(), collectedPixels_.end(), false);
441  }
442 
443  if (doTracks_) {
444 
445  Handle<TrajTrackAssociationCollection> trajectories_totrack;
446  iEvent.getByToken(trajectories_,trajectories_totrack);
447 
448  std::vector<Handle<edm::ValueMap<int> > > quals;
449  if ( overrideTrkQuals_.size() > 0) {
450  quals.resize(1);
451  iEvent.getByToken(overrideTrkQuals_[0],quals[0]);
452  }
453 
454  TrajTrackAssociationCollection::const_iterator asst=trajectories_totrack->begin();
455 
456  for ( ; asst!=trajectories_totrack->end();++asst){
457  const Track & track = *(asst->val);
458  if (filterTracks_) {
459  bool goodTk = true;
460  if ( quals.size()!=0) {
461  int qual=(*(quals[0]))[asst->val];
462  if ( qual < 0 ) {goodTk=false;}
463  //note that this does not work for some trackquals (goodIterative or undefQuality)
464  else
465  goodTk = ( qual & (1<<trackQuality_))>>trackQuality_;
466  }
467  else
468  goodTk=(track.quality(trackQuality_));
469  if ( !goodTk) continue;
471  }
472  const Trajectory &tj = *(asst->key);
473  const vector<TrajectoryMeasurement> &tms = tj.measurements();
474  vector<TrajectoryMeasurement>::const_iterator itm, endtm;
475  for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
476  const TrackingRecHit *hit = itm->recHit()->hit();
477  if (!hit->isValid()) continue;
478  process( hit, itm->estimate() );
479  }
480  }
481  }
482 
483  if (doStripChargeCheck_) {
485  iEvent.getByToken(rphiRecHitToken_, rechitsrphi);
486  const SiStripRecHit2DCollection::DataContainer * rphiRecHits = & (rechitsrphi).product()->data();
488  recHit = rphiRecHits->begin(); recHit!= rphiRecHits->end(); recHit++){
489  SiStripDetId detid = recHit->geographicalId();
490  process(recHit->omniClusterRef(),detid,false);
491  }
493  iEvent.getByToken(stereoRecHitToken_, rechitsstereo);
494  const SiStripRecHit2DCollection::DataContainer * stereoRecHits = & (rechitsstereo).product()->data();
496  recHit = stereoRecHits->begin(); recHit!= stereoRecHits->end(); recHit++){
497  SiStripDetId detid = recHit->geographicalId();
498  process(recHit->omniClusterRef(),detid,false);
499  }
500 
501  }
502 // if(doPixelChargeCheck_) {
503 // edm::Handle<SiPixelRecHitCollection> pixelrechits;
504 // iEvent.getByToken(pixelRecHitsToken_,pixelrechits);
505 // }
506 
508  auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters = cleanup(*pixelClusters, pixels,
509  cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
510  OrphanHandle<edmNew::DetSetVector<SiPixelCluster> > newPixels = iEvent.put(newPixelClusters);
511 //DBG// std::cout << "TrackClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
512  cri->setNewPixelClusters(newPixels);
513  }
515  auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters = cleanup(*stripClusters, strips,
516  cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
517  OrphanHandle<edmNew::DetSetVector<SiStripCluster> > newStrips = iEvent.put(newStripClusters);
518 //DBG// std::cout << "TrackClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
519  cri->setNewStripClusters(newStrips);
520  }
521 
522 
523  if (clusterWasteSolution_) {
524  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
525  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
526  // edm::LogWarning("TrackClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
527  iEvent.put(cri);
528  }
529 
530  pixels.clear(); strips.clear();
531 
532  if (!clusterWasteSolution_){
533  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
534  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
535 
536  std::auto_ptr<StripMaskContainer> removedStripClusterMask(
538  LogDebug("TrackClusterRemover")<<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true);
539  // std::cout << "TrackClusterRemover " <<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true) <<std::endl;
540  iEvent.put( removedStripClusterMask );
541 
542  std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
544  LogDebug("TrackClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
545  iEvent.put( removedPixelClusterMask );
546 
547  }
548 
549 
550 }
#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:203
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:740
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
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
void reset()
Definition: ProductID.h:39
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 115 of file TrackClusterRemover.cc.

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

Referenced by TrackClusterRemover().

117 {
118  if (iConfig.exists(name)) {
119  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
120  if (id1 == -1) {
122  } else {
123  pblocks_[id1] = pblock;
124  if (id2 != -1) pblocks_[id2] = pblock;
125  if (id3 != -1) pblocks_[id3] = pblock;
126  if (id4 != -1) pblocks_[id4] = pblock;
127  if (id5 != -1) pblocks_[id5] = pblock;
128  if (id6 != -1) pblocks_[id6] = pblock;
129  }
130  }
131 }
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
float TrackClusterRemover::sensorThickness ( const SiStripDetId detid) const
private

Definition at line 267 of file TrackClusterRemover.cc.

References SiStripDetId::moduleGeometry(), PixelSubdetector::PixelBarrel, DetId::subdetId(), SiStripDetId::TIB, SiStripDetId::TOB, SiStripDetId::W5, SiStripDetId::W6, and SiStripDetId::W7.

Referenced by process().

268 {
269  if (detid.subdetId()>=SiStripDetId::TIB) {
270  if (detid.subdetId()==SiStripDetId::TOB) return 0.047;
273  return 0.047;
274  return 0.029; // so it is TEC ring 1-4 or TIB or TOB;
275  } else if (detid.subdetId()==PixelSubdetector::PixelBarrel) return 0.0285;
276  else return 0.027;
277 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
ModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:132

Member Data Documentation

bool TrackClusterRemover::clusterWasteSolution_
private

Definition at line 97 of file TrackClusterRemover.cc.

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

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

Definition at line 103 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 102 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

bool TrackClusterRemover::doPixel_
private

Definition at line 64 of file TrackClusterRemover.cc.

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

bool TrackClusterRemover::doPixelChargeCheck_
private

Definition at line 97 of file TrackClusterRemover.cc.

Referenced by TrackClusterRemover().

bool TrackClusterRemover::doStrip_
private

Definition at line 64 of file TrackClusterRemover.cc.

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

bool TrackClusterRemover::doStripChargeCheck_
private

Definition at line 97 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::doTracks_
private

Definition at line 63 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::filterTracks_
private

Definition at line 99 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::mergeOld_
private

Definition at line 65 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

int TrackClusterRemover::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 100 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

const unsigned int TrackClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 61 of file TrackClusterRemover.cc.

Referenced by process(), and TrackClusterRemover().

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

Definition at line 72 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 71 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 73 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 74 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

ParamBlock TrackClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 78 of file TrackClusterRemover.cc.

Referenced by process(), and TrackClusterRemover().

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

Definition at line 68 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

std::string TrackClusterRemover::pixelRecHits_
private

Definition at line 98 of file TrackClusterRemover.cc.

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

Definition at line 82 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID TrackClusterRemover::pixelSourceProdID
private

Definition at line 83 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 75 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 75 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 69 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

std::string TrackClusterRemover::stripRecHits_
private

Definition at line 98 of file TrackClusterRemover.cc.

Referenced by TrackClusterRemover().

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

Definition at line 82 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID TrackClusterRemover::stripSourceProdID
private

Definition at line 83 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

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

Definition at line 101 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

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

Definition at line 70 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().