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
IslandClusterProducer Class Reference

#include <IslandClusterProducer.h>

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

Public Member Functions

 IslandClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~IslandClusterProducer ()
 
- 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
 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 (const std::string &iProcessName, std::vector< const char * > &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 std::string &clusterShapeAssociation, const IslandClusterAlgo::EcalPart &ecalPart)
 
bool counterExceeded () const
 
const EcalRecHitCollectiongetCollection (edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
 
void outputValidationInfo (reco::CaloClusterPtrVector &clusterPtrVector)
 

Private Attributes

std::string barrelClusterCollection_
 
std::string barrelClusterShapeAssociation_
 
edm::EDGetTokenT
< EcalRecHitCollection
barrelRecHits_
 
std::string clustershapecollectionEB_
 
std::string clustershapecollectionEE_
 
std::string endcapClusterCollection_
 
std::string endcapClusterShapeAssociation_
 
edm::EDGetTokenT
< EcalRecHitCollection
endcapRecHits_
 
IslandClusterAlgoisland_p
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 
ClusterShapeAlgo shapeAlgo_
 
IslandClusterAlgo::VerbosityLevel verbosity
 

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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 27 of file IslandClusterProducer.h.

Constructor & Destructor Documentation

IslandClusterProducer::IslandClusterProducer ( const edm::ParameterSet ps)

Definition at line 39 of file IslandClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelRecHits_, clustershapecollectionEB_, clustershapecollectionEE_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapRecHits_, edm::ParameterSet::getParameter(), island_p, nEvt_, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, HLT_25ns14e33_v3_cff::posCalcParameters, posCalculator_, IslandClusterAlgo::pWARNING, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

40 {
41  // The verbosity level
42  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
43  if (verbosityString == "DEBUG") verbosity = IslandClusterAlgo::pDEBUG;
44  else if (verbosityString == "WARNING") verbosity = IslandClusterAlgo::pWARNING;
45  else if (verbosityString == "INFO") verbosity = IslandClusterAlgo::pINFO;
47 
48  // Parameters to identify the hit collections
50  consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHits"));
52  consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHits"));
53 
54  // The names of the produced cluster collections
55  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
56  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
57 
58  // Island algorithm parameters
59  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
60  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
61 
62  // Parameters for the position calculation:
64  ps.getParameter<edm::ParameterSet>("posCalcParameters");
65  posCalculator_ = PositionCalc(posCalcParameters);
66  shapeAlgo_ = ClusterShapeAlgo(posCalcParameters);
67 
68  clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
69  clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
70 
71  //AssociationMap
72  barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
73  endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
74 
75  // Produces a collection of barrel and a collection of endcap clusters
76 
77  produces< reco::ClusterShapeCollection>(clustershapecollectionEE_);
78  produces< reco::BasicClusterCollection >(endcapClusterCollection_);
79  produces< reco::ClusterShapeCollection>(clustershapecollectionEB_);
80  produces< reco::BasicClusterCollection >(barrelClusterCollection_);
81  produces< reco::BasicClusterShapeAssociationCollection >(barrelClusterShapeAssociation_);
82  produces< reco::BasicClusterShapeAssociationCollection >(endcapClusterShapeAssociation_);
83 
84  island_p = new IslandClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, posCalculator_,verbosity);
85 
86  nEvt_ = 0;
87 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHits_
std::string barrelClusterShapeAssociation_
IslandClusterAlgo * island_p
std::string endcapClusterShapeAssociation_
IslandClusterAlgo::VerbosityLevel verbosity
IslandClusterProducer::~IslandClusterProducer ( )

Definition at line 90 of file IslandClusterProducer.cc.

References island_p.

91 {
92  delete island_p;
93 }
IslandClusterAlgo * island_p

Member Function Documentation

void IslandClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const edm::EDGetTokenT< EcalRecHitCollection > &  token,
const std::string &  clusterCollection,
const std::string &  clusterShapeAssociation,
const IslandClusterAlgo::EcalPart ecalPart 
)
private

Definition at line 112 of file IslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), HLT_25ns14e33_v1_cff::clusters, clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), i, island_p, IslandClusterAlgo::makeClusters(), edm::Event::put(), shapeAlgo_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

115 {
116  // get the hit collection from the event:
117  const EcalRecHitCollection *hitCollection_p = getCollection(evt,token);
118 
119  // get the geometry and topology from the event setup:
120  edm::ESHandle<CaloGeometry> geoHandle;
121  es.get<CaloGeometryRecord>().get(geoHandle);
122 
123  const CaloSubdetectorGeometry *geometry_p;
124  CaloSubdetectorTopology *topology_p;
125 
126  std::string clustershapetag;
127  if (ecalPart == IslandClusterAlgo::barrel)
128  {
129  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
130  topology_p = new EcalBarrelTopology(geoHandle);
131  }
132  else
133  {
134  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
135  topology_p = new EcalEndcapTopology(geoHandle);
136  }
137 
138  const CaloSubdetectorGeometry *geometryES_p;
139  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
140 
141  // Run the clusterization algorithm:
143  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, ecalPart);
144 
145  //Create associated ClusterShape objects.
146  std::vector <reco::ClusterShape> ClusVec;
147  for (int erg=0;erg<int(clusters.size());++erg){
148  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],hitCollection_p,geometry_p,topology_p);
149  ClusVec.push_back(TestShape);
150  }
151 
152  //Put clustershapes in event, but retain a Handle on them.
153  std::auto_ptr< reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
154  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
156  if (ecalPart == IslandClusterAlgo::barrel)
157  clusHandle= evt.put(clustersshapes_p, clustershapecollectionEB_);
158  else
159  clusHandle= evt.put(clustersshapes_p, clustershapecollectionEE_);
160 
161  // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
162  std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
163  clusters_p->assign(clusters.begin(), clusters.end());
165  if (ecalPart == IslandClusterAlgo::barrel)
166  bccHandle = evt.put(clusters_p, barrelClusterCollection_);
167  else
168  bccHandle = evt.put(clusters_p, endcapClusterCollection_);
169 
170 
171  // BasicClusterShapeAssociationMap
172  std::auto_ptr<reco::BasicClusterShapeAssociationCollection> shapeAssocs_p(new reco::BasicClusterShapeAssociationCollection);
173  for (unsigned int i = 0; i < clusHandle->size(); i++){
174  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i));
175  }
176  evt.put(shapeAssocs_p,clusterShapeAssociation);
177 
178  delete topology_p;
179 }
int i
Definition: DBlmapReader.cc:9
std::vector< ClusterShape > ClusterShapeCollection
collection of ClusterShape objects
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, EcalPart ecalPart, bool regional=false, const std::vector< EcalEtaPhiRegion > &regions=std::vector< EcalEtaPhiRegion >())
IslandClusterAlgo * island_p
const T & get() const
Definition: EventSetup.h:55
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const EcalRecHitCollection * getCollection(edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
bool IslandClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 62 of file IslandClusterProducer.h.

References nEvt_, and nMaxPrintout_.

const EcalRecHitCollection * IslandClusterProducer::getCollection ( edm::Event evt,
const edm::EDGetTokenT< EcalRecHitCollection > &  token 
)
private

Definition at line 104 of file IslandClusterProducer.cc.

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

Referenced by clusterizeECALPart().

105 {
107  evt.getByToken(token, rhcHandle);
108  return rhcHandle.product();
109 
110 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
T const * product() const
Definition: Handle.h:81
void IslandClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private
void IslandClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 96 of file IslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelRecHits_, clusterizeECALPart(), IslandClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapRecHits_, and nEvt_.

97 {
100  nEvt_++;
101 }
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHits_
std::string barrelClusterShapeAssociation_
std::string endcapClusterShapeAssociation_
void clusterizeECALPart(edm::Event &evt, const edm::EventSetup &es, const edm::EDGetTokenT< EcalRecHitCollection > &token, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const IslandClusterAlgo::EcalPart &ecalPart)

Member Data Documentation

std::string IslandClusterProducer::barrelClusterCollection_
private

Definition at line 48 of file IslandClusterProducer.h.

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

std::string IslandClusterProducer::barrelClusterShapeAssociation_
private

Definition at line 55 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> IslandClusterProducer::barrelRecHits_
private

Definition at line 45 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

std::string IslandClusterProducer::clustershapecollectionEB_
private

Definition at line 51 of file IslandClusterProducer.h.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

std::string IslandClusterProducer::clustershapecollectionEE_
private

Definition at line 52 of file IslandClusterProducer.h.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

std::string IslandClusterProducer::endcapClusterCollection_
private

Definition at line 49 of file IslandClusterProducer.h.

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

std::string IslandClusterProducer::endcapClusterShapeAssociation_
private

Definition at line 56 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> IslandClusterProducer::endcapRecHits_
private

Definition at line 46 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

IslandClusterAlgo* IslandClusterProducer::island_p
private
int IslandClusterProducer::nEvt_
private

Definition at line 40 of file IslandClusterProducer.h.

Referenced by counterExceeded(), IslandClusterProducer(), and produce().

int IslandClusterProducer::nMaxPrintout_
private

Definition at line 39 of file IslandClusterProducer.h.

Referenced by counterExceeded().

PositionCalc IslandClusterProducer::posCalculator_
private

Definition at line 58 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer().

ClusterShapeAlgo IslandClusterProducer::shapeAlgo_
private

Definition at line 59 of file IslandClusterProducer.h.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

IslandClusterAlgo::VerbosityLevel IslandClusterProducer::verbosity
private

Definition at line 42 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer().