CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EgammaSCCorrectionMaker Class Reference

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

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

Public Member Functions

 EgammaSCCorrectionMaker (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EgammaSCCorrectionMaker () 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 applyCrackCorrection_
 
bool applyEnergyCorrection_
 
bool applyLocalContCorrection_
 
std::unique_ptr< EcalClusterFunctionBaseClasscrackCorrectionFunction_
 
std::string crackCorrectorName_
 
std::unique_ptr< EcalClusterFunctionBaseClassenergyCorrectionFunction_
 
std::unique_ptr< EgammaSCEnergyCorrectionAlgoenergyCorrector_
 
std::string energyCorrectorName_
 
double etThresh_
 
std::unique_ptr< EcalClusterFunctionBaseClasslocalContCorrectionFunction_
 
std::string localContCorrectorName_
 
int modeEB_
 
int modeEE_
 
std::string outputCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionrHInputProducer_
 
edm::InputTag rHTag_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsCInputProducer_
 
double sigmaElectronicNoise_
 

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 EgammaSCCorrectionMaker.h.

Constructor & Destructor Documentation

◆ EgammaSCCorrectionMaker()

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

Definition at line 22 of file EgammaSCCorrectionMaker.cc.

22  {
23  // the input producers
24  rHTag_ = ps.getParameter<edm::InputTag>("recHitProducer");
25  rHInputProducer_ = consumes<EcalRecHitCollection>(rHTag_);
26  sCInputProducer_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("rawSuperClusterProducer"));
27  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
28 
29  // determine which BasicCluster algo we are correcting for
30  //And obtain forrection parameters form cfg file
31  edm::ParameterSet fCorrPset;
32  if (sCAlgo_str == "Hybrid") {
34  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
35  } else if (sCAlgo_str == "Island") {
37  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
38  } else if (sCAlgo_str == "DynamicHybrid") {
40  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
41  } else if (sCAlgo_str == "Multi5x5") {
43  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
44  } else {
45  edm::LogError("EgammaSCCorrectionMakerError")
46  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: " << sCAlgo_str
47  << " Using Hybrid by default";
49  }
50 
51  // set correction algo parameters
52  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
53  applyCrackCorrection_ = ps.getParameter<bool>("applyCrackCorrection");
55  ps.existsAs<bool>("applyLocalContCorrection") ? ps.getParameter<bool>("applyLocalContCorrection") : false;
56 
57  energyCorrectorName_ = ps.getParameter<std::string>("energyCorrectorName");
58  crackCorrectorName_ = ps.existsAs<std::string>("crackCorrectorName")
59  ? ps.getParameter<std::string>("crackCorrectorName")
60  : std::string("EcalClusterCrackCorrection");
61  localContCorrectorName_ = ps.existsAs<std::string>("localContCorrectorName")
62  ? ps.getParameter<std::string>("localContCorrectorName")
63  : std::string("EcalBasicClusterLocalContCorrection");
64 
65  modeEB_ = ps.getParameter<int>("modeEB");
66  modeEE_ = ps.getParameter<int>("modeEE");
67 
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<EgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_, sCAlgo_, fCorrPset);
78 
79  // energy correction class
82  //energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
83 
86 
89 }

References applyCrackCorrection_, applyEnergyCorrection_, applyLocalContCorrection_, crackCorrectionFunction_, crackCorrectorName_, reco::CaloCluster::dynamicHybrid, energyCorrectionFunction_, energyCorrector_, energyCorrectorName_, etThresh_, edm::ParameterSet::existsAs(), get, edm::ParameterSet::getParameter(), reco::CaloCluster::hybrid, reco::CaloCluster::island, localContCorrectionFunction_, localContCorrectorName_, modeEB_, modeEE_, reco::CaloCluster::multi5x5, outputCollection_, rHInputProducer_, rHTag_, sCAlgo_, sCInputProducer_, sigmaElectronicNoise_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~EgammaSCCorrectionMaker()

EgammaSCCorrectionMaker::~EgammaSCCorrectionMaker ( )
overridedefault

Member Function Documentation

◆ produce()

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

Definition at line 93 of file EgammaSCCorrectionMaker.cc.

