#include <RecoLocalCalo/Castor/src/RecHitCorrector.cc>
Public Member Functions | |
RecHitCorrector (const edm::ParameterSet &) | |
~RecHitCorrector () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | factor_ |
edm::InputTag | inputLabel_ |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 46 of file RecHitCorrector.cc.
RecHitCorrector::RecHitCorrector | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 73 of file RecHitCorrector.cc.
: inputLabel_(iConfig.getParameter<edm::InputTag>("rechitLabel")), factor_(iConfig.getParameter<double>("revertFactor")) { //register your products produces<CastorRecHitCollection>(); //now do what ever other initialization is needed }
RecHitCorrector::~RecHitCorrector | ( | ) |
Definition at line 84 of file RecHitCorrector.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void RecHitCorrector::beginJob | ( | void | ) | [private, virtual] |
void RecHitCorrector::endJob | ( | void | ) | [private, virtual] |
void RecHitCorrector::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 99 of file RecHitCorrector.cc.
References gather_cfg::cout, CaloRecHit::energy(), factor_, CastorCalibrations::gain(), edm::EventSetup::get(), edm::Event::getByLabel(), i, CastorRecHit::id(), inputLabel_, edm::Event::put(), HI_PhotonSkim_cff::rechits, cond::rpcobgas::time, and CaloRecHit::time().
{ using namespace edm; edm::Handle<CastorRecHitCollection> rechits; iEvent.getByLabel(inputLabel_,rechits); // get conditions edm::ESHandle<CastorDbService> conditions; iSetup.get<CastorDbRecord>().get(conditions); if (!rechits.isValid()) std::cout << "No valid CastorRecHitCollection found, please check the InputLabel..." << std::endl; CastorCalibrations calibrations; std::auto_ptr<CastorRecHitCollection> rec(new CastorRecHitCollection); for (unsigned int i=0;i<rechits->size();i++) { CastorRecHit rechit = (*rechits)[i]; //std::cout << "rechit energy = " << rechit.energy() << std::endl; double fC = factor_*rechit.energy(); double time = rechit.time(); //std::cout << "rechit energy(fC) = " << fC << " time = " << time << std::endl; // do proper gain calibration reading the latest entries in the condDB const CastorCalibrations& calibrations=conditions->getCastorCalibrations(rechit.id()); int capid = 0; // take some capid double correctedenergy = fC*calibrations.gain(capid); //std::cout << " correctedenergy = " << correctedenergy << " gain = " << calibrations.gain(capid) << std::endl; CastorRecHit *correctedhit = new CastorRecHit(rechit.id(),correctedenergy,time); rec->push_back(*correctedhit); } iEvent.put(rec); }
double RecHitCorrector::factor_ [private] |
Definition at line 58 of file RecHitCorrector.cc.
Referenced by produce().
edm::InputTag RecHitCorrector::inputLabel_ [private] |
Definition at line 57 of file RecHitCorrector.cc.
Referenced by produce().