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  doACheck_(conf.getParameter<bool>("doClusterCheck")),
12  selector_(conf.getParameter<bool>("doClusterCheck") && conf.existsAs<std::string>("cut") ?
13  conf.getParameter<std::string>("cut") :
14  "")
15 {
16  if (doACheck_){
17  clusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("ClusterCollectionLabel");
18  pixelClusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("PixelClusterCollectionLabel");
21  maxNrOfCosmicClusters_ = conf.getParameter<unsigned int>("MaxNumberOfCosmicClusters");
22  maxNrOfPixelClusters_ = conf.getParameter<unsigned int>("MaxNumberOfPixelClusters");
23  if (conf.existsAs<uint32_t>("DontCountDetsAboveNClusters")) {
24  ignoreDetsAboveNClusters_ = conf.getParameter<uint32_t>("DontCountDetsAboveNClusters");
25  } else {
27  }
28  }
29 }
30 
31 
33 {
34 }
35 
37 {
38  if (!doACheck_) return 0;
39 
40  // get special input for cosmic cluster multiplicity filter
42  e.getByToken(token_sc, clusterDSV);
44  if (!clusterDSV.failedToGet()) {
45  const edmNew::DetSetVector<SiStripCluster> & input = *clusterDSV;
46 
47  if (ignoreDetsAboveNClusters_ == 0) {
48  totals.strip = input.dataSize();
49  totals.stripdets = input.size();
50  } else {
51  //loop over detectors
52  totals.strip = 0;
53  totals.stripdets = 0;
54  edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
55  for (; DSViter!=DSViter_end; DSViter++ ) {
56  size_t siz = DSViter->size();
57  if (siz > ignoreDetsAboveNClusters_) continue;
58  totals.strip += siz;
59  totals.stripdets++;
60  }
61  }
62  }
63  else{
65  e.getByToken(token_sc, lazyGH);
66  totals.stripdets = 0; // don't know how to count this online
67  if (!lazyGH.failedToGet()){
68  totals.strip = lazyGH->size();
69  }else{
70  //say something's wrong.
71  edm::LogError("ClusterChecker")<<"could not get any SiStrip cluster collections of type edm::DetSetVector<SiStripCluster> or edm::LazyGetter<SiStripCluster, with label: "<<clusterCollectionInputTag_;
72  totals.strip = 999999;
73  }
74  }
75  if (totals.strip > int(maxNrOfCosmicClusters_)) return totals.strip;
76 
77  // get special input for pixel cluster multiplicity filter
79  e.getByToken(token_pc, pixelClusterDSV);
80  if (!pixelClusterDSV.failedToGet()) {
81  const edmNew::DetSetVector<SiPixelCluster> & input = *pixelClusterDSV;
82 
83  if (ignoreDetsAboveNClusters_ == 0) {
84  totals.pixel = input.dataSize();
85  totals.pixeldets = input.size();
86  } else {
87  //loop over detectors
88  totals.pixel = 0;
89  totals.pixeldets = 0;
90  edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end();
91  for (; DSViter!=DSViter_end; DSViter++ ) {
92  size_t siz = DSViter->size();
93  if (siz > ignoreDetsAboveNClusters_) continue;
94  totals.pixel += siz;
95  totals.pixeldets++;
96  }
97  }
98  }
99  else{
100  //say something's wrong.
101  edm::LogError("ClusterChecker")<<"could not get any SiPixel cluster collections of type edm::DetSetVector<SiPixelCluster> with label: "<<pixelClusterCollectionInputTag_;
102  totals.pixel = 999999;
103  }
104  if (totals.pixel > int(maxNrOfPixelClusters_)) return totals.pixel;
105 
106  if (!selector_(totals)) return totals.strip;
107  return 0;
108 }
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 begin() 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_
const_iterator end() const
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