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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 19 of file Multi5x5SuperClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 24 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  :
25  barrelEtaSearchRoad_{static_cast<float>(ps.getParameter<double>("barrelEtaSearchRoad"))},
26  barrelPhiSearchRoad_{static_cast<float>(ps.getParameter<double>("barrelPhiSearchRoad"))},
27  endcapEtaSearchRoad_{static_cast<float>(ps.getParameter<double>("endcapEtaSearchRoad"))},
28  endcapPhiSearchRoad_{static_cast<float>(ps.getParameter<double>("endcapPhiSearchRoad"))},
29  seedTransverseEnergyThreshold_{static_cast<float>(ps.getParameter<double>("seedTransverseEnergyThreshold"))},
30  doBarrel_{ps.getParameter<bool>("doBarrel")},
31  doEndcaps_{ps.getParameter<bool>("doEndcaps")},
32  totalE{0.},
34 {
35 
36  if(doEndcaps_) {
38  consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("endcapClusterTag"));
39  }
40  if(doBarrel_) {
42  consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("barrelClusterTag"));
43  }
44 
45  const edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
46  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
47 
48  bremAlgo_p = std::make_unique<Multi5x5BremRecoveryClusterAlgo>(bremRecoveryPset, barrelEtaSearchRoad_, barrelPhiSearchRoad_,
51 
52  if(doEndcaps_) {
53  endcapPutToken_ = produces< reco::SuperClusterCollection >(ps.getParameter<std::string>("endcapSuperclusterCollection"));
54  }
55  if(doBarrel_) {
56  barrelPutToken_ = produces< reco::SuperClusterCollection >(ps.getParameter<std::string>("barrelSuperclusterCollection"));
57  }
58 }
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 62 of file Multi5x5SuperClusterProducer.cc.

References noSuperClusters, str, and totalE.

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

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

113 {
114  reco::CaloClusterPtrVector clusterPtrVector_p;
116  evt.getByToken(clustersToken, bccHandle);
117 
118  const reco::BasicClusterCollection *clusterCollection_p = bccHandle.product();
119  clusterPtrVector_p.reserve(clusterCollection_p->size());
120  for (unsigned int i = 0; i < clusterCollection_p->size(); i++)
121  {
122  clusterPtrVector_p.push_back(reco::CaloClusterPtr(bccHandle, i));
123  }
124  return clusterPtrVector_p;
125 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:140
T const * product() const
Definition: Handle.h:74
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void reserve(size_type n)
Reserve space for RefVector.
Definition: PtrVectorBase.h:88
void Multi5x5SuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private
void Multi5x5SuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 77 of file Multi5x5SuperClusterProducer.cc.

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

78 {
79  if(doEndcaps_)
81 
82  if(doBarrel_)
84 }
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 88 of file Multi5x5SuperClusterProducer.cc.

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

Referenced by produce().

91 {
92  // get the cluster collection out and turn it to a BasicClusterRefVector:
93  reco::CaloClusterPtrVector clusterPtrVector_p=getClusterPtrVector(evt, clustersToken);
94 
95  // run the brem recovery and get the SC collection
96  reco::SuperClusterCollection superclusters_ap(bremAlgo_p->makeSuperClusters(clusterPtrVector_p));
97 
98  // count the total energy and the number of superclusters
99  for (auto const& sc: superclusters_ap)
100  {
101  totalE += sc.energy();
102  noSuperClusters++;
103  }
104 
105  // put the SC collection in the event
106  evt.emplace(putToken,std::move(superclusters_ap));
107 
108 }
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:413
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 36 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

const float Multi5x5SuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 37 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

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

Definition at line 34 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 42 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

const bool Multi5x5SuperClusterProducer::doEndcaps_
private

Definition at line 43 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

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

Definition at line 32 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

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

Definition at line 31 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

const float Multi5x5SuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 38 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

const float Multi5x5SuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 39 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

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

Definition at line 33 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

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

Definition at line 40 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

double Multi5x5SuperClusterProducer::totalE
private