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::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::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 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_
 

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 25 of file Multi5x5ClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), island_p, nEvt_, posCalculator_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 85 of file Multi5x5ClusterProducer.cc.

References island_p.

86 {
87  delete island_p;
88 }
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 121 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().

126 {
127  // get the hit collection from the event:
128  const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection);
129 
130  // get the geometry and topology from the event setup:
131  edm::ESHandle<CaloGeometry> geoHandle;
132  es.get<CaloGeometryRecord>().get(geoHandle);
133 
134  const CaloSubdetectorGeometry *geometry_p;
135  CaloSubdetectorTopology *topology_p;
136 
137  if (detector == reco::CaloID::DET_ECAL_BARREL)
138  {
139  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
140  topology_p = new EcalBarrelTopology(geoHandle);
141  }
142  else
143  {
144  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
145  topology_p = new EcalEndcapTopology(geoHandle);
146  }
147 
148  const CaloSubdetectorGeometry *geometryES_p;
149  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
150 
151  // Run the clusterization algorithm:
153  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, detector);
154 
155  // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
156  std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
157  clusters_p->assign(clusters.begin(), clusters.end());
159  if (detector == reco::CaloID::DET_ECAL_BARREL)
160  bccHandle = evt.put(clusters_p, barrelClusterCollection_);
161  else
162  bccHandle = evt.put(clusters_p, endcapClusterCollection_);
163 
164  delete topology_p;
165 }
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:94
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 55 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 105 of file Multi5x5ClusterProducer.cc.

References 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  edm::LogError("MissingProduct") << "could not get a handle on the EcalRecHitCollection! : " ;;
114  return 0;
115  }
116 
117  return rhcHandle.product();
118 }
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
void Multi5x5ClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private
void Multi5x5ClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 91 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_.

92 {
93 
94  if (doEndcap_) {
96  }
97  if (doBarrel_) {
99  }
100 
101  nEvt_++;
102 }
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 49 of file Multi5x5ClusterProducer.h.

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

std::string Multi5x5ClusterProducer::barrelHitCollection_
private

Definition at line 46 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::barrelHitProducer_
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 50 of file Multi5x5ClusterProducer.h.

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

std::string Multi5x5ClusterProducer::endcapHitCollection_
private

Definition at line 47 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapHitProducer_
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 52 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().