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 Member Functions | Private Attributes
ClusterChecker Class Reference

#include <ClusterChecker.h>

Public Member Functions

 ClusterChecker (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
 ClusterChecker (const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
 
size_t tooManyClusters (const edm::Event &e) const
 
 ~ClusterChecker ()
 

Private Member Functions

 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_
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiPixelCluster > > 
token_pc
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiStripCluster > > 
token_sc
 

Detailed Description

Definition at line 30 of file ClusterChecker.h.

Constructor & Destructor Documentation

ClusterChecker::ClusterChecker ( const edm::ParameterSet conf,
edm::ConsumesCollector iC 
)

Definition at line 14 of file ClusterChecker.cc.

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

15  :
16  doACheck_(conf.getParameter<bool>("doClusterCheck")),
17  selector_(conf.getParameter<bool>("doClusterCheck") && conf.existsAs<std::string>("cut") ?
18  conf.getParameter<std::string>("cut") :
19  "")
20 {
21  if (doACheck_){
22  clusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("ClusterCollectionLabel");
23  pixelClusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("PixelClusterCollectionLabel");
26  maxNrOfCosmicClusters_ = conf.getParameter<unsigned int>("MaxNumberOfCosmicClusters");
27  maxNrOfPixelClusters_ = conf.getParameter<unsigned int>("MaxNumberOfPixelClusters");
28  if (conf.existsAs<uint32_t>("DontCountDetsAboveNClusters")) {
29  ignoreDetsAboveNClusters_ = conf.getParameter<uint32_t>("DontCountDetsAboveNClusters");
30  } else {
32  }
33  }
34 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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:185
edm::InputTag clusterCollectionInputTag_
StringCutObjectSelector< reco::utils::ClusterTotals > selector_
unsigned int maxNrOfPixelClusters_
unsigned int maxNrOfCosmicClusters_
unsigned int ignoreDetsAboveNClusters_
edm::InputTag pixelClusterCollectionInputTag_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > token_pc
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > token_sc
ClusterChecker::ClusterChecker ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC 
)

Definition at line 9 of file ClusterChecker.cc.

10  :
11  ClusterChecker(conf, iC)
12 {}
ClusterChecker::~ClusterChecker ( )

Definition at line 37 of file ClusterChecker.cc.

38 {
39 }
ClusterChecker::ClusterChecker ( )
private

Member Function Documentation

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

Definition at line 41 of file ClusterChecker.cc.

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

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

42 {
43  if (!doACheck_) return 0;
44 
45  // get special input for cosmic cluster multiplicity filter
47  e.getByToken(token_sc, clusterDSV);
49  if (!clusterDSV.failedToGet()) {
50  const edmNew::DetSetVector<SiStripCluster> & input = *clusterDSV;
51 
52  if (ignoreDetsAboveNClusters_ == 0) {
53  totals.strip = input.dataSize();
54  totals.stripdets = input.size();
55  } else {
56  //loop over detectors
57  totals.strip = 0;
58  totals.stripdets = 0;
59  edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
60  for (; DSViter!=DSViter_end; DSViter++ ) {
61  size_t siz = DSViter->size();
62  if (siz > ignoreDetsAboveNClusters_) continue;
63  totals.strip += siz;
64  totals.stripdets++;
65  }
66  }
67  }
68  if (totals.strip > int(maxNrOfCosmicClusters_)) return totals.strip;
69 
70  // get special input for pixel cluster multiplicity filter
72  e.getByToken(token_pc, pixelClusterDSV);
73  if (!pixelClusterDSV.failedToGet()) {
74  const edmNew::DetSetVector<SiPixelCluster> & input = *pixelClusterDSV;
75 
76  if (ignoreDetsAboveNClusters_ == 0) {
77  totals.pixel = input.dataSize();
78  totals.pixeldets = input.size();
79  } else {
80  //loop over detectors
81  totals.pixel = 0;
82  totals.pixeldets = 0;
83  edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
84  for (; DSViter!=DSViter_end; DSViter++ ) {
85  size_t siz = DSViter->size();
86  if (siz > ignoreDetsAboveNClusters_) continue;
87  totals.pixel += siz;
88  totals.pixeldets++;
89  }
90  }
91  }
92  else{
93  //say something's wrong.
94  edm::LogError("ClusterChecker")<<"could not get any SiPixel cluster collections of type edm::DetSetVector<SiPixelCluster> with label: "<<pixelClusterCollectionInputTag_;
95  totals.pixel = 999999;
96  }
97  if (totals.pixel > int(maxNrOfPixelClusters_)) return totals.pixel;
98 
99  if (!selector_(totals)) return totals.strip;
100  return 0;
101 }
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 end(bool update=false) const
size_type dataSize() const
StringCutObjectSelector< reco::utils::ClusterTotals > selector_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
unsigned int maxNrOfPixelClusters_
static std::string const input
Definition: EdmProvDump.cc:43
int pixel
number of strip clusters
unsigned int maxNrOfCosmicClusters_
unsigned int ignoreDetsAboveNClusters_
bool failedToGet() const
Definition: HandleBase.h:79
edm::InputTag pixelClusterCollectionInputTag_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > token_pc
size_type size() const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > token_sc
const_iterator begin(bool update=false) const

Member Data Documentation

edm::InputTag ClusterChecker::clusterCollectionInputTag_
private

Definition at line 43 of file ClusterChecker.h.

Referenced by ClusterChecker().

bool ClusterChecker::doACheck_
private

Definition at line 42 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::ignoreDetsAboveNClusters_
private

Definition at line 48 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::maxNrOfCosmicClusters_
private

Definition at line 45 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::maxNrOfPixelClusters_
private

Definition at line 46 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

edm::InputTag ClusterChecker::pixelClusterCollectionInputTag_
private

Definition at line 44 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

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

Definition at line 47 of file ClusterChecker.h.

Referenced by tooManyClusters().

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > ClusterChecker::token_pc
private

Definition at line 51 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > ClusterChecker::token_sc
private

Definition at line 50 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().