#include <HcalCoarsePedestalClient.h>
Public Member Functions | |
void | analyze (void) |
void | beginJob (void) |
void | beginRun (void) |
void | calculateProblems (void) |
void | cleanup (void) |
void | endJob (void) |
void | endRun (void) |
bool | hasErrors_Temp (void) |
bool | hasOther_Temp (void) |
bool | hasWarnings_Temp (void) |
HcalCoarsePedestalClient (std::string myname) | |
HcalCoarsePedestalClient () | |
Constructors. | |
HcalCoarsePedestalClient (std::string myname, const edm::ParameterSet &ps) | |
void | setup (void) |
bool | test_enabled (void) |
void | updateChannelStatus (std::map< HcalDetId, unsigned int > &myqual) |
~HcalCoarsePedestalClient () | |
Destructor. | |
Private Attributes | |
double | ADCDiffThresh_ |
MonitorElement * | CoarsePedDiff |
EtaPhiHists * | CoarsePedestalsByDepth |
TH2F * | DatabasePedestalsADCByDepth [4] |
int | nevts_ |
Definition at line 8 of file HcalCoarsePedestalClient.h.
HcalCoarsePedestalClient::HcalCoarsePedestalClient | ( | ) | [inline] |
Constructors.
Definition at line 13 of file HcalCoarsePedestalClient.h.
References HcalBaseDQClient::name_.
{name_="";};
HcalCoarsePedestalClient::HcalCoarsePedestalClient | ( | std::string | myname | ) |
Definition at line 20 of file HcalCoarsePedestalClient.cc.
References HcalBaseDQClient::name_.
{ name_=myname; }
HcalCoarsePedestalClient::HcalCoarsePedestalClient | ( | std::string | myname, |
const edm::ParameterSet & | ps | ||
) |
Definition at line 25 of file HcalCoarsePedestalClient.cc.
References HcalBaseDQClient::badChannelStatusMask_, HcalBaseDQClient::cloneME_, HcalBaseDQClient::debug_, HcalBaseDQClient::enableCleanup_, edm::ParameterSet::getUntrackedParameter(), HcalChannelStatus::HcalCellDead, HcalChannelStatus::HcalCellHot, HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, HcalBaseDQClient::name_, HcalBaseDQClient::prefixME_, HcalBaseDQClient::ProblemCellsByDepth, HcalBaseDQClient::subdir_, and HcalBaseDQClient::validHtmlOutput_.
{ name_=myname; enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false); debug_ = ps.getUntrackedParameter<int>("debug",0); prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/"); if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/") prefixME_.append("/"); subdir_ = ps.getUntrackedParameter<std::string>("CoarsePedestalFolder","CoarsePedestalMonitor_Hcal/"); // CoarsePedestalMonitor_Hcal if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/") subdir_.append("/"); subdir_=prefixME_+subdir_; validHtmlOutput_ = ps.getUntrackedParameter<bool>("CoarsePedestal_validHtmlOutput",true); cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true); badChannelStatusMask_ = ps.getUntrackedParameter<int>("CoarsePedestal_BadChannelStatusMask", ps.getUntrackedParameter<int>("BadChannelStatusMask", ((1<<HcalChannelStatus::HcalCellDead)|(1<<HcalChannelStatus::HcalCellHot)))); // identify channel status values to mask minerrorrate_ = ps.getUntrackedParameter<double>("CoarsePedestal_minerrorrate", ps.getUntrackedParameter<double>("minerrorrate",0.05)); // minevents_ canbe overwritten by monitor task value minevents_ = ps.getUntrackedParameter<int>("CoarsePedestal_minevents", ps.getUntrackedParameter<int>("minevents",1)); ProblemCellsByDepth=0; }
HcalCoarsePedestalClient::~HcalCoarsePedestalClient | ( | ) |
Destructor.
void HcalCoarsePedestalClient::analyze | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 56 of file HcalCoarsePedestalClient.cc.
References calculateProblems(), gather_cfg::cout, and HcalBaseDQClient::debug_.
Referenced by endRun().
{ if (debug_>2) std::cout <<"\tHcalCoarsePedestalClient::analyze()"<<std::endl; calculateProblems(); } // void HcalCoarsePedestalClient::analyze()
void HcalCoarsePedestalClient::beginJob | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 217 of file HcalCoarsePedestalClient.cc.
References gather_cfg::cout, HcalBaseDQClient::debug_, HcalBaseDQClient::dqmStore_, cmsCodeRules::cppFunctionSkipper::operator, and DQMStore::showDirStructure().
{ dqmStore_ = edm::Service<DQMStore>().operator->(); if (debug_>0) { std::cout <<"<HcalCoarsePedestalClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl; dqmStore_->showDirStructure(); } }
void HcalCoarsePedestalClient::beginRun | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 229 of file HcalCoarsePedestalClient.cc.
References ADCDiffThresh_, DQMStore::book1D(), DQMStore::book2D(), HcalBaseDQClient::cloneME_, CoarsePedDiff, CoarsePedestalsByDepth, gather_cfg::cout, DatabasePedestalsADCByDepth, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::dqmStore_, HcalBaseDQClient::enoughevents_, DQMStore::get(), MonitorElement::getFloatValue(), MonitorElement::getIntValue(), MonitorElement::getName(), HcalEtaPhiHistNames(), i, HcalBaseDQClient::minevents_, HcalBaseDQClient::name(), nevts_, HcalBaseDQClient::prefixME_, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, HcalBaseDQClient::problemnames_, asciidump::s, DQMStore::setCurrentFolder(), EtaPhiHists::setup(), HcalBaseDQClient::subdir_, and cond::rpcobtemp::temp.
{ enoughevents_=false; if (!dqmStore_) { if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::beginRun> dqmStore does not exist!"<<std::endl; return; } dqmStore_->setCurrentFolder(subdir_); CoarsePedestalsByDepth = new EtaPhiHists(); CoarsePedestalsByDepth->setup(dqmStore_," Coarse Pedestal Map"); CoarsePedDiff=dqmStore_->book1D("PedRefDiff","(Pedestal-Reference)",200,-10,10); problemnames_.clear(); ProblemCells=dqmStore_->book2D(" ProblemCoarsePedestals", " Problem Coarse Pedestal Rate for all HCAL;ieta;iphi", 85,-42.5,42.5, 72,0.5,72.5); problemnames_.push_back(ProblemCells->getName()); if (debug_>1) std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl; dqmStore_->setCurrentFolder(subdir_+"problem_coarsepedestals"); ProblemCellsByDepth = new EtaPhiHists(); ProblemCellsByDepth->setup(dqmStore_," Problem Coarse Pedestal Rate"); for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i) problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName()); nevts_=0; std::vector<std::string> name = HcalEtaPhiHistNames(); MonitorElement* me; for (int i=0;i<4;++i) { std::string s=prefixME_+"HcalInfo/PedestalsFromCondDB/"+name[i]+"ADC Pedestals From Conditions DB"; me=dqmStore_->get(s.c_str()); if (me==0) { if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::beginRun> Could not get histogram with name "<<s<<std::endl; } DatabasePedestalsADCByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, DatabasePedestalsADCByDepth[i], debug_); } std::string s=subdir_+"CoarsePedestal_parameters/ADCdiff_Problem_Threshold"; me=dqmStore_->get(s.c_str()); if (me==0) { if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::beginRun> Could not get value with name "<<s<<std::endl; } else ADCDiffThresh_=me->getFloatValue(); s=subdir_+"CoarsePedestal_parameters/minEventsNeededForPedestalCalculation"; me=dqmStore_->get(s.c_str()); int temp = 0; if (me==0) { if (debug_>0) { std::cout <<"<HcalCoarsePedestalClient::beginRun> Could not get value with name "<<s<<"\n\t Continuing on using default 'minevents' value of "<<minevents_<<std::endl; } } else temp=me->getIntValue(); if (temp>minevents_) { if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::beginRun> Specified client 'minevents' value of "<<minevents_<<" is less than minimum task 'minevents' value of "<<temp<<"\n\t Setting client 'minevents' to "<<temp<<std::endl; minevents_=temp; } } // void HcalCoarsePedestalClient::beginRun()
void HcalCoarsePedestalClient::calculateProblems | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 62 of file HcalCoarsePedestalClient.cc.
References abs, ADCDiffThresh_, HcalBaseDQClient::badstatusmap, CalcIeta(), HcalBaseDQClient::cloneME_, CoarsePedDiff, CoarsePedestalsByDepth, gather_cfg::cout, DatabasePedestalsADCByDepth, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::dqmStore_, HcalBaseDQClient::enoughevents_, eta(), MonitorElement::Fill(), FillUnphysicalHEHFBins(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getTH2F(), HcalBarrel, HcalEmpty, HcalEndcap, HcalEtaPhiHistNames(), HcalForward, HcalOuter, i, isHB(), isHE(), isHF(), isHO(), HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, HcalBaseDQClient::name(), phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), asciidump::s, MonitorElement::setBinContent(), and HcalBaseDQClient::subdir_.
Referenced by analyze().
{ if (debug_>2) std::cout <<"\t\tHcalCoarsePedestalClient::calculateProblems()"<<std::endl; if(!dqmStore_) return; //int totalevents=0; // events checked on a channel-by-channel basis int etabins=0, phibins=0, zside=0; double problemvalue=0; if (CoarsePedDiff!=0) CoarsePedDiff->Reset(); // Clear away old problems if (ProblemCells!=0) { ProblemCells->Reset(); (ProblemCells->getTH2F())->SetMaximum(1.05); (ProblemCells->getTH2F())->SetMinimum(0.); (ProblemCells->getTH2F())->SetOption("colz"); } for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d) { if (ProblemCellsByDepth->depth[d]!=0) { ProblemCellsByDepth->depth[d]->Reset(); (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05); (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.); (ProblemCellsByDepth->depth[d]->getTH2F())->SetOption("colz"); } } // Get histograms that are used in testing TH2F* CoarsePedestalsSumByDepth[4]; TH2F* CoarsePedestalsOccByDepth[4]; std::vector<std::string> name = HcalEtaPhiHistNames(); bool gothistos=true; MonitorElement* me; for (int i=0;i<4;++i) { std::string s=subdir_+"CoarsePedestalSumPlots/"+name[i]+"Coarse Pedestal Summed Map"; me=dqmStore_->get(s.c_str()); if (me==0) { gothistos=false; if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::calculateProblems> Could not get histogram with name "<<s<<std::endl; } CoarsePedestalsSumByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, CoarsePedestalsSumByDepth[i], debug_); s=subdir_+"CoarsePedestalSumPlots/"+name[i]+"Coarse Pedestal Occupancy Map"; me=dqmStore_->get(s.c_str()); if (me==0) { gothistos=false; if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::calculateProblems> Could not get histogram with name "<<s<<std::endl; } CoarsePedestalsOccByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, CoarsePedestalsOccByDepth[i], debug_); } // for (int i=0;i<4;++i) if (gothistos==false) { if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::calculateProblems> Unable to get all necessary histograms to evaluate problem rate"<<std::endl; return; } enoughevents_=true; // Always set this to true, so that pedestal monitoring doesn't hold up int numevents=0; for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d) { if (ProblemCellsByDepth->depth[d]==0) continue; if (CoarsePedestalsSumByDepth[d]==0 || CoarsePedestalsOccByDepth[d]==0 || DatabasePedestalsADCByDepth[d]==0) continue; if (CoarsePedestalsByDepth->depth[d]!=0) CoarsePedestalsByDepth->depth[d]->Reset(); etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX(); phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY(); for (int eta=0;eta<etabins;++eta) { int ieta=CalcIeta(eta,d+1); if (ieta==-9999) continue; for (int phi=0;phi<phibins;++phi) { if (abs(ieta)>20 && (phi+1)%2==0) continue; if (abs(ieta)>39 && (phi+1)%4!=3) continue; numevents=(int)CoarsePedestalsOccByDepth[d]->GetBinContent(eta+1,phi+1); if (numevents==0 || numevents<minevents_) { if (debug_>1) std::cout <<"NOT ENOUGH EVENTS for channel ("<<ieta<<", "<<phi+1<<", "<<d+1<<") numevents = "<<numevents<<" minevents = "<<minevents_<<std::endl; continue; // insufficient pedestal information available for this channel; continue on? } problemvalue=1.*CoarsePedestalsSumByDepth[d]->GetBinContent(eta+1,phi+1)/numevents; CoarsePedestalsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue); problemvalue=(problemvalue-DatabasePedestalsADCByDepth[d]->GetBinContent(eta+1,phi+1)); CoarsePedDiff->Fill(problemvalue); problemvalue=fabs(problemvalue); // Pedestal status is cumulative (DetDiag pedestals perform resets after each calibration cycle, and save each output) // Either a channels pedestal is 'bad' (outside of allowed range) or 'good' (in range) problemvalue>ADCDiffThresh_ ? problemvalue=1 : problemvalue=0; if (debug_>0 && problemvalue==1) std::cout <<"<HcalCoarsePedestalClient> Problem found for channel ("<<ieta<<", "<<phi+1<<", "<<d+1<<")"<<std::endl; zside=0; if (isHF(eta,d+1)) // shift ieta by 1 for HF ieta<0 ? zside = -1 : zside = 1; // For problem cells that exceed our allowed rate, // set the values to -1 if the cells are already marked in the status database if (problemvalue>minerrorrate_) { HcalSubdetector subdet=HcalEmpty; if (isHB(eta,d+1))subdet=HcalBarrel; else if (isHE(eta,d+1)) subdet=HcalEndcap; else if (isHF(eta,d+1)) subdet=HcalForward; else if (isHO(eta,d+1)) subdet=HcalOuter; HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1)); if (badstatusmap.find(hcalid)!=badstatusmap.end()) problemvalue=999; } ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue); if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue); } // loop on phi } // loop on eta } // loop on depth if (ProblemCells==0) { if (debug_>0) std::cout <<"<HcalCoarsePedestalClient::analyze> ProblemCells histogram does not exist!"<<std::endl; return; } // Normalization of ProblemCell plot, in the case where there are errors in multiple depths etabins=(ProblemCells->getTH2F())->GetNbinsX(); phibins=(ProblemCells->getTH2F())->GetNbinsY(); for (int eta=0;eta<etabins;++eta) { for (int phi=0;phi<phibins;++phi) { if (ProblemCells->getBinContent(eta+1,phi+1)>1. && ProblemCells->getBinContent(eta+1,phi+1)<999) ProblemCells->setBinContent(eta+1,phi+1,1.); } } FillUnphysicalHEHFBins(*ProblemCellsByDepth); FillUnphysicalHEHFBins(ProblemCells); FillUnphysicalHEHFBins(*CoarsePedestalsByDepth); return; }
void HcalCoarsePedestalClient::cleanup | ( | void | ) | [virtual] |
void HcalCoarsePedestalClient::endJob | ( | void | ) | [virtual] |
void HcalCoarsePedestalClient::endRun | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 300 of file HcalCoarsePedestalClient.cc.
References analyze().
{analyze();}
bool HcalCoarsePedestalClient::hasErrors_Temp | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 305 of file HcalCoarsePedestalClient.cc.
References CalcIeta(), gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, MonitorElement::getTH2F(), HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::ProblemCells, and HcalBaseDQClient::ProblemCellsByDepth.
{ if (!ProblemCells) { if (debug_>1) std::cout <<"<HcalCoarsePedestalClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl; return false; } int problemcount=0; int ieta=-9999; for (int depth=0;depth<4; ++depth) { int etabins = (ProblemCells->getTH2F())->GetNbinsX(); int phibins = (ProblemCells->getTH2F())->GetNbinsY(); for (int hist_eta=0;hist_eta<etabins;++hist_eta) { for (int hist_phi=0; hist_phi<phibins;++hist_phi) { ieta=CalcIeta(hist_eta,depth+1); if (ieta==-9999) continue; if (ProblemCellsByDepth->depth[depth]==0) continue; if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_) ++problemcount; } // for (int hist_phi=1;...) } // for (int hist_eta=1;...) } // for (int depth=0;...) if (problemcount>0) return true; return false; }
bool HcalCoarsePedestalClient::hasOther_Temp | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 339 of file HcalCoarsePedestalClient.cc.
{return false;}
bool HcalCoarsePedestalClient::hasWarnings_Temp | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 338 of file HcalCoarsePedestalClient.cc.
{return false;}
void HcalCoarsePedestalClient::setup | ( | void | ) | [virtual] |
bool HcalCoarsePedestalClient::test_enabled | ( | void | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 340 of file HcalCoarsePedestalClient.cc.
{return true;}
void HcalCoarsePedestalClient::updateChannelStatus | ( | std::map< HcalDetId, unsigned int > & | myqual | ) | [virtual] |
Reimplemented from HcalBaseDQClient.
Definition at line 343 of file HcalCoarsePedestalClient.cc.
{ // client does not alter channel status yet; // look at dead cell or hot cell clients for example code } //void HcalCoarsePedestalClient::updateChannelStatus
double HcalCoarsePedestalClient::ADCDiffThresh_ [private] |
Definition at line 38 of file HcalCoarsePedestalClient.h.
Referenced by beginRun(), and calculateProblems().
Definition at line 41 of file HcalCoarsePedestalClient.h.
Referenced by beginRun(), and calculateProblems().
Definition at line 40 of file HcalCoarsePedestalClient.h.
Referenced by beginRun(), and calculateProblems().
TH2F* HcalCoarsePedestalClient::DatabasePedestalsADCByDepth[4] [private] |
Definition at line 39 of file HcalCoarsePedestalClient.h.
Referenced by beginRun(), and calculateProblems().
int HcalCoarsePedestalClient::nevts_ [private] |
Definition at line 36 of file HcalCoarsePedestalClient.h.
Referenced by beginRun().