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
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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< EcalBasicClusterLocalContCorrectionlocalContCorrectionFunction_
 
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 39 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 
62  modeEB_ = ps.getParameter<int>("modeEB");
63  modeEE_ = ps.getParameter<int>("modeEE");
64 
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<EgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_);
75 
76  // energy correction class
79  //energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
80 
83 
85  localContCorrectionFunction_ = std::make_unique<EcalBasicClusterLocalContCorrection>(consumesCollector());
86 }

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_, modeEB_, modeEE_, reco::CaloCluster::multi5x5, outputCollection_, rHInputProducer_, rHTag_, sCAlgo_, sCInputProducer_, sigmaElectronicNoise_, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Function Documentation

◆ produce()

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

Definition at line 88 of file EgammaSCCorrectionMaker.cc.

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

References EgammaSCEnergyCorrectionAlgo::applyCrackCorrection(), applyCrackCorrection_, applyEnergyCorrection_, EgammaSCEnergyCorrectionAlgo::applyLocalContCorrection(), 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 54 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ applyEnergyCorrection_

bool EgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 53 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ applyLocalContCorrection_

bool EgammaSCCorrectionMaker::applyLocalContCorrection_
private

Definition at line 55 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ crackCorrectionFunction_

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

Definition at line 46 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ crackCorrectorName_

std::string EgammaSCCorrectionMaker::crackCorrectorName_
private

Definition at line 58 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

◆ energyCorrectionFunction_

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

Definition at line 45 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ energyCorrector_

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

Definition at line 50 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ energyCorrectorName_

std::string EgammaSCCorrectionMaker::energyCorrectorName_
private

Definition at line 57 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<EcalBasicClusterLocalContCorrection> EgammaSCCorrectionMaker::localContCorrectionFunction_
private

Definition at line 47 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ 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:428
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:57
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:171
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::applyEnergyCorrection_
bool applyEnergyCorrection_
Definition: EgammaSCCorrectionMaker.h:53
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:58
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EgammaSCEnergyCorrectionAlgo::applyCrackCorrection
static reco::SuperCluster applyCrackCorrection(const reco::SuperCluster &cl, EcalClusterFunctionBaseClass *crackCorrectionFunction)
Definition: EgammaSCEnergyCorrectionAlgo.cc:215
EgammaSCCorrectionMaker::sigmaElectronicNoise_
double sigmaElectronicNoise_
Definition: EgammaSCCorrectionMaker.h:64
reco::CaloCluster::multi5x5
Definition: CaloCluster.h:38
str
#define str(s)
Definition: TestProcessor.cc:52
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:535
EgammaSCCorrectionMaker::applyCrackCorrection_
bool applyCrackCorrection_
Definition: EgammaSCCorrectionMaker.h:54
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
edm::ParameterSet
Definition: ParameterSet.h:47
EgammaSCCorrectionMaker::localContCorrectionFunction_
std::unique_ptr< EcalBasicClusterLocalContCorrection > localContCorrectionFunction_
Definition: EgammaSCCorrectionMaker.h:47
EgammaSCCorrectionMaker::sCInputProducer_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
Definition: EgammaSCCorrectionMaker.h:69
EgammaSCCorrectionMaker::energyCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > energyCorrectionFunction_
Definition: EgammaSCCorrectionMaker.h:45
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
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:55
EgammaSCCorrectionMaker::modeEB_
int modeEB_
Definition: EgammaSCCorrectionMaker.h:60
EcalPreshower
Definition: EcalSubdetector.h:10
EgammaSCCorrectionMaker::crackCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
Definition: EgammaSCCorrectionMaker.h:46
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::CaloCluster::dynamicHybrid
Definition: CaloCluster.h:37
EgammaSCEnergyCorrectionAlgo::applyLocalContCorrection
static reco::SuperCluster applyLocalContCorrection(const reco::SuperCluster &cl, BasicClusterFunction localContCorrectionFunction)
Definition: EgammaSCEnergyCorrectionAlgo.cc:233
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EgammaSCCorrectionMaker::energyCorrector_
std::unique_ptr< EgammaSCEnergyCorrectionAlgo > energyCorrector_
Definition: EgammaSCCorrectionMaker.h:50
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