CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Multi5x5SuperClusterProducer Class Reference

#include <Multi5x5SuperClusterProducer.h>

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
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 18 of file Multi5x5SuperClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file Multi5x5SuperClusterProducer.cc.

References barrelEtaSearchRoad_, barrelPhiSearchRoad_, barrelPutToken_, bremAlgo_p, cosmicSuperClusters_cfi::bremRecoveryPset, doBarrel_, doEndcaps_, cosmicSuperClusters_cfi::dynamicPhiRoad, ebClustersToken_, eeClustersToken_, endcapEtaSearchRoad_, endcapPhiSearchRoad_, endcapPutToken_, edm::ParameterSet::getParameter(), noSuperClusters, seedTransverseEnergyThreshold_, AlCaHLTBitMon_QueryRunRegistry::string, and totalE.

24  : barrelEtaSearchRoad_{static_cast<float>(ps.getParameter<double>("barrelEtaSearchRoad"))},
25  barrelPhiSearchRoad_{static_cast<float>(ps.getParameter<double>("barrelPhiSearchRoad"))},
26  endcapEtaSearchRoad_{static_cast<float>(ps.getParameter<double>("endcapEtaSearchRoad"))},
27  endcapPhiSearchRoad_{static_cast<float>(ps.getParameter<double>("endcapPhiSearchRoad"))},
28  seedTransverseEnergyThreshold_{static_cast<float>(ps.getParameter<double>("seedTransverseEnergyThreshold"))},
29  doBarrel_{ps.getParameter<bool>("doBarrel")},
30  doEndcaps_{ps.getParameter<bool>("doEndcaps")},
31  totalE{0.},
32  noSuperClusters{0} {
33  if (doEndcaps_) {
34  eeClustersToken_ = consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("endcapClusterTag"));
35  }
36  if (doBarrel_) {
37  ebClustersToken_ = consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("barrelClusterTag"));
38  }
39 
40  const edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
41  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
42 
43  bremAlgo_p = std::make_unique<Multi5x5BremRecoveryClusterAlgo>(bremRecoveryPset,
50 
51  if (doEndcaps_) {
53  produces<reco::SuperClusterCollection>(ps.getParameter<std::string>("endcapSuperclusterCollection"));
54  }
55  if (doBarrel_) {
57  produces<reco::SuperClusterCollection>(ps.getParameter<std::string>("barrelSuperclusterCollection"));
58  }
59 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
std::unique_ptr< Multi5x5BremRecoveryClusterAlgo > bremAlgo_p
edm::EDPutTokenT< reco::SuperClusterCollection > endcapPutToken_
edm::EDPutTokenT< reco::SuperClusterCollection > barrelPutToken_
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_

Member Function Documentation

void Multi5x5SuperClusterProducer::endStream ( )
override

Definition at line 61 of file Multi5x5SuperClusterProducer.cc.

References noSuperClusters, str, and totalE.

61  {
62  double averEnergy = 0.;
63  std::ostringstream str;
64  str << "Multi5x5SuperClusterProducer::endJob()\n"
65  << " total # reconstructed super clusters: " << noSuperClusters << "\n"
66  << " total energy of all clusters: " << totalE << "\n";
67  if (noSuperClusters > 0) {
68  averEnergy = totalE / noSuperClusters;
69  str << " average SuperCluster energy = " << averEnergy << "\n";
70  }
71  edm::LogInfo("Multi5x5SuperClusterProducerInfo") << str.str() << "\n";
72 }
#define str(s)
reco::CaloClusterPtrVector Multi5x5SuperClusterProducer::getClusterPtrVector ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken 
) const
private

Definition at line 102 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().

103  {
104  reco::CaloClusterPtrVector clusterPtrVector_p;
106  evt.getByToken(clustersToken, bccHandle);
107 
108  const reco::BasicClusterCollection* clusterCollection_p = bccHandle.product();
109  clusterPtrVector_p.reserve(clusterCollection_p->size());
110  for (unsigned int i = 0; i < clusterCollection_p->size(); i++) {
111  clusterPtrVector_p.push_back(reco::CaloClusterPtr(bccHandle, i));
112  }
113  return clusterPtrVector_p;
114 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
T const * product() const
Definition: Handle.h:69
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void reserve(size_type n)
Reserve space for RefVector.
Definition: PtrVectorBase.h:93
void Multi5x5SuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private
void Multi5x5SuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 74 of file Multi5x5SuperClusterProducer.cc.

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

74  {
75  if (doEndcaps_)
77 
78  if (doBarrel_)
80 }
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_
void Multi5x5SuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken,
const edm::EDPutTokenT< reco::SuperClusterCollection > &  putToken 
)
private

Definition at line 82 of file Multi5x5SuperClusterProducer.cc.

References bremAlgo_p, edm::Event::emplace(), SimCluster::energy(), getClusterPtrVector(), eostools::move(), noSuperClusters, SimDataFormats::CaloAnalysis::sc, and totalE.

Referenced by produce().

85  {
86  // get the cluster collection out and turn it to a BasicClusterRefVector:
87  reco::CaloClusterPtrVector clusterPtrVector_p = getClusterPtrVector(evt, clustersToken);
88 
89  // run the brem recovery and get the SC collection
90  reco::SuperClusterCollection superclusters_ap(bremAlgo_p->makeSuperClusters(clusterPtrVector_p));
91 
92  // count the total energy and the number of superclusters
93  for (auto const& sc : superclusters_ap) {
94  totalE += sc.energy();
96  }
97 
98  // put the SC collection in the event
99  evt.emplace(putToken, std::move(superclusters_ap));
100 }
std::unique_ptr< Multi5x5BremRecoveryClusterAlgo > bremAlgo_p
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:104
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:421
reco::CaloClusterPtrVector getClusterPtrVector(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken) const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const float Multi5x5SuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 31 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

const float Multi5x5SuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 32 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

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

Definition at line 29 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

std::unique_ptr<Multi5x5BremRecoveryClusterAlgo> Multi5x5SuperClusterProducer::bremAlgo_p
private
const bool Multi5x5SuperClusterProducer::doBarrel_
private

Definition at line 37 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

const bool Multi5x5SuperClusterProducer::doEndcaps_
private

Definition at line 38 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

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

Definition at line 27 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

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

Definition at line 26 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

const float Multi5x5SuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 33 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

const float Multi5x5SuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 34 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

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

Definition at line 28 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

int Multi5x5SuperClusterProducer::noSuperClusters
private
const float Multi5x5SuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 35 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

double Multi5x5SuperClusterProducer::totalE
private