93  {
94  using namespace edm;
95 
96  // initialize energy correction class
98  energyCorrectionFunction_->init(es);
99 
100  // initialize energy correction class
102  crackCorrectionFunction_->init(es);
103 
104  // initialize containemnt correction class
107 
108  // get the collection geometry:
109  edm::ESHandle<CaloGeometry> geoHandle;
110  es.get<CaloGeometryRecord>().get(geoHandle);
111  const CaloGeometry& geometry = *geoHandle;
112  const CaloSubdetectorGeometry* geometry_p;
113 
114  std::string rHInputCollection = rHTag_.instance();
115  if (rHInputCollection == "EcalRecHitsEB") {
116  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
117  } else if (rHInputCollection == "EcalRecHitsEE") {
118  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
119  } else if (rHInputCollection == "EcalRecHitsPS") {
120  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
121  } else {
122  std::string str =
123  "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
124  throw(std::runtime_error(str.c_str()));
125  }
126 
127  // Get raw SuperClusters from the event
128  Handle<reco::SuperClusterCollection> pRawSuperClusters;
129  evt.getByToken(sCInputProducer_, pRawSuperClusters);
130 
131  // Get the RecHits from the event
133  evt.getByToken(rHInputProducer_, pRecHits);
134 
135  // Create a pointer to the RecHits and raw SuperClusters
136  const EcalRecHitCollection* hitCollection = pRecHits.product();
137  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
138 
139  // Define a collection of corrected SuperClusters to put back into the event
140  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
141 
142  // Loop over raw clusters and make corrected ones
143  reco::SuperClusterCollection::const_iterator aClus;
144  int i = 0;
145  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
146  reco::SuperCluster enecorrClus, crackcorrClus, localContCorrClus;
147 
148  i++;
149 
151  enecorrClus = energyCorrector_->applyCorrection(*aClus,
152  *hitCollection,
153  sCAlgo_,
154  geometry_p,
157  modeEB_,
158  modeEE_);
159  else
160  enecorrClus = *aClus;
161 
163  crackcorrClus = energyCorrector_->applyCrackCorrection(enecorrClus, crackCorrectionFunction_.get());
164  else
165  crackcorrClus = enecorrClus;
166 
168  localContCorrClus = energyCorrector_->applyLocalContCorrection(crackcorrClus, localContCorrectionFunction_.get());
169  else
170  localContCorrClus = crackcorrClus;
171 
172  if (localContCorrClus.energy() * sin(localContCorrClus.position().theta()) > etThresh_) {
173  corrClusters->push_back(localContCorrClus);
174  }
175  }
176 
177  // Put collection of corrected SuperClusters into the event
178  evt.put(std::move(corrClusters), outputCollection_);
179 }

References applyCrackCorrection_, applyEnergyCorrection_, applyLocalContCorrection_, crackCorrectionFunction_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrectionFunction_, energyCorrector_, energyCorrectorName_, etThresh_, edm::EventSetup::get(), get, edm::Event::getByToken(), egammaRechitFilter_cfi::hitCollection, mps_fire::i, edm::InputTag::instance(), localContCorrectionFunction_, modeEB_, modeEE_, eostools::move(), outputCollection_, reco::CaloCluster::position(), edm::Handle< T >::product(), edm::Event::put(), rHInputProducer_, rHTag_, sCAlgo_, sCInputProducer_, funct::sin(), str, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ applyCrackCorrection_

bool EgammaSCCorrectionMaker::applyCrackCorrection_
private

Definition at line 53 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ applyEnergyCorrection_

bool EgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 52 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ applyLocalContCorrection_

bool EgammaSCCorrectionMaker::applyLocalContCorrection_
private

Definition at line 54 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ crackCorrectionFunction_

std::unique_ptr<EcalClusterFunctionBaseClass> EgammaSCCorrectionMaker::crackCorrectionFunction_
private

Definition at line 45 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ crackCorrectorName_

std::string EgammaSCCorrectionMaker::crackCorrectorName_
private

Definition at line 57 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

◆ energyCorrectionFunction_

std::unique_ptr<EcalClusterFunctionBaseClass> EgammaSCCorrectionMaker::energyCorrectionFunction_
private

Definition at line 44 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ energyCorrector_

std::unique_ptr<EgammaSCEnergyCorrectionAlgo> EgammaSCCorrectionMaker::energyCorrector_
private

Definition at line 49 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ energyCorrectorName_

std::string EgammaSCCorrectionMaker::energyCorrectorName_
private

Definition at line 56 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ etThresh_

double EgammaSCCorrectionMaker::etThresh_
private

Definition at line 65 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ localContCorrectionFunction_

std::unique_ptr<EcalClusterFunctionBaseClass> EgammaSCCorrectionMaker::localContCorrectionFunction_
private

Definition at line 46 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ localContCorrectorName_

std::string EgammaSCCorrectionMaker::localContCorrectorName_
private

Definition at line 58 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

◆ modeEB_

int EgammaSCCorrectionMaker::modeEB_
private

Definition at line 60 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ modeEE_

int EgammaSCCorrectionMaker::modeEE_
private

Definition at line 61 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ outputCollection_

std::string EgammaSCCorrectionMaker::outputCollection_
private

Definition at line 73 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ rHInputProducer_

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

Definition at line 68 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ rHTag_

edm::InputTag EgammaSCCorrectionMaker::rHTag_
private

Definition at line 70 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ sCAlgo_

reco::CaloCluster::AlgoId EgammaSCCorrectionMaker::sCAlgo_
private

Definition at line 72 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ sCInputProducer_

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

Definition at line 69 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ sigmaElectronicNoise_

double EgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 64 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

mps_fire.i
i
Definition: mps_fire.py:355
EgammaSCCorrectionMaker::modeEE_
int modeEE_
Definition: EgammaSCCorrectionMaker.h:61
EgammaSCCorrectionMaker::rHTag_
edm::InputTag rHTag_
Definition: EgammaSCCorrectionMaker.h:70
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
EgammaSCCorrectionMaker::energyCorrectorName_
std::string energyCorrectorName_
Definition: EgammaSCCorrectionMaker.h:56
geometry
Definition: geometry.py:1
reco::CaloCluster::hybrid
Definition: CaloCluster.h:35
edm::SortedCollection< EcalRecHit >
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::Handle
Definition: AssociativeIterator.h:50
EgammaSCCorrectionMaker::rHInputProducer_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
Definition: EgammaSCCorrectionMaker.h:68
EcalBarrel
Definition: EcalSubdetector.h:10
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EgammaSCCorrectionMaker::localContCorrectorName_
std::string localContCorrectorName_
Definition: EgammaSCCorrectionMaker.h:58
EgammaSCCorrectionMaker::applyEnergyCorrection_
bool applyEnergyCorrection_
Definition: EgammaSCCorrectionMaker.h:52
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
CaloGeometry
Definition: CaloGeometry.h:21
EgammaSCCorrectionMaker::crackCorrectorName_
std::string crackCorrectorName_
Definition: EgammaSCCorrectionMaker.h:57
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EgammaSCCorrectionMaker::sigmaElectronicNoise_
double sigmaElectronicNoise_
Definition: EgammaSCCorrectionMaker.h:64
reco::CaloCluster::multi5x5
Definition: CaloCluster.h:38
str
#define str(s)
Definition: TestProcessor.cc:48
edm::ESHandle< CaloGeometry >
EgammaSCCorrectionMaker::outputCollection_
std::string outputCollection_
Definition: EgammaSCCorrectionMaker.h:73
egammaRechitFilter_cfi.hitCollection
hitCollection
Definition: egammaRechitFilter_cfi.py:10
EgammaSCCorrectionMaker::sCAlgo_
reco::CaloCluster::AlgoId sCAlgo_
Definition: EgammaSCCorrectionMaker.h:72
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
EgammaSCCorrectionMaker::applyCrackCorrection_
bool applyCrackCorrection_
Definition: EgammaSCCorrectionMaker.h:53
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
EgammaSCCorrectionMaker::sCInputProducer_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
Definition: EgammaSCCorrectionMaker.h:69
EgammaSCCorrectionMaker::energyCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > energyCorrectionFunction_
Definition: EgammaSCCorrectionMaker.h:44
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
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
EgammaSCCorrectionMaker::applyLocalContCorrection_
bool applyLocalContCorrection_
Definition: EgammaSCCorrectionMaker.h:54
EgammaSCCorrectionMaker::modeEB_
int modeEB_
Definition: EgammaSCCorrectionMaker.h:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalPreshower
Definition: EcalSubdetector.h:10
EgammaSCCorrectionMaker::crackCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
Definition: EgammaSCCorrectionMaker.h:45
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::CaloCluster::dynamicHybrid
Definition: CaloCluster.h:37
EgammaSCCorrectionMaker::localContCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > localContCorrectionFunction_
Definition: EgammaSCCorrectionMaker.h:46
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
EgammaSCCorrectionMaker::energyCorrector_
std::unique_ptr< EgammaSCEnergyCorrectionAlgo > energyCorrector_
Definition: EgammaSCCorrectionMaker.h:49
EgammaSCCorrectionMaker::etThresh_
double etThresh_
Definition: EgammaSCCorrectionMaker.h:65
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
edm::InputTag
Definition: InputTag.h:15