CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Multi5x5ClusterProducer Class Reference
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 33 of file Multi5x5ClusterProducer.cc.

Constructor & Destructor Documentation

◆ Multi5x5ClusterProducer()

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

Definition at line 75 of file Multi5x5ClusterProducer.cc.

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

75  {
76  // Parameters to identify the hit collections
77  barrelHitToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHitTag"));
78 
79  endcapHitToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHitTag"));
80 
81  //EventSetup Token for CaloGeometry
82  caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
83 
84  // should cluster algo be run in barrel and endcap?
85  doEndcap_ = ps.getParameter<bool>("doEndcap");
86  doBarrel_ = ps.getParameter<bool>("doBarrel");
87 
88  // The names of the produced cluster collections
89  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
90  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
91 
92  // Island algorithm parameters
93  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
94  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
95 
96  const std::vector<std::string> flagnames = ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded");
97 
98  const std::vector<int> v_chstatus = StringToEnumValue<EcalRecHit::Flags>(flagnames);
99 
100  // Parameters for the position calculation:
103 
104  // Produces a collection of barrel and a collection of endcap clusters
105  produces<reco::BasicClusterCollection>(endcapClusterCollection_);
106  produces<reco::BasicClusterCollection>(barrelClusterCollection_);
107 
109  if (ps.exists("reassignSeedCrysToClusterItSeeds"))
110  reassignSeedCrysToClusterItSeeds = ps.getParameter<bool>("reassignSeedCrysToClusterItSeeds");
111 
113  barrelSeedThreshold, endcapSeedThreshold, v_chstatus, posCalculator_, reassignSeedCrysToClusterItSeeds);
114 
115  nEvt_ = 0;
116 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< EcalRecHitCollection > barrelHitToken_
edm::EDGetTokenT< EcalRecHitCollection > endcapHitToken_
Multi5x5ClusterAlgo * island_p
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_

◆ ~Multi5x5ClusterProducer()

Multi5x5ClusterProducer::~Multi5x5ClusterProducer ( )
override

Definition at line 118 of file Multi5x5ClusterProducer.cc.

References island_p.

118 { delete island_p; }
Multi5x5ClusterAlgo * island_p

Member Function Documentation

◆ clusterizeECALPart()

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 138 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, caloGeometryToken_, bsc_activity_cfg::clusters, reco::CaloID::DET_ECAL_BARREL, hgcalTestNeighbor_cfi::detector, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, getCollection(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), island_p, Multi5x5ClusterAlgo::makeClusters(), eostools::move(), edm::Event::put(), and unpackBuffers-CaloStage2::token.

Referenced by produce().

142  {
143  // get the hit collection from the event:
144  const EcalRecHitCollection* hitCollection_p = getCollection(evt, token);
145 
146  // get the geometry and topology from the event setup:
148 
149  const CaloSubdetectorGeometry* geometry_p;
150  std::unique_ptr<CaloSubdetectorTopology> topology_p;
151 
153  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
154  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
155  } else {
156  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
157  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
158  }
159 
160  const CaloSubdetectorGeometry* geometryES_p;
161  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
162 
163  // Run the clusterization algorithm:
165  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p.get(), geometryES_p, detector);
166 
167  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
168  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
169  clusters_p->assign(clusters.begin(), clusters.end());
172  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
173  else
174  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
175 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
Multi5x5ClusterAlgo * island_p
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
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)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
def move(src, dest)
Definition: eostools.py:511

◆ counterExceeded()

bool Multi5x5ClusterProducer::counterExceeded ( ) const
inlineprivate

◆ getCollection()

const EcalRecHitCollection * Multi5x5ClusterProducer::getCollection ( edm::Event evt,
const edm::EDGetTokenT< EcalRecHitCollection > &  token 
)
private

Definition at line 131 of file Multi5x5ClusterProducer.cc.

References edm::Event::getByToken(), edm::Handle< T >::product(), and unpackBuffers-CaloStage2::token.

Referenced by clusterizeECALPart().

132  {
134  evt.getByToken(token, rhcHandle);
135  return rhcHandle.product();
136 }
T const * product() const
Definition: Handle.h:70
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528

◆ outputValidationInfo()

void Multi5x5ClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private

◆ produce()

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

Definition at line 120 of file Multi5x5ClusterProducer.cc.

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

120  {
121  if (doEndcap_) {
123  }
124  if (doBarrel_) {
126  }
127 
128  nEvt_++;
129 }
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

◆ barrelClusterCollection_

std::string Multi5x5ClusterProducer::barrelClusterCollection_
private

Definition at line 53 of file Multi5x5ClusterProducer.cc.

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

◆ barrelHitToken_

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

Definition at line 49 of file Multi5x5ClusterProducer.cc.

Referenced by Multi5x5ClusterProducer(), and produce().

◆ caloGeometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> Multi5x5ClusterProducer::caloGeometryToken_
private

Definition at line 51 of file Multi5x5ClusterProducer.cc.

Referenced by clusterizeECALPart(), and Multi5x5ClusterProducer().

◆ doBarrel_

bool Multi5x5ClusterProducer::doBarrel_
private

Definition at line 46 of file Multi5x5ClusterProducer.cc.

Referenced by Multi5x5ClusterProducer(), and produce().

◆ doEndcap_

bool Multi5x5ClusterProducer::doEndcap_
private

Definition at line 47 of file Multi5x5ClusterProducer.cc.

Referenced by Multi5x5ClusterProducer(), and produce().

◆ endcapClusterCollection_

std::string Multi5x5ClusterProducer::endcapClusterCollection_
private

Definition at line 54 of file Multi5x5ClusterProducer.cc.

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

◆ endcapHitToken_

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

Definition at line 50 of file Multi5x5ClusterProducer.cc.

Referenced by Multi5x5ClusterProducer(), and produce().

◆ island_p

Multi5x5ClusterAlgo* Multi5x5ClusterProducer::island_p
private

◆ nEvt_

int Multi5x5ClusterProducer::nEvt_
private

Definition at line 43 of file Multi5x5ClusterProducer.cc.

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

◆ nMaxPrintout_

int Multi5x5ClusterProducer::nMaxPrintout_
private

Definition at line 42 of file Multi5x5ClusterProducer.cc.

Referenced by counterExceeded().

◆ posCalculator_

PositionCalc Multi5x5ClusterProducer::posCalculator_
private

Definition at line 56 of file Multi5x5ClusterProducer.cc.

Referenced by Multi5x5ClusterProducer().