CMS 3D CMS Logo

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< HiEgammaSCEnergyCorrectionAlgoenergyCorrector_
 
double etThresh_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeoToken_
 
std::string outputCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionrHInputProducer_
 
edm::InputTag rHInputProducerTag_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsCInputProducer_
 
edm::InputTag sCInputProducerTag_
 
double sigmaElectronicNoise_
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopologyToken_
 
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::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 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
Log< level::Error, false > LogError
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
reco::CaloCluster::AlgoId sCAlgo_

◆ ~HiEgammaSCCorrectionMaker()

HiEgammaSCCorrectionMaker::~HiEgammaSCCorrectionMaker ( )
overridedefault

Member Function Documentation

◆ produce()

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_, geoToken_, edm::Event::getByToken(), edm::EventSetup::getData(), hgceeDigitizer_cfi::hitCollection, edm::InputTag::instance(), edm::InputTag::label(), eostools::move(), outputCollection_, reco::CaloCluster::position(), edm::Handle< T >::product(), 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:153
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::string const & instance() const
Definition: InputTag.h:37
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * product() const
Definition: Handle.h:70
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
std::string const & label() const
Definition: InputTag.h:36
Log< level::Error, false > LogError
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
double energy() const
cluster energy
Definition: CaloCluster.h:148
HLT enums.
edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
#define str(s)
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
reco::CaloCluster::AlgoId sCAlgo_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ applyEnergyCorrection_

bool HiEgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 51 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ energyCorrector_

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

Definition at line 48 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ etThresh_

double HiEgammaSCCorrectionMaker::etThresh_
private

Definition at line 54 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ geoToken_

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

Definition at line 61 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

◆ outputCollection_

std::string HiEgammaSCCorrectionMaker::outputCollection_
private

Definition at line 65 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ rHInputProducer_

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

Definition at line 59 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ rHInputProducerTag_

edm::InputTag HiEgammaSCCorrectionMaker::rHInputProducerTag_
private

Definition at line 57 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ sCAlgo_

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

Definition at line 64 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ sCInputProducer_

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

Definition at line 60 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ sCInputProducerTag_

edm::InputTag HiEgammaSCCorrectionMaker::sCInputProducerTag_
private

Definition at line 58 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

◆ sigmaElectronicNoise_

double HiEgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 53 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().

◆ topologyToken_

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

Definition at line 62 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

◆ verbosity_

HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel HiEgammaSCCorrectionMaker::verbosity_
private

Definition at line 45 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().