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
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< EcalRecHitCollection
barrelHitToken_
 
bool doBarrel_
 
bool doEndcap_
 
std::string endcapClusterCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
endcapHitToken_
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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_, HLT_FULL_cff::posCalcParameters, posCalculator_, 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 
76  bool reassignSeedCrysToClusterItSeeds=false;
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_
tuple posCalcParameters
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_, HLT_FULL_cff::clusters, reco::CaloID::DET_ECAL_BARREL, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), island_p, Multi5x5ClusterAlgo::makeClusters(), and edm::Event::put().

Referenced by 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 
130  if (detector == reco::CaloID::DET_ECAL_BARREL)
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 an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
149  std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
150  clusters_p->assign(clusters.begin(), clusters.end());
152  if (detector == reco::CaloID::DET_ECAL_BARREL)
153  bccHandle = evt.put(clusters_p, barrelClusterCollection_);
154  else
155  bccHandle = evt.put(clusters_p, endcapClusterCollection_);
156 
157  delete topology_p;
158 }
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 >())
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
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)
bool Multi5x5ClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 53 of file Multi5x5ClusterProducer.h.

References nEvt_, and nMaxPrintout_.

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().

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

Implements edm::stream::EDProducerBase.

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 counterExceeded(), Multi5x5ClusterProducer(), and produce().

int Multi5x5ClusterProducer::nMaxPrintout_
private

Definition at line 37 of file Multi5x5ClusterProducer.h.

Referenced by counterExceeded().

PositionCalc Multi5x5ClusterProducer::posCalculator_
private

Definition at line 50 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().