Go to the documentation of this file.00001 #include "DQM/L1TMonitorClient/interface/L1TRPCTFClient.h"
00002
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/EventSetup.h"
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "DQMServices/Core/interface/QReport.h"
00009 #include "DQMServices/Core/interface/DQMStore.h"
00010 #include "DQMServices/Core/interface/MonitorElement.h"
00011 #include "TRandom.h"
00012
00013 #include <TF1.h>
00014 #include <stdio.h>
00015 #include <sstream>
00016 #include <math.h>
00017 #include <TProfile.h>
00018 #include <TProfile2D.h>
00019
00020 using namespace edm;
00021 using namespace std;
00022
00023 L1TRPCTFClient::L1TRPCTFClient(const edm::ParameterSet& ps)
00024 {
00025 parameters_=ps;
00026 initialize();
00027 }
00028
00029 L1TRPCTFClient::~L1TRPCTFClient(){
00030 LogInfo("TriggerDQM")<<"[TriggerDQM]: ending... ";
00031 }
00032
00033
00034 void L1TRPCTFClient::initialize(){
00035
00036 counterLS_=0;
00037 counterEvt_=0;
00038
00039
00040 dbe_ = Service<DQMStore>().operator->();
00041
00042
00043 monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","");
00044
00045 prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
00046
00047 prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
00048
00049 output_dir_ = parameters_.getUntrackedParameter<string>("output_dir","");
00050
00051 input_dir_ = parameters_.getUntrackedParameter<string>("input_dir","");
00052
00053
00054 verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
00055
00056 LogInfo( "TriggerDQM");
00057
00058
00059 }
00060
00061
00062 void L1TRPCTFClient::beginJob(void){
00063
00064 LogInfo("TriggerDQM")<<"[TriggerDQM]: Begin Job";
00065
00066
00067 dbe_ = Service<DQMStore>().operator->();
00068
00069 dbe_->setCurrentFolder(output_dir_);
00070
00071 m_deadChannels = dbe_->book2D("RPCTF_deadchannels",
00072 "RPCTF deadchannels",
00073 33, -16.5, 16.5,
00074 144, -0.5, 143.5);
00075 m_noisyChannels = dbe_->book2D("RPCTF_noisychannels",
00076 "RPCTF noisy channels",
00077 33, -16.5, 16.5,
00078 144, -0.5, 143.5);
00079 }
00080
00081 void L1TRPCTFClient::beginRun(const Run& r, const EventSetup& context) {
00082 }
00083
00084
00085 void L1TRPCTFClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
00086
00087
00088 }
00089
00090
00091 void L1TRPCTFClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00092 const edm::EventSetup& c)
00093 {
00094 if (verbose_) std::cout << "L1TRPCTFClient::endLuminosityBlock" << std::endl;
00095
00096 dbe_->setCurrentFolder(input_dir_);
00097
00098 {
00099
00100 MonitorElement *me
00101 = dbe_->get( (input_dir_+"/RPCTF_muons_eta_phi_bx0").c_str() );
00102
00103 if (me){
00104 const QReport *qreport;
00105
00106 qreport = me->getQReport("DeadChannels_RPCTF_2D");
00107 if (qreport) {
00108 vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
00109 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
00110 channel != badChannels.end();
00111 ++channel)
00112 {
00113 m_deadChannels->setBinContent((*channel).getBinX(),
00114 (*channel).getBinY(),
00115 100);
00116 }
00117 }
00118
00119 qreport = me->getQReport("HotChannels_RPCTF_2D");
00120 if (qreport) {
00121 vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
00122 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
00123 channel != badChannels.end();
00124 ++channel)
00125 {
00126
00127 m_noisyChannels->setBinContent((*channel).getBinX(), 100);
00128 }
00129 }
00130
00131 }
00132
00133
00134 }
00135
00136
00137 if (verbose_)
00138 {
00139 std::vector<string> meVec = dbe_->getMEs();
00140 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
00141
00142 std::string full_path = input_dir_ + "/" + (*it);
00143 MonitorElement * me =dbe_->get(full_path);
00144
00145
00146 std::vector<QReport *> Qtest_map = me->getQReports();
00147
00148 if (Qtest_map.size() > 0) {
00149 std::cout << "Test: " << full_path << std::endl;
00150 for (std::vector<QReport *>::const_iterator it = Qtest_map.begin();
00151 it != Qtest_map.end();
00152 ++it)
00153 {
00154 std::cout
00155 << " Name "<< (*it)->getQRName()
00156 << " Status " << (*it)->getStatus()
00157 <<std::endl;
00158
00159 std::vector<dqm::me_util::Channel> badChannels=(*it)->getBadChannels();
00160
00161 vector<dqm::me_util::Channel>::iterator badchsit = badChannels.begin();
00162 while(badchsit != badChannels.end())
00163 {
00164 int ix = (*badchsit).getBinX();
00165 int iy = (*badchsit).getBinY();
00166 std::cout << "(" << ix <<","<< iy << ") ";
00167 ++badchsit;
00168 }
00169 std::cout << std::endl;
00170
00171 }
00172 }
00173
00174 }
00175 }
00176 }
00177
00178 void L1TRPCTFClient::analyze(const Event& e, const EventSetup& context){
00179
00180 counterEvt_++;
00181 if (prescaleEvt_<1) return;
00182 if (prescaleEvt_>0 && counterEvt_%prescaleEvt_ != 0) return;
00183
00184
00185
00186
00187 }
00188
00189
00190 void L1TRPCTFClient::endRun(const Run& r, const EventSetup& context){
00191 }
00192
00193
00194 void L1TRPCTFClient::endJob(){
00195 }
00196
00197
00198
00199