Go to the documentation of this file.00001 #include <iostream>
00002
00003 #include "DQMOffline/JetMET/plugins/SusyPostProcessor.h"
00004 #include "DQMOffline/JetMET/interface/SusyDQM/Quantile.h"
00005 #include "FWCore/PluginManager/interface/ModuleDef.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007
00008 using namespace std;
00009
00010 const char* SusyPostProcessor::messageLoggerCatregory = "SusyDQMPostProcessor";
00011
00012 SusyPostProcessor::SusyPostProcessor(const edm::ParameterSet& pSet)
00013 {
00014
00015 dqm = edm::Service<DQMStore>().operator->();
00016 iConfig = pSet;
00017
00018 SUSYFolder = iConfig.getParameter<string>("folderName");
00019 _quantile = iConfig.getParameter<double>("quantile");
00020
00021 }
00022
00023 SusyPostProcessor::~SusyPostProcessor(){
00024 }
00025
00026 void SusyPostProcessor::beginJob(void){
00027 }
00028
00029 void SusyPostProcessor::beginRun(const edm::Run&, const edm::EventSetup& iSetup){
00030 }
00031
00032 void SusyPostProcessor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00033 }
00034
00035 void SusyPostProcessor::QuantilePlots(MonitorElement* ME, double q_value)
00036 {
00037 if(ME->getTH1()->GetEntries()>0.)
00038 {
00039 Quantile q(static_cast<const TH1*>(ME->getTH1()));
00040 Float_t mean=q[q_value].first;
00041 Float_t RMS=q[q_value].second;
00042
00043 Float_t xLow=-5.5;
00044 Float_t xUp=9.5;
00045 Int_t NBin=15;
00046
00047 if(mean>0.)
00048 {
00049 Float_t DBin=RMS*TMath::Sqrt(12.)/2.;
00050 xLow=mean-int(mean/DBin+2)*DBin;
00051 xUp=int(0.2*mean/DBin)*DBin+mean+5*DBin;
00052 NBin=(xUp-xLow)/DBin;
00053 }
00054
00055 dqm->setCurrentFolder(ME->getPathname());
00056 TString name=ME->getTH1()->GetName();
00057 name+="_quant";
00058 ME=dqm->book1D(name,"",NBin, xLow, xUp);
00059 ME->Fill(mean-RMS);
00060 ME->Fill(mean+RMS);
00061 }
00062 }
00063
00064
00065
00066 void SusyPostProcessor::endRun(const edm::Run&, const edm::EventSetup&)
00067 {
00068
00069
00070 dqm->setCurrentFolder("JetMET/MET");
00071
00072 Dirs = dqm->getSubdirs();
00073
00074 std::vector<std::string> metFolders;
00075
00076 metFolders.push_back("All/");
00077 metFolders.push_back("BasicCleanup/");
00078 metFolders.push_back("ExtraCleanup/");
00079
00080 for (int i=0; i<int(Dirs.size()); i++) {
00081
00082 std::string prefix = "dummy";
00083
00084 if (size_t(Dirs[i].find("Calo")) != string::npos) prefix = "Calo";
00085 if (size_t(Dirs[i].find("Pf")) != string::npos) prefix = "Pf";
00086 if (size_t(Dirs[i].find("Tc")) != string::npos) prefix = "";
00087
00088 for (std::vector<std::string>::const_iterator ic=metFolders.begin();
00089 ic!=metFolders.end(); ic++) {
00090
00091 std::string dirName = Dirs[i] + "/" + *ic;
00092
00093 MEx = dqm->get(dirName + "METTask_" + prefix + "MEx");
00094 MEy = dqm->get(dirName + "METTask_" + prefix + "MEx");
00095
00096 if (MEx && MEx->kind() == MonitorElement::DQM_KIND_TH1F) {
00097 if (MEx->getTH1F()->GetEntries() > 50) MEx->getTH1F()->Fit("gaus", "q");
00098 }
00099
00100 if (MEy && MEy->kind() == MonitorElement::DQM_KIND_TH1F) {
00101 if (MEy->getTH1F()->GetEntries() > 50) MEy->getTH1F()->Fit("gaus", "q");
00102 }
00103 }
00104 }
00105
00106
00107
00108
00109 dqm->setCurrentFolder(SUSYFolder);
00110 Dirs = dqm->getSubdirs();
00111 for (int i=0; i<int(Dirs.size()); i++)
00112 {
00113 size_t found = Dirs[i].find("Alpha");
00114 if (found!=string::npos) continue;
00115 if(!dqm->dirExists(Dirs[i])){
00116 edm::LogError(messageLoggerCatregory)<< "Directory "<<Dirs[i]<<" doesn't exist!!";
00117 continue;
00118 }
00119 vector<MonitorElement*> histoVector = dqm->getContents(Dirs[i]);
00120 for (int i=0; i<int(histoVector.size()); i++) {
00121 QuantilePlots(histoVector[i],_quantile);
00122 }
00123 }
00124 }
00125
00126
00127 void SusyPostProcessor::endJob(){}