#include <HcalAutoPedestalValidator.h>
Public Member Functions | |
void | analyze (const edm::Event &ev, const edm::EventSetup &es) |
HcalAutoPedestalValidator (edm::ParameterSet const &ps) | |
~HcalAutoPedestalValidator () | |
Private Attributes | |
double | epsilon |
std::string | outfile |
Definition at line 41 of file HcalAutoPedestalValidator.h.
HcalAutoPedestalValidator::HcalAutoPedestalValidator | ( | edm::ParameterSet const & | ps | ) |
Definition at line 3 of file HcalAutoPedestalValidator.cc.
References epsilon, edm::ParameterSet::getUntrackedParameter(), and outfile.
HcalAutoPedestalValidator::~HcalAutoPedestalValidator | ( | ) |
Definition at line 9 of file HcalAutoPedestalValidator.cc.
{ }
void HcalAutoPedestalValidator::analyze | ( | const edm::Event & | ev, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 13 of file HcalAutoPedestalValidator.cc.
References gather_cfg::cout, epsilon, spr::find(), edm::EventSetup::get(), HcalCondObjectContainer< Item >::getAllChannels(), outfile, DetId::rawId(), and makeHLTPrescaleTable::values.
{ using namespace edm::eventsetup; // get fake pedestals from file ("new pedestals") edm::ESHandle<HcalPedestals> newPeds; es.get<HcalPedestalsRcd>().get("update",newPeds); const HcalPedestals* myNewPeds = newPeds.product(); // get DB pedestals from Frontier/OrcoX ("reference") edm::ESHandle<HcalPedestals> refPeds; es.get<HcalPedestalsRcd>().get("reference",refPeds); const HcalPedestals* myRefPeds = refPeds.product(); std::vector<DetId> listNewChan = myNewPeds->getAllChannels(); std::vector<DetId> listRefChan = myRefPeds->getAllChannels(); std::vector<DetId>::iterator cell; bool failflag = false; for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) { DetId mydetid = *it; cell = std::find(listNewChan.begin(), listNewChan.end(), mydetid); if (cell == listNewChan.end()) {continue;} else { const float* values = (myNewPeds->getValues( mydetid ))->getValues(); const float* oldvalue = (myRefPeds->getValues( mydetid ))->getValues(); if( (*values==0) &&(*(values+1)==0) && (*(values+2)==0) && (*(values+3)==0) )continue; if( (*oldvalue-*values) + (*(oldvalue+1)-*(values+1)) + (*(oldvalue+2)-*(values+2)) + (*(oldvalue+3)-*(values+3))/4 > epsilon) { std::cout << "Channel " << std::hex << mydetid.rawId() << " Values differ by " << std::dec << (*oldvalue-*values) << " " << (*(oldvalue+1)-*(values+1)) << " " << (*(oldvalue+2)-*(values+2)) << " " << (*(oldvalue+3)-*(values+3)) << std::endl; failflag = true; } listNewChan.erase(cell); // fix 25.02.08 } } if(!failflag) std::cout << "These are identical to within deltaP" << std::endl; if(failflag) { // if changed, this creates the empty file changed.bool which the auto job uses as a flag std::ofstream outStream3(outfile.c_str()); std::cout << "--- Pedestals changed! ---" << std::endl; } }
double HcalAutoPedestalValidator::epsilon [private] |
Definition at line 52 of file HcalAutoPedestalValidator.h.
Referenced by analyze(), and HcalAutoPedestalValidator().
std::string HcalAutoPedestalValidator::outfile [private] |
Definition at line 51 of file HcalAutoPedestalValidator.h.
Referenced by analyze(), and HcalAutoPedestalValidator().