Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-29 23:10:22

0001 #include "DQMOffline/Hcal/interface/HcalNoiseRatesClient.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/Run.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009 
0010 HcalNoiseRatesClient::HcalNoiseRatesClient(const edm::ParameterSet &iConfig) : conf_(iConfig) {
0011   outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
0012   debug_ = false;
0013   verbose_ = false;
0014   dirName_ = iConfig.getParameter<std::string>("DQMDirName");
0015 }
0016 
0017 HcalNoiseRatesClient::~HcalNoiseRatesClient() {}
0018 
0019 void HcalNoiseRatesClient::beginJob() {}
0020 
0021 void HcalNoiseRatesClient::beginRun(const edm::Run &run, const edm::EventSetup &c) {}
0022 
0023 void HcalNoiseRatesClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0024   igetter.setCurrentFolder(dirName_);
0025 
0026   if (verbose_)
0027     std::cout << "\nrunClient" << std::endl;
0028 
0029   std::vector<MonitorElement *> hcalMEs;
0030 
0031   // Since out folders are fixed to three, we can just go over these three
0032   // folders i.e., CaloTowersD/CaloTowersTask, HcalRecHitsD/HcalRecHitTask,
0033   // HcalNoiseRatesD/NoiseRatesTask.
0034   std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
0035   for (unsigned int i = 0; i < fullPathHLTFolders.size(); i++) {
0036     if (verbose_)
0037       std::cout << "\nfullPath: " << fullPathHLTFolders[i] << std::endl;
0038     igetter.setCurrentFolder(fullPathHLTFolders[i]);
0039 
0040     std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
0041     for (unsigned int j = 0; j < fullSubPathHLTFolders.size(); j++) {
0042       if (verbose_)
0043         std::cout << "fullSub: " << fullSubPathHLTFolders[j] << std::endl;
0044 
0045       if (strcmp(fullSubPathHLTFolders[j].c_str(), "HcalNoiseRatesD/NoiseRatesTask") == 0) {
0046         hcalMEs = igetter.getContents(fullSubPathHLTFolders[j]);
0047         if (verbose_)
0048           std::cout << "hltMES size : " << hcalMEs.size() << std::endl;
0049         if (!NoiseRatesEndjob(hcalMEs))
0050           std::cout << "\nError in NoiseRatesEndjob!" << std::endl << std::endl;
0051       }
0052     }
0053   }
0054 }
0055 
0056 // called after entering the HcalNoiseRatesD/NoiseRatesTask directory
0057 // hcalMEs are within that directory
0058 int HcalNoiseRatesClient::NoiseRatesEndjob(const std::vector<MonitorElement *> &hcalMEs) {
0059   int useAllHistos = 0;
0060   MonitorElement *hLumiBlockCount = nullptr;
0061   for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
0062     if (strcmp(hcalMEs[ih]->getName().c_str(), "hLumiBlockCount") == 0) {
0063       hLumiBlockCount = hcalMEs[ih];
0064       useAllHistos = 1;
0065     }
0066   }
0067   if (useAllHistos != 0 && useAllHistos != 1)
0068     return 0;
0069 
0070   // FIXME: dummy lumiCountMap.size since hLumiBlockCount is disabled
0071   // in a general case.
0072   int lumiCountMapsize = -1;  // dummy
0073   if (useAllHistos)
0074     hLumiBlockCount->Fill(0.0, lumiCountMapsize);
0075 
0076   return 1;
0077 }
0078 
0079 DEFINE_FWK_MODULE(HcalNoiseRatesClient);