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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 24 of file Multi5x5ClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitToken_, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitToken_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), island_p, nEvt_, MonitorAlCaEcalPi0_cfi::posCalcParameters, posCalculator_, multi5x5BasicClusters_cfi::reassignSeedCrysToClusterItSeeds, and AlCaHLTBitMon_QueryRunRegistry::string.

37  {
38  // Parameters to identify the hit collections
39  barrelHitToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHitTag"));
40 
41  endcapHitToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHitTag"));
42 
43  // should cluster algo be run in barrel and endcap?
44  doEndcap_ = ps.getParameter<bool>("doEndcap");
45  doBarrel_ = ps.getParameter<bool>("doBarrel");
46 
47  // The names of the produced cluster collections
48  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
49  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
50 
51  // Island algorithm parameters
52  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
53  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
54 
55  const std::vector<std::string> flagnames = ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded");
56 
57  const std::vector<int> v_chstatus = StringToEnumValue<EcalRecHit::Flags>(flagnames);
58 
59  // Parameters for the position calculation:
62 
63  // Produces a collection of barrel and a collection of endcap clusters
64  produces<reco::BasicClusterCollection>(endcapClusterCollection_);
65  produces<reco::BasicClusterCollection>(barrelClusterCollection_);
66 
68  if (ps.exists("reassignSeedCrysToClusterItSeeds"))
69  reassignSeedCrysToClusterItSeeds = ps.getParameter<bool>("reassignSeedCrysToClusterItSeeds");
70 
72  barrelSeedThreshold, endcapSeedThreshold, v_chstatus, posCalculator_, reassignSeedCrysToClusterItSeeds);
73 
74  nEvt_ = 0;
75 }
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 77 of file Multi5x5ClusterProducer.cc.

References island_p.

77 { delete island_p; }
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 97 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, bsc_activity_cfg::clusters, reco::CaloID::DET_ECAL_BARREL, hgcalTestNeighbor_cfi::detector, 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().

101  {
102  // get the hit collection from the event:
103  const EcalRecHitCollection* hitCollection_p = getCollection(evt, token);
104 
105  // get the geometry and topology from the event setup:
106  edm::ESHandle<CaloGeometry> geoHandle;
107  es.get<CaloGeometryRecord>().get(geoHandle);
108 
109  const CaloSubdetectorGeometry* geometry_p;
110  std::unique_ptr<CaloSubdetectorTopology> topology_p;
111 
113  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
114  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
115  } else {
116  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
117  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
118  }
119 
120  const CaloSubdetectorGeometry* geometryES_p;
121  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
122 
123  // Run the clusterization algorithm:
125  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p.get(), geometryES_p, detector);
126 
127  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
128  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
129  clusters_p->assign(clusters.begin(), clusters.end());
132  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
133  else
134  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
135 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
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:73
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 90 of file Multi5x5ClusterProducer.cc.

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

Referenced by clusterizeECALPart(), and counterExceeded().

91  {
93  evt.getByToken(token, rhcHandle);
94  return rhcHandle.product();
95 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
T const * product() const
Definition: Handle.h:69
void Multi5x5ClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private

Referenced by counterExceeded().

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

Definition at line 79 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitToken_, clusterizeECALPart(), reco::CaloID::DET_ECAL_BARREL, reco::CaloID::DET_ECAL_ENDCAP, doBarrel_, doEndcap_, endcapClusterCollection_, endcapHitToken_, and nEvt_.

79  {
80  if (doEndcap_) {
82  }
83  if (doBarrel_) {
85  }
86 
87  nEvt_++;
88 }
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 43 of file Multi5x5ClusterProducer.h.

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

edm::EDGetTokenT<EcalRecHitCollection> Multi5x5ClusterProducer::barrelHitToken_
private

Definition at line 40 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

bool Multi5x5ClusterProducer::doBarrel_
private

Definition at line 37 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

bool Multi5x5ClusterProducer::doEndcap_
private

Definition at line 38 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapClusterCollection_
private

Definition at line 44 of file Multi5x5ClusterProducer.h.

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

edm::EDGetTokenT<EcalRecHitCollection> Multi5x5ClusterProducer::endcapHitToken_
private

Definition at line 41 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Multi5x5ClusterAlgo* Multi5x5ClusterProducer::island_p
private
int Multi5x5ClusterProducer::nEvt_
private

Definition at line 34 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

int Multi5x5ClusterProducer::nMaxPrintout_
private

Definition at line 33 of file Multi5x5ClusterProducer.h.

PositionCalc Multi5x5ClusterProducer::posCalculator_
private

Definition at line 46 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().