CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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
 
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::HiEgammaSCCorrectionMaker ( const edm::ParameterSet ps)
explicit

Definition at line 24 of file HiEgammaSCCorrectionMaker.cc.

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 }

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_.

◆ ~HiEgammaSCCorrectionMaker()

HiEgammaSCCorrectionMaker::~HiEgammaSCCorrectionMaker ( )
overridedefault

Member Function Documentation

◆ produce()

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

Definition at line 79 of file HiEgammaSCCorrectionMaker.cc.

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 }

References applyEnergyCorrection_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrector_, etThresh_, edm::EventSetup::get(), get, edm::Event::getByToken(), 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().

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().

◆ outputCollection_

std::string HiEgammaSCCorrectionMaker::outputCollection_
private

Definition at line 63 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 62 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().

◆ theCaloTopo_

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

Definition at line 64 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

◆ verbosity_

HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel HiEgammaSCCorrectionMaker::verbosity_
private

Definition at line 45 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().

edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
reco::SuperCluster
Definition: SuperCluster.h:18
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
HiEgammaSCCorrectionMaker::sCInputProducer_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
Definition: HiEgammaSCCorrectionMaker.h:60
geometry
Definition: geometry.py:1
reco::CaloCluster::hybrid
Definition: CaloCluster.h:35
edm::SortedCollection< EcalRecHit >
HiEgammaSCCorrectionMaker::sCInputProducerTag_
edm::InputTag sCInputProducerTag_
Definition: HiEgammaSCCorrectionMaker.h:58
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
edm::Handle
Definition: AssociativeIterator.h:50
CaloTopology
Definition: CaloTopology.h:19
EcalBarrel
Definition: EcalSubdetector.h:10
HiEgammaSCCorrectionMaker::energyCorrector_
std::unique_ptr< HiEgammaSCEnergyCorrectionAlgo > energyCorrector_
Definition: HiEgammaSCCorrectionMaker.h:48
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HiEgammaSCCorrectionMaker::sigmaElectronicNoise_
double sigmaElectronicNoise_
Definition: HiEgammaSCCorrectionMaker.h:53
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
HiEgammaSCCorrectionMaker::rHInputProducer_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
Definition: HiEgammaSCCorrectionMaker.h:59
CaloGeometry
Definition: CaloGeometry.h:21
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
ecaldqm::topology
const CaloTopology * topology(nullptr)
HiEgammaSCEnergyCorrectionAlgo::pERROR
Definition: HiEgammaSCEnergyCorrectionAlgo.h:24
reco::CaloCluster::multi5x5
Definition: CaloCluster.h:38
HiEgammaSCCorrectionMaker::verbosity_
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
Definition: HiEgammaSCCorrectionMaker.h:45
str
#define str(s)
Definition: TestProcessor.cc:48
edm::ESHandle< CaloGeometry >
egammaRechitFilter_cfi.hitCollection
hitCollection
Definition: egammaRechitFilter_cfi.py:10
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HiEgammaSCEnergyCorrectionAlgo::pINFO
Definition: HiEgammaSCEnergyCorrectionAlgo.h:24
EcalEndcap
Definition: EcalSubdetector.h:10
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
HiEgammaSCCorrectionMaker::outputCollection_
std::string outputCollection_
Definition: HiEgammaSCCorrectionMaker.h:63
HiEgammaSCCorrectionMaker::rHInputProducerTag_
edm::InputTag rHInputProducerTag_
Definition: HiEgammaSCCorrectionMaker.h:57
DetId::Ecal
Definition: DetId.h:27
get
#define get
reco::CaloCluster::island
Definition: CaloCluster.h:34
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalPreshower
Definition: EcalSubdetector.h:10
eostools.move
def move(src, dest)
Definition: eostools.py:511
HiEgammaSCEnergyCorrectionAlgo::pDEBUG
Definition: HiEgammaSCEnergyCorrectionAlgo.h:24
reco::CaloCluster::dynamicHybrid
Definition: CaloCluster.h:37
HiEgammaSCCorrectionMaker::etThresh_
double etThresh_
Definition: HiEgammaSCCorrectionMaker.h:54
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
cms::Exception
Definition: Exception.h:70
HiEgammaSCCorrectionMaker::theCaloTopo_
edm::ESHandle< CaloTopology > theCaloTopo_
Definition: HiEgammaSCCorrectionMaker.h:64
HiEgammaSCCorrectionMaker::sCAlgo_
reco::CaloCluster::AlgoId sCAlgo_
Definition: HiEgammaSCCorrectionMaker.h:62
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
edm::InputTag
Definition: InputTag.h:15
HiEgammaSCCorrectionMaker::applyEnergyCorrection_
bool applyEnergyCorrection_
Definition: HiEgammaSCCorrectionMaker.h:51