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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Producer of corrected SuperClusters

Definition at line 46 of file EgammaSCCorrectionMaker.cc.

Constructor & Destructor Documentation

◆ EgammaSCCorrectionMaker()

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

Definition at line 86 of file EgammaSCCorrectionMaker.cc.

86  {
87  // the input producers
88  rHTag_ = ps.getParameter<edm::InputTag>("recHitProducer");
89  rHInputProducer_ = consumes<EcalRecHitCollection>(rHTag_);
90  sCInputProducer_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("rawSuperClusterProducer"));
91  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
92 
93  // determine which BasicCluster algo we are correcting for
94  //And obtain forrection parameters form cfg file
95  edm::ParameterSet fCorrPset;
96  if (sCAlgo_str == "Hybrid") {
98  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
99  } else if (sCAlgo_str == "Island") {
101  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
102  } else if (sCAlgo_str == "DynamicHybrid") {
104  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
105  } else if (sCAlgo_str == "Multi5x5") {
107  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
108  } else {
109  edm::LogError("EgammaSCCorrectionMakerError")
110  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: " << sCAlgo_str
111  << " Using Hybrid by default";
113  }
114 
115  // set correction algo parameters
116  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
117  applyCrackCorrection_ = ps.getParameter<bool>("applyCrackCorrection");
119  ps.existsAs<bool>("applyLocalContCorrection") ? ps.getParameter<bool>("applyLocalContCorrection") : false;
120 
121  energyCorrectorName_ = ps.getParameter<std::string>("energyCorrectorName");
122  crackCorrectorName_ = ps.existsAs<std::string>("crackCorrectorName")
123  ? ps.getParameter<std::string>("crackCorrectorName")
124  : std::string("EcalClusterCrackCorrection");
125 
126  modeEB_ = ps.getParameter<int>("modeEB");
127  modeEE_ = ps.getParameter<int>("modeEE");
128 
129  sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise");
130 
131  etThresh_ = ps.getParameter<double>("etThresh");
132 
133  // set the producer parameters
134  outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection");
135  produces<reco::SuperClusterCollection>(outputCollection_);
136 
137  // instanciate the correction algo object
138  energyCorrector_ = std::make_unique<EgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_);
139 
140  // energy correction class
143  //energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
144 
147 
149  localContCorrectionFunction_ = std::make_unique<EcalBasicClusterLocalContCorrection>(consumesCollector());
150 }

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 152 of file EgammaSCCorrectionMaker.cc.

152  {
153  using namespace edm;
154 
155  // initialize energy correction class
157  energyCorrectionFunction_->init(es);
158 
159  // initialize energy correction class
161  crackCorrectionFunction_->init(es);
162 
163  // initialize containemnt correction class
166 
167  // get the collection geometry:
168  edm::ESHandle<CaloGeometry> geoHandle;
169  es.get<CaloGeometryRecord>().get(geoHandle);
170  const CaloGeometry& geometry = *geoHandle;
171  const CaloSubdetectorGeometry* geometry_p;
172 
173  std::string rHInputCollection = rHTag_.instance();
174  if (rHInputCollection == "EcalRecHitsEB") {
175  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
176  } else if (rHInputCollection == "EcalRecHitsEE") {
177  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
178  } else if (rHInputCollection == "EcalRecHitsPS") {
179  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
180  } else {
181  std::string str =
182  "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
183  throw(std::runtime_error(str.c_str()));
184  }
185 
186  // Get raw SuperClusters from the event
187  Handle<reco::SuperClusterCollection> pRawSuperClusters;
188  evt.getByToken(sCInputProducer_, pRawSuperClusters);
189 
190  // Get the RecHits from the event
192  evt.getByToken(rHInputProducer_, pRecHits);
193 
194  // Create a pointer to the RecHits and raw SuperClusters
195  const EcalRecHitCollection* hitCollection = pRecHits.product();
196  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
197 
198  // Define a collection of corrected SuperClusters to put back into the event
199  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
200 
201  // Loop over raw clusters and make corrected ones
202  reco::SuperClusterCollection::const_iterator aClus;
203  int i = 0;
204  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
205  reco::SuperCluster enecorrClus, crackcorrClus, localContCorrClus;
206 
207  i++;
208 
210  enecorrClus = energyCorrector_->applyCorrection(*aClus,
211  *hitCollection,
212  sCAlgo_,
213  geometry_p,
216  modeEB_,
217  modeEE_);
218  else
219  enecorrClus = *aClus;
220 
223  else
224  crackcorrClus = enecorrClus;
225 
227  localContCorrClus =
229  else
230  localContCorrClus = crackcorrClus;
231 
232  if (localContCorrClus.energy() * sin(localContCorrClus.position().theta()) > etThresh_) {
233  corrClusters->push_back(localContCorrClus);
234  }
235  }
236 
237  // Put collection of corrected SuperClusters into the event
238  evt.put(std::move(corrClusters), outputCollection_);
239 }

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 61 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ applyEnergyCorrection_

bool EgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 60 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ applyLocalContCorrection_

bool EgammaSCCorrectionMaker::applyLocalContCorrection_
private

Definition at line 62 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ crackCorrectionFunction_

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

Definition at line 53 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ crackCorrectorName_

std::string EgammaSCCorrectionMaker::crackCorrectorName_
private

Definition at line 65 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker().

◆ energyCorrectionFunction_

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

Definition at line 52 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ energyCorrector_

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

Definition at line 57 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ energyCorrectorName_

std::string EgammaSCCorrectionMaker::energyCorrectorName_
private

Definition at line 64 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ etThresh_

double EgammaSCCorrectionMaker::etThresh_
private

Definition at line 72 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ localContCorrectionFunction_

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

Definition at line 54 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ modeEB_

int EgammaSCCorrectionMaker::modeEB_
private

Definition at line 67 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ modeEE_

int EgammaSCCorrectionMaker::modeEE_
private

Definition at line 68 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ outputCollection_

std::string EgammaSCCorrectionMaker::outputCollection_
private

Definition at line 80 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ rHInputProducer_

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

Definition at line 75 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ rHTag_

edm::InputTag EgammaSCCorrectionMaker::rHTag_
private

Definition at line 77 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ sCAlgo_

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

Definition at line 79 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ sCInputProducer_

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

Definition at line 76 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

◆ sigmaElectronicNoise_

double EgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 71 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker().

mps_fire.i
i
Definition: mps_fire.py:428
EgammaSCCorrectionMaker::modeEE_
int modeEE_
Definition: EgammaSCCorrectionMaker.cc:68
EgammaSCCorrectionMaker::rHTag_
edm::InputTag rHTag_
Definition: EgammaSCCorrectionMaker.cc:77
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.cc:64
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.cc:75
EcalBarrel
Definition: EcalSubdetector.h:10
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EgammaSCCorrectionMaker::applyEnergyCorrection_
bool applyEnergyCorrection_
Definition: EgammaSCCorrectionMaker.cc:60
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.cc:65
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.cc:71
reco::CaloCluster::multi5x5
Definition: CaloCluster.h:38
str
#define str(s)
Definition: TestProcessor.cc:53
edm::ESHandle< CaloGeometry >
EgammaSCCorrectionMaker::outputCollection_
std::string outputCollection_
Definition: EgammaSCCorrectionMaker.cc:80
egammaRechitFilter_cfi.hitCollection
hitCollection
Definition: egammaRechitFilter_cfi.py:10
EgammaSCCorrectionMaker::sCAlgo_
reco::CaloCluster::AlgoId sCAlgo_
Definition: EgammaSCCorrectionMaker.cc:79
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
EgammaSCCorrectionMaker::applyCrackCorrection_
bool applyCrackCorrection_
Definition: EgammaSCCorrectionMaker.cc:61
EcalEndcap
Definition: EcalSubdetector.h:10
edm::ParameterSet
Definition: ParameterSet.h:47
EgammaSCCorrectionMaker::localContCorrectionFunction_
std::unique_ptr< EcalBasicClusterLocalContCorrection > localContCorrectionFunction_
Definition: EgammaSCCorrectionMaker.cc:54
EgammaSCCorrectionMaker::sCInputProducer_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
Definition: EgammaSCCorrectionMaker.cc:76
EgammaSCCorrectionMaker::energyCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > energyCorrectionFunction_
Definition: EgammaSCCorrectionMaker.cc:52
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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.cc:62
EgammaSCCorrectionMaker::modeEB_
int modeEB_
Definition: EgammaSCCorrectionMaker.cc:67
EcalPreshower
Definition: EcalSubdetector.h:10
EgammaSCCorrectionMaker::crackCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
Definition: EgammaSCCorrectionMaker.cc:53
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.cc:57
EgammaSCCorrectionMaker::etThresh_
double etThresh_
Definition: EgammaSCCorrectionMaker.cc:72
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
edm::InputTag
Definition: InputTag.h:15