Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
#include "DQM/EcalPreshowerMonitorClient/interface/EcalPreshowerMonitorClient.h"

#include "DQM/EcalPreshowerMonitorClient/interface/ESClient.h"
#include "DQM/EcalPreshowerMonitorClient/interface/ESIntegrityClient.h"
#include "DQM/EcalPreshowerMonitorClient/interface/ESPedestalClient.h"
#include "DQM/EcalPreshowerMonitorClient/interface/ESSummaryClient.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include "FWCore/Framework/interface/MakerMacros.h"

#include <iostream>
#include <memory>
#include <string>
#include <vector>

EcalPreshowerMonitorClient::EcalPreshowerMonitorClient(const edm::ParameterSet &ps)
    : debug_(ps.getUntrackedParameter<bool>("debug")), verbose_(ps.getUntrackedParameter<bool>("verbose")), clients_() {
  std::vector<std::string> enabledClients(ps.getUntrackedParameter<std::vector<std::string>>("enabledClients"));

  if (verbose_) {
    std::cout << " Enabled Clients:";
    for (unsigned int i = 0; i < enabledClients.size(); i++) {
      std::cout << " " << enabledClients[i];
    }
    std::cout << std::endl;
  }

  // Setup Clients
  if (find(enabledClients.begin(), enabledClients.end(), "Integrity") != enabledClients.end()) {
    clients_.push_back(new ESIntegrityClient(ps));
  }

  if (find(enabledClients.begin(), enabledClients.end(), "Pedestal") != enabledClients.end()) {
    clients_.push_back(new ESPedestalClient(ps));
  }

  if (find(enabledClients.begin(), enabledClients.end(), "Summary") != enabledClients.end()) {
    clients_.push_back(new ESSummaryClient(ps));
  }
}

EcalPreshowerMonitorClient::~EcalPreshowerMonitorClient() {
  if (verbose_)
    std::cout << "Finish EcalPreshowerMonitorClient" << std::endl;

  for (unsigned int i = 0; i < clients_.size(); i++) {
    delete clients_[i];
  }
}

/*static*/
void EcalPreshowerMonitorClient::fillDescriptions(edm::ConfigurationDescriptions &_descs) {
  edm::ParameterSetDescription desc;

  std::vector<std::string> clientsDefault;
  clientsDefault.push_back("Integrity");
  clientsDefault.push_back("Pedestal");
  clientsDefault.push_back("Summary");
  desc.addUntracked<std::vector<std::string>>("enabledClients", clientsDefault);
  desc.addUntracked<edm::FileInPath>("LookupTable");
  desc.addUntracked<std::string>("prefixME", "EcalPreshower");
  desc.addUntracked<bool>("fitPedestal", true);
  desc.addUntracked<bool>("cloneME", true);
  desc.addUntracked<bool>("verbose", false);
  desc.addUntracked<bool>("debug", false);

  _descs.addDefault(desc);
}

void EcalPreshowerMonitorClient::dqmEndJob(DQMStore::IBooker &_ibooker, DQMStore::IGetter &_igetter) {
  if (debug_) {
    std::cout << "EcalPreshowerMonitorClient: endJob" << std::endl;
  }

  for (unsigned int i = 0; i < clients_.size(); i++) {
    clients_[i]->setup(_ibooker);
    clients_[i]->endJobAnalyze(_igetter);
  }
}

void EcalPreshowerMonitorClient::dqmEndLuminosityBlock(DQMStore::IBooker &_ibooker,
                                                       DQMStore::IGetter &_igetter,
                                                       const edm::LuminosityBlock &,
                                                       const edm::EventSetup &) {
  for (unsigned int i = 0; i < clients_.size(); i++) {
    clients_[i]->setup(_ibooker);
    clients_[i]->endLumiAnalyze(_igetter);
  }
}

// define this as a plug-in
DEFINE_FWK_MODULE(EcalPreshowerMonitorClient);