CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
CaloGeometryRecord
caloGeomToken_
 
std::unique_ptr
< EcalClusterFunctionBaseClass
crackCorrectionFunction_
 
std::string crackCorrectorName_
 
std::unique_ptr
< EcalClusterFunctionBaseClass
energyCorrectionFunction_
 
std::unique_ptr
< EgammaSCEnergyCorrectionAlgo
energyCorrector_
 
std::string energyCorrectorName_
 
double etThresh_
 
std::unique_ptr
< EcalBasicClusterLocalContCorrection
localContCorrectionFunction_
 
int modeEB_
 
int modeEE_
 
std::string outputCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
rHInputProducer_
 
edm::InputTag rHTag_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
sCInputProducer_
 
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 ( 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 
148  if (applyCrackCorrection_)
149  crackCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(crackCorrectorName_, ps, consumesCollector());
150 
151  if (applyLocalContCorrection_)
152  localContCorrectionFunction_ = std::make_unique<EcalBasicClusterLocalContCorrection>(consumesCollector());
153 }
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
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_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::unique_ptr< EgammaSCEnergyCorrectionAlgo > energyCorrector_

Member Function Documentation

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_, relativeConstraints::geometry, edm::Event::getByToken(), edm::EventSetup::getData(), reco_application_2006_simpleTBanalysis_cfg::hitCollection, mps_fire::i, edm::InputTag::instance(), localContCorrectionFunction_, modeEB_, modeEE_, eostools::move(), outputCollection_, reco::CaloCluster::position(), 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  int i = 0;
205  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
206  reco::SuperCluster enecorrClus, crackcorrClus, localContCorrClus;
207 
208  i++;
209 
211  enecorrClus = energyCorrector_->applyCorrection(*aClus,
212  *hitCollection,
213  sCAlgo_,
214  geometry_p,
217  modeEB_,
218  modeEE_);
219  else
220  enecorrClus = *aClus;
221 
224  else
225  crackcorrClus = enecorrClus;
226 
228  localContCorrClus =
230  else
231  localContCorrClus = crackcorrClus;
232 
233  if (localContCorrClus.energy() * sin(localContCorrClus.position().theta()) > etThresh_) {
234  corrClusters->push_back(localContCorrClus);
235  }
236  }
237 
238  // Put collection of corrected SuperClusters into the event
239  evt.put(std::move(corrClusters), outputCollection_);
240 }
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
static reco::SuperCluster applyLocalContCorrection(const reco::SuperCluster &cl, BasicClusterFunction localContCorrectionFunction)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
def move
Definition: eostools.py:511
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_
#define str(s)
std::string const & instance() const
Definition: InputTag.h:37
std::unique_ptr< EgammaSCEnergyCorrectionAlgo > energyCorrector_

Member Data Documentation

bool EgammaSCCorrectionMaker::applyCrackCorrection_
private

Definition at line 61 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

bool EgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 60 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

bool EgammaSCCorrectionMaker::applyLocalContCorrection_
private

Definition at line 62 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 78 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 53 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

std::string EgammaSCCorrectionMaker::crackCorrectorName_
private

Definition at line 65 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker().

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

Definition at line 52 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 57 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

std::string EgammaSCCorrectionMaker::energyCorrectorName_
private

Definition at line 64 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

double EgammaSCCorrectionMaker::etThresh_
private

Definition at line 72 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 54 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

int EgammaSCCorrectionMaker::modeEB_
private

Definition at line 67 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

int EgammaSCCorrectionMaker::modeEE_
private

Definition at line 68 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

std::string EgammaSCCorrectionMaker::outputCollection_
private

Definition at line 81 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 75 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

edm::InputTag EgammaSCCorrectionMaker::rHTag_
private

Definition at line 77 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 80 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 76 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker(), and produce().

double EgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 71 of file EgammaSCCorrectionMaker.cc.

Referenced by EgammaSCCorrectionMaker().