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_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeomToken_
 
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 87 of file EgammaSCCorrectionMaker.cc.

References applyCrackCorrection_, applyEnergyCorrection_, applyLocalContCorrection_, caloGeomToken_, crackCorrectionFunction_, crackCorrectorName_, reco::CaloCluster::dynamicHybrid, energyCorrectionFunction_, energyCorrector_, energyCorrectorName_, deDxTools::esConsumes(), 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.

87  {
88  // the input producers
89  rHTag_ = ps.getParameter<edm::InputTag>("recHitProducer");
90  rHInputProducer_ = consumes<EcalRecHitCollection>(rHTag_);
91  sCInputProducer_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("rawSuperClusterProducer"));
93  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
94 
95  // determine which BasicCluster algo we are correcting for
96  //And obtain forrection parameters form cfg file
97  edm::ParameterSet fCorrPset;
98  if (sCAlgo_str == "Hybrid") {
100  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
101  } else if (sCAlgo_str == "Island") {
103  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
104  } else if (sCAlgo_str == "DynamicHybrid") {
106  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
107  } else if (sCAlgo_str == "Multi5x5") {
109  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
110  } else {
111  edm::LogError("EgammaSCCorrectionMakerError")
112  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: " << sCAlgo_str
113  << " Using Hybrid by default";
115  }
116 
117  // set correction algo parameters
118  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
119  applyCrackCorrection_ = ps.getParameter<bool>("applyCrackCorrection");
121  ps.existsAs<bool>("applyLocalContCorrection") ? ps.getParameter<bool>("applyLocalContCorrection") : false;
122 
123  energyCorrectorName_ = ps.getParameter<std::string>("energyCorrectorName");
124  crackCorrectorName_ = ps.existsAs<std::string>("crackCorrectorName")
125  ? ps.getParameter<std::string>("crackCorrectorName")
126  : std::string("EcalClusterCrackCorrection");
127 
128  modeEB_ = ps.getParameter<int>("modeEB");
129  modeEE_ = ps.getParameter<int>("modeEE");
130 
131  sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise");
132 
133  etThresh_ = ps.getParameter<double>("etThresh");
134 
135  // set the producer parameters
136  outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection");
137  produces<reco::SuperClusterCollection>(outputCollection_);
138 
139  // instanciate the correction algo object
140  energyCorrector_ = std::make_unique<EgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_);
141 
142  // energy correction class
145  EcalClusterFunctionFactory::get()->create(energyCorrectorName_, ps, consumesCollector());
146  //energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
147 
150 
152  localContCorrectionFunction_ = std::make_unique<EcalBasicClusterLocalContCorrection>(consumesCollector());
153 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
Log< level::Error, false > LogError
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
std::unique_ptr< EcalBasicClusterLocalContCorrection > localContCorrectionFunction_
reco::CaloCluster::AlgoId sCAlgo_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
std::unique_ptr< EcalClusterFunctionBaseClass > energyCorrectionFunction_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
#define get
std::unique_ptr< EgammaSCEnergyCorrectionAlgo > energyCorrector_

Member Function Documentation

◆ produce()

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

Definition at line 155 of file EgammaSCCorrectionMaker.cc.

References EgammaSCEnergyCorrectionAlgo::applyCrackCorrection(), applyCrackCorrection_, applyEnergyCorrection_, EgammaSCEnergyCorrectionAlgo::applyLocalContCorrection(), applyLocalContCorrection_, caloGeomToken_, crackCorrectionFunction_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrectionFunction_, energyCorrector_, energyCorrectorName_, etThresh_, edm::Event::getByToken(), edm::EventSetup::getData(), hgceeDigitizer_cfi::hitCollection, 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.

155  {
156  using namespace edm;
157 
158  // initialize energy correction class
160  energyCorrectionFunction_->init(es);
161 
162  // initialize energy correction class
164  crackCorrectionFunction_->init(es);
165 
166  // initialize containemnt correction class
169 
170  // get the collection geometry:
172  const CaloSubdetectorGeometry* geometry_p;
173 
174  std::string rHInputCollection = rHTag_.instance();
175  if (rHInputCollection == "EcalRecHitsEB") {
176  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
177  } else if (rHInputCollection == "EcalRecHitsEE") {
178  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
179  } else if (rHInputCollection == "EcalRecHitsPS") {
180  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
181  } else {
182  std::string str =
183  "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
184  throw(std::runtime_error(str.c_str()));
185  }
186 
187  // Get raw SuperClusters from the event
188  Handle<reco::SuperClusterCollection> pRawSuperClusters;
189  evt.getByToken(sCInputProducer_, pRawSuperClusters);
190 
191  // Get the RecHits from the event
193  evt.getByToken(rHInputProducer_, pRecHits);
194 
195  // Create a pointer to the RecHits and raw SuperClusters
196  const EcalRecHitCollection* hitCollection = pRecHits.product();
197  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
198 
199  // Define a collection of corrected SuperClusters to put back into the event
200  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
201 
202  // Loop over raw clusters and make corrected ones
203  reco::SuperClusterCollection::const_iterator aClus;
204  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
205  reco::SuperCluster enecorrClus, crackcorrClus, localContCorrClus;
206 
208  enecorrClus = energyCorrector_->applyCorrection(*aClus,
209  *hitCollection,
210  sCAlgo_,
211  geometry_p,
214  modeEB_,
215  modeEE_);
216  else
217  enecorrClus = *aClus;
218 
221  else
222  crackcorrClus = enecorrClus;
223 
225  localContCorrClus =
227  else
228  localContCorrClus = crackcorrClus;
229 
230  if (localContCorrClus.energy() * sin(localContCorrClus.position().theta()) > etThresh_) {
231  corrClusters->push_back(localContCorrClus);
232  }
233  }
234 
235  // Put collection of corrected SuperClusters into the event
236  evt.put(std::move(corrClusters), outputCollection_);
237 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::string const & instance() const
Definition: InputTag.h:37
static reco::SuperCluster applyLocalContCorrection(const reco::SuperCluster &cl, BasicClusterFunction localContCorrectionFunction)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::unique_ptr< EcalBasicClusterLocalContCorrection > localContCorrectionFunction_
reco::CaloCluster::AlgoId sCAlgo_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
double energy() const
cluster energy
Definition: CaloCluster.h:149
std::unique_ptr< EcalClusterFunctionBaseClass > energyCorrectionFunction_
static reco::SuperCluster applyCrackCorrection(const reco::SuperCluster &cl, EcalClusterFunctionBaseClass *crackCorrectionFunction)
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
HLT enums.
#define str(s)
std::unique_ptr< EgammaSCEnergyCorrectionAlgo > energyCorrector_
def move(src, dest)
Definition: eostools.py:511

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

◆ caloGeomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EgammaSCCorrectionMaker::caloGeomToken_
private

Definition at line 78 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 81 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 80 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().