CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DQM/CSCMonitorModule/src/CSCOfflineClient.cc

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCOfflineClient.cc
00005  *
00006  *    Description:  CSC Offline Client
00007  *
00008  *        Version:  1.0
00009  *        Created:  08/20/2009 02:31:12 PM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #include "DQM/CSCMonitorModule/interface/CSCOfflineClient.h"
00020 
00025 CSCOfflineClient::CSCOfflineClient(const edm::ParameterSet& ps) {
00026 
00027   edm::ParameterSet params = ps.getUntrackedParameter<edm::ParameterSet>("EventProcessor");
00028   config.load(params);
00029 
00030   dbe = edm::Service<DQMStore>().operator->();
00031 
00032   dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCOfflineClient*>(this));
00033   dispatcher->init();
00034 
00035   if (ps.exists("MASKEDHW")) {
00036     std::vector<std::string> maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
00037     dispatcher->maskHWElements(maskedHW);
00038   }
00039 
00040 }
00041 
00045 CSCOfflineClient::~CSCOfflineClient() {
00046   if (dispatcher) delete dispatcher;
00047 }
00048 
00049 void CSCOfflineClient::endRun(const edm::Run& r, const edm::EventSetup& c) {
00050 
00051   /*
00052    *  Putting histograms to internal cache: EMU stuff
00053    */
00054 
00055   dbe->setCurrentFolder(config.getFOLDER_EMU());
00056   std::vector<std::string> me_names = dbe->getMEs();
00057   for (std::vector<std::string>::iterator iter = me_names.begin(); iter != me_names.end(); iter++) {
00058     std::string me_name = *iter;
00059     MonitorElement* me = dbe->get(config.getFOLDER_EMU() + me_name);
00060     cscdqm::HistoId id;
00061     if (me && cscdqm::HistoDef::getHistoIdByName(me_name, id)) {
00062       const cscdqm::EMUHistoDef def(id);
00063       cscdqm::MonitorObject* mo = new CSCMonitorObject(me);
00064       config.fnPutHisto(def, mo);
00065     }
00066   }
00067 
00068   /*
00069    *  Putting histograms to internal cache: EventInfo
00070    */
00071 
00072   {
00073     std::string name = DIR_EVENTINFO;
00074     name += "reportSummaryMap";
00075     MonitorElement* me = dbe->get(name);
00076     if (me) {
00077       const cscdqm::EMUHistoDef def(cscdqm::h::EMU_CSC_STATS_SUMMARY);
00078       cscdqm::MonitorObject* mo = new CSCMonitorObject(me);
00079       config.fnPutHisto(def, mo);
00080     }
00081   }
00082 
00083   config.incNEvents();
00084   dispatcher->updateFractionAndEfficiencyHistos();
00085 
00086 }
00087 
00093 cscdqm::MonitorObject* CSCOfflineClient::bookMonitorObject(const cscdqm::HistoBookRequest& req) {
00094 
00095   cscdqm::MonitorObject *me = NULL;
00096   std::string name = req.hdef->getName();
00097 
00098   std::string path = req.folder;
00099   if (req.hdef->getPath().size() > 0) {
00100     path = path + req.hdef->getPath() + "/";
00101   }
00102   
00103   dbe->setCurrentFolder(path);
00104 
00105   if (req.htype == cscdqm::INT) {
00106     me = new CSCMonitorObject(dbe->bookInt(name));
00107     me->Fill(req.default_int);
00108   } else 
00109   if (req.htype == cscdqm::FLOAT) {
00110     if (req.hdef->getId() == cscdqm::h::PAR_REPORT_SUMMARY) {
00111       dbe->setCurrentFolder(DIR_EVENTINFO);
00112     } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
00113       dbe->setCurrentFolder(DIR_DCSINFO);
00114     } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
00115       dbe->setCurrentFolder(DIR_DAQINFO);
00116     } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
00117       dbe->setCurrentFolder(DIR_CRTINFO);
00118     }
00119     me = new CSCMonitorObject(dbe->bookFloat(name));
00120     me->Fill(req.default_float);
00121   } else 
00122   if (req.htype == cscdqm::STRING) {
00123     me = new CSCMonitorObject(dbe->bookString(name, req.default_string));
00124   }
00125 
00126   return me;
00127 
00128 }