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 00007 using namespace std; 00008 00009 SusyPostProcessor::SusyPostProcessor(const edm::ParameterSet& pSet) 00010 { 00011 00012 dqm = 0; 00013 dqm = edm::Service<DQMStore>().operator->(); 00014 iConfig = pSet; 00015 00016 SUSYFolder = iConfig.getParameter<string>("folderName"); 00017 00018 } 00019 00020 SusyPostProcessor::~SusyPostProcessor(){ 00021 } 00022 00023 void SusyPostProcessor::beginJob(void){ 00024 } 00025 00026 void SusyPostProcessor::beginRun(const edm::Run&, const edm::EventSetup& iSetup){ 00027 } 00028 00029 void SusyPostProcessor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){ 00030 } 00031 00032 void SusyPostProcessor::QuantilePlots(MonitorElement* ME, double q_value) 00033 { 00034 if(ME->getTH1()->GetEntries()>0.) 00035 { 00036 Quantile q(static_cast<const TH1*>(ME->getTH1())); 00037 Float_t mean=q[q_value].first; 00038 Float_t RMS=q[q_value].second; 00039 00040 Float_t xLow=-5.5; 00041 Float_t xUp=9.5; 00042 Int_t NBin=15; 00043 00044 if(mean>0.) 00045 { 00046 Float_t DBin=RMS*TMath::Sqrt(12.)/2.; 00047 xLow=mean-int(mean/DBin+2)*DBin; 00048 xUp=int(0.2*mean/DBin)*DBin+mean+5*DBin; 00049 NBin=(xUp-xLow)/DBin; 00050 } 00051 00052 dqm->setCurrentFolder(ME->getPathname()); 00053 TString name=ME->getTH1()->GetName(); 00054 name+="_quant"; 00055 //std::cout<<name<<std::endl; 00056 ME=dqm->book1D(name,"",NBin, xLow, xUp); 00057 ME->Fill(mean-RMS); 00058 ME->Fill(mean+RMS); 00059 } 00060 } 00061 00062 00063 00064 void SusyPostProcessor::endRun(const edm::Run&, const edm::EventSetup&) 00065 { 00066 //std::cout<<"here 1"<<std::endl; 00067 dqm->setCurrentFolder(SUSYFolder); 00068 Dirs = dqm->getSubdirs(); 00069 for (int i=0; i<int(Dirs.size()); i++) 00070 { 00071 //std::cout<<Dirs[i]<<std::endl; 00072 size_t found = Dirs[i].find("Alpha"); 00073 if (found!=string::npos) continue; 00074 //std::cout<<string::npos<<std::endl; 00075 if(!dqm->dirExists(Dirs[i])){ 00076 cout << "Directory "<<Dirs[i]<<" doesn't exist!!" << std::endl; 00077 continue; 00078 } 00079 00080 vector<MonitorElement*> histoVector = dqm->getContents(Dirs[i]); 00081 00082 for (int i=0; i<int(histoVector.size()); i++) { 00083 std::cout<<histoVector[i]->getTH1()->GetName()<<std::endl; 00084 QuantilePlots(histoVector[i],0.05); 00085 } 00086 } 00087 } 00088 00089 00090 void SusyPostProcessor::endJob(){} 00091 00092 00093 00094 00095