CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
HiEgammaSCCorrectionMaker Class Reference

#include <HiEgammaSCCorrectionMaker/HiEgammaSCCorrectionMaker/src/HiEgammaSCCorrectionMaker.cc>

Inheritance diagram for HiEgammaSCCorrectionMaker:
edm::stream::EDProducer<>

Public Member Functions

 HiEgammaSCCorrectionMaker (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HiEgammaSCCorrectionMaker () 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 Attributes

bool applyEnergyCorrection_
 
std::unique_ptr
< HiEgammaSCEnergyCorrectionAlgo
energyCorrector_
 
double etThresh_
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geoToken_
 
std::string outputCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
rHInputProducer_
 
edm::InputTag rHInputProducerTag_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
sCInputProducer_
 
edm::InputTag sCInputProducerTag_
 
double sigmaElectronicNoise_
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topologyToken_
 
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
 

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

Description: Producer of corrected SuperClusters

Definition at line 37 of file HiEgammaSCCorrectionMaker.h.

Constructor & Destructor Documentation

HiEgammaSCCorrectionMaker::HiEgammaSCCorrectionMaker ( const edm::ParameterSet ps)
explicit

Definition at line 24 of file HiEgammaSCCorrectionMaker.cc.

References applyEnergyCorrection_, reco::CaloCluster::dynamicHybrid, energyCorrector_, etThresh_, edm::ParameterSet::getParameter(), reco::CaloCluster::hybrid, reco::CaloCluster::island, reco::CaloCluster::multi5x5, outputCollection_, HiEgammaSCEnergyCorrectionAlgo::pDEBUG, HiEgammaSCEnergyCorrectionAlgo::pERROR, HiEgammaSCEnergyCorrectionAlgo::pINFO, rHInputProducer_, rHInputProducerTag_, sCAlgo_, sCInputProducer_, sCInputProducerTag_, sigmaElectronicNoise_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

26  // The verbosity level
27  std::string debugString = ps.getParameter<std::string>("VerbosityLevel");
28  if (debugString == "DEBUG")
30  else if (debugString == "INFO")
32  else
34 
35  // the input producers
36  rHInputProducerTag_ = ps.getParameter<edm::InputTag>("recHitProducer");
37  sCInputProducerTag_ = ps.getParameter<edm::InputTag>("rawSuperClusterProducer");
38  rHInputProducer_ = consumes<EcalRecHitCollection>(rHInputProducerTag_);
39  sCInputProducer_ = consumes<reco::SuperClusterCollection>(sCInputProducerTag_);
40  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
41 
42  // determine which BasicCluster algo we are correcting for
43  //And obtain forrection parameters form cfg file
44  edm::ParameterSet fCorrPset;
45  if (sCAlgo_str == "Hybrid") {
47  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
48  } else if (sCAlgo_str == "Island") {
50  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
51  } else if (sCAlgo_str == "DynamicHybrid") {
53  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
54  } else if (sCAlgo_str == "Multi5x5") {
56  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
57  } else {
58  edm::LogError("HiEgammaSCCorrectionMakerError")
59  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: " << sCAlgo_str
60  << " Using Hybrid by default";
62  }
63 
64  // set correction algo parameters
65  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
66  sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise");
67 
68  etThresh_ = ps.getParameter<double>("etThresh");
69 
70  // set the producer parameters
71  outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection");
72  produces<reco::SuperClusterCollection>(outputCollection_);
73 
74  // instanciate the correction algo object
75  energyCorrector_ = std::make_unique<HiEgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_, fCorrPset, verbosity_);
76 }
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
Log< level::Error, false > LogError
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
reco::CaloCluster::AlgoId sCAlgo_
HiEgammaSCCorrectionMaker::~HiEgammaSCCorrectionMaker ( )
overridedefault

Member Function Documentation

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

Definition at line 80 of file HiEgammaSCCorrectionMaker.cc.

References applyEnergyCorrection_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrector_, etThresh_, relativeConstraints::geometry, geoToken_, edm::Event::getByToken(), edm::EventSetup::getData(), reco_application_2006_simpleTBanalysis_cfg::hitCollection, edm::InputTag::instance(), edm::InputTag::label(), eostools::move(), outputCollection_, reco::CaloCluster::position(), edm::Event::put(), rHInputProducer_, rHInputProducerTag_, sCAlgo_, sCInputProducer_, sCInputProducerTag_, funct::sin(), str, AlCaHLTBitMon_QueryRunRegistry::string, and topologyToken_.

80  {
81  using namespace edm;
82 
83  // get the collection geometry:
85  const CaloSubdetectorGeometry* geometry_p;
86 
87  const CaloTopology& topology = es.getData(topologyToken_);
88 
89  std::string rHInputCollection = rHInputProducerTag_.instance();
90  if (rHInputCollection == "EcalRecHitsEB") {
91  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
92  } else if (rHInputCollection == "EcalRecHitsEE") {
93  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
94  } else if (rHInputCollection == "EcalRecHitsPS") {
95  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
96  } else {
98  "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
99  throw(std::runtime_error(str.c_str()));
100  }
101 
102  // Get raw SuperClusters from the event
103  Handle<reco::SuperClusterCollection> pRawSuperClusters;
104  try {
105  evt.getByToken(sCInputProducer_, pRawSuperClusters);
106  } catch (cms::Exception& ex) {
107  edm::LogError("HiEgammaSCCorrectionMakerError")
108  << "Error! can't get the rawSuperClusters " << sCInputProducerTag_.label();
109  }
110 
111  // Get the RecHits from the event
113  try {
114  evt.getByToken(rHInputProducer_, pRecHits);
115  } catch (cms::Exception& ex) {
116  edm::LogError("HiEgammaSCCorrectionMakerError") << "Error! can't get the RecHits " << rHInputProducerTag_.label();
117  }
118 
119  // Create a pointer to the RecHits and raw SuperClusters
120  const EcalRecHitCollection* hitCollection = pRecHits.product();
121  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
122 
123  // Define a collection of corrected SuperClusters to put back into the event
124  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
125 
126  // Loop over raw clusters and make corrected ones
127  reco::SuperClusterCollection::const_iterator aClus;
128  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
129  reco::SuperCluster newClus;
131  newClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, *geometry_p, topology);
132  else
133  newClus = *aClus;
134 
135  if (newClus.energy() * sin(newClus.position().theta()) > etThresh_) {
136  corrClusters->push_back(newClus);
137  }
138  }
139  // Put collection of corrected SuperClusters into the event
140  evt.put(std::move(corrClusters), outputCollection_);
141 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Log< level::Error, false > LogError
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
def move
Definition: eostools.py:511
double energy() const
cluster energy
Definition: CaloCluster.h:149
std::string const & label() const
Definition: InputTag.h:36
edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
#define str(s)
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
std::string const & instance() const
Definition: InputTag.h:37
reco::CaloCluster::AlgoId sCAlgo_

Member Data Documentation

bool HiEgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 51 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

std::unique_ptr<HiEgammaSCEnergyCorrectionAlgo> HiEgammaSCCorrectionMaker::energyCorrector_
private

Definition at line 48 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

double HiEgammaSCCorrectionMaker::etThresh_
private

Definition at line 54 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HiEgammaSCCorrectionMaker::geoToken_
private

Definition at line 61 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

std::string HiEgammaSCCorrectionMaker::outputCollection_
private

Definition at line 65 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> HiEgammaSCCorrectionMaker::rHInputProducer_
private

Definition at line 59 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::InputTag HiEgammaSCCorrectionMaker::rHInputProducerTag_
private

Definition at line 57 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

reco::CaloCluster::AlgoId HiEgammaSCCorrectionMaker::sCAlgo_
private

Definition at line 64 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::EDGetTokenT<reco::SuperClusterCollection> HiEgammaSCCorrectionMaker::sCInputProducer_
private

Definition at line 60 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::InputTag HiEgammaSCCorrectionMaker::sCInputProducerTag_
private

Definition at line 58 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

double HiEgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 53 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().

edm::ESGetToken<CaloTopology, CaloTopologyRecord> HiEgammaSCCorrectionMaker::topologyToken_
private

Definition at line 62 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel HiEgammaSCCorrectionMaker::verbosity_
private

Definition at line 45 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().