CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClusterChecker.cc
Go to the documentation of this file.
2 
6 
8 
11  ClusterChecker(conf, iC)
12 {}
13 
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 }
35 
36 
38 {
39 }
40 
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 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
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
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_
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_
size_t tooManyClusters(const edm::Event &e) const
unsigned int ignoreDetsAboveNClusters_
tuple conf
Definition: dbtoconf.py:185
bool failedToGet() const
Definition: HandleBase.h:80
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