CMS 3D CMS Logo

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

Public Member Functions

virtual void endJob ()
 
 HiSuperClusterProducer (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

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

Private Attributes

const float barrelBCEnergyThreshold_
 
const float barrelEtaSearchRoad_
 
const float barrelPhiSearchRoad_
 
const edm::EDPutTokenT< reco::SuperClusterCollectionbarrelSuperclusterPut_
 
std::unique_ptr< HiBremRecoveryClusterAlgobremAlgo_p
 
const bool doBarrel_
 
const bool doEndcaps_
 
const edm::EDGetTokenT< reco::BasicClusterCollectionebClustersToken_
 
const edm::EDGetTokenT< reco::BasicClusterCollectioneeClustersToken_
 
const float endcapBCEnergyThreshold_
 
const float endcapEtaSearchRoad_
 
const float endcapPhiSearchRoad_
 
const edm::EDPutTokenT< reco::SuperClusterCollectionendcapSuperclusterPut_
 
int noSuperClusters = 0
 
const float seedTransverseEnergyThreshold_
 
double totalE = 0.0
 

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 20 of file HiSuperClusterProducer.cc.

Constructor & Destructor Documentation

◆ HiSuperClusterProducer()

HiSuperClusterProducer::HiSuperClusterProducer ( const edm::ParameterSet ps)

Definition at line 65 of file HiSuperClusterProducer.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

66  : endcapSuperclusterPut_{produces<reco::SuperClusterCollection>(
67  ps.getParameter<std::string>("endcapSuperclusterCollection"))},
69  produces<reco::SuperClusterCollection>(ps.getParameter<std::string>("barrelSuperclusterCollection"))},
70  eeClustersToken_{consumes<reco::BasicClusterCollection>(
71  edm::InputTag(ps.getParameter<std::string>("endcapClusterProducer"),
72  ps.getParameter<std::string>("endcapClusterCollection")))},
73  ebClustersToken_{consumes<reco::BasicClusterCollection>(
74  edm::InputTag(ps.getParameter<std::string>("barrelClusterProducer"),
75  ps.getParameter<std::string>("barrelClusterCollection")))},
76  barrelEtaSearchRoad_{float(ps.getParameter<double>("barrelEtaSearchRoad"))},
77  barrelPhiSearchRoad_{float(ps.getParameter<double>("barrelPhiSearchRoad"))},
78  endcapEtaSearchRoad_{float(ps.getParameter<double>("endcapEtaSearchRoad"))},
79  endcapPhiSearchRoad_{float(ps.getParameter<double>("endcapPhiSearchRoad"))},
80  seedTransverseEnergyThreshold_{float(ps.getParameter<double>("seedTransverseEnergyThreshold"))},
81  barrelBCEnergyThreshold_{float(ps.getParameter<double>("barrelBCEnergyThreshold"))},
82  endcapBCEnergyThreshold_{float(ps.getParameter<double>("endcapBCEnergyThreshold"))},
83  doBarrel_{ps.getParameter<bool>("doBarrel")},
84  doEndcaps_{ps.getParameter<bool>("doEndcaps")}
85 
86 {
87  // The verbosity level
89  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
90  if (verbosityString == "DEBUG")
92  else if (verbosityString == "WARNING")
94  else if (verbosityString == "INFO")
96  else
98 
99  if (verbosityString == "INFO") {
100  std::cout << "Barrel BC Energy threshold = " << barrelBCEnergyThreshold_ << std::endl;
101  std::cout << "Endcap BC Energy threshold = " << endcapBCEnergyThreshold_ << std::endl;
102  }
103 
104  bremAlgo_p = std::make_unique<HiBremRecoveryClusterAlgo>(barrelEtaSearchRoad_,
111  verbosity);
112 }
std::unique_ptr< HiBremRecoveryClusterAlgo > bremAlgo_p
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDPutTokenT< reco::SuperClusterCollection > endcapSuperclusterPut_
const edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_
const int verbosity
const edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
const edm::EDPutTokenT< reco::SuperClusterCollection > barrelSuperclusterPut_

Member Function Documentation

◆ endJob()

void HiSuperClusterProducer::endJob ( void  )
virtual

Definition at line 114 of file HiSuperClusterProducer.cc.

References noSuperClusters, str, and totalE.

114  {
115  double averEnergy = 0.;
116  std::ostringstream str;
117  str << "HiSuperClusterProducer::endJob()\n"
118  << " total # reconstructed super clusters: " << noSuperClusters << "\n"
119  << " total energy of all clusters: " << totalE << "\n";
120  if (noSuperClusters > 0) {
121  averEnergy = totalE / noSuperClusters;
122  str << " average SuperCluster energy = " << averEnergy << "\n";
123  }
124  edm::LogInfo("HiSuperClusterProducerInfo") << str.str() << "\n";
125 }
Log< level::Info, false > LogInfo
#define str(s)

◆ getClusterPtrVector()

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

Definition at line 156 of file HiSuperClusterProducer.cc.

References edm::Event::getHandle(), mps_fire::i, edm::HandleBase::isValid(), edm::Handle< T >::product(), and edm::PtrVector< T >::push_back().

Referenced by produceSuperclustersForECALPart().

158  {
159  edm::Handle<reco::BasicClusterCollection> bccHandle = evt.getHandle(clustersToken);
160 
161  if (!(bccHandle.isValid())) {
162  edm::LogError("HiSuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
163  clusterPtrVector_p = nullptr;
164  }
165 
166  const reco::BasicClusterCollection* clusterCollection_p = bccHandle.product();
167  for (unsigned int i = 0; i < clusterCollection_p->size(); i++) {
168  clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
169  }
170 }
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
T const * product() const
Definition: Handle.h:70
Log< level::Error, false > LogError
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
bool isValid() const
Definition: HandleBase.h:70
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:564

◆ outputValidationInfo()

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

◆ produce()

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

Definition at line 127 of file HiSuperClusterProducer.cc.

References barrelSuperclusterPut_, doBarrel_, doEndcaps_, ebClustersToken_, eeClustersToken_, endcapSuperclusterPut_, and produceSuperclustersForECALPart().

127  {
128  if (doEndcaps_)
130 
131  if (doBarrel_)
133 }
void produceSuperclustersForECALPart(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, edm::EDPutTokenT< reco::SuperClusterCollection > const &putToken)
const edm::EDPutTokenT< reco::SuperClusterCollection > endcapSuperclusterPut_
const edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_
const edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
const edm::EDPutTokenT< reco::SuperClusterCollection > barrelSuperclusterPut_

◆ produceSuperclustersForECALPart()

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

Definition at line 135 of file HiSuperClusterProducer.cc.

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

Referenced by produce().

138  {
139  // get the cluster collection out and turn it to a BasicClusterRefVector:
140  reco::CaloClusterPtrVector clusterPtrVector_p{};
141  getClusterPtrVector(evt, clustersToken, &clusterPtrVector_p);
142 
143  // run the brem recovery and get the SC collection
144  reco::SuperClusterCollection superclusters_ap = bremAlgo_p->makeSuperClusters(clusterPtrVector_p);
145 
146  // count the total energy and the number of superclusters
147  for (auto const& cluster : superclusters_ap) {
148  totalE += cluster.energy();
149  noSuperClusters++;
150  }
151 
152  // put the SC collection in the event
153  evt.emplace(putToken, std::move(superclusters_ap));
154 }
std::unique_ptr< HiBremRecoveryClusterAlgo > bremAlgo_p
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
void getClusterPtrVector(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, reco::CaloClusterPtrVector *)
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

◆ barrelBCEnergyThreshold_

const float HiSuperClusterProducer::barrelBCEnergyThreshold_
private

Definition at line 39 of file HiSuperClusterProducer.cc.

◆ barrelEtaSearchRoad_

const float HiSuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 34 of file HiSuperClusterProducer.cc.

◆ barrelPhiSearchRoad_

const float HiSuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 35 of file HiSuperClusterProducer.cc.

◆ barrelSuperclusterPut_

const edm::EDPutTokenT<reco::SuperClusterCollection> HiSuperClusterProducer::barrelSuperclusterPut_
private

Definition at line 29 of file HiSuperClusterProducer.cc.

Referenced by produce().

◆ bremAlgo_p

std::unique_ptr<HiBremRecoveryClusterAlgo> HiSuperClusterProducer::bremAlgo_p
private

Definition at line 45 of file HiSuperClusterProducer.cc.

Referenced by produceSuperclustersForECALPart().

◆ doBarrel_

const bool HiSuperClusterProducer::doBarrel_
private

Definition at line 42 of file HiSuperClusterProducer.cc.

Referenced by produce().

◆ doEndcaps_

const bool HiSuperClusterProducer::doEndcaps_
private

Definition at line 43 of file HiSuperClusterProducer.cc.

Referenced by produce().

◆ ebClustersToken_

const edm::EDGetTokenT<reco::BasicClusterCollection> HiSuperClusterProducer::ebClustersToken_
private

Definition at line 32 of file HiSuperClusterProducer.cc.

Referenced by produce().

◆ eeClustersToken_

const edm::EDGetTokenT<reco::BasicClusterCollection> HiSuperClusterProducer::eeClustersToken_
private

Definition at line 31 of file HiSuperClusterProducer.cc.

Referenced by produce().

◆ endcapBCEnergyThreshold_

const float HiSuperClusterProducer::endcapBCEnergyThreshold_
private

Definition at line 40 of file HiSuperClusterProducer.cc.

◆ endcapEtaSearchRoad_

const float HiSuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 36 of file HiSuperClusterProducer.cc.

◆ endcapPhiSearchRoad_

const float HiSuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 37 of file HiSuperClusterProducer.cc.

◆ endcapSuperclusterPut_

const edm::EDPutTokenT<reco::SuperClusterCollection> HiSuperClusterProducer::endcapSuperclusterPut_
private

Definition at line 28 of file HiSuperClusterProducer.cc.

Referenced by produce().

◆ noSuperClusters

int HiSuperClusterProducer::noSuperClusters = 0
private

Definition at line 48 of file HiSuperClusterProducer.cc.

Referenced by endJob(), and produceSuperclustersForECALPart().

◆ seedTransverseEnergyThreshold_

const float HiSuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 38 of file HiSuperClusterProducer.cc.

◆ totalE

double HiSuperClusterProducer::totalE = 0.0
private

Definition at line 47 of file HiSuperClusterProducer.cc.

Referenced by endJob(), and produceSuperclustersForECALPart().