#include <HcalPedestalAnalyzer.h>
Public Member Functions | |
HcalPedestalAnalyzer (const edm::ParameterSet &ps) | |
Constructor. | |
~HcalPedestalAnalyzer () | |
Destructor. | |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
Analyze. | |
void | beginJob () |
void | endJob (void) |
Private Attributes | |
int | m_endSample |
int | m_ievt |
int | m_inputPedestals_run |
std::string | m_inputPedestals_source |
std::string | m_inputPedestals_tag |
int | m_inputPedestalWidths_run |
std::string | m_inputPedestalWidths_source |
std::string | m_inputPedestalWidths_tag |
std::string | m_outputPedestals_dest |
int | m_outputPedestals_run |
std::string | m_outputPedestals_tag |
std::string | m_outputPedestalWidths_dest |
int | m_outputPedestalWidths_run |
std::string | m_outputPedestalWidths_tag |
HcalPedestalAnalysis * | m_pedAnal |
int | m_startSample |
int | ped_sample |
Definition at line 41 of file HcalPedestalAnalyzer.h.
HcalPedestalAnalyzer::HcalPedestalAnalyzer | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 105 of file HcalPedestalAnalyzer.cc.
References edm::ParameterSet::getUntrackedParameter(), m_endSample, m_inputPedestals_run, m_inputPedestals_source, m_inputPedestals_tag, m_inputPedestalWidths_run, m_inputPedestalWidths_source, m_inputPedestalWidths_tag, m_outputPedestals_dest, m_outputPedestals_run, m_outputPedestals_tag, m_outputPedestalWidths_dest, m_outputPedestalWidths_run, m_outputPedestalWidths_tag, m_pedAnal, m_startSample, and HcalPedestalAnalysis::setup().
{ m_pedAnal = new HcalPedestalAnalysis(ps); m_pedAnal->setup(ps.getUntrackedParameter<std::string>("outputFileHist", "HcalPedestalAnalyzer.root")); m_startSample = ps.getUntrackedParameter<int>("firstSample", 0); m_endSample = ps.getUntrackedParameter<int>("lastSample", 19); m_inputPedestals_source = ps.getUntrackedParameter<std::string>("inputPedestalsSource", ""); m_inputPedestals_tag = ps.getUntrackedParameter<std::string>("inputPedestalsTag", ""); m_inputPedestals_run = ps.getUntrackedParameter<int>("inputPedestalsRun", 1); m_inputPedestalWidths_source = ps.getUntrackedParameter<std::string>("inputPedestalWidthsSource", ""); m_inputPedestalWidths_tag = ps.getUntrackedParameter<std::string>("inputPedestalWidthsTag", ""); m_inputPedestalWidths_run = ps.getUntrackedParameter<int>("inputPedestalWidthsRun", 1); m_outputPedestals_dest = ps.getUntrackedParameter<std::string>("outputPedestalsDest", ""); m_outputPedestals_tag = ps.getUntrackedParameter<std::string>("outputPedestalsTag", ""); m_outputPedestals_run = ps.getUntrackedParameter<int>("outputPedestalsRun", 99999); m_outputPedestalWidths_dest = ps.getUntrackedParameter<std::string>("outputPedestalWidthsDest", ""); m_outputPedestalWidths_tag = ps.getUntrackedParameter<std::string>("outputPedestalWidthsTag", ""); m_outputPedestalWidths_run = ps.getUntrackedParameter<int>("outputPedestalWidthsRun", 99999); // CORAL required variables to be set, even if not needed const char* foo1 = "CORAL_AUTH_USER=blaaah"; const char* foo2 = "CORAL_AUTH_PASSWORD=blaaah"; if (!::getenv("CORAL_AUTH_USER")) ::putenv(const_cast<char*>(foo1)); if (!::getenv("CORAL_AUTH_PASSWORD")) ::putenv(const_cast<char*>(foo2)); }
HcalPedestalAnalyzer::~HcalPedestalAnalyzer | ( | ) |
void HcalPedestalAnalyzer::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
get digis
Implements edm::EDAnalyzer.
Definition at line 194 of file HcalPedestalAnalyzer.cc.
References gather_cfg::cout, edm::EventSetup::get(), edm::Event::getByType(), m_ievt, m_pedAnal, and HcalPedestalAnalysis::processEvent().
{ m_ievt++; edm::Handle<HBHEDigiCollection> hbhe; e.getByType(hbhe); edm::Handle<HODigiCollection> ho; e.getByType(ho); edm::Handle<HFDigiCollection> hf; e.getByType(hf); // get conditions edm::ESHandle<HcalDbService> conditions; eventSetup.get<HcalDbRecord>().get(conditions); m_pedAnal->processEvent(*hbhe, *ho, *hf, *conditions); if(m_ievt%1000 == 0) std::cout << "HcalPedestalAnalyzer: analyzed " << m_ievt << " events" << std::endl; return; }
void HcalPedestalAnalyzer::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 136 of file HcalPedestalAnalyzer.cc.
References m_ievt, and ped_sample.
{ m_ievt = 0; ped_sample = 1; }
void HcalPedestalAnalyzer::endJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 141 of file HcalPedestalAnalyzer.cc.
References dtNoiseDBValidation_cfg::cerr, HcalPedestalAnalysis::done(), getObject(), m_inputPedestals_run, m_inputPedestals_source, m_inputPedestals_tag, m_inputPedestalWidths_run, m_inputPedestalWidths_source, m_inputPedestalWidths_tag, m_outputPedestals_dest, m_outputPedestals_run, m_outputPedestals_tag, m_outputPedestalWidths_dest, m_outputPedestalWidths_run, m_outputPedestalWidths_tag, m_pedAnal, and xmlFile().
{ // get input objects HcalPedestals* inputPeds = 0; if (!m_inputPedestals_source.empty ()) { inputPeds = new HcalPedestals (); if (!getObject (inputPeds, m_inputPedestals_source, m_inputPedestals_tag, m_inputPedestals_run)) { std::cerr << "HcalPedestalAnalyzer-> Failed to get input Pedestals" << std::endl; } } HcalPedestalWidths* inputPedWids = 0; if (!m_inputPedestalWidths_source.empty ()) { inputPedWids = new HcalPedestalWidths (); if (!getObject (inputPedWids, m_inputPedestalWidths_source, m_inputPedestalWidths_tag, m_inputPedestalWidths_run)) { std::cerr << "HcalPedestalAnalyzer-> Failed to get input PedestalWidths" << std::endl; } } // make output objects HcalPedestals* outputPeds = (m_outputPedestals_dest.empty () && !xmlFile (m_outputPedestals_dest)) ? 0 : new HcalPedestals (); HcalPedestalWidths* outputPedWids = (m_outputPedestalWidths_dest.empty () && !xmlFile (m_outputPedestals_dest)) ? 0 : new HcalPedestalWidths (); // run algorithm int Flag=m_pedAnal->done(inputPeds, inputPedWids, outputPeds, outputPedWids); delete inputPeds; delete inputPedWids; // store new objects // Flag=-2 indicates there were less than 100 events and output is meaningless if (Flag>-2) { if (xmlFile (m_outputPedestals_dest)) { // output pedestals and widths together if (!dumpXmlPedestals (*outputPeds, *outputPedWids, m_outputPedestals_dest, m_outputPedestals_tag, m_outputPedestals_run)) { std::cerr << "HcalPedestalAnalyzer-> Failed to put output Pedestals & Widths" << std::endl; } } else { if (outputPeds) { if (!putObject (&outputPeds, m_outputPedestals_dest, m_outputPedestals_tag, m_outputPedestals_run)) { std::cerr << "HcalPedestalAnalyzer-> Failed to put output Pedestals" << std::endl; } } if (outputPedWids) { if (!putObject (&outputPedWids, m_outputPedestalWidths_dest, m_outputPedestalWidths_tag, m_outputPedestalWidths_run)) { std::cerr << "HcalPedestalAnalyzer-> Failed to put output PedestalWidths" << std::endl; } } } } delete outputPeds; delete outputPedWids; }
int HcalPedestalAnalyzer::m_endSample [private] |
Definition at line 74 of file HcalPedestalAnalyzer.h.
Referenced by HcalPedestalAnalyzer().
int HcalPedestalAnalyzer::m_ievt [private] |
Definition at line 66 of file HcalPedestalAnalyzer.h.
Referenced by analyze(), and beginJob().
int HcalPedestalAnalyzer::m_inputPedestals_run [private] |
Definition at line 78 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_inputPedestals_source [private] |
Definition at line 76 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_inputPedestals_tag [private] |
Definition at line 77 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
int HcalPedestalAnalyzer::m_inputPedestalWidths_run [private] |
Definition at line 81 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_inputPedestalWidths_source [private] |
Definition at line 79 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_inputPedestalWidths_tag [private] |
Definition at line 80 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_outputPedestals_dest [private] |
Definition at line 82 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
int HcalPedestalAnalyzer::m_outputPedestals_run [private] |
Definition at line 84 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_outputPedestals_tag [private] |
Definition at line 83 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_outputPedestalWidths_dest [private] |
Definition at line 85 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
int HcalPedestalAnalyzer::m_outputPedestalWidths_run [private] |
Definition at line 87 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
std::string HcalPedestalAnalyzer::m_outputPedestalWidths_tag [private] |
Definition at line 86 of file HcalPedestalAnalyzer.h.
Referenced by endJob(), and HcalPedestalAnalyzer().
Definition at line 71 of file HcalPedestalAnalyzer.h.
Referenced by analyze(), endJob(), and HcalPedestalAnalyzer().
int HcalPedestalAnalyzer::m_startSample [private] |
Definition at line 73 of file HcalPedestalAnalyzer.h.
Referenced by HcalPedestalAnalyzer().
int HcalPedestalAnalyzer::ped_sample [private] |
Definition at line 67 of file HcalPedestalAnalyzer.h.
Referenced by beginJob().