Go to the documentation of this file.00001 #include "DQMOffline/Trigger/interface/JetMETHLTOfflineClient.h"
00002
00003 #include "FWCore/Framework/interface/Run.h"
00004 #include "FWCore/Framework/interface/Event.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "FWCore/ServiceRegistry/interface/Service.h"
00007
00008 #include "DQMServices/Core/interface/DQMStore.h"
00009 #include "DQMServices/Core/interface/MonitorElement.h"
00010
00011 JetMETHLTOfflineClient::JetMETHLTOfflineClient(const edm::ParameterSet& iConfig):conf_(iConfig)
00012 {
00013 dbe_ = edm::Service<DQMStore>().operator->();
00014 if (!dbe_) {
00015 edm::LogError("JetMETHLTOfflineClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
00016 }
00017 if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
00018 if(dbe_) dbe_->setVerbose(0);
00019 }
00020
00021 debug_ = false;
00022 verbose_ = false;
00023
00024 processname_ = iConfig.getParameter<std::string>("processname");
00025
00026 hltTag_ = iConfig.getParameter<std::string>("hltTag");
00027 if (debug_) std::cout << hltTag_ << std::endl;
00028
00029 dirName_=iConfig.getParameter<std::string>("DQMDirName");
00030 if(dbe_) dbe_->setCurrentFolder(dirName_);
00031
00032 }
00033
00034
00035 JetMETHLTOfflineClient::~JetMETHLTOfflineClient()
00036 {
00037
00038 }
00039
00040 void JetMETHLTOfflineClient::beginJob()
00041 {
00042
00043
00044 }
00045
00046 void JetMETHLTOfflineClient::endJob()
00047 {
00048
00049 }
00050
00051 void JetMETHLTOfflineClient::beginRun(const edm::Run& run, const edm::EventSetup& c)
00052 {
00053
00054 }
00055
00056
00057 void JetMETHLTOfflineClient::endRun(const edm::Run& run, const edm::EventSetup& c)
00058 {
00059 runClient_();
00060 }
00061
00062
00063 void JetMETHLTOfflineClient::analyze(const edm::Event& iEvent,const edm::EventSetup& iSetup)
00064 {
00065
00066 }
00067
00068 void JetMETHLTOfflineClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c)
00069 {
00070 runClient_();
00071 }
00072
00073 void JetMETHLTOfflineClient::runClient_()
00074 {
00075 if(!dbe_) return;
00076 dbe_->setCurrentFolder(dirName_);
00077
00078 LogDebug("JetMETHLTOfflineClient") << "runClient" << std::endl;
00079 if (debug_) std::cout << "runClient" << std::endl;
00080
00081 std::vector<MonitorElement*> hltMEs;
00082
00083
00084 std::vector<std::string> fullPathHLTFolders = dbe_->getSubdirs();
00085 for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
00086
00087
00088 if (debug_) std::cout << fullPathHLTFolders[i] << std::endl;
00089 if ((fullPathHLTFolders[i].find("Eff")!=std::string::npos)) {
00090 dbe_->setCurrentFolder(fullPathHLTFolders[i]);
00091 }
00092 else {
00093 continue;
00094 }
00095
00096
00097 std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs();
00098 for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
00099
00100 if (debug_) std::cout << fullSubPathHLTFolders[j] << std::endl;
00101 dbe_->setCurrentFolder(fullSubPathHLTFolders[j]);
00102
00103
00104
00105
00106 hltMEs = dbe_->getContents(fullSubPathHLTFolders[j]);
00107 LogDebug("JetMETHLTOfflineClient")<< "Number of MEs for this HLT path = " << hltMEs.size() << std::endl;
00108
00109 for(unsigned int k=0;k<hltMEs.size();k++) {
00110 if (debug_) std::cout << hltMEs[k]->getName() << std::endl;
00111
00112
00113 if ((hltMEs[k]->getName().find("ME_Numerator")!=std::string::npos) && hltMEs[k]->getName().find("ME_Numerator")==0){
00114
00115 std::string name = hltMEs[k]->getName();
00116 name.erase(0,12);
00117 if (debug_) std::cout <<"==name=="<< name << std::endl;
00118
00119
00120
00121
00122
00123
00124 for(unsigned int l=0;l<hltMEs.size();l++) {
00125 if (hltMEs[l]->getName() == "ME_Denominator"+name){
00126
00127 if(name.find("EtaPhi") !=std::string::npos) {
00128 TH2F* tNumerator = hltMEs[k]->getTH2F();
00129 TH2F* tDenominator = hltMEs[l]->getTH2F();
00130
00131 std::string title = "Eff_"+hltMEs[k]->getTitle();
00132
00133 TH2F *teff = (TH2F*) tNumerator->Clone(title.c_str());
00134 teff->Divide(tNumerator,tDenominator,1,1);
00135 dbe_->book2D("ME_Eff_"+name,teff);
00136 delete teff;
00137
00138 }
00139 else{
00140 TH1F* tNumerator = hltMEs[k]->getTH1F();
00141 TH1F* tDenominator = hltMEs[l]->getTH1F();
00142
00143 std::string title = "Eff_"+hltMEs[k]->getTitle();
00144
00145 TH1F *teff = (TH1F*) tNumerator->Clone(title.c_str());
00146 teff->Divide(tNumerator,tDenominator,1,1);
00147 dbe_->book1D("ME_Eff_"+name,teff);
00148 delete teff;
00149
00150 }
00151 }
00152 }
00153 }
00154
00155
00156 }
00157 }
00158 }
00159 }
00160