CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/CSCMonitorModule/src/CSCMonitorModule.cc

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCMonitorModule.cc
00005  *
00006  *    Description:  CSC Monitor Module
00007  *
00008  *        Version:  1.0
00009  *        Created:  11/13/2008 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/CSCMonitorModule.h"
00020 
00025 CSCMonitorModule::CSCMonitorModule(const edm::ParameterSet& ps) {
00026 
00027   edm::FileInPath fp;
00028 
00029   inputTag = ps.getUntrackedParameter<edm::InputTag>("InputObjects", (edm::InputTag)INPUT_TAG_LABEL);
00030   prebookEffParams = ps.getUntrackedParameter<bool>("PREBOOK_EFF_PARAMS", false);
00031   processDcsScalers = ps.getUntrackedParameter<bool>("PROCESS_DCS_SCALERS", true);
00032   edm::ParameterSet params = ps.getUntrackedParameter<edm::ParameterSet>("EventProcessor");
00033   config.load(params);
00034 
00035   fp = ps.getParameter<edm::FileInPath>("BOOKING_XML_FILE");
00036   config.setBOOKING_XML_FILE(fp.fullPath());
00037     
00038   dbe = edm::Service<DQMStore>().operator->();
00039 
00040   dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this));
00041   dispatcher->init();
00042 
00043   if (ps.exists("MASKEDHW")) {
00044     std::vector<std::string> maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
00045     dispatcher->maskHWElements(maskedHW);
00046   }
00047 
00048 }
00049 
00053 CSCMonitorModule::~CSCMonitorModule() {
00054   if (dispatcher) delete dispatcher;
00055 }
00056 
00062 void CSCMonitorModule::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00063 
00064   if (prebookEffParams) {
00065     dispatcher->updateFractionAndEfficiencyHistos();
00066   }
00067 
00068 }
00069 
00075 void CSCMonitorModule::analyze(const edm::Event& e, const edm::EventSetup& c) {
00076 
00077   // Get crate mapping from database
00078   edm::ESHandle<CSCCrateMap> hcrate;
00079   c.get<CSCCrateMapRcd>().get(hcrate);
00080   pcrate = hcrate.product();
00081 
00082   cscdqm::HWStandbyType standby;
00083 
00084   // Get DCS status scalers
00085   if (processDcsScalers) {
00086     edm::Handle<DcsStatusCollection> dcsStatus;
00087     if (e.getByLabel("scalersRawToDigi", dcsStatus)) {
00088       DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
00089       for (; dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
00090         standby.applyMeP(dcsStatusItr->ready(DcsStatus::CSCp));
00091         standby.applyMeM(dcsStatusItr->ready(DcsStatus::CSCm));
00092       }
00093     }
00094     standby.process = true;
00095   }
00096 
00097   dispatcher->processEvent(e, inputTag, standby);
00098 
00099 }
00100 
00106 cscdqm::MonitorObject* CSCMonitorModule::bookMonitorObject(const cscdqm::HistoBookRequest& req) {
00107 
00108   cscdqm::MonitorObject *me = NULL;
00109   std::string name = req.hdef->getName();
00110 
00111   std::string path = req.folder;
00112   if (req.hdef->getPath().size() > 0) {
00113     path = path + req.hdef->getPath() + "/";
00114   }
00115   
00116   //std::cout << "Moving to " << path << " for name = " << name << " with fullPath = " << req.hdef->getFullPath() << "\n";
00117 
00118   dbe->setCurrentFolder(path);
00119 
00120   if (req.htype == cscdqm::INT) {
00121     me = new CSCMonitorObject(dbe->bookInt(name));
00122     me->Fill(req.default_int);
00123   } else 
00124   if (req.htype == cscdqm::FLOAT) {
00125     if (req.hdef->getId() == cscdqm::h::PAR_REPORT_SUMMARY ||
00126         req.hdef->getId() == cscdqm::h::PAR_CRT_SUMMARY ||
00127         req.hdef->getId() == cscdqm::h::PAR_DAQ_SUMMARY ||
00128         req.hdef->getId() == cscdqm::h::PAR_DCS_SUMMARY) {
00129       dbe->setCurrentFolder(DIR_EVENTINFO);
00130     } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
00131       dbe->setCurrentFolder(DIR_DCSINFO);
00132     } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
00133       dbe->setCurrentFolder(DIR_DAQINFO);
00134     } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
00135       dbe->setCurrentFolder(DIR_CRTINFO);
00136     }
00137     me = new CSCMonitorObject(dbe->bookFloat(name));
00138     me->Fill(req.default_float);
00139   } else 
00140   if (req.htype == cscdqm::STRING) {
00141     me = new CSCMonitorObject(dbe->bookString(name, req.default_string));
00142   } else 
00143   if (req.htype == cscdqm::H1D) { 
00144     me = new CSCMonitorObject(dbe->book1D(name, req.title, req.nchX, req.lowX, req.highX));
00145   } else 
00146   if (req.htype == cscdqm::H2D) {
00147     if (req.hdef->getId() == cscdqm::h::EMU_CSC_STATS_SUMMARY) {
00148       dbe->setCurrentFolder(DIR_EVENTINFO);
00149       name = "reportSummaryMap";
00150     }
00151     me = new CSCMonitorObject(dbe->book2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY));
00152   } else 
00153   if (req.htype == cscdqm::H3D) {
00154     me = new CSCMonitorObject(dbe->book3D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ));
00155   } else 
00156   if (req.htype == cscdqm::PROFILE) {
00157     me = new CSCMonitorObject(dbe->bookProfile(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.option.c_str()));
00158   } else 
00159   if (req.htype == cscdqm::PROFILE2D) {
00160     me = new CSCMonitorObject(dbe->bookProfile2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ, req.option.c_str()));
00161   }
00162 
00163   return me;
00164 
00165 }
00166