CMS 3D CMS Logo

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

Public Member Functions

 Multi5x5ClusterProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~Multi5x5ClusterProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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< EcalRecHitCollectionbarrelHitToken_
 
bool doBarrel_
 
bool doEndcap_
 
std::string endcapClusterCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionendcapHitToken_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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_, cleanAndMergeSuperClusters_cfi::posCalcParameters, posCalculator_, multi5x5BasicClusters_cfi::reassignSeedCrysToClusterItSeeds, 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 
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_
Multi5x5ClusterAlgo * island_p
Multi5x5ClusterProducer::~Multi5x5ClusterProducer ( )
override

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_, fastPrimaryVertexProducer_cfi::clusters, reco::CaloID::DET_ECAL_BARREL, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), CaloGeometry::getSubdetectorGeometry(), island_p, Multi5x5ClusterAlgo::makeClusters(), eostools::move(), and edm::Event::put().

Referenced by counterExceeded(), and 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 
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 a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
149  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
150  clusters_p->assign(clusters.begin(), clusters.end());
153  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
154  else
155  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
156 
157  delete topology_p;
158 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
Multi5x5ClusterAlgo * island_p
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< RectangularEtaPhiRegion > &regions=std::vector< RectangularEtaPhiRegion >())
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const EcalRecHitCollection * getCollection(edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
T get() const
Definition: EventSetup.h:62
def move(src, dest)
Definition: eostools.py:511
bool Multi5x5ClusterProducer::counterExceeded ( ) const
inlineprivate
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(), and counterExceeded().

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

Referenced by counterExceeded().

void Multi5x5ClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

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

int Multi5x5ClusterProducer::nMaxPrintout_
private

Definition at line 37 of file Multi5x5ClusterProducer.h.

PositionCalc Multi5x5ClusterProducer::posCalculator_
private

Definition at line 50 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().