CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Multi5x5SuperClusterProducer Class Reference
Inheritance diagram for Multi5x5SuperClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

void endStream () override
 
 Multi5x5SuperClusterProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) 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

reco::CaloClusterPtrVector getClusterPtrVector (edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken) const
 
void outputValidationInfo (reco::SuperClusterCollection &superclusterCollection)
 
void produceSuperclustersForECALPart (edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, const edm::EDPutTokenT< reco::SuperClusterCollection > &putToken)
 

Private Attributes

const float barrelEtaSearchRoad_
 
const float barrelPhiSearchRoad_
 
edm::EDPutTokenT< reco::SuperClusterCollectionbarrelPutToken_
 
std::unique_ptr< Multi5x5BremRecoveryClusterAlgobremAlgo_p
 
const bool doBarrel_
 
const bool doEndcaps_
 
edm::EDGetTokenT< reco::BasicClusterCollectionebClustersToken_
 
edm::EDGetTokenT< reco::BasicClusterCollectioneeClustersToken_
 
const float endcapEtaSearchRoad_
 
const float endcapPhiSearchRoad_
 
edm::EDPutTokenT< reco::SuperClusterCollectionendcapPutToken_
 
int noSuperClusters
 
const float seedTransverseEnergyThreshold_
 
double totalE
 

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 19 of file Multi5x5SuperClusterProducer.cc.

Constructor & Destructor Documentation

◆ Multi5x5SuperClusterProducer()

Multi5x5SuperClusterProducer::Multi5x5SuperClusterProducer ( const edm::ParameterSet ps)

Definition at line 59 of file Multi5x5SuperClusterProducer.cc.

References edm::ParameterSet::getParameter().

60  : barrelEtaSearchRoad_{static_cast<float>(ps.getParameter<double>("barrelEtaSearchRoad"))},
61  barrelPhiSearchRoad_{static_cast<float>(ps.getParameter<double>("barrelPhiSearchRoad"))},
62  endcapEtaSearchRoad_{static_cast<float>(ps.getParameter<double>("endcapEtaSearchRoad"))},
63  endcapPhiSearchRoad_{static_cast<float>(ps.getParameter<double>("endcapPhiSearchRoad"))},
64  seedTransverseEnergyThreshold_{static_cast<float>(ps.getParameter<double>("seedTransverseEnergyThreshold"))},
65  doBarrel_{ps.getParameter<bool>("doBarrel")},
66  doEndcaps_{ps.getParameter<bool>("doEndcaps")},
67  totalE{0.},
68  noSuperClusters{0} {
69  if (doEndcaps_) {
70  eeClustersToken_ = consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("endcapClusterTag"));
71  }
72  if (doBarrel_) {
73  ebClustersToken_ = consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("barrelClusterTag"));
74  }
75 
76  const edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
77  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
78 
79  bremAlgo_p = std::make_unique<Multi5x5BremRecoveryClusterAlgo>(bremRecoveryPset,
86 
87  if (doEndcaps_) {
89  produces<reco::SuperClusterCollection>(ps.getParameter<std::string>("endcapSuperclusterCollection"));
90  }
91  if (doBarrel_) {
93  produces<reco::SuperClusterCollection>(ps.getParameter<std::string>("barrelSuperclusterCollection"));
94  }
95 }
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< Multi5x5BremRecoveryClusterAlgo > bremAlgo_p
edm::EDPutTokenT< reco::SuperClusterCollection > endcapPutToken_
edm::EDPutTokenT< reco::SuperClusterCollection > barrelPutToken_
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_

Member Function Documentation

◆ endStream()

void Multi5x5SuperClusterProducer::endStream ( )
override

Definition at line 97 of file Multi5x5SuperClusterProducer.cc.

References noSuperClusters, str, and totalE.

97  {
98  double averEnergy = 0.;
99  std::ostringstream str;
100  str << "Multi5x5SuperClusterProducer::endJob()\n"
101  << " total # reconstructed super clusters: " << noSuperClusters << "\n"
102  << " total energy of all clusters: " << totalE << "\n";
103  if (noSuperClusters > 0) {
104  averEnergy = totalE / noSuperClusters;
105  str << " average SuperCluster energy = " << averEnergy << "\n";
106  }
107  edm::LogInfo("Multi5x5SuperClusterProducerInfo") << str.str() << "\n";
108 }
Log< level::Info, false > LogInfo
#define str(s)

◆ getClusterPtrVector()

reco::CaloClusterPtrVector Multi5x5SuperClusterProducer::getClusterPtrVector ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken 
) const
private

Definition at line 138 of file Multi5x5SuperClusterProducer.cc.

References edm::Event::getByToken(), mps_fire::i, edm::Handle< T >::product(), edm::PtrVector< T >::push_back(), and edm::PtrVectorBase::reserve().

Referenced by produceSuperclustersForECALPart().

139  {
140  reco::CaloClusterPtrVector clusterPtrVector_p;
142  evt.getByToken(clustersToken, bccHandle);
143 
144  const reco::BasicClusterCollection* clusterCollection_p = bccHandle.product();
145  clusterPtrVector_p.reserve(clusterCollection_p->size());
146  for (unsigned int i = 0; i < clusterCollection_p->size(); i++) {
147  clusterPtrVector_p.push_back(reco::CaloClusterPtr(bccHandle, i));
148  }
149  return clusterPtrVector_p;
150 }
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
T const * product() const
Definition: Handle.h:70
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void reserve(size_type n)
Reserve space for RefVector.
Definition: PtrVectorBase.h:95

◆ outputValidationInfo()

void Multi5x5SuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private

◆ produce()

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

Definition at line 110 of file Multi5x5SuperClusterProducer.cc.

References barrelPutToken_, doBarrel_, doEndcaps_, ebClustersToken_, eeClustersToken_, endcapPutToken_, and produceSuperclustersForECALPart().

110  {
111  if (doEndcaps_)
113 
114  if (doBarrel_)
116 }
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
void produceSuperclustersForECALPart(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, const edm::EDPutTokenT< reco::SuperClusterCollection > &putToken)
edm::EDPutTokenT< reco::SuperClusterCollection > endcapPutToken_
edm::EDPutTokenT< reco::SuperClusterCollection > barrelPutToken_
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_

◆ produceSuperclustersForECALPart()

void Multi5x5SuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken,
const edm::EDPutTokenT< reco::SuperClusterCollection > &  putToken 
)
private

Definition at line 118 of file Multi5x5SuperClusterProducer.cc.

References bremAlgo_p, edm::Event::emplace(), getClusterPtrVector(), eostools::move(), noSuperClusters, and totalE.

Referenced by produce().

121  {
122  // get the cluster collection out and turn it to a BasicClusterRefVector:
123  reco::CaloClusterPtrVector clusterPtrVector_p = getClusterPtrVector(evt, clustersToken);
124 
125  // run the brem recovery and get the SC collection
126  reco::SuperClusterCollection superclusters_ap(bremAlgo_p->makeSuperClusters(clusterPtrVector_p));
127 
128  // count the total energy and the number of superclusters
129  for (auto const& sc : superclusters_ap) {
130  totalE += sc.energy();
131  noSuperClusters++;
132  }
133 
134  // put the SC collection in the event
135  evt.emplace(putToken, std::move(superclusters_ap));
136 }
std::unique_ptr< Multi5x5BremRecoveryClusterAlgo > bremAlgo_p
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
reco::CaloClusterPtrVector getClusterPtrVector(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken) const
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
Definition: Event.h:434
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ barrelEtaSearchRoad_

const float Multi5x5SuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 32 of file Multi5x5SuperClusterProducer.cc.

◆ barrelPhiSearchRoad_

const float Multi5x5SuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 33 of file Multi5x5SuperClusterProducer.cc.

◆ barrelPutToken_

edm::EDPutTokenT<reco::SuperClusterCollection> Multi5x5SuperClusterProducer::barrelPutToken_
private

Definition at line 30 of file Multi5x5SuperClusterProducer.cc.

Referenced by produce().

◆ bremAlgo_p

std::unique_ptr<Multi5x5BremRecoveryClusterAlgo> Multi5x5SuperClusterProducer::bremAlgo_p
private

Definition at line 41 of file Multi5x5SuperClusterProducer.cc.

Referenced by produceSuperclustersForECALPart().

◆ doBarrel_

const bool Multi5x5SuperClusterProducer::doBarrel_
private

Definition at line 38 of file Multi5x5SuperClusterProducer.cc.

Referenced by produce().

◆ doEndcaps_

const bool Multi5x5SuperClusterProducer::doEndcaps_
private

Definition at line 39 of file Multi5x5SuperClusterProducer.cc.

Referenced by produce().

◆ ebClustersToken_

edm::EDGetTokenT<reco::BasicClusterCollection> Multi5x5SuperClusterProducer::ebClustersToken_
private

Definition at line 28 of file Multi5x5SuperClusterProducer.cc.

Referenced by produce().

◆ eeClustersToken_

edm::EDGetTokenT<reco::BasicClusterCollection> Multi5x5SuperClusterProducer::eeClustersToken_
private

Definition at line 27 of file Multi5x5SuperClusterProducer.cc.

Referenced by produce().

◆ endcapEtaSearchRoad_

const float Multi5x5SuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 34 of file Multi5x5SuperClusterProducer.cc.

◆ endcapPhiSearchRoad_

const float Multi5x5SuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 35 of file Multi5x5SuperClusterProducer.cc.

◆ endcapPutToken_

edm::EDPutTokenT<reco::SuperClusterCollection> Multi5x5SuperClusterProducer::endcapPutToken_
private

Definition at line 29 of file Multi5x5SuperClusterProducer.cc.

Referenced by produce().

◆ noSuperClusters

int Multi5x5SuperClusterProducer::noSuperClusters
private

Definition at line 44 of file Multi5x5SuperClusterProducer.cc.

Referenced by endStream(), and produceSuperclustersForECALPart().

◆ seedTransverseEnergyThreshold_

const float Multi5x5SuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 36 of file Multi5x5SuperClusterProducer.cc.

◆ totalE

double Multi5x5SuperClusterProducer::totalE
private

Definition at line 43 of file Multi5x5SuperClusterProducer.cc.

Referenced by endStream(), and produceSuperclustersForECALPart().