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 (const edm::ParameterSet &conf)
 
size_t tooManyClusters (const edm::Event &e) const
 
 ~ClusterChecker ()
 

Private Attributes

edm::InputTag clusterCollectionInputTag_
 
bool doACheck_
 
unsigned int ignoreDetsAboveNClusters_
 
unsigned int maxNrOfCosmicClusters_
 
unsigned int maxNrOfPixelClusters_
 
edm::InputTag pixelClusterCollectionInputTag_
 
StringCutObjectSelector
< reco::utils::ClusterTotals
selector_
 

Detailed Description

Definition at line 19 of file ClusterChecker.h.

Constructor & Destructor Documentation

ClusterChecker::ClusterChecker ( const edm::ParameterSet conf)

Definition at line 13 of file ClusterChecker.cc.

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

13  :
14  doACheck_(conf.getParameter<bool>("doClusterCheck")),
15  selector_(conf.getParameter<bool>("doClusterCheck") && conf.existsAs<std::string>("cut") ?
16  conf.getParameter<std::string>("cut") :
17  "")
18 {
19  if (doACheck_){
20  clusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("ClusterCollectionLabel");
21  pixelClusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("PixelClusterCollectionLabel");
22  maxNrOfCosmicClusters_ = conf.getParameter<unsigned int>("MaxNumberOfCosmicClusters");
23  maxNrOfPixelClusters_ = conf.getParameter<unsigned int>("MaxNumberOfPixelClusters");
24  if (conf.existsAs<uint32_t>("DontCountDetsAboveNClusters")) {
25  ignoreDetsAboveNClusters_ = conf.getParameter<uint32_t>("DontCountDetsAboveNClusters");
26  } else {
28  }
29  }
30 }
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:187
edm::InputTag clusterCollectionInputTag_
StringCutObjectSelector< reco::utils::ClusterTotals > selector_
unsigned int maxNrOfPixelClusters_
unsigned int maxNrOfCosmicClusters_
unsigned int ignoreDetsAboveNClusters_
edm::InputTag pixelClusterCollectionInputTag_
ClusterChecker::~ClusterChecker ( )

Definition at line 33 of file ClusterChecker.cc.

34 {
35 }

Member Function Documentation

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

Definition at line 37 of file ClusterChecker.cc.

References edmNew::DetSetVector< T >::begin(), clusterCollectionInputTag_, edmNew::DetSetVector< T >::dataSize(), doACheck_, edmNew::DetSetVector< T >::end(), edm::HandleBase::failedToGet(), edm::Event::getByLabel(), ignoreDetsAboveNClusters_, LaserDQM_cfg::input, maxNrOfCosmicClusters_, maxNrOfPixelClusters_, reco::utils::ClusterTotals::pixel, pixelClusterCollectionInputTag_, reco::utils::ClusterTotals::pixeldets, selector_, edmNew::DetSetVector< T >::size(), reco::utils::ClusterTotals::strip, and reco::utils::ClusterTotals::stripdets.

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

38 {
39  if (!doACheck_) return 0;
40 
41  // get special input for cosmic cluster multiplicity filter
45  if (!clusterDSV.failedToGet()) {
46  const edmNew::DetSetVector<SiStripCluster> & input = *clusterDSV;
47 
48  if (ignoreDetsAboveNClusters_ == 0) {
49  totals.strip = input.dataSize();
50  totals.stripdets = input.size();
51  } else {
52  //loop over detectors
53  totals.strip = 0;
54  totals.stripdets = 0;
55  edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
56  for (; DSViter!=DSViter_end; DSViter++ ) {
57  size_t siz = DSViter->size();
58  if (siz > ignoreDetsAboveNClusters_) continue;
59  totals.strip += siz;
60  totals.stripdets++;
61  }
62  }
63  }
64  else{
67  totals.stripdets = 0; // don't know how to count this online
68  if (!lazyGH.failedToGet()){
69  totals.strip = lazyGH->size();
70  }else{
71  //say something's wrong.
72  edm::LogError("ClusterChecker")<<"could not get any SiStrip cluster collections of type edm::DetSetVector<SiStripCluster> or edm::LazyGetter<SiStripCluster, with label: "<<clusterCollectionInputTag_;
73  totals.strip = 999999;
74  }
75  }
76  if (totals.strip > int(maxNrOfCosmicClusters_)) return totals.strip;
77 
78  // get special input for pixel cluster multiplicity filter
80  e.getByLabel(pixelClusterCollectionInputTag_, pixelClusterDSV);
81  if (!pixelClusterDSV.failedToGet()) {
82  const edmNew::DetSetVector<SiPixelCluster> & input = *pixelClusterDSV;
83 
84  if (ignoreDetsAboveNClusters_ == 0) {
85  totals.pixel = input.dataSize();
86  totals.pixeldets = input.size();
87  } else {
88  //loop over detectors
89  totals.pixel = 0;
90  totals.pixeldets = 0;
91  edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
92  for (; DSViter!=DSViter_end; DSViter++ ) {
93  size_t siz = DSViter->size();
94  if (siz > ignoreDetsAboveNClusters_) continue;
95  totals.pixel += siz;
96  totals.pixeldets++;
97  }
98  }
99  }
100  else{
101  //say something's wrong.
102  edm::LogError("ClusterChecker")<<"could not get any SiPixel cluster collections of type edm::DetSetVector<SiPixelCluster> with label: "<<pixelClusterCollectionInputTag_;
103  totals.pixel = 999999;
104  }
105  if (totals.pixel > int(maxNrOfPixelClusters_)) return totals.pixel;
106 
107  if (!selector_(totals)) return totals.strip;
108  return 0;
109 }
int stripdets
number of pixel clusters
int pixeldets
number of strip detectors with at least one cluster
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
size_type dataSize() const
edm::InputTag clusterCollectionInputTag_
StringCutObjectSelector< reco::utils::ClusterTotals > selector_
unsigned int maxNrOfPixelClusters_
int pixel
number of strip clusters
unsigned int maxNrOfCosmicClusters_
unsigned int ignoreDetsAboveNClusters_
const_iterator end() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
bool failedToGet() const
Definition: HandleBase.h:80
edm::InputTag pixelClusterCollectionInputTag_
size_type size() const

Member Data Documentation

edm::InputTag ClusterChecker::clusterCollectionInputTag_
private

Definition at line 27 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

bool ClusterChecker::doACheck_
private

Definition at line 26 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::ignoreDetsAboveNClusters_
private

Definition at line 32 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::maxNrOfCosmicClusters_
private

Definition at line 29 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::maxNrOfPixelClusters_
private

Definition at line 30 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

edm::InputTag ClusterChecker::pixelClusterCollectionInputTag_
private

Definition at line 28 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

StringCutObjectSelector<reco::utils::ClusterTotals> ClusterChecker::selector_
private

Definition at line 31 of file ClusterChecker.h.

Referenced by tooManyClusters().