#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_ |
Definition at line 19 of file ClusterChecker.h.
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_.
: doACheck_(conf.getParameter<bool>("doClusterCheck")), selector_(conf.getParameter<bool>("doClusterCheck") && conf.existsAs<std::string>("cut") ? conf.getParameter<std::string>("cut") : "") { if (doACheck_){ clusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("ClusterCollectionLabel"); pixelClusterCollectionInputTag_ = conf.getParameter<edm::InputTag>("PixelClusterCollectionLabel"); maxNrOfCosmicClusters_ = conf.getParameter<unsigned int>("MaxNumberOfCosmicClusters"); maxNrOfPixelClusters_ = conf.getParameter<unsigned int>("MaxNumberOfPixelClusters"); if (conf.existsAs<uint32_t>("DontCountDetsAboveNClusters")) { ignoreDetsAboveNClusters_ = conf.getParameter<uint32_t>("DontCountDetsAboveNClusters"); } else { ignoreDetsAboveNClusters_ = 0; } } }
ClusterChecker::~ClusterChecker | ( | ) |
Definition at line 33 of file ClusterChecker.cc.
{ }
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_, collect_tpl::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(), CosmicSeedGenerator::produce(), SeedGeneratorFromRegionHitsEDProducer::produce(), CtfSpecialSeedGenerator::produce(), SimpleCosmicBONSeeder::produce(), and RoadSearchSeedFinder::produce().
{ if (!doACheck_) return 0; // get special input for cosmic cluster multiplicity filter edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusterDSV; e.getByLabel(clusterCollectionInputTag_, clusterDSV); reco::utils::ClusterTotals totals; if (!clusterDSV.failedToGet()) { const edmNew::DetSetVector<SiStripCluster> & input = *clusterDSV; if (ignoreDetsAboveNClusters_ == 0) { totals.strip = input.dataSize(); totals.stripdets = input.size(); } else { //loop over detectors totals.strip = 0; totals.stripdets = 0; edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end(); for (; DSViter!=DSViter_end; DSViter++ ) { size_t siz = DSViter->size(); if (siz > ignoreDetsAboveNClusters_) continue; totals.strip += siz; totals.stripdets++; } } } else{ edm::Handle<edm::LazyGetter<SiStripCluster> > lazyGH; e.getByLabel(clusterCollectionInputTag_, lazyGH); totals.stripdets = 0; // don't know how to count this online if (!lazyGH.failedToGet()){ totals.strip = lazyGH->size(); }else{ //say something's wrong. edm::LogError("ClusterChecker")<<"could not get any SiStrip cluster collections of type edm::DetSetVector<SiStripCluster> or edm::LazyGetter<SiStripCluster, with label: "<<clusterCollectionInputTag_; totals.strip = 999999; } } if (totals.strip > int(maxNrOfCosmicClusters_)) return totals.strip; // get special input for pixel cluster multiplicity filter edm::Handle<edmNew::DetSetVector<SiPixelCluster> > pixelClusterDSV; e.getByLabel(pixelClusterCollectionInputTag_, pixelClusterDSV); if (!pixelClusterDSV.failedToGet()) { const edmNew::DetSetVector<SiPixelCluster> & input = *pixelClusterDSV; if (ignoreDetsAboveNClusters_ == 0) { totals.pixel = input.dataSize(); totals.pixeldets = input.size(); } else { //loop over detectors totals.pixel = 0; totals.pixeldets = 0; edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=input.begin(), DSViter_end=input.end(); for (; DSViter!=DSViter_end; DSViter++ ) { size_t siz = DSViter->size(); if (siz > ignoreDetsAboveNClusters_) continue; totals.pixel += siz; totals.pixeldets++; } } } else{ //say something's wrong. edm::LogError("ClusterChecker")<<"could not get any SiPixel cluster collections of type edm::DetSetVector<SiPixelCluster> with label: "<<pixelClusterCollectionInputTag_; totals.pixel = 999999; } if (totals.pixel > int(maxNrOfPixelClusters_)) return totals.pixel; if (!selector_(totals)) return totals.strip; return 0; }
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().
Definition at line 28 of file ClusterChecker.h.
Referenced by ClusterChecker(), and tooManyClusters().
Definition at line 31 of file ClusterChecker.h.
Referenced by tooManyClusters().