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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool applyCrackCorrection_
 
bool applyEnergyCorrection_
 
bool applyLocalContCorrection_
 
EcalClusterFunctionBaseClasscrackCorrectionFunction_
 
std::string crackCorrectorName_
 
EcalClusterFunctionBaseClassenergyCorrectionFunction_
 
EgammaSCEnergyCorrectionAlgoenergyCorrector_
 
std::string energyCorrectorName_
 
double etThresh_
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Producer of corrected SuperClusters

Definition at line 38 of file EgammaSCCorrectionMaker.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file EgammaSCCorrectionMaker.cc.

References applyCrackCorrection_, applyEnergyCorrection_, applyLocalContCorrection_, crackCorrectionFunction_, crackCorrectorName_, reco::CaloCluster::dynamicHybrid, energyCorrectionFunction_, energyCorrector_, energyCorrectorName_, etThresh_, edm::ParameterSet::existsAs(), reco::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.

23 {
24 
25 
26  // the input producers
27  rHTag_ = ps.getParameter<edm::InputTag>("recHitProducer");
28  rHInputProducer_ = consumes<EcalRecHitCollection>(rHTag_);
29  sCInputProducer_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("rawSuperClusterProducer"));
30  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
31 
32  // determine which BasicCluster algo we are correcting for
33  //And obtain forrection parameters form cfg file
34  edm::ParameterSet fCorrPset;
35  if (sCAlgo_str=="Hybrid") {
37  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
38  } else if (sCAlgo_str=="Island") {
40  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
41  } else if (sCAlgo_str=="DynamicHybrid") {
43  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
44  } else if (sCAlgo_str=="Multi5x5") {
46  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
47  } else {
48  edm::LogError("EgammaSCCorrectionMakerError")
49  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: "
50  << sCAlgo_str << " Using Hybrid by default";
52  }
53 
54  // set correction algo parameters
55  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
56  applyCrackCorrection_ = ps.getParameter<bool>("applyCrackCorrection");
57  applyLocalContCorrection_= ps.existsAs<bool>("applyLocalContCorrection") ?
58  ps.getParameter<bool>("applyLocalContCorrection") : false;
59 
60  energyCorrectorName_ = ps.getParameter<std::string>("energyCorrectorName");
61  crackCorrectorName_ = ps.existsAs<std::string>("crackCorrectorName") ?
62  ps.getParameter<std::string>("crackCorrectorName") : std::string("EcalClusterCrackCorrection");
63  localContCorrectorName_= ps.existsAs<std::string>("localContCorrectorName") ?
64  ps.getParameter<std::string>("localContCorrectorName") : std::string("EcalBasicClusterLocalContCorrection") ;
65 
66  modeEB_ = ps.getParameter<int>("modeEB");
67  modeEE_ = ps.getParameter<int>("modeEE");
68 
69  sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise");
70 
71  etThresh_ = ps.getParameter<double>("etThresh");
72 
73 
74 
75  // set the producer parameters
76  outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection");
77  produces<reco::SuperClusterCollection>(outputCollection_);
78 
79  // instanciate the correction algo object
80  energyCorrector_ = new EgammaSCEnergyCorrectionAlgo(sigmaElectronicNoise_, sCAlgo_, fCorrPset);
81 
82  // energy correction class
85  //energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
86  else
88 
89  if (applyCrackCorrection_ )
90  crackCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(crackCorrectorName_, ps);
91  else
93 
94 
95  if (applyLocalContCorrection_ )
97  else
99 
100 }
T getParameter(std::string const &) const
EcalClusterFunctionBaseClass * localContCorrectionFunction_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
EcalClusterFunctionBaseClass * energyCorrectionFunction_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
EcalClusterFunctionBaseClass * crackCorrectionFunction_
reco::CaloCluster::AlgoId sCAlgo_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
EgammaSCEnergyCorrectionAlgo * energyCorrector_
T get(const Candidate &c)
Definition: component.h:55
EgammaSCCorrectionMaker::~EgammaSCCorrectionMaker ( )
override

Definition at line 102 of file EgammaSCCorrectionMaker.cc.

References crackCorrectionFunction_, energyCorrectionFunction_, energyCorrector_, and localContCorrectionFunction_.

103 {
107 
108  delete energyCorrector_;
109 }
EcalClusterFunctionBaseClass * localContCorrectionFunction_
EcalClusterFunctionBaseClass * energyCorrectionFunction_
EcalClusterFunctionBaseClass * crackCorrectionFunction_
EgammaSCEnergyCorrectionAlgo * energyCorrector_

Member Function Documentation

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

Definition at line 112 of file EgammaSCCorrectionMaker.cc.

References EgammaSCEnergyCorrectionAlgo::applyCorrection(), EgammaSCEnergyCorrectionAlgo::applyCrackCorrection(), applyCrackCorrection_, applyEnergyCorrection_, EgammaSCEnergyCorrectionAlgo::applyLocalContCorrection(), applyLocalContCorrection_, crackCorrectionFunction_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrectionFunction_, energyCorrector_, energyCorrectorName_, etThresh_, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getSubdetectorGeometry(), egammaRechitFilter_cfi::hitCollection, mps_fire::i, EcalClusterFunctionBaseClass::init(), 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(), harvestTrackValidationPlots::str, and AlCaHLTBitMon_QueryRunRegistry::string.

113 {
114  using namespace edm;
115 
116  // initialize energy correction class
119 
120  // initialize energy correction class
123 
124 
125  // initialize containemnt correction class
128 
129  // get the collection geometry:
130  edm::ESHandle<CaloGeometry> geoHandle;
131  es.get<CaloGeometryRecord>().get(geoHandle);
132  const CaloGeometry& geometry = *geoHandle;
133  const CaloSubdetectorGeometry *geometry_p;
134 
135  std::string rHInputCollection = rHTag_.instance();
136  if(rHInputCollection == "EcalRecHitsEB") {
137  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
138  } else if(rHInputCollection == "EcalRecHitsEE") {
139  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
140  } else if(rHInputCollection == "EcalRecHitsPS") {
141  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
142  } else {
143  std::string str = "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
144  throw(std::runtime_error( str.c_str() ));
145  }
146 
147  // Get raw SuperClusters from the event
148  Handle<reco::SuperClusterCollection> pRawSuperClusters;
149  evt.getByToken(sCInputProducer_, pRawSuperClusters);
150 
151  // Get the RecHits from the event
153  evt.getByToken(rHInputProducer_, pRecHits);
154 
155  // Create a pointer to the RecHits and raw SuperClusters
156  const EcalRecHitCollection *hitCollection = pRecHits.product();
157  const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
158 
159  // Define a collection of corrected SuperClusters to put back into the event
160  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
161 
162  // Loop over raw clusters and make corrected ones
163  reco::SuperClusterCollection::const_iterator aClus;
164  int i=0;
165  for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++)
166  {
167  reco::SuperCluster enecorrClus,crackcorrClus,localContCorrClus;
168 
169  i++;
170 
172  enecorrClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, geometry_p, energyCorrectionFunction_, energyCorrectorName_, modeEB_, modeEE_);
173  else
174  enecorrClus=*aClus;
175 
176 
179  else
180  crackcorrClus=enecorrClus;
181 
183  localContCorrClus =
185  else
186  localContCorrClus = crackcorrClus;
187 
188 
189  if(localContCorrClus.energy()*sin(localContCorrClus.position().theta())>etThresh_) {
190 
191  corrClusters->push_back(localContCorrClus);
192  }
193  }
194 
195  // Put collection of corrected SuperClusters into the event
196  evt.put(std::move(corrClusters), outputCollection_);
197 
198 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:129
reco::SuperCluster applyCorrection(const reco::SuperCluster &cl, const EcalRecHitCollection &rhc, reco::CaloCluster::AlgoId theAlgo, const CaloSubdetectorGeometry *geometry, EcalClusterFunctionBaseClass *energyCorrectionFunction, std::string energyCorrectorName_, int modeEB_, int modeEE_)
EcalClusterFunctionBaseClass * localContCorrectionFunction_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EcalClusterFunctionBaseClass * energyCorrectionFunction_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducer_
EcalClusterFunctionBaseClass * crackCorrectionFunction_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
reco::CaloCluster::AlgoId sCAlgo_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducer_
double energy() const
cluster energy
Definition: CaloCluster.h:124
reco::SuperCluster applyCrackCorrection(const reco::SuperCluster &cl, EcalClusterFunctionBaseClass *crackCorrectionFunction)
reco::SuperCluster applyLocalContCorrection(const reco::SuperCluster &cl, EcalClusterFunctionBaseClass *localContCorrectionFunction)
EgammaSCEnergyCorrectionAlgo * energyCorrector_
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:55
HLT enums.
virtual void init(const edm::EventSetup &es)=0
std::string const & instance() const
Definition: InputTag.h:37
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

bool EgammaSCCorrectionMaker::applyCrackCorrection_
private

Definition at line 59 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

bool EgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 58 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

bool EgammaSCCorrectionMaker::applyLocalContCorrection_
private

Definition at line 60 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

EcalClusterFunctionBaseClass* EgammaSCCorrectionMaker::crackCorrectionFunction_
private
std::string EgammaSCCorrectionMaker::crackCorrectorName_
private

Definition at line 63 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

EcalClusterFunctionBaseClass* EgammaSCCorrectionMaker::energyCorrectionFunction_
private
EgammaSCEnergyCorrectionAlgo* EgammaSCCorrectionMaker::energyCorrector_
private
std::string EgammaSCCorrectionMaker::energyCorrectorName_
private

Definition at line 62 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

double EgammaSCCorrectionMaker::etThresh_
private

Definition at line 71 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

EcalClusterFunctionBaseClass* EgammaSCCorrectionMaker::localContCorrectionFunction_
private
std::string EgammaSCCorrectionMaker::localContCorrectorName_
private

Definition at line 64 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

int EgammaSCCorrectionMaker::modeEB_
private

Definition at line 66 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

int EgammaSCCorrectionMaker::modeEE_
private

Definition at line 67 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

std::string EgammaSCCorrectionMaker::outputCollection_
private

Definition at line 79 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 74 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

edm::InputTag EgammaSCCorrectionMaker::rHTag_
private

Definition at line 76 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 78 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 75 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

double EgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 70 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().