test
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
HiEgammaSCCorrectionMaker Class Reference

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

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

Public Member Functions

 HiEgammaSCCorrectionMaker (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HiEgammaSCCorrectionMaker ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool applyEnergyCorrection_
 
EcalClusterFunctionBaseClassEnergyCorrection_
 
HiEgammaSCEnergyCorrectionAlgoenergyCorrector_
 
double etThresh_
 
std::string outputCollection_
 
edm::InputTag rHInputProducer_
 
reco::CaloCluster::AlgoId sCAlgo_
 
edm::InputTag sCInputProducer_
 
double sigmaElectronicNoise_
 
edm::ESHandle< CaloTopologytheCaloTopo_
 
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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 38 of file HiEgammaSCCorrectionMaker.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file HiEgammaSCCorrectionMaker.cc.

References applyEnergyCorrection_, reco::CaloCluster::dynamicHybrid, EnergyCorrection_, energyCorrector_, etThresh_, reco::get(), edm::ParameterSet::getParameter(), reco::CaloCluster::hybrid, reco::CaloCluster::island, reco::CaloCluster::multi5x5, outputCollection_, HiEgammaSCEnergyCorrectionAlgo::pDEBUG, HiEgammaSCEnergyCorrectionAlgo::pERROR, HiEgammaSCEnergyCorrectionAlgo::pINFO, rHInputProducer_, sCAlgo_, sCInputProducer_, sigmaElectronicNoise_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

31 {
32 
33  // The verbosity level
34  std::string debugString = ps.getParameter<std::string>("VerbosityLevel");
35  if (debugString == "DEBUG") verbosity_ = HiEgammaSCEnergyCorrectionAlgo::pDEBUG;
36  else if (debugString == "INFO") verbosity_ = HiEgammaSCEnergyCorrectionAlgo::pINFO;
38 
39  // the input producers
40  rHInputProducer_ = ps.getParameter<edm::InputTag>("recHitProducer");
41  sCInputProducer_ = ps.getParameter<edm::InputTag>("rawSuperClusterProducer");
42  std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo");
43 
44  // determine which BasicCluster algo we are correcting for
45  //And obtain forrection parameters form cfg file
46  edm::ParameterSet fCorrPset;
47  if (sCAlgo_str=="Hybrid") {
49  fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset");
50  } else if (sCAlgo_str=="Island") {
52  fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset");
53  } else if (sCAlgo_str=="DynamicHybrid") {
55  fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset");
56  } else if (sCAlgo_str=="Multi5x5") {
58  fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset");
59  } else {
60  edm::LogError("HiEgammaSCCorrectionMakerError")
61  << "Error! SuperClusterAlgo in config file must be Hybrid or Island: "
62  << sCAlgo_str << " Using Hybrid by default";
64  }
65 
66  // set correction algo parameters
67  applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection");
68  sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise");
69 
70  etThresh_ = ps.getParameter<double>("etThresh");
71 
72  // set the producer parameters
73  outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection");
74  produces<reco::SuperClusterCollection>(outputCollection_);
75 
76  // instanciate the correction algo object
77  energyCorrector_ = new HiEgammaSCEnergyCorrectionAlgo(sigmaElectronicNoise_, sCAlgo_, fCorrPset, verbosity_);
78 
79 
80  // energy correction class
82  EnergyCorrection_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
83 }
T getParameter(std::string const &) const
EcalClusterFunctionBaseClass * EnergyCorrection_
HiEgammaSCEnergyCorrectionAlgo * energyCorrector_
HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel verbosity_
reco::CaloCluster::AlgoId sCAlgo_
T get(const Candidate &c)
Definition: component.h:55
HiEgammaSCCorrectionMaker::~HiEgammaSCCorrectionMaker ( )

Definition at line 85 of file HiEgammaSCCorrectionMaker.cc.

References energyCorrector_.

86 {
87  delete energyCorrector_;
88 }
HiEgammaSCEnergyCorrectionAlgo * energyCorrector_

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 91 of file HiEgammaSCCorrectionMaker.cc.

References HiEgammaSCEnergyCorrectionAlgo::applyCorrection(), applyEnergyCorrection_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), EnergyCorrection_, energyCorrector_, etThresh_, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), reco_application_2006_simpleTBanalysis_cfg::hitCollection, EcalClusterFunctionBaseClass::init(), edm::InputTag::instance(), edm::InputTag::label(), outputCollection_, reco::CaloCluster::position(), edm::ESHandle< class >::product(), edm::Event::put(), rHInputProducer_, sCAlgo_, sCInputProducer_, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, theCaloTopo_, and ecaldqm::topology().

92 {
93  using namespace edm;
94 
95  // initialize energy correction class
98 
99  // get the collection geometry:
100  edm::ESHandle<CaloGeometry> geoHandle;
101  es.get<CaloGeometryRecord>().get(geoHandle);
102  const CaloGeometry& geometry = *geoHandle;
103  const CaloSubdetectorGeometry *geometry_p;
104 
105  edm::ESHandle<CaloTopology> pTopology;
108 
109  std::string rHInputCollection = rHInputProducer_.instance();
110  if(rHInputCollection == "EcalRecHitsEB") {
111  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
112  } else if(rHInputCollection == "EcalRecHitsEE") {
113  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
114  } else if(rHInputCollection == "EcalRecHitsPS") {
115  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
116  } else {
117  std::string str = "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n";
118  throw(std::runtime_error( str.c_str() ));
119  }
120 
121  // Get raw SuperClusters from the event
122  Handle<reco::SuperClusterCollection> pRawSuperClusters;
123  try {
124  evt.getByLabel(sCInputProducer_, pRawSuperClusters);
125  } catch ( cms::Exception& ex ) {
126  edm::LogError("HiEgammaSCCorrectionMakerError")
127  << "Error! can't get the rawSuperClusters "
128  << sCInputProducer_.label() ;
129  }
130 
131  // Get the RecHits from the event
133  try {
134  evt.getByLabel(rHInputProducer_, pRecHits);
135  } catch ( cms::Exception& ex ) {
136  edm::LogError("HiEgammaSCCorrectionMakerError")
137  << "Error! can't get the RecHits "
138  << rHInputProducer_.label();
139  }
140 
141  // Create a pointer to the RecHits and raw SuperClusters
142  const EcalRecHitCollection *hitCollection = pRecHits.product();
143  const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
144 
145  // Define a collection of corrected SuperClusters to put back into the event
146  std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection);
147 
148  // Loop over raw clusters and make corrected ones
149  reco::SuperClusterCollection::const_iterator aClus;
150  for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++)
151  {
152  reco::SuperCluster newClus;
155  else
156  newClus=*aClus;
157 
158  if(newClus.energy()*sin(newClus.position().theta())>etThresh_) {
159  corrClusters->push_back(newClus);
160  }
161  }
162  // Put collection of corrected SuperClusters into the event
163  evt.put(corrClusters, outputCollection_);
164 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:124
CaloTopology const * topology(0)
reco::SuperCluster applyCorrection(const reco::SuperCluster &cl, const EcalRecHitCollection &rhc, reco::CaloCluster::AlgoId theAlgo, const CaloSubdetectorGeometry *geometry, const CaloTopology *topology, EcalClusterFunctionBaseClass *EnergyCorrectionClass)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EcalClusterFunctionBaseClass * EnergyCorrection_
HiEgammaSCEnergyCorrectionAlgo * energyCorrector_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
double energy() const
cluster energy
Definition: CaloCluster.h:120
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::string const & label() const
Definition: InputTag.h:42
ESHandle< TrackerGeometry > geometry
edm::ESHandle< CaloTopology > theCaloTopo_
virtual void init(const edm::EventSetup &es)=0
std::string const & instance() const
Definition: InputTag.h:43
reco::CaloCluster::AlgoId sCAlgo_

Member Data Documentation

bool HiEgammaSCCorrectionMaker::applyEnergyCorrection_
private

Definition at line 56 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

EcalClusterFunctionBaseClass* HiEgammaSCCorrectionMaker::EnergyCorrection_
private

Definition at line 47 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

HiEgammaSCEnergyCorrectionAlgo* HiEgammaSCCorrectionMaker::energyCorrector_
private
double HiEgammaSCCorrectionMaker::etThresh_
private

Definition at line 59 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

std::string HiEgammaSCCorrectionMaker::outputCollection_
private

Definition at line 66 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::InputTag HiEgammaSCCorrectionMaker::rHInputProducer_
private

Definition at line 62 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

reco::CaloCluster::AlgoId HiEgammaSCCorrectionMaker::sCAlgo_
private

Definition at line 65 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

edm::InputTag HiEgammaSCCorrectionMaker::sCInputProducer_
private

Definition at line 63 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker(), and produce().

double HiEgammaSCCorrectionMaker::sigmaElectronicNoise_
private

Definition at line 58 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().

edm::ESHandle<CaloTopology> HiEgammaSCCorrectionMaker::theCaloTopo_
private

Definition at line 67 of file HiEgammaSCCorrectionMaker.h.

Referenced by produce().

HiEgammaSCEnergyCorrectionAlgo::VerbosityLevel HiEgammaSCCorrectionMaker::verbosity_
private

Definition at line 50 of file HiEgammaSCCorrectionMaker.h.

Referenced by HiEgammaSCCorrectionMaker().