CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ClusterChecker Class Reference

#include <ClusterChecker.h>

Public Member Functions

 ClusterChecker (edm::ParameterSet conf)
 
size_t tooManyClusters (const edm::Event &e)
 

Private Attributes

edm::InputTag clusterCollectionInputTag_
 
bool doACheck_
 
uint32_t ignoreDetsAboveNClusters_
 
uint32_t maxNrOfCosmicClusters_
 
uint32_t maxNrOfPixelClusters_
 
edm::InputTag pixelClusterCollectionInputTag_
 

Detailed Description

Definition at line 16 of file ClusterChecker.h.

Constructor & Destructor Documentation

ClusterChecker::ClusterChecker ( edm::ParameterSet  conf)
inline

Definition at line 18 of file ClusterChecker.h.

References clusterCollectionInputTag_, doACheck_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), ignoreDetsAboveNClusters_, maxNrOfCosmicClusters_, maxNrOfPixelClusters_, and pixelClusterCollectionInputTag_.

18  :
19  doACheck_(conf.getParameter<bool>("doClusterCheck"))
20  {
21  if (doACheck_){
22  clusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("ClusterCollectionLabel");
23  maxNrOfCosmicClusters_ = conf.getParameter<unsigned int>("MaxNumberOfCosmicClusters");
24  pixelClusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("PixelClusterCollectionLabel");
25  maxNrOfPixelClusters_ = conf.getParameter<unsigned int>("MaxNumberOfPixelClusters");
26  if (conf.existsAs<uint32_t>("DontCountDetsAboveNClusters")) {
27  ignoreDetsAboveNClusters_ = conf.getParameter<uint32_t>("DontCountDetsAboveNClusters");
28  } else {
30  }
31  }
32  }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:181
edm::InputTag clusterCollectionInputTag_
uint32_t maxNrOfPixelClusters_
edm::InputTag pixelClusterCollectionInputTag_
uint32_t ignoreDetsAboveNClusters_
uint32_t maxNrOfCosmicClusters_

Member Function Documentation

size_t ClusterChecker::tooManyClusters ( const edm::Event e)
inline

Definition at line 34 of file ClusterChecker.h.

References edmNew::DetSetVector< T >::begin(), clusterCollectionInputTag_, edmNew::DetSetVector< T >::dataSize(), doACheck_, edmNew::DetSetVector< T >::end(), edm::HandleBase::failedToGet(), edm::Event::getByLabel(), ignoreDetsAboveNClusters_, collect_tpl::input, maxNrOfCosmicClusters_, maxNrOfPixelClusters_, pixelClusterCollectionInputTag_, and edmNew::DetSetVector< T >::size().

Referenced by SeedGeneratorFromRegionHitsEDProducer::produce(), CosmicSeedGenerator::produce(), RoadSearchSeedFinder::produce(), SimpleCosmicBONSeeder::produce(), and CtfSpecialSeedGenerator::produce().

34  {
35  if (!doACheck_) return 0;
36 
37  // get special input for cosmic cluster multiplicity filter
40  unsigned int totalClusters = 0;
41  if (!clusterDSV.failedToGet()) {
42  const edmNew::DetSetVector<SiStripCluster> & input = *clusterDSV;
43 
44  if (ignoreDetsAboveNClusters_ == 0) {
45  totalClusters = input.dataSize();
46  } else {
47  //loop over detectors
48  edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
49  for (; DSViter!=DSViter_end; DSViter++ ) {
50  size_t siz = DSViter->size();
51  if (siz > ignoreDetsAboveNClusters_) continue;
52  totalClusters += siz;
53  }
54  }
55  }
56  else{
59  if (!lazyGH.failedToGet()){
60  totalClusters = lazyGH->size();
61  }else{
62  //say something's wrong.
63  edm::LogError("ClusterChecker")<<"could not get any SiStrip cluster collections of type edm::DetSetVector<SiStripCluster> or edm::LazyGetter<SiStripCluster, with label: "<<clusterCollectionInputTag_;
64  totalClusters = 999999;
65  }
66  }
67  if (totalClusters > maxNrOfCosmicClusters_) return totalClusters;
68 
69  // get special input for pixel cluster multiplicity filter
71  e.getByLabel(pixelClusterCollectionInputTag_, pixelClusterDSV);
72  unsigned int totalPixelClusters = 0;
73  if (!pixelClusterDSV.failedToGet()) {
74  const edmNew::DetSetVector<SiPixelCluster> & input = *pixelClusterDSV;
75 
76  if (ignoreDetsAboveNClusters_ == 0) {
77  totalPixelClusters = input.dataSize();
78  } else {
79  //loop over detectors
80  edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
81  for (; DSViter!=DSViter_end; DSViter++ ) {
82  size_t siz = DSViter->size();
83  if (siz > ignoreDetsAboveNClusters_) continue;
84  totalPixelClusters += siz;
85  }
86  }
87  }
88  else{
89  //say something's wrong.
90  edm::LogError("ClusterChecker")<<"could not get any SiPixel cluster collections of type edm::DetSetVector<SiPixelCluster> with label: "<<pixelClusterCollectionInputTag_;
91  totalPixelClusters = 999999;
92  }
93  if (totalPixelClusters > maxNrOfPixelClusters_) return totalPixelClusters;
94 
95  return 0;
96 
97  }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
size_type dataSize() const
edm::InputTag clusterCollectionInputTag_
uint32_t maxNrOfPixelClusters_
const_iterator end() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple input
Definition: collect_tpl.py:10
bool failedToGet() const
Definition: HandleBase.h:80
edm::InputTag pixelClusterCollectionInputTag_
size_type size() const
uint32_t ignoreDetsAboveNClusters_
uint32_t maxNrOfCosmicClusters_

Member Data Documentation

edm::InputTag ClusterChecker::clusterCollectionInputTag_
private

Definition at line 101 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

bool ClusterChecker::doACheck_
private

Definition at line 100 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

uint32_t ClusterChecker::ignoreDetsAboveNClusters_
private

Definition at line 105 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

uint32_t ClusterChecker::maxNrOfCosmicClusters_
private

Definition at line 103 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

uint32_t ClusterChecker::maxNrOfPixelClusters_
private

Definition at line 104 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

edm::InputTag ClusterChecker::pixelClusterCollectionInputTag_
private

Definition at line 102 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().