CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EgammaSCCorrectionMaker Class Reference

#include <EgammaSCCorrectionMaker/EgammaSCCorrectionMaker/src/EgammaSCCorrectionMaker.cc>

Inheritance diagram for EgammaSCCorrectionMaker:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaSCCorrectionMaker (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaSCCorrectionMaker ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::InputTag rHInputProducer_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::InputTag sCInputProducer_
 
double sigmaElectronicNoise_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 35 of file EgammaSCCorrectionMaker.h.

Constructor & Destructor Documentation

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

Definition at line 24 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_, sCAlgo_, sCInputProducer_, sigmaElectronicNoise_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 103 of file EgammaSCCorrectionMaker.cc.

References crackCorrectionFunction_, energyCorrectionFunction_, energyCorrector_, and localContCorrectionFunction_.

104 {
108 
109  delete energyCorrector_;
110 }
EcalClusterFunctionBaseClass * localContCorrectionFunction_
EcalClusterFunctionBaseClass * energyCorrectionFunction_
EcalClusterFunctionBaseClass * crackCorrectionFunction_
EgammaSCEnergyCorrectionAlgo * energyCorrector_

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 113 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_, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), reco_application_2006_simpleTBanalysis_cfg::hitCollection, i, EcalClusterFunctionBaseClass::init(), edm::InputTag::instance(), edm::InputTag::label(), localContCorrectionFunction_, modeEB_, modeEE_, outputCollection_, reco::CaloCluster::position(), edm::Event::put(), rHInputProducer_, sCAlgo_, sCInputProducer_, funct::sin(), and AlCaHLTBitMon_QueryRunRegistry::string.

114 {
115  using namespace edm;
116 
117  // initialize energy correction class
120 
121  // initialize energy correction class
124 
125 
126  // initialize containemnt correction class
129 
130  // get the collection geometry:
131  edm::ESHandle<CaloGeometry> geoHandle;
132  es.get<CaloGeometryRecord>().get(geoHandle);
133  const CaloGeometry& geometry = *geoHandle;
134  const CaloSubdetectorGeometry *geometry_p;
135 
136  std::string rHInputCollection = rHInputProducer_.instance();
137  if(rHInputCollection == "EcalRecHitsEB") {
138  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
139  } else if(rHInputCollection == "EcalRecHitsEE") {
140  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
141  } else if(rHInputCollection == "EcalRecHitsPS") {
142  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
143  } else {
144  std::string str = "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
145  throw(std::runtime_error( str.c_str() ));
146  }
147 
148  // Get raw SuperClusters from the event
149  Handle<reco::SuperClusterCollection> pRawSuperClusters;
150  try {
151  evt.getByLabel(sCInputProducer_, pRawSuperClusters);
152  } catch ( cms::Exception& ex ) {
153  edm::LogError("EgammaSCCorrectionMakerError")
154  << "Error! can't get the rawSuperClusters "
155  << sCInputProducer_.label() ;
156  }
157 
158  // Get the RecHits from the event
160  try {
161  evt.getByLabel(rHInputProducer_, pRecHits);
162  } catch ( cms::Exception& ex ) {
163  edm::LogError("EgammaSCCorrectionMakerError")
164  << "Error! can't get the RecHits "
165  << rHInputProducer_.label();
166  }
167 
168  // Create a pointer to the RecHits and raw SuperClusters
169  const EcalRecHitCollection *hitCollection = pRecHits.product();
170  const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
171 
172  // Define a collection of corrected SuperClusters to put back into the event
173  std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection);
174 
175  // Loop over raw clusters and make corrected ones
176  reco::SuperClusterCollection::const_iterator aClus;
177  int i=0;
178  for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++)
179  {
180  reco::SuperCluster enecorrClus,crackcorrClus,localContCorrClus;
181 
182  i++;
183 
186  else
187  enecorrClus=*aClus;
188 
189 
192  else
193  crackcorrClus=enecorrClus;
194 
196  localContCorrClus =
198  else
199  localContCorrClus = crackcorrClus;
200 
201 
202  if(localContCorrClus.energy()*sin(localContCorrClus.position().theta())>etThresh_) {
203 
204  corrClusters->push_back(localContCorrClus);
205  }
206  }
207 
208  // Put collection of corrected SuperClusters into the event
209  evt.put(corrClusters, outputCollection_);
210 
211 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
int i
Definition: DBlmapReader.cc:9
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_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EcalClusterFunctionBaseClass * energyCorrectionFunction_
EcalClusterFunctionBaseClass * crackCorrectionFunction_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
reco::CaloCluster::AlgoId sCAlgo_
double energy() const
cluster energy
Definition: CaloCluster.h:120
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
reco::SuperCluster applyCrackCorrection(const reco::SuperCluster &cl, EcalClusterFunctionBaseClass *crackCorrectionFunction)
reco::SuperCluster applyLocalContCorrection(const reco::SuperCluster &cl, EcalClusterFunctionBaseClass *localContCorrectionFunction)
EgammaSCEnergyCorrectionAlgo * energyCorrector_
const T & get() const
Definition: EventSetup.h:55
std::string const & label() const
Definition: InputTag.h:42
ESHandle< TrackerGeometry > geometry
virtual void init(const edm::EventSetup &es)=0
std::string const & instance() const
Definition: InputTag.h:43

Member Data Documentation

bool EgammaSCCorrectionMaker::applyCrackCorrection_
private

Definition at line 56 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

bool EgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 55 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

bool EgammaSCCorrectionMaker::applyLocalContCorrection_
private

Definition at line 57 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 60 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

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

Definition at line 59 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

double EgammaSCCorrectionMaker::etThresh_
private

Definition at line 68 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 61 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().

int EgammaSCCorrectionMaker::modeEB_
private

Definition at line 63 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

int EgammaSCCorrectionMaker::modeEE_
private

Definition at line 64 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

std::string EgammaSCCorrectionMaker::outputCollection_
private

Definition at line 75 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

edm::InputTag EgammaSCCorrectionMaker::rHInputProducer_
private

Definition at line 71 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

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

Definition at line 74 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

edm::InputTag EgammaSCCorrectionMaker::sCInputProducer_
private

Definition at line 72 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker(), and produce().

double EgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 67 of file EgammaSCCorrectionMaker.h.

Referenced by EgammaSCCorrectionMaker().