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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

bool applyEnergyCorrection_
 
std::unique_ptr< EcalClusterFunctionBaseClassEnergyCorrection_
 
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgoenergyCorrector_
 
double etThresh_
 
std::string outputCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionrHInputProducer_
 
edm::InputTag rHInputProducerTag_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsCInputProducer_
 
edm::InputTag sCInputProducerTag_
 
double sigmaElectronicNoise_
 
edm::ESHandle< CaloTopologytheCaloTopo_
 
HiEgammaSCEnergyCorrectionAlgo::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

Description: Producer of corrected SuperClusters

Definition at line 40 of file HiEgammaSCCorrectionMaker.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file HiEgammaSCCorrectionMaker.cc.

References applyEnergyCorrection_, reco::CaloCluster::dynamicHybrid, EnergyCorrection_, energyCorrector_, etThresh_, reco::get(), 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, verbosity_, and ~HiEgammaSCCorrectionMaker().

29 {
30 
31  // The verbosity level
32  std::string debugString = ps.getParameter<std::string>("VerbosityLevel");
33  if (debugString == "DEBUG") verbosity_ = HiEgammaSCEnergyCorrectionAlgo::pDEBUG;
34  else if (debugString == "INFO") verbosity_ = HiEgammaSCEnergyCorrectionAlgo::pINFO;
36 
37  // the input producers
38  rHInputProducerTag_ = ps.getParameter<edm::InputTag>("recHitProducer");
39  sCInputProducerTag_ = ps.getParameter<edm::InputTag>("rawSuperClusterProducer");
40  rHInputProducer_ = consumes<EcalRecHitCollection>(rHInputProducerTag_);
41  sCInputProducer_ = consumes<reco::SuperClusterCollection>(sCInputProducerTag_);
42  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
43 
44  // determine which BasicCluster algo we are correcting for
45  //And obtain forrection parameters form cfg file
46  edm::ParameterSet fCorrPset;
47  if (sCAlgo_str=="Hybrid") {
49  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
50  } else if (sCAlgo_str=="Island") {
52  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
53  } else if (sCAlgo_str=="DynamicHybrid") {
55  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
56  } else if (sCAlgo_str=="Multi5x5") {
58  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
59  } else {
60  edm::LogError("HiEgammaSCCorrectionMakerError")
61  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: "
62  << sCAlgo_str << " Using Hybrid by default";
64  }
65 
66  // set correction algo parameters
67  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
68  sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise");
69 
70  etThresh_ = ps.getParameter<double>("etThresh");
71 
72  // set the producer parameters
73  outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection");
74  produces<reco::SuperClusterCollection>(outputCollection_);
75 
76  // instanciate the correction algo object
77  energyCorrector_ = std::make_unique<HiEgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_, sCAlgo_, fCorrPset, verbosity_);
78 
79 
80  // energy correction class
82  EnergyCorrection_ = std::unique_ptr<EcalClusterFunctionBaseClass>{EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps)};
83 }
T getParameter(std::string const &) const
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
std::unique_ptr< EcalClusterFunctionBaseClass > EnergyCorrection_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
reco::CaloCluster::AlgoId sCAlgo_
T get(const Candidate &c)
Definition: component.h:55
HiEgammaSCCorrectionMaker::~HiEgammaSCCorrectionMaker ( )
overridedefault

Member Function Documentation

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

Definition at line 88 of file HiEgammaSCCorrectionMaker.cc.

References applyEnergyCorrection_, DEFINE_FWK_MODULE, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), EnergyCorrection_, energyCorrector_, etThresh_, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getSubdetectorGeometry(), egammaRechitFilter_cfi::hitCollection, edm::InputTag::instance(), edm::InputTag::label(), eostools::move(), outputCollection_, reco::CaloCluster::position(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), rHInputProducer_, rHInputProducerTag_, sCAlgo_, sCInputProducer_, sCInputProducerTag_, funct::sin(), str, AlCaHLTBitMon_QueryRunRegistry::string, theCaloTopo_, and ecaldqm::topology().

89 {
90  using namespace edm;
91 
92  // initialize energy correction class
94  EnergyCorrection_->init(es);
95 
96  // get the collection geometry:
98  es.get<CaloGeometryRecord>().get(geoHandle);
99  const CaloGeometry& geometry = *geoHandle;
100  const CaloSubdetectorGeometry *geometry_p;
101 
102  edm::ESHandle<CaloTopology> pTopology;
105 
106  std::string rHInputCollection = rHInputProducerTag_.instance();
107  if(rHInputCollection == "EcalRecHitsEB") {
108  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
109  } else if(rHInputCollection == "EcalRecHitsEE") {
110  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
111  } else if(rHInputCollection == "EcalRecHitsPS") {
112  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
113  } else {
114  std::string str = "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
115  throw(std::runtime_error( str.c_str() ));
116  }
117 
118  // Get raw SuperClusters from the event
119  Handle<reco::SuperClusterCollection> pRawSuperClusters;
120  try {
121  evt.getByToken(sCInputProducer_, pRawSuperClusters);
122  } catch ( cms::Exception& ex ) {
123  edm::LogError("HiEgammaSCCorrectionMakerError")
124  << "Error! can't get the rawSuperClusters "
126  }
127 
128  // Get the RecHits from the event
130  try {
131  evt.getByToken(rHInputProducer_, pRecHits);
132  } catch ( cms::Exception& ex ) {
133  edm::LogError("HiEgammaSCCorrectionMakerError")
134  << "Error! can't get the RecHits "
136  }
137 
138  // Create a pointer to the RecHits and raw SuperClusters
139  const EcalRecHitCollection *hitCollection = pRecHits.product();
140  const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
141 
142  // Define a collection of corrected SuperClusters to put back into the event
143  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
144 
145  // Loop over raw clusters and make corrected ones
146  reco::SuperClusterCollection::const_iterator aClus;
147  for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++)
148  {
149  reco::SuperCluster newClus;
151  newClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, geometry_p, topology, EnergyCorrection_.get());
152  else
153  newClus=*aClus;
154 
155  if(newClus.energy()*sin(newClus.position().theta())>etThresh_) {
156  corrClusters->push_back(newClus);
157  }
158  }
159  // Put collection of corrected SuperClusters into the event
160  evt.put(std::move(corrClusters), outputCollection_);
161 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:131
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
double energy() const
cluster energy
Definition: CaloCluster.h:126
std::unique_ptr< EcalClusterFunctionBaseClass > EnergyCorrection_
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
T get() const
Definition: EventSetup.h:71
edm::ESHandle< CaloTopology > theCaloTopo_
#define str(s)
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
T const * product() const
Definition: ESHandle.h:86
std::string const & instance() const
Definition: InputTag.h:37
reco::CaloCluster::AlgoId sCAlgo_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool HiEgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 58 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

std::unique_ptr<EcalClusterFunctionBaseClass> HiEgammaSCCorrectionMaker::EnergyCorrection_
private

Definition at line 49 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

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

Definition at line 55 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

double HiEgammaSCCorrectionMaker::etThresh_
private

Definition at line 61 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

std::string HiEgammaSCCorrectionMaker::outputCollection_
private

Definition at line 70 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

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

Definition at line 66 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::InputTag HiEgammaSCCorrectionMaker::rHInputProducerTag_
private

Definition at line 64 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

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

Definition at line 69 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

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

Definition at line 67 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::InputTag HiEgammaSCCorrectionMaker::sCInputProducerTag_
private

Definition at line 65 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

double HiEgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 60 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().

edm::ESHandle<CaloTopology> HiEgammaSCCorrectionMaker::theCaloTopo_
private

Definition at line 71 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel HiEgammaSCCorrectionMaker::verbosity_
private

Definition at line 52 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().