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::EDProducer edm::ProducerBase 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::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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 reco::CaloID::Detectors detector)
 
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 barrelHitCollection_
 
std::string barrelHitProducer_
 
bool doBarrel_
 
bool doEndcap_
 
std::string endcapClusterCollection_
 
std::string endcapHitCollection_
 
std::string endcapHitProducer_
 
Multi5x5ClusterAlgoisland_p
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 
Multi5x5ClusterAlgo::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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 25 of file Multi5x5ClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::getParameter(), island_p, nEvt_, Multi5x5ClusterAlgo::pDEBUG, Multi5x5ClusterAlgo::pERROR, Multi5x5ClusterAlgo::pINFO, posCalculator_, Multi5x5ClusterAlgo::pWARNING, and verbosity.

38 {
39  // The verbosity level
40  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
41  if (verbosityString == "DEBUG") verbosity = Multi5x5ClusterAlgo::pDEBUG;
42  else if (verbosityString == "WARNING") verbosity = Multi5x5ClusterAlgo::pWARNING;
43  else if (verbosityString == "INFO") verbosity = Multi5x5ClusterAlgo::pINFO;
45 
46  // Parameters to identify the hit collections
47  barrelHitProducer_ = ps.getParameter<std::string>("barrelHitProducer");
48  endcapHitProducer_ = ps.getParameter<std::string>("endcapHitProducer");
49  barrelHitCollection_ = ps.getParameter<std::string>("barrelHitCollection");
50  endcapHitCollection_ = ps.getParameter<std::string>("endcapHitCollection");
51 
52  // should cluster algo be run in barrel and endcap?
53  doEndcap_ = ps.getParameter<bool>("doEndcap");
54  doBarrel_ = ps.getParameter<bool>("doBarrel");
55 
56  // The names of the produced cluster collections
57  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
58  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
59 
60  // Island algorithm parameters
61  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
62  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
63 
64  std::vector<int> v_chstatus = ps.getParameter<std::vector<int> >("RecHitFlagToBeExcluded");
65 
66  // Parameters for the position calculation:
67  edm::ParameterSet posCalcParameters =
68  ps.getParameter<edm::ParameterSet>("posCalcParameters");
69  posCalculator_ = PositionCalc(posCalcParameters);
70 
71  // Produces a collection of barrel and a collection of endcap clusters
72  produces< reco::BasicClusterCollection >(endcapClusterCollection_);
73  produces< reco::BasicClusterCollection >(barrelClusterCollection_);
74 
75  island_p = new Multi5x5ClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, v_chstatus, posCalculator_,verbosity);
76 
77  nEvt_ = 0;
78 }
T getParameter(std::string const &) const
Multi5x5ClusterAlgo * island_p
Multi5x5ClusterAlgo::VerbosityLevel verbosity
Multi5x5ClusterProducer::~Multi5x5ClusterProducer ( )

Definition at line 81 of file Multi5x5ClusterProducer.cc.

References island_p.

82 {
83  delete island_p;
84 }
Multi5x5ClusterAlgo * island_p

Member Function Documentation

void Multi5x5ClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const std::string &  hitProducer,
const std::string &  hitCollection,
const std::string &  clusterCollection,
const reco::CaloID::Detectors  detector 
)
private

Definition at line 124 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, 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().

129 {
130  // get the hit collection from the event:
131  const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection);
132 
133  // get the geometry and topology from the event setup:
134  edm::ESHandle<CaloGeometry> geoHandle;
135  es.get<CaloGeometryRecord>().get(geoHandle);
136 
137  const CaloSubdetectorGeometry *geometry_p;
138  CaloSubdetectorTopology *topology_p;
139 
141  {
142  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
143  topology_p = new EcalBarrelTopology(geoHandle);
144  }
145  else
146  {
147  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
148  topology_p = new EcalEndcapTopology(geoHandle);
149  }
150 
151  const CaloSubdetectorGeometry *geometryES_p;
152  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
153 
154  // Run the clusterization algorithm:
156  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, detector);
157 
158  // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
159  std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
160  clusters_p->assign(clusters.begin(), clusters.end());
163  bccHandle = evt.put(clusters_p, barrelClusterCollection_);
164  else
165  bccHandle = evt.put(clusters_p, endcapClusterCollection_);
166 
167  delete topology_p;
168 }
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 >())
const EcalRecHitCollection * getCollection(edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
Multi5x5ClusterAlgo * island_p
const T & get() const
Definition: EventSetup.h:55
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
bool Multi5x5ClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 57 of file Multi5x5ClusterProducer.h.

References nEvt_, and nMaxPrintout_.

const EcalRecHitCollection * Multi5x5ClusterProducer::getCollection ( edm::Event evt,
const std::string &  hitProducer_,
const std::string &  hitCollection_ 
)
private

Definition at line 101 of file Multi5x5ClusterProducer.cc.

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

Referenced by clusterizeECALPart().

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

Implements edm::EDProducer.

Definition at line 87 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, clusterizeECALPart(), reco::CaloID::DET_ECAL_BARREL, reco::CaloID::DET_ECAL_ENDCAP, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, and nEvt_.

88 {
89 
90  if (doEndcap_) {
92  }
93  if (doBarrel_) {
95  }
96 
97  nEvt_++;
98 }
void clusterizeECALPart(edm::Event &evt, const edm::EventSetup &es, const std::string &hitProducer, const std::string &hitCollection, const std::string &clusterCollection, const reco::CaloID::Detectors detector)

Member Data Documentation

std::string Multi5x5ClusterProducer::barrelClusterCollection_
private

Definition at line 51 of file Multi5x5ClusterProducer.h.

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

std::string Multi5x5ClusterProducer::barrelHitCollection_
private

Definition at line 48 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::barrelHitProducer_
private

Definition at line 46 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 52 of file Multi5x5ClusterProducer.h.

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

std::string Multi5x5ClusterProducer::endcapHitCollection_
private

Definition at line 49 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapHitProducer_
private

Definition at line 47 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 54 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().

Multi5x5ClusterAlgo::VerbosityLevel Multi5x5ClusterProducer::verbosity
private

Definition at line 44 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().