![]() |
![]() |
#include <Validation/HcalDigisClient/src/HcalDigisClient.cc>
Classes | |
struct | HistLim |
Public Member Functions | |
HcalDigisClient (const edm::ParameterSet &) | |
~HcalDigisClient () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | beginRun (edm::Run const &, edm::EventSetup const &) |
void | book1D (std::string name, int n, double min, double max) |
void | book1D (std::string name, HistLim limX) |
void | book2D (std::string name, HistLim limX, HistLim limY) |
void | booking (std::string subdetopt) |
void | bookPf (std::string name, HistLim limX, HistLim limY) |
virtual void | endJob () |
virtual void | endRun (edm::Run const &, edm::EventSetup const &) |
void | fill1D (std::string name, double X, double weight=1) |
void | fill2D (std::string name, double X, double Y, double weight=1) |
void | fillPf (std::string name, double X, double Y) |
int | HcalDigisEndjob (const std::vector< MonitorElement * > &hcalMEs, std::string subdet_) |
double | integralMETH2D (MonitorElement *ME, int i0, int i1, int j0, int j1) |
MonitorElement * | monitor (std::string name) |
virtual void | runClient () |
void | scaleMETH2D (MonitorElement *ME, double s) |
std::string | str (int x) |
Private Attributes | |
DQMStore * | dbe_ |
std::string | dirName_ |
std::map< std::string, MonitorElement * > * | msm_ |
std::string | outputFile_ |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 27 of file HcalDigisClient.h.
HcalDigisClient::HcalDigisClient | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 24 of file HcalDigisClient.cc.
References booking(), dbe_, dirName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), msm_, cppFunctionSkipper::operator, outputFile_, DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ dbe_ = edm::Service<DQMStore > ().operator->(); outputFile_ = iConfig.getUntrackedParameter<std::string > ("outputFile", "HcalDigisClient.root"); dirName_ = iConfig.getParameter<std::string > ("DQMDirName"); if (!dbe_) edm::LogError("HcalDigisClient") << "unable to get DQMStore service, upshot is no client histograms will be made"; msm_ = new std::map<std::string, MonitorElement*>(); //if (iConfig.getUntrackedParameter<bool>("DQMStore", false)) if (dbe_) dbe_->setVerbose(0); // std::cout << "dirName: " << dirName_ << std::endl; //dbe_->setCurrentFolder(dirName_); dbe_->setCurrentFolder("HcalDigisV/HcalDigiTask"); booking("HB"); booking("HE"); booking("HO"); booking("HF"); }
HcalDigisClient::~HcalDigisClient | ( | ) | [inline] |
Definition at line 31 of file HcalDigisClient.h.
{ };
void HcalDigisClient::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 42 of file HcalDigisClient.cc.
{
using namespace edm;
}
virtual void HcalDigisClient::beginJob | ( | void | ) | [inline, private, virtual] |
virtual void HcalDigisClient::beginRun | ( | edm::Run const & | , |
edm::EventSetup const & | |||
) | [inline, private, virtual] |
void HcalDigisClient::book1D | ( | std::string | name, |
int | n, | ||
double | min, | ||
double | max | ||
) | [inline, private] |
void HcalDigisClient::book1D | ( | std::string | name, |
HistLim | limX | ||
) | [inline, private] |
Definition at line 73 of file HcalDigisClient.h.
References DQMStore::book1D(), dbe_, HcalDigisClient::HistLim::max, HcalDigisClient::HistLim::min, msm_, HcalDigisClient::HistLim::n, and mergeVDriftHistosByStation::name.
Definition at line 81 of file HcalDigisClient.h.
References DQMStore::book2D(), dbe_, HcalDigisClient::HistLim::max, HcalDigisClient::HistLim::min, msm_, HcalDigisClient::HistLim::n, and mergeVDriftHistosByStation::name.
void HcalDigisClient::booking | ( | std::string | subdetopt | ) | [private] |
Definition at line 48 of file HcalDigisClient.cc.
References book1D(), str(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by HcalDigisClient().
{ std::string strtmp; HistLim ietaLim(82, -41., 41.); for (int depth = 1; depth <= 4; depth++) { strtmp = "HcalDigiTask_occupancy_vs_ieta_depth" + str(depth) + "_" + subdetopt; book1D(strtmp, ietaLim); } }
Definition at line 89 of file HcalDigisClient.h.
References DQMStore::bookProfile(), dbe_, HcalDigisClient::HistLim::max, HcalDigisClient::HistLim::min, msm_, HcalDigisClient::HistLim::n, and mergeVDriftHistosByStation::name.
virtual void HcalDigisClient::endJob | ( | void | ) | [inline, private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 40 of file HcalDigisClient.h.
References dbe_, outputFile_, and DQMStore::save().
{ if (outputFile_.size() != 0 && dbe_) dbe_->save(outputFile_); };
virtual void HcalDigisClient::endRun | ( | edm::Run const & | , |
edm::EventSetup const & | |||
) | [inline, private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 48 of file HcalDigisClient.h.
References dbe_, dirName_, runClient(), and DQMStore::setCurrentFolder().
{ if (dbe_) dbe_->setCurrentFolder(dirName_); runClient(); };
void HcalDigisClient::fill1D | ( | std::string | name, |
double | X, | ||
double | weight = 1 |
||
) | [inline, private] |
Definition at line 77 of file HcalDigisClient.h.
References msm_, and histoStyle::weight.
Referenced by HcalDigisEndjob().
void HcalDigisClient::fill2D | ( | std::string | name, |
double | X, | ||
double | Y, | ||
double | weight = 1 |
||
) | [inline, private] |
Definition at line 85 of file HcalDigisClient.h.
References msm_, and histoStyle::weight.
void HcalDigisClient::fillPf | ( | std::string | name, |
double | X, | ||
double | Y | ||
) | [inline, private] |
int HcalDigisClient::HcalDigisEndjob | ( | const std::vector< MonitorElement * > & | hcalMEs, |
std::string | subdet_ | ||
) | [private] |
Definition at line 85 of file HcalDigisClient.cc.
References gather_cfg::cout, fill1D(), MonitorElement::getBinContent(), MonitorElement::getEntries(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), i, j, and MonitorElement::setBinContent().
Referenced by runClient().
{ using namespace std; string strtmp; MonitorElement * nevtot(0); MonitorElement * ieta_iphi_occupancy_map1(0); MonitorElement * ieta_iphi_occupancy_map2(0); MonitorElement * ieta_iphi_occupancy_map3(0); MonitorElement * ieta_iphi_occupancy_map4(0); std::cout << " Number of histos " << hcalMEs.size() << std::endl; for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) { if (hcalMEs[ih]->getName() == "nevtot") nevtot = hcalMEs[ih]; strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth1_" + subdet_; if (hcalMEs[ih]->getName() == strtmp) ieta_iphi_occupancy_map1 = hcalMEs[ih]; strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth2_" + subdet_; if (hcalMEs[ih]->getName() == strtmp) ieta_iphi_occupancy_map2 = hcalMEs[ih]; strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth3_" + subdet_; if (hcalMEs[ih]->getName() == strtmp) ieta_iphi_occupancy_map3 = hcalMEs[ih]; strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth4_" + subdet_; if (hcalMEs[ih]->getName() == strtmp) ieta_iphi_occupancy_map4 = hcalMEs[ih]; }// if (nevtot == 0 || ieta_iphi_occupancy_map1 == 0 || ieta_iphi_occupancy_map2 == 0 || ieta_iphi_occupancy_map3 == 0 || ieta_iphi_occupancy_map4 == 0 ) { edm::LogError("HcalDigisClient") << "No nevtot or maps histo found..."; return 0; } int ev = nevtot->getEntries(); if(ev <= 0) { edm::LogError("HcalDigisClient") << "normalization factor <= 0!"; return 0; } float fev = (float) nevtot->getEntries(); int nx = ieta_iphi_occupancy_map1->getNbinsX(); int ny = ieta_iphi_occupancy_map1->getNbinsY(); float sumphi_1, sumphi_2, sumphi_3, sumphi_4; float phi_factor; float cnorm; for (int i = 1; i <= nx; i++) { sumphi_1 = 0.; sumphi_2 = 0.; sumphi_3 = 0.; sumphi_4 = 0.; for (int j = 1; j <= ny; j++) { // occupancies strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth1_" + subdet_; cnorm = ieta_iphi_occupancy_map1->getBinContent(i, j) / fev; ieta_iphi_occupancy_map1->setBinContent(i, j, cnorm); sumphi_1 += ieta_iphi_occupancy_map1->getBinContent(i, j); strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth2_" + subdet_; cnorm = ieta_iphi_occupancy_map2->getBinContent(i, j) / fev; ieta_iphi_occupancy_map2->setBinContent(i, j, cnorm); sumphi_2 += ieta_iphi_occupancy_map2->getBinContent(i, j); strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth3_" + subdet_; cnorm = ieta_iphi_occupancy_map3->getBinContent(i, j) / fev; ieta_iphi_occupancy_map3->setBinContent(i, j, cnorm); sumphi_3 += ieta_iphi_occupancy_map3->getBinContent(i, j); strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth4_" + subdet_; cnorm = ieta_iphi_occupancy_map4->getBinContent(i, j) / fev; ieta_iphi_occupancy_map4->setBinContent(i, j, cnorm); sumphi_4 += ieta_iphi_occupancy_map4->getBinContent(i, j); } int ieta = i - 42; // -41 -1, 0 40 if (ieta >= 0) ieta += 1; // -41 -1, 1 41 - to make it detector-like if (ieta >= -20 && ieta <= 20) { phi_factor = 72.; } else { if (ieta >= 40 || ieta <= -40) phi_factor = 18.; else phi_factor = 36.; } if (ieta >= 0) ieta -= 1; // -41 -1, 0 40 - to bring back to strtmp num !!! double deta = double(ieta); // occupancies vs ieta cnorm = sumphi_1 / phi_factor; strtmp = "HcalDigiTask_occupancy_vs_ieta_depth1_" + subdet_; fill1D(strtmp, deta, cnorm); cnorm = sumphi_2 / phi_factor; strtmp = "HcalDigiTask_occupancy_vs_ieta_depth2_" + subdet_; fill1D(strtmp, deta, cnorm); cnorm = sumphi_3 / phi_factor; strtmp = "HcalDigiTask_occupancy_vs_ieta_depth3_" + subdet_; fill1D(strtmp, deta, cnorm); cnorm = sumphi_4 / phi_factor; strtmp = "HcalDigiTask_occupancy_vs_ieta_depth4_" + subdet_; fill1D(strtmp, deta, cnorm); } // end of i-loop return 1; }
double HcalDigisClient::integralMETH2D | ( | MonitorElement * | ME, |
int | i0, | ||
int | i1, | ||
int | j0, | ||
int | j1 | ||
) | [private] |
Definition at line 218 of file HcalDigisClient.cc.
References MonitorElement::getBinContent(), i, and j.
MonitorElement * HcalDigisClient::monitor | ( | std::string | name | ) | [private] |
void HcalDigisClient::runClient | ( | ) | [private, virtual] |
Definition at line 60 of file HcalDigisClient.cc.
References dbe_, dirName_, DQMStore::getContents(), DQMStore::getSubdirs(), HcalDigisEndjob(), i, j, and DQMStore::setCurrentFolder().
Referenced by endRun().
{ if (!dbe_) return; //we dont have the DQMStore so we cant do anything dbe_->setCurrentFolder(dirName_); std::vector<MonitorElement*> hcalMEs; // Since out folders are fixed to three, we can just go over these three folders // i.e., CaloTowersV/CaloTowersTask, HcalRecHitsV/HcalRecHitTask, NoiseRatesV/NoiseRatesTask. std::vector<std::string> fullPathHLTFolders = dbe_->getSubdirs(); for (unsigned int i = 0; i < fullPathHLTFolders.size(); i++) { dbe_->setCurrentFolder(fullPathHLTFolders[i]); std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs(); for (unsigned int j = 0; j < fullSubPathHLTFolders.size(); j++) { if (strcmp(fullSubPathHLTFolders[j].c_str(), "HcalDigisV/HcalDigiTask") == 0) { hcalMEs = dbe_->getContents(fullSubPathHLTFolders[j]); if (!HcalDigisEndjob(hcalMEs, "HB")) edm::LogError("HcalDigisClient") << "Error in HcalDigisEndjob! HB"; if (!HcalDigisEndjob(hcalMEs, "HE")) edm::LogError("HcalDigisClient") << "Error in HcalDigisEndjob! HE"; if (!HcalDigisEndjob(hcalMEs, "HO")) edm::LogError("HcalDigisClient") << "Error in HcalDigisEndjob! HO"; if (!HcalDigisEndjob(hcalMEs, "HF")) edm::LogError("HcalDigisClient") << "Error in HcalDigisEndjob! HF"; } } } }
void HcalDigisClient::scaleMETH2D | ( | MonitorElement * | ME, |
double | s | ||
) | [private] |
Definition at line 229 of file HcalDigisClient.cc.
References ws_sso_content_reader::content, MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), i, j, alignCSCRings::s, and MonitorElement::setBinContent().
std::string HcalDigisClient::str | ( | int | x | ) | [private] |
Definition at line 212 of file HcalDigisClient.cc.
References dbtoconf::out, and x.
Referenced by booking().
DQMStore* HcalDigisClient::dbe_ [private] |
Definition at line 104 of file HcalDigisClient.h.
Referenced by book1D(), book2D(), bookPf(), endJob(), endRun(), HcalDigisClient(), and runClient().
std::string HcalDigisClient::dirName_ [private] |
Definition at line 106 of file HcalDigisClient.h.
Referenced by endRun(), HcalDigisClient(), and runClient().
std::map<std::string, MonitorElement*>* HcalDigisClient::msm_ [private] |
Definition at line 103 of file HcalDigisClient.h.
Referenced by book1D(), book2D(), bookPf(), fill1D(), fill2D(), fillPf(), HcalDigisClient(), and monitor().
std::string HcalDigisClient::outputFile_ [private] |
Definition at line 105 of file HcalDigisClient.h.
Referenced by endJob(), and HcalDigisClient().