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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

bool applyEnergyCorrection_
 
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 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, verbosity_, and ~HiEgammaSCCorrectionMaker().

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

Member Function Documentation

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

Definition at line 79 of file HiEgammaSCCorrectionMaker.cc.

References applyEnergyCorrection_, DEFINE_FWK_MODULE, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), 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::Event::put(), rHInputProducer_, rHInputProducerTag_, sCAlgo_, sCInputProducer_, sCInputProducerTag_, funct::sin(), str, AlCaHLTBitMon_QueryRunRegistry::string, theCaloTopo_, and ecaldqm::topology().

79  {
80  using namespace edm;
81 
82  // get the collection geometry:
84  es.get<CaloGeometryRecord>().get(geoHandle);
85  const CaloGeometry& geometry = *geoHandle;
86  const CaloSubdetectorGeometry* geometry_p;
87 
91 
92  std::string rHInputCollection = rHInputProducerTag_.instance();
93  if (rHInputCollection == "EcalRecHitsEB") {
94  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
95  } else if (rHInputCollection == "EcalRecHitsEE") {
96  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
97  } else if (rHInputCollection == "EcalRecHitsPS") {
98  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
99  } else {
100  std::string str =
101  "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
102  throw(std::runtime_error(str.c_str()));
103  }
104 
105  // Get raw SuperClusters from the event
106  Handle<reco::SuperClusterCollection> pRawSuperClusters;
107  try {
108  evt.getByToken(sCInputProducer_, pRawSuperClusters);
109  } catch (cms::Exception& ex) {
110  edm::LogError("HiEgammaSCCorrectionMakerError")
111  << "Error! can't get the rawSuperClusters " << sCInputProducerTag_.label();
112  }
113 
114  // Get the RecHits from the event
116  try {
117  evt.getByToken(rHInputProducer_, pRecHits);
118  } catch (cms::Exception& ex) {
119  edm::LogError("HiEgammaSCCorrectionMakerError") << "Error! can't get the RecHits " << rHInputProducerTag_.label();
120  }
121 
122  // Create a pointer to the RecHits and raw SuperClusters
123  const EcalRecHitCollection* hitCollection = pRecHits.product();
124  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
125 
126  // Define a collection of corrected SuperClusters to put back into the event
127  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
128 
129  // Loop over raw clusters and make corrected ones
130  reco::SuperClusterCollection::const_iterator aClus;
131  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
132  reco::SuperCluster newClus;
134  newClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, *geometry_p, topology);
135  else
136  newClus = *aClus;
137 
138  if (newClus.energy() * sin(newClus.position().theta()) > etThresh_) {
139  corrClusters->push_back(newClus);
140  }
141  }
142  // Put collection of corrected SuperClusters into the event
143  evt.put(std::move(corrClusters), outputCollection_);
144 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
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:131
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
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:148
T const * product() const
Definition: Handle.h:69
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
T get() const
Definition: EventSetup.h:73
edm::ESHandle< CaloTopology > theCaloTopo_
#define str(s)
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
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 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().

std::string HiEgammaSCCorrectionMaker::outputCollection_
private

Definition at line 63 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 62 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::ESHandle<CaloTopology> HiEgammaSCCorrectionMaker::theCaloTopo_
private

Definition at line 64 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel HiEgammaSCCorrectionMaker::verbosity_
private

Definition at line 45 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().