CMS 3D CMS Logo

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

#include <HiSuperClusterProducer.h>

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
 
 ~HiSuperClusterProducer () 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

bool counterExceeded () const
 
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, std::string superclusterColection)
 

Private Attributes

float barrelBCEnergyThreshold_
 
float barrelEtaSearchRoad_
 
float barrelPhiSearchRoad_
 
std::string barrelSuperclusterCollection_
 
HiBremRecoveryClusterAlgobremAlgo_p
 
bool doBarrel_
 
bool doEndcaps_
 
edm::EDGetTokenT< reco::BasicClusterCollectionebClustersToken_
 
edm::EDGetTokenT< reco::BasicClusterCollectioneeClustersToken_
 
float endcapBCEnergyThreshold_
 
float endcapEtaSearchRoad_
 
float endcapPhiSearchRoad_
 
std::string endcapSuperclusterCollection_
 
int nEvt_
 
int nMaxPrintout_
 
int noSuperClusters
 
float seedTransverseEnergyThreshold_
 
double totalE
 
HiBremRecoveryClusterAlgo::VerbosityLevel verbosity
 

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 HiSuperClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file HiSuperClusterProducer.cc.

References barrelBCEnergyThreshold_, barrelEtaSearchRoad_, barrelPhiSearchRoad_, barrelSuperclusterCollection_, bremAlgo_p, gather_cfg::cout, doBarrel_, doEndcaps_, ebClustersToken_, eeClustersToken_, endcapBCEnergyThreshold_, endcapEtaSearchRoad_, endcapPhiSearchRoad_, endcapSuperclusterCollection_, edm::ParameterSet::getParameter(), HLT_2018_cff::InputTag, nEvt_, noSuperClusters, HiBremRecoveryClusterAlgo::pDEBUG, HiBremRecoveryClusterAlgo::pERROR, HiBremRecoveryClusterAlgo::pINFO, HiBremRecoveryClusterAlgo::pWARNING, seedTransverseEnergyThreshold_, AlCaHLTBitMon_QueryRunRegistry::string, totalE, and verbosity.

25  {
26  // The verbosity level
27  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
28  if (verbosityString == "DEBUG")
30  else if (verbosityString == "WARNING")
32  else if (verbosityString == "INFO")
34  else
36 
37  endcapSuperclusterCollection_ = ps.getParameter<std::string>("endcapSuperclusterCollection");
38  barrelSuperclusterCollection_ = ps.getParameter<std::string>("barrelSuperclusterCollection");
39 
40  doBarrel_ = ps.getParameter<bool>("doBarrel");
41  doEndcaps_ = ps.getParameter<bool>("doEndcaps");
42 
43  barrelEtaSearchRoad_ = ps.getParameter<double>("barrelEtaSearchRoad");
44  barrelPhiSearchRoad_ = ps.getParameter<double>("barrelPhiSearchRoad");
45  endcapEtaSearchRoad_ = ps.getParameter<double>("endcapEtaSearchRoad");
46  endcapPhiSearchRoad_ = ps.getParameter<double>("endcapPhiSearchRoad");
47  seedTransverseEnergyThreshold_ = ps.getParameter<double>("seedTransverseEnergyThreshold");
48  barrelBCEnergyThreshold_ = ps.getParameter<double>("barrelBCEnergyThreshold");
49  endcapBCEnergyThreshold_ = ps.getParameter<double>("endcapBCEnergyThreshold");
50 
51  if (verbosityString == "INFO") {
52  std::cout << "Barrel BC Energy threshold = " << barrelBCEnergyThreshold_ << std::endl;
53  std::cout << "Endcap BC Energy threshold = " << endcapBCEnergyThreshold_ << std::endl;
54  }
55 
56  bremAlgo_p = new HiBremRecoveryClusterAlgo(barrelEtaSearchRoad_,
57  barrelPhiSearchRoad_,
58  endcapEtaSearchRoad_,
59  endcapPhiSearchRoad_,
60  seedTransverseEnergyThreshold_,
61  barrelBCEnergyThreshold_,
62  endcapBCEnergyThreshold_,
63  verbosity);
64 
65  produces<reco::SuperClusterCollection>(endcapSuperclusterCollection_);
66  produces<reco::SuperClusterCollection>(barrelSuperclusterCollection_);
67 
68  eeClustersToken_ = consumes<reco::BasicClusterCollection>(edm::InputTag(
69  ps.getParameter<std::string>("endcapClusterProducer"), ps.getParameter<std::string>("endcapClusterCollection")));
70  ebClustersToken_ = consumes<reco::BasicClusterCollection>(edm::InputTag(
71  ps.getParameter<std::string>("barrelClusterProducer"), ps.getParameter<std::string>("barrelClusterCollection")));
72 
73  totalE = 0;
74  noSuperClusters = 0;
75  nEvt_ = 0;
76 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
HiBremRecoveryClusterAlgo::VerbosityLevel verbosity
HiBremRecoveryClusterAlgo * bremAlgo_p
HiSuperClusterProducer::~HiSuperClusterProducer ( )
override

Definition at line 78 of file HiSuperClusterProducer.cc.

References bremAlgo_p.

78 { delete bremAlgo_p; }
HiBremRecoveryClusterAlgo * bremAlgo_p

Member Function Documentation

bool HiSuperClusterProducer::counterExceeded ( ) const
inlineprivate
void HiSuperClusterProducer::endJob ( void  )
virtual

Definition at line 80 of file HiSuperClusterProducer.cc.

References noSuperClusters, str, and totalE.

80  {
81  double averEnergy = 0.;
82  std::ostringstream str;
83  str << "HiSuperClusterProducer::endJob()\n"
84  << " total # reconstructed super clusters: " << noSuperClusters << "\n"
85  << " total energy of all clusters: " << totalE << "\n";
86  if (noSuperClusters > 0) {
87  averEnergy = totalE / noSuperClusters;
88  str << " average SuperCluster energy = " << averEnergy << "\n";
89  }
90  edm::LogInfo("HiSuperClusterProducerInfo") << str.str() << "\n";
91 }
#define str(s)
void HiSuperClusterProducer::getClusterPtrVector ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken,
reco::CaloClusterPtrVector clusterPtrVector_p 
)
private

Definition at line 128 of file HiSuperClusterProducer.cc.

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

Referenced by produceSuperclustersForECALPart().

130  {
132 
133  evt.getByToken(clustersToken, bccHandle);
134 
135  if (!(bccHandle.isValid())) {
136  edm::LogError("HiSuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
137  clusterPtrVector_p = nullptr;
138  }
139 
140  const reco::BasicClusterCollection* clusterCollection_p = bccHandle.product();
141  for (unsigned int i = 0; i < clusterCollection_p->size(); i++) {
142  clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
143  }
144 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
bool isValid() const
Definition: HandleBase.h:70
T const * product() const
Definition: Handle.h:69
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void HiSuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private
void HiSuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 93 of file HiSuperClusterProducer.cc.

References barrelSuperclusterCollection_, doBarrel_, doEndcaps_, ebClustersToken_, eeClustersToken_, endcapSuperclusterCollection_, nEvt_, and produceSuperclustersForECALPart().

93  {
94  if (doEndcaps_)
96 
97  if (doBarrel_)
99 
100  nEvt_++;
101 }
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
void produceSuperclustersForECALPart(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, std::string superclusterColection)
void HiSuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken,
std::string  superclusterColection 
)
private

Definition at line 103 of file HiSuperClusterProducer.cc.

References bremAlgo_p, getClusterPtrVector(), HiBremRecoveryClusterAlgo::makeSuperClusters(), eostools::move(), noSuperClusters, edm::Event::put(), and totalE.

Referenced by produce().

106  {
107  // get the cluster collection out and turn it to a BasicClusterRefVector:
108  reco::CaloClusterPtrVector* clusterPtrVector_p = new reco::CaloClusterPtrVector;
109  getClusterPtrVector(evt, clustersToken, clusterPtrVector_p);
110 
111  // run the brem recovery and get the SC collection
112  auto superclusters_ap =
113  std::make_unique<reco::SuperClusterCollection>(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p));
114 
115  // count the total energy and the number of superclusters
116  reco::SuperClusterCollection::iterator it;
117  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++) {
118  totalE += it->energy();
119  noSuperClusters++;
120  }
121 
122  // put the SC collection in the event
123  evt.put(std::move(superclusters_ap), superclusterCollection);
124 
125  delete clusterPtrVector_p;
126 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
reco::SuperClusterCollection makeSuperClusters(reco::CaloClusterPtrVector &clusters)
void getClusterPtrVector(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, reco::CaloClusterPtrVector *)
edm::PtrVector< CaloCluster > CaloClusterPtrVector
HiBremRecoveryClusterAlgo * bremAlgo_p
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

float HiSuperClusterProducer::barrelBCEnergyThreshold_
private

Definition at line 45 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 40 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 41 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::barrelSuperclusterCollection_
private

Definition at line 35 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

HiBremRecoveryClusterAlgo* HiSuperClusterProducer::bremAlgo_p
private
bool HiSuperClusterProducer::doBarrel_
private

Definition at line 48 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

bool HiSuperClusterProducer::doEndcaps_
private

Definition at line 49 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

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

Definition at line 38 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

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

Definition at line 37 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

float HiSuperClusterProducer::endcapBCEnergyThreshold_
private

Definition at line 46 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 42 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 43 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::endcapSuperclusterCollection_
private

Definition at line 34 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

int HiSuperClusterProducer::nEvt_
private

Definition at line 30 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

int HiSuperClusterProducer::nMaxPrintout_
private

Definition at line 29 of file HiSuperClusterProducer.h.

int HiSuperClusterProducer::noSuperClusters
private
float HiSuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 44 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

double HiSuperClusterProducer::totalE
private
HiBremRecoveryClusterAlgo::VerbosityLevel HiSuperClusterProducer::verbosity
private

Definition at line 32 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().