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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 IslandClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~IslandClusterProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void clusterizeECALPart (edm::Event &evt, const edm::EventSetup &es, const std::string &hitProducer, const std::string &hitCollection, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const IslandClusterAlgo::EcalPart &ecalPart)
 
bool counterExceeded () const
 
const EcalRecHitCollectiongetCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)
 
void outputValidationInfo (reco::CaloClusterPtrVector &clusterPtrVector)
 

Private Attributes

std::string barrelClusterCollection_
 
std::string barrelClusterShapeAssociation_
 
std::string barrelHitCollection_
 
std::string barrelHitProducer_
 
std::string clustershapecollectionEB_
 
std::string clustershapecollectionEE_
 
std::string endcapClusterCollection_
 
std::string endcapClusterShapeAssociation_
 
std::string endcapHitCollection_
 
std::string endcapHitProducer_
 
IslandClusterAlgoisland_p
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 
ClusterShapeAlgo shapeAlgo_
 
IslandClusterAlgo::VerbosityLevel verbosity
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 26 of file IslandClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file IslandClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, clustershapecollectionEB_, clustershapecollectionEE_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::getParameter(), island_p, nEvt_, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, posCalculator_, IslandClusterAlgo::pWARNING, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

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

Definition at line 91 of file IslandClusterProducer.cc.

References island_p.

92 {
93  delete island_p;
94 }
IslandClusterAlgo * island_p

Member Function Documentation

void IslandClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const std::string &  hitProducer,
const std::string &  hitCollection,
const std::string &  clusterCollection,
const std::string &  clusterShapeAssociation,
const IslandClusterAlgo::EcalPart ecalPart 
)
private

Definition at line 121 of file IslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), 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().

127 {
128  // get the hit collection from the event:
129  const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection);
130 
131  // get the geometry and topology from the event setup:
132  edm::ESHandle<CaloGeometry> geoHandle;
133  es.get<CaloGeometryRecord>().get(geoHandle);
134 
135  const CaloSubdetectorGeometry *geometry_p;
136  CaloSubdetectorTopology *topology_p;
137 
138  std::string clustershapetag;
139  if (ecalPart == IslandClusterAlgo::barrel)
140  {
141  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
142  topology_p = new EcalBarrelTopology(geoHandle);
143  }
144  else
145  {
146  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
147  topology_p = new EcalEndcapTopology(geoHandle);
148  }
149 
150  const CaloSubdetectorGeometry *geometryES_p;
151  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
152 
153  // Run the clusterization algorithm:
155  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, ecalPart);
156 
157  //Create associated ClusterShape objects.
158  std::vector <reco::ClusterShape> ClusVec;
159  for (int erg=0;erg<int(clusters.size());++erg){
160  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],hitCollection_p,geometry_p,topology_p);
161  ClusVec.push_back(TestShape);
162  }
163 
164  //Put clustershapes in event, but retain a Handle on them.
165  std::auto_ptr< reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
166  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
168  if (ecalPart == IslandClusterAlgo::barrel)
169  clusHandle= evt.put(clustersshapes_p, clustershapecollectionEB_);
170  else
171  clusHandle= evt.put(clustersshapes_p, clustershapecollectionEE_);
172 
173  // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
174  std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
175  clusters_p->assign(clusters.begin(), clusters.end());
177  if (ecalPart == IslandClusterAlgo::barrel)
178  bccHandle = evt.put(clusters_p, barrelClusterCollection_);
179  else
180  bccHandle = evt.put(clusters_p, endcapClusterCollection_);
181 
182 
183  // BasicClusterShapeAssociationMap
184  std::auto_ptr<reco::BasicClusterShapeAssociationCollection> shapeAssocs_p(new reco::BasicClusterShapeAssociationCollection);
185  for (unsigned int i = 0; i < clusHandle->size(); i++){
186  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i));
187  }
188  evt.put(shapeAssocs_p,clusterShapeAssociation);
189 
190  delete topology_p;
191 }
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:94
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 std::string &hitProducer_, const std::string &hitCollection_)
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 std::string &  hitProducer_,
const std::string &  hitCollection_ 
)
private

Definition at line 105 of file IslandClusterProducer.cc.

References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), and edm::Handle< T >::product().

Referenced by clusterizeECALPart().

108 {
110  evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
111  if (!(rhcHandle.isValid()))
112  {
113  std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
114  edm::LogError("IslandClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
115  return 0;
116  } else {
117  return rhcHandle.product();
118  }
119 }
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
T const * product() const
Definition: Handle.h:74
tuple cout
Definition: gather_cfg.py:121
void IslandClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private
void IslandClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 97 of file IslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, clusterizeECALPart(), IslandClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, and nEvt_.

98 {
101  nEvt_++;
102 }
std::string barrelClusterShapeAssociation_
void clusterizeECALPart(edm::Event &evt, const edm::EventSetup &es, const std::string &hitProducer, const std::string &hitCollection, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const IslandClusterAlgo::EcalPart &ecalPart)
std::string endcapClusterShapeAssociation_

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

std::string IslandClusterProducer::barrelHitCollection_
private

Definition at line 45 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

std::string IslandClusterProducer::barrelHitProducer_
private

Definition at line 43 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().

std::string IslandClusterProducer::endcapHitCollection_
private

Definition at line 46 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

std::string IslandClusterProducer::endcapHitProducer_
private

Definition at line 44 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

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

Definition at line 39 of file IslandClusterProducer.h.

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

int IslandClusterProducer::nMaxPrintout_
private

Definition at line 38 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 41 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer().