CMS 3D CMS Logo

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

#include <GBRWrap/EGEnergyAnalyzer/src/EGEnergyAnalyzer.cc>

Inheritance diagram for EGEnergyAnalyzer:
edm::EDAnalyzer

Public Member Functions

 EGEnergyAnalyzer (const edm::ParameterSet &)
 
 ~EGEnergyAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

EGEnergyCorrector cordb
 
EGEnergyCorrector corfile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file EGEnergyAnalyzer.cc.

Constructor & Destructor Documentation

EGEnergyAnalyzer::EGEnergyAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 84 of file EGEnergyAnalyzer.cc.

86 {
87  //now do what ever initialization is needed
88 
89 }
EGEnergyAnalyzer::~EGEnergyAnalyzer ( )

Definition at line 92 of file EGEnergyAnalyzer.cc.

93 {
94 
95  // do anything here that needs to be done at desctruction time
96  // (e.g. close files, deallocate resources etc.)
97 
98 }

Member Function Documentation

void EGEnergyAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 107 of file EGEnergyAnalyzer.cc.

References cordb, corfile, EGEnergyCorrector::CorrectedEnergyWithError(), edm::Event::getByLabel(), EGEnergyCorrector::Initialize(), and EGEnergyCorrector::IsInitialized().

108 {
109  using namespace edm;
110 
111  if (!corfile.IsInitialized()) {
112  corfile.Initialize(iSetup,"/afs/cern.ch/user/b/bendavid/cmspublic/gbrv3ph.root");
113  //corfile.Initialize(iSetup,"wgbrph",true);
114  }
115 
116  if (!cordb.IsInitialized()) {
117  //cordb.Initialize(iSetup,"/afs/cern.ch/user/b/bendavid/cmspublic/regweights/gbrph.root");
118  cordb.Initialize(iSetup,"wgbrph",true);
119  }
120 
121  // get photon collection
122  Handle<reco::PhotonCollection> hPhotonProduct;
123  iEvent.getByLabel("photons",hPhotonProduct);
124 
125  EcalClusterLazyTools lazyTools(iEvent, iSetup, edm::InputTag("reducedEcalRecHitsEB"),
126  edm::InputTag("reducedEcalRecHitsEE"));
127 
128  Handle<reco::VertexCollection> hVertexProduct;
129  iEvent.getByLabel("offlinePrimaryVerticesWithBS", hVertexProduct);
130 
131  for (reco::PhotonCollection::const_iterator it = hPhotonProduct->begin(); it!=hPhotonProduct->end(); ++it) {
132  std::pair<double,double> corsfile = corfile.CorrectedEnergyWithError(*it, *hVertexProduct, lazyTools, iSetup);
133  std::pair<double,double> corsdb = cordb.CorrectedEnergyWithError(*it, *hVertexProduct, lazyTools, iSetup);
134 
135 
136  printf("file: default = %5f, correction = %5f, uncertainty = %5f\n", it->energy(),corsfile.first,corsfile.second);
137  printf("db: default = %5f, correction = %5f, uncertainty = %5f\n", it->energy(),corsdb.first,corsdb.second);
138 
139  }
140 
141 
142 
143 
144 }
void Initialize(const edm::EventSetup &iSetup, std::string regweights, bool weightsFromDB=false)
EGEnergyCorrector corfile
EGEnergyCorrector cordb
std::pair< double, double > CorrectedEnergyWithError(const reco::Photon &p, const reco::VertexCollection &vtxcol, EcalClusterLazyTools &clustertools, const edm::EventSetup &es)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Bool_t IsInitialized() const
void EGEnergyAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file EGEnergyAnalyzer.cc.

150 {
151 
152 
153 
154 }
void EGEnergyAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 176 of file EGEnergyAnalyzer.cc.

177 {
178 }
void EGEnergyAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file EGEnergyAnalyzer.cc.

165 {
166 }
void EGEnergyAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 158 of file EGEnergyAnalyzer.cc.

159 {
160 }
void EGEnergyAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 182 of file EGEnergyAnalyzer.cc.

183 {
184 }
void EGEnergyAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 170 of file EGEnergyAnalyzer.cc.

171 {
172 }
void EGEnergyAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 188 of file EGEnergyAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

188  {
189  //The following says we do not know what parameters are allowed so do no validation
190  // Please change this to state exactly what you do use, even if it is no parameters
192  desc.setUnknown();
193  descriptions.addDefault(desc);
194 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

EGEnergyCorrector EGEnergyAnalyzer::cordb
private

Definition at line 68 of file EGEnergyAnalyzer.cc.

Referenced by analyze().

EGEnergyCorrector EGEnergyAnalyzer::corfile
private

Definition at line 67 of file EGEnergyAnalyzer.cc.

Referenced by analyze().