CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Multi5x5ClusterProducer Class Reference

#include <Multi5x5ClusterProducer.h>

Inheritance diagram for Multi5x5ClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Multi5x5ClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~Multi5x5ClusterProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void clusterizeECALPart (edm::Event &evt, const edm::EventSetup &es, const edm::EDGetTokenT< EcalRecHitCollection > &token, const std::string &clusterCollection, const reco::CaloID::Detectors detector)
 
bool counterExceeded () const
 
const EcalRecHitCollectiongetCollection (edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
 
void outputValidationInfo (reco::CaloClusterPtrVector &clusterPtrVector)
 

Private Attributes

std::string barrelClusterCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionbarrelHitToken_
 
bool doBarrel_
 
bool doEndcap_
 
std::string endcapClusterCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionendcapHitToken_
 
Multi5x5ClusterAlgoisland_p
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 25 of file Multi5x5ClusterProducer.h.

Constructor & Destructor Documentation

Multi5x5ClusterProducer::Multi5x5ClusterProducer ( const edm::ParameterSet ps)

Definition at line 38 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitToken_, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitToken_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), island_p, nEvt_, cleanAndMergeSuperClusters_cfi::posCalcParameters, posCalculator_, multi5x5BasicClusters_cfi::reassignSeedCrysToClusterItSeeds, and AlCaHLTBitMon_QueryRunRegistry::string.

39 {
40 
41  // Parameters to identify the hit collections
43  consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHitTag"));
44 
46  consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHitTag"));
47 
48 
49  // should cluster algo be run in barrel and endcap?
50  doEndcap_ = ps.getParameter<bool>("doEndcap");
51  doBarrel_ = ps.getParameter<bool>("doBarrel");
52 
53  // The names of the produced cluster collections
54  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
55  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
56 
57  // Island algorithm parameters
58  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
59  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
60 
61  const std::vector<std::string> flagnames =
62  ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded");
63 
64  const std::vector<int> v_chstatus=
65  StringToEnumValue<EcalRecHit::Flags>(flagnames);
66 
67  // Parameters for the position calculation:
69  ps.getParameter<edm::ParameterSet>("posCalcParameters");
71 
72  // Produces a collection of barrel and a collection of endcap clusters
73  produces< reco::BasicClusterCollection >(endcapClusterCollection_);
74  produces< reco::BasicClusterCollection >(barrelClusterCollection_);
75 
77  if(ps.exists("reassignSeedCrysToClusterItSeeds")) reassignSeedCrysToClusterItSeeds = ps.getParameter<bool>("reassignSeedCrysToClusterItSeeds");
78 
79 
80 
81  island_p = new Multi5x5ClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, v_chstatus, posCalculator_,reassignSeedCrysToClusterItSeeds);
82 
83  nEvt_ = 0;
84 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< EcalRecHitCollection > barrelHitToken_
edm::EDGetTokenT< EcalRecHitCollection > endcapHitToken_
Multi5x5ClusterAlgo * island_p
Multi5x5ClusterProducer::~Multi5x5ClusterProducer ( )

Definition at line 87 of file Multi5x5ClusterProducer.cc.

References island_p.

88 {
89  delete island_p;
90 }
Multi5x5ClusterAlgo * island_p

Member Function Documentation

void Multi5x5ClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const edm::EDGetTokenT< EcalRecHitCollection > &  token,
const std::string &  clusterCollection,
const reco::CaloID::Detectors  detector 
)
private

Definition at line 115 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, fastPrimaryVertexProducer_cfi::clusters, reco::CaloID::DET_ECAL_BARREL, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), CaloGeometry::getSubdetectorGeometry(), island_p, Multi5x5ClusterAlgo::makeClusters(), eostools::move(), and edm::Event::put().

Referenced by counterExceeded(), and produce().

119 {
120  // get the hit collection from the event:
121  const EcalRecHitCollection *hitCollection_p = getCollection(evt, token);
122 
123  // get the geometry and topology from the event setup:
124  edm::ESHandle<CaloGeometry> geoHandle;
125  es.get<CaloGeometryRecord>().get(geoHandle);
126 
127  const CaloSubdetectorGeometry *geometry_p;
128  CaloSubdetectorTopology *topology_p;
129 
131  {
132  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
133  topology_p = new EcalBarrelTopology(geoHandle);
134  }
135  else
136  {
137  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
138  topology_p = new EcalEndcapTopology(geoHandle);
139  }
140 
141  const CaloSubdetectorGeometry *geometryES_p;
142  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
143 
144  // Run the clusterization algorithm:
146  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, detector);
147 
148  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
149  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
150  clusters_p->assign(clusters.begin(), clusters.end());
153  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
154  else
155  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
156 
157  delete topology_p;
158 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, reco::CaloID::Detectors detector, bool regional=false, const std::vector< EcalEtaPhiRegion > &regions=std::vector< EcalEtaPhiRegion >())
Multi5x5ClusterAlgo * island_p
const T & get() const
Definition: EventSetup.h:56
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const EcalRecHitCollection * getCollection(edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
def move(src, dest)
Definition: eostools.py:510
bool Multi5x5ClusterProducer::counterExceeded ( ) const
inlineprivate
const EcalRecHitCollection * Multi5x5ClusterProducer::getCollection ( edm::Event evt,
const edm::EDGetTokenT< EcalRecHitCollection > &  token 
)
private

Definition at line 107 of file Multi5x5ClusterProducer.cc.

References edm::Event::getByToken(), and edm::Handle< T >::product().

Referenced by clusterizeECALPart(), and counterExceeded().

108 {
110  evt.getByToken(token, rhcHandle);
111  return rhcHandle.product();
112 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
T const * product() const
Definition: Handle.h:81
void Multi5x5ClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private

Referenced by counterExceeded().

void Multi5x5ClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Definition at line 93 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitToken_, clusterizeECALPart(), reco::CaloID::DET_ECAL_BARREL, reco::CaloID::DET_ECAL_ENDCAP, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitToken_, and nEvt_.

94 {
95 
96  if (doEndcap_) {
98  }
99  if (doBarrel_) {
101  }
102 
103  nEvt_++;
104 }
edm::EDGetTokenT< EcalRecHitCollection > barrelHitToken_
edm::EDGetTokenT< EcalRecHitCollection > endcapHitToken_
void clusterizeECALPart(edm::Event &evt, const edm::EventSetup &es, const edm::EDGetTokenT< EcalRecHitCollection > &token, const std::string &clusterCollection, const reco::CaloID::Detectors detector)

Member Data Documentation

std::string Multi5x5ClusterProducer::barrelClusterCollection_
private

Definition at line 47 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), Multi5x5ClusterProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> Multi5x5ClusterProducer::barrelHitToken_
private

Definition at line 44 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

bool Multi5x5ClusterProducer::doBarrel_
private

Definition at line 41 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

bool Multi5x5ClusterProducer::doEndcap_
private

Definition at line 42 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapClusterCollection_
private

Definition at line 48 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), Multi5x5ClusterProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> Multi5x5ClusterProducer::endcapHitToken_
private

Definition at line 45 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Multi5x5ClusterAlgo* Multi5x5ClusterProducer::island_p
private
int Multi5x5ClusterProducer::nEvt_
private

Definition at line 38 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

int Multi5x5ClusterProducer::nMaxPrintout_
private

Definition at line 37 of file Multi5x5ClusterProducer.h.

PositionCalc Multi5x5ClusterProducer::posCalculator_
private

Definition at line 50 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().