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 31 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:184
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(), clusterCollectionInputTag_, 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::analyze(), 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  else{
70  e.getByToken(token_sc, lazyGH);
71  totals.stripdets = 0; // don't know how to count this online
72  if (!lazyGH.failedToGet()){
73  totals.strip = lazyGH->size();
74  }else{
75  //say something's wrong.
76  edm::LogError("ClusterChecker")<<"could not get any SiStrip cluster collections of type edm::DetSetVector<SiStripCluster> or edm::LazyGetter<SiStripCluster, with label: "<<clusterCollectionInputTag_;
77  totals.strip = 999999;
78  }
79  }
80  if (totals.strip > int(maxNrOfCosmicClusters_)) return totals.strip;
81 
82  // get special input for pixel cluster multiplicity filter
84  e.getByToken(token_pc, pixelClusterDSV);
85  if (!pixelClusterDSV.failedToGet()) {
86  const edmNew::DetSetVector<SiPixelCluster> & input = *pixelClusterDSV;
87 
88  if (ignoreDetsAboveNClusters_ == 0) {
89  totals.pixel = input.dataSize();
90  totals.pixeldets = input.size();
91  } else {
92  //loop over detectors
93  totals.pixel = 0;
94  totals.pixeldets = 0;
95  edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
96  for (; DSViter!=DSViter_end; DSViter++ ) {
97  size_t siz = DSViter->size();
98  if (siz > ignoreDetsAboveNClusters_) continue;
99  totals.pixel += siz;
100  totals.pixeldets++;
101  }
102  }
103  }
104  else{
105  //say something's wrong.
106  edm::LogError("ClusterChecker")<<"could not get any SiPixel cluster collections of type edm::DetSetVector<SiPixelCluster> with label: "<<pixelClusterCollectionInputTag_;
107  totals.pixel = 999999;
108  }
109  if (totals.pixel > int(maxNrOfPixelClusters_)) return totals.pixel;
110 
111  if (!selector_(totals)) return totals.strip;
112  return 0;
113 }
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
size_type dataSize() const
edm::InputTag clusterCollectionInputTag_
StringCutObjectSelector< reco::utils::ClusterTotals > selector_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
unsigned int maxNrOfPixelClusters_
static std::string const input
Definition: EdmProvDump.cc:44
int pixel
number of strip clusters
unsigned int maxNrOfCosmicClusters_
unsigned int ignoreDetsAboveNClusters_
bool failedToGet() const
Definition: HandleBase.h:80
edm::InputTag pixelClusterCollectionInputTag_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > token_pc
size_type size() const
const_iterator end(bool update=true) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > token_sc
const_iterator begin(bool update=true) const

Member Data Documentation

edm::InputTag ClusterChecker::clusterCollectionInputTag_
private

Definition at line 44 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

bool ClusterChecker::doACheck_
private

Definition at line 43 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::ignoreDetsAboveNClusters_
private

Definition at line 49 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::maxNrOfCosmicClusters_
private

Definition at line 46 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

unsigned int ClusterChecker::maxNrOfPixelClusters_
private

Definition at line 47 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

edm::InputTag ClusterChecker::pixelClusterCollectionInputTag_
private

Definition at line 45 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

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

Definition at line 48 of file ClusterChecker.h.

Referenced by tooManyClusters().

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

Definition at line 52 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().

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

Definition at line 51 of file ClusterChecker.h.

Referenced by ClusterChecker(), and tooManyClusters().