CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/HLTriggerOffline/JetMET/src/JetMETDQMPostProcessor.cc

Go to the documentation of this file.
00001 #include "HLTriggerOffline/JetMET/interface/JetMETDQMPostProcessor.h"
00002 
00003 #include "DQMServices/Core/interface/DQMStore.h"
00004 #include "DQMServices/Core/interface/MonitorElement.h"
00005 #include "FWCore/ServiceRegistry/interface/Service.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 
00008 
00009 #include <iostream>
00010 #include <string.h>
00011 #include <iomanip>
00012 #include<fstream>
00013 #include <math.h>
00014 
00015 
00016 JetMETDQMPostProcessor::JetMETDQMPostProcessor(const edm::ParameterSet& pset)
00017 {
00018   subDir_ = pset.getUntrackedParameter<std::string>("subDir");
00019 }
00020 
00021 void JetMETDQMPostProcessor::endRun(edm::Run const& run, edm::EventSetup const& es)
00022 {
00024   // setup DQM stor               //
00026 
00027   DQMStore * dqm = 0;
00028   dqm = edm::Service<DQMStore>().operator->();
00029 
00030   if ( ! dqm ) {
00031     edm::LogInfo("JetMETDQMPostProcessor") << "Cannot create DQMStore instance\n";
00032     return;
00033   }
00034 
00035 
00036   //go to the directory to be processed
00037   if(dqm->dirExists(subDir_)) dqm->cd(subDir_);
00038   else {
00039    edm::LogWarning("JetMETDQMPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
00040     return;
00041   }
00042   
00043   std::vector<std::string> subdirectories = dqm->getSubdirs();
00044   for(std::vector<std::string>::iterator dir = subdirectories.begin() ;dir!= subdirectories.end(); dir++ ){
00045     dqm->cd(*dir);
00046     
00047     TH1F* gmetTrg = new TH1F("gmetTrg","gmetTrg",100,0,500);
00048     TH1F* gmetTrg2 = new TH1F("gmetTrg2","gmetTrg2",100,0,500);
00049     TH1F* gmetTrgLow = new TH1F("gmetTrgLow","gmetTrgLow",100,0,500);
00050     TH1F* gmet = new TH1F("gmet","gmet",100,0,500);
00051     TH1F* gjetTrg = new TH1F("gjetTrg","gjetTrg",100,0,500);
00052     TH1F* gjetTrg2 = new TH1F("gjetTrg2","gjetTrg2",100,0,500);
00053     TH1F* gjetTrgLow = new TH1F("gjetTrgLow","gjetTrgLow",100,0,500);
00054     TH1F* gjet = new TH1F("gjet","gjet",100,0,500);
00055     TH1F* gjetEtaTrg = new TH1F("gjetEtaTrg","gjetEtaTrg",100,-10,10);
00056     TH1F* gjetEtaTrg2 = new TH1F("gjetEtaTrg2","gjetEtaTrg2",100,-10,10);
00057     TH1F* gjetEtaTrgLow = new TH1F("gjetEtaTrgLow","gjetEtaTrgLow",100,-10,10);
00058     TH1F* gjetEta = new TH1F("gjetEta","gjetEta",100,-10,10);
00059     TH1F* gjetPhiTrg = new TH1F("gjetPhiTrg","gjetPhiTrg",100,-4,4);
00060     TH1F* gjetPhiTrg2 = new TH1F("gjetPhiTrg2","gjetPhiTrg2",100,-4,4);
00061     TH1F* gjetPhiTrgLow = new TH1F("gjetPhiTrgLow","gjetPhiTrgLow",100,-4,4);
00062     TH1F* gjetPhi = new TH1F("gjetPhi","gjetPhi",100,-4,4);
00063     TH1F* ghtTrg = new TH1F("ghtTrg","ghtTrg",100,0,1000);
00064     TH1F* ghtTrg2 = new TH1F("ghtTrg2","ghtTrg2",100,0,1000);
00065     TH1F* ghtTrgLow = new TH1F("ghtTrgLow","ghtTrgLow",100,0,1000);
00066     TH1F* ght = new TH1F("ght","ght",100,0,1000);
00067     TH1F* rmetTrg = new TH1F("rmetTrg","rmetTrg",100,0,500);
00068     TH1F* rmetTrg2 = new TH1F("rmetTrg2","rmetTrg2",100,0,500);
00069     TH1F* rmetTrgLow = new TH1F("rmetTrgLow","rmetTrgLow",100,0,500);
00070     TH1F* rmet = new TH1F("rmet","rmet",100,0,500);
00071     TH1F* rjetTrg = new TH1F("rjetTrg","rjetTrg",100,0,500);
00072     TH1F* rjetTrg2 = new TH1F("rjetTrg2","rjetTrg2",100,0,500);
00073     TH1F* rjetTrgLow = new TH1F("rjetTrgLow","rjetTrgLow",100,0,500);
00074     TH1F* rjet = new TH1F("rjet","rjet",100,0,500);
00075     TH1F* rjetEtaTrg = new TH1F("rjetEtaTrg","rjetEtaTrg",100,-10,10);
00076     TH1F* rjetEtaTrg2 = new TH1F("rjetEtaTrg2","rjetEtaTrg2",100,-10,10);
00077     TH1F* rjetEtaTrgLow = new TH1F("rjetEtaTrgLow","rjetEtaTrgLow",100,-10,10);
00078     TH1F* rjetEta = new TH1F("rjetEta","rjetEta",100,-10,10);
00079     TH1F* rjetPhiTrg = new TH1F("rjetPhiTrg","rjetPhiTrg",100,-4,4);
00080     TH1F* rjetPhiTrg2 = new TH1F("rjetPhiTrg2","rjetPhiTrg2",100,-4,4);
00081     TH1F* rjetPhiTrgLow = new TH1F("rjetPhiTrgLow","rjetPhiTrgLow",100,-4,4);
00082     TH1F* rjetPhi = new TH1F("rjetPhi","rjetPhi",100,-4,4);
00083     TH1F* rhtTrg = new TH1F("rhtTrg","rhtTrg",100,0,1000);
00084     TH1F* rhtTrg2 = new TH1F("rhtTrg2","rhtTrg2",100,0,1000);
00085     TH1F* rhtTrgLow = new TH1F("rhtTrgLow","rhtTrgLow",100,0,1000);
00086     TH1F* rht = new TH1F("rht","rht",100,0,1000);
00087 
00088     TProfile* gmto = new TProfile("_meTurnOngMET","Gen Missing ET Turn-On RelVal",100,0,500,0,1);
00089     TProfile* gmtol = new TProfile("_meTurnOngMETLow","Gen Missing ET Turn-On Data",100,0,500,0,1);
00090     TProfile* gjto = new TProfile("_meTurnOngJetPt","Gen Jet Pt Turn-On RelVal",100,0,500,0,1);
00091     TProfile* gjtol = new TProfile("_meTurnOngJetPtLow","Gen Jet Pt Turn-On Data",100,0,500,0,1);
00092     TProfile* gjeto = new TProfile("_meTurnOngJetEta","Gen Jet Eta Turn-On RelVal",100,-10,10,0,1);
00093     TProfile* gjetol = new TProfile("_meTurnOngJetEtaLow","Gen Jet Eta Turn-On Data",100,-10,10,0,1);
00094     TProfile* gjpto = new TProfile("_meTurnOngJetPhi","Gen Jet Phi Turn-On RelVal",100,-4,4,0,1);
00095     TProfile* gjptol = new TProfile("_meTurnOngJetPhiLow","Gen Jet Phi Turn-On Data",100,-4,4,0,1);
00096     TProfile* ghto = new TProfile("_meTurnOngHT","Gen HT Turn-On RelVal",100,0,1000,0,1);
00097     TProfile* ghtol = new TProfile("_meTurnOngHTLow","Gen HT Turn-On Data",100,0,1000,0,1);
00098     TProfile* rmto = new TProfile("_meTurnOnrMET","Reco Missing ET Turn-On RelVal",100,0,500,0,1);
00099     TProfile* rmtol = new TProfile("_meTurnOnrMETLow","Reco Missing ET Turn-On Data",100,0,500,0,1);
00100     TProfile* rjto = new TProfile("_meTurnOnrJetPt","Reco Jet Pt Turn-On RelVal",100,0,500,0,1);
00101     TProfile* rjtol = new TProfile("_meTurnOnrJetPtLow","Reco Jet Pt Turn-On Data",100,0,500,0,1);
00102     TProfile* rjeto = new TProfile("_meTurnOnrJetEta","Reco Jet Eta Turn-On RelVal",100,-10,10,0,1);
00103     TProfile* rjetol = new TProfile("_meTurnOnrJetEtaLow","Reco Jet Eta Turn-On Data",100,-10,10,0,1);
00104     TProfile* rjpto = new TProfile("_meTurnOnrJetPhi","Reco Jet Phi Turn-On RelVal",100,-4,4,0,1);
00105     TProfile* rjptol = new TProfile("_meTurnOnrJetPhiLow","Reco Jet Phi Turn-On Data",100,-4,4,0,1);
00106     TProfile* rhto = new TProfile("_meTurnOnrHT","Reco HT Turn-On RelVal",100,0,1000,0,1);
00107     TProfile* rhtol = new TProfile("_meTurnOnrHTLow","Reco HT Turn-On Data",100,0,1000,0,1);
00108 
00109     //std::vector<std::string> mes = dqm->getMEs();
00110     //for(std::vector<std::string>::iterator me = mes.begin() ;me!= mes.end(); me++ )
00111     //  std::cout <<*me <<std::endl;
00112     //std::cout <<std::endl;
00113     
00114     gmetTrg->Add(dqm->get(dqm->pwd() + "/_meGenMETTrg")->getTH1F(),1);
00115     gmetTrg->Sumw2();
00116     gmetTrg2->Add(dqm->get(dqm->pwd() + "/_meGenMETTrg")->getTH1F(),1);
00117     gmetTrg2->Sumw2();
00118     gmetTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenMETTrgLow")->getTH1F(),1);
00119     gmetTrgLow->Sumw2();
00120     gmet->Add(dqm->get(dqm->pwd() + "/_meGenMET")->getTH1F(),1);
00121     gmet->Sumw2();
00122     gmetTrg->Divide(gmetTrg,gmet,1,1,"B");
00123     gmetTrg2->Divide(gmetTrg2,gmetTrgLow,1,1,"B");
00124     
00125     rmetTrg->Add(dqm->get(dqm->pwd() + "/_meRecoMETTrg")->getTH1F(),1);
00126     rmetTrg->Sumw2();
00127     rmetTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoMETTrg")->getTH1F(),1);
00128     rmetTrg2->Sumw2();
00129     rmetTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoMETTrgLow")->getTH1F(),1);
00130     rmetTrgLow->Sumw2();
00131     rmet->Add(dqm->get(dqm->pwd() + "/_meRecoMET")->getTH1F(),1);
00132     rmet->Sumw2();
00133     rmetTrg->Divide(rmetTrg,rmet,1,1,"B");
00134     rmetTrg2->Divide(rmetTrg2,rmetTrgLow,1,1,"B");
00135     
00136     gjetTrg->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrg")->getTH1F(),1);
00137     gjetTrg->Sumw2();
00138     gjetTrg2->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrg")->getTH1F(),1);
00139     gjetTrg2->Sumw2();
00140     gjetTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrgLow")->getTH1F(),1);
00141     gjetTrgLow->Sumw2();
00142     gjet->Add(dqm->get(dqm->pwd() + "/_meGenJetPt")->getTH1F(),1);
00143     gjet->Sumw2();
00144     gjetTrg->Divide(gjetTrg,gjet,1,1,"B");
00145     gjetTrg2->Divide(gjetTrg2,gjetTrgLow,1,1,"B");
00146 
00147     rjetTrg->Add(dqm->get(dqm->pwd() + "/_meRecoJetPtTrg")->getTH1F(),1);
00148     rjetTrg->Sumw2();
00149     rjetTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoJetPtTrg")->getTH1F(),1);
00150     rjetTrg2->Sumw2();
00151     rjetTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoJetPtTrgLow")->getTH1F(),1);
00152     rjetTrgLow->Sumw2();
00153     rjet->Add(dqm->get(dqm->pwd() + "/_meRecoJetPt")->getTH1F(),1);
00154     rjet->Sumw2();
00155     rjetTrg->Divide(rjetTrg,rjet,1,1,"B");
00156     rjetTrg2->Divide(rjetTrg2,rjetTrgLow,1,1,"B");
00157 
00158     gjetEtaTrg->Add(dqm->get(dqm->pwd() + "/_meGenJetEtaTrg")->getTH1F(),1);
00159     gjetEtaTrg->Sumw2();
00160     gjetEtaTrg2->Add(dqm->get(dqm->pwd() + "/_meGenJetEtaTrg")->getTH1F(),1);
00161     gjetEtaTrg2->Sumw2();
00162     gjetEtaTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenJetEtaTrgLow")->getTH1F(),1);
00163     gjetEtaTrgLow->Sumw2();
00164     gjetEta->Add(dqm->get(dqm->pwd() + "/_meGenJetEta")->getTH1F(),1);
00165     gjetEta->Sumw2();
00166     gjetEtaTrg->Divide(gjetEtaTrg,gjetEta,1,1,"B");
00167     gjetEtaTrg2->Divide(gjetEtaTrg2,gjetEtaTrgLow,1,1,"B");
00168 
00169     rjetEtaTrg->Add(dqm->get(dqm->pwd() + "/_meRecoJetEtaTrg")->getTH1F(),1);
00170     rjetEtaTrg->Sumw2();
00171     rjetEtaTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoJetEtaTrg")->getTH1F(),1);
00172     rjetEtaTrg2->Sumw2();
00173     rjetEtaTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoJetEtaTrgLow")->getTH1F(),1);
00174     rjetEtaTrgLow->Sumw2();
00175     rjetEta->Add(dqm->get(dqm->pwd() + "/_meRecoJetEta")->getTH1F(),1);
00176     rjetEta->Sumw2();
00177     rjetEtaTrg->Divide(rjetEtaTrg,rjetEta,1,1,"B");
00178     rjetEtaTrg2->Divide(rjetEtaTrg2,rjetEtaTrgLow,1,1,"B");
00179     
00180     gjetPhiTrg->Add(dqm->get(dqm->pwd() + "/_meGenJetPhiTrg")->getTH1F(),1);
00181     gjetPhiTrg->Sumw2();
00182     gjetPhiTrg2->Add(dqm->get(dqm->pwd() + "/_meGenJetPhiTrg")->getTH1F(),1);
00183     gjetPhiTrg2->Sumw2();
00184     gjetPhiTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenJetPhiTrgLow")->getTH1F(),1);
00185     gjetPhiTrgLow->Sumw2();
00186     gjetPhi->Add(dqm->get(dqm->pwd() + "/_meGenJetPhi")->getTH1F(),1);
00187     gjetPhi->Sumw2();
00188     gjetPhiTrg->Divide(gjetPhiTrg,gjetPhi,1,1,"B");
00189     gjetPhiTrg2->Divide(gjetPhiTrg2,gjetPhiTrgLow,1,1,"B");
00190     
00191     rjetPhiTrg->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhiTrg")->getTH1F(),1);
00192     rjetPhiTrg->Sumw2();
00193     rjetPhiTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhiTrg")->getTH1F(),1);
00194     rjetPhiTrg2->Sumw2();
00195     rjetPhiTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhiTrgLow")->getTH1F(),1);
00196     rjetPhiTrgLow->Sumw2();
00197     rjetPhi->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhi")->getTH1F(),1);
00198     rjetPhi->Sumw2();
00199     rjetPhiTrg->Divide(rjetPhiTrg,rjetPhi,1,1,"B");
00200     rjetPhiTrg2->Divide(rjetPhiTrg2,rjetPhiTrgLow,1,1,"B");
00201     
00202     ghtTrg->Add(dqm->get(dqm->pwd() + "/_meGenHTTrg")->getTH1F(),1);
00203     ghtTrg->Sumw2();
00204     ghtTrg2->Add(dqm->get(dqm->pwd() + "/_meGenHTTrg")->getTH1F(),1);
00205     ghtTrg2->Sumw2();
00206     ghtTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenHTTrgLow")->getTH1F(),1);
00207     ghtTrgLow->Sumw2();
00208     ght->Add(dqm->get(dqm->pwd() + "/_meGenHT")->getTH1F(),1);
00209     ght->Sumw2();
00210     ghtTrg->Divide(ghtTrg,ght,1,1,"B");
00211     ghtTrg2->Divide(ghtTrg2,ghtTrgLow,1,1,"B");
00212 
00213     rhtTrg->Add(dqm->get(dqm->pwd() + "/_meRecoHTTrg")->getTH1F(),1);
00214     rhtTrg->Sumw2();
00215     rhtTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoHTTrg")->getTH1F(),1);
00216     rhtTrg2->Sumw2();
00217     rhtTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoHTTrgLow")->getTH1F(),1);
00218     rhtTrgLow->Sumw2();
00219     rht->Add(dqm->get(dqm->pwd() + "/_meRecoHT")->getTH1F(),1);
00220     rht->Sumw2();
00221     rhtTrg->Divide(rhtTrg,rht,1,1,"B");
00222     rhtTrg2->Divide(rhtTrg2,rhtTrgLow,1,1,"B");
00223     
00224     double val,err;
00225     for (int ib=0;ib<100;ib++) {
00226       //genmet relval
00227       val = gmetTrg->GetBinContent(ib+1);
00228       gmto->SetBinContent(ib+1,val);
00229       gmto->SetBinEntries(ib+1,1);
00230       err = gmetTrg->GetBinError(ib+1);
00231       gmto->SetBinError(ib+1,sqrt(err*err+val*val));
00232       //genmet data
00233       val = gmetTrg2->GetBinContent(ib+1);
00234       gmtol->SetBinContent(ib+1,val);
00235       gmtol->SetBinEntries(ib+1,1);
00236       err = gmetTrg2->GetBinError(ib+1);
00237       gmtol->SetBinError(ib+1,sqrt(err*err+val*val));
00238       //recmet relval
00239       val = rmetTrg->GetBinContent(ib+1);
00240       rmto->SetBinContent(ib+1,val);
00241       rmto->SetBinEntries(ib+1,1);
00242       err = rmetTrg->GetBinError(ib+1);
00243       rmto->SetBinError(ib+1,sqrt(err*err+val*val));
00244       //recmet data
00245       val = rmetTrg2->GetBinContent(ib+1);
00246       rmtol->SetBinContent(ib+1,val);
00247       rmtol->SetBinEntries(ib+1,1);
00248       err = rmetTrg2->GetBinError(ib+1);
00249       rmtol->SetBinError(ib+1,sqrt(err*err+val*val));
00250       //genjet relval
00251       val = gjetTrg->GetBinContent(ib+1);
00252       gjto->SetBinContent(ib+1,val);
00253       gjto->SetBinEntries(ib+1,1);
00254       err = gjetTrg->GetBinError(ib+1);
00255       gjto->SetBinError(ib+1,sqrt(err*err+val*val));
00256       //genjet data
00257       val = gjetTrg2->GetBinContent(ib+1);
00258       gjtol->SetBinContent(ib+1,val);
00259       gjtol->SetBinEntries(ib+1,1);
00260       err = gjetTrg2->GetBinError(ib+1);
00261       gjtol->SetBinError(ib+1,sqrt(err*err+val*val));
00262       //recjet relval
00263       val = rjetTrg->GetBinContent(ib+1);
00264       rjto->SetBinContent(ib+1,val);
00265       rjto->SetBinEntries(ib+1,1);
00266       err = rjetTrg->GetBinError(ib+1);
00267       rjto->SetBinError(ib+1,sqrt(err*err+val*val));
00268       //recjet data
00269       val = rjetTrg2->GetBinContent(ib+1);
00270       rjtol->SetBinContent(ib+1,val);
00271       rjtol->SetBinEntries(ib+1,1);
00272       err = rjetTrg2->GetBinError(ib+1);
00273       rjtol->SetBinError(ib+1,sqrt(err*err+val*val));
00274       //genjeteta relval
00275       val = gjetEtaTrg->GetBinContent(ib+1);
00276       gjeto->SetBinContent(ib+1,val);
00277       gjeto->SetBinEntries(ib+1,1);
00278       err = gjetEtaTrg->GetBinError(ib+1);
00279       gjeto->SetBinError(ib+1,sqrt(err*err+val*val));
00280       //genjeteta data
00281       val = gjetEtaTrg2->GetBinContent(ib+1);
00282       gjetol->SetBinContent(ib+1,val);
00283       gjetol->SetBinEntries(ib+1,1);
00284       err = gjetEtaTrg2->GetBinError(ib+1);
00285       gjetol->SetBinError(ib+1,sqrt(err*err+val*val));
00286       //recjeteta relval
00287       val = rjetEtaTrg->GetBinContent(ib+1);
00288       rjeto->SetBinContent(ib+1,val);
00289       rjeto->SetBinEntries(ib+1,1);
00290       err = rjetEtaTrg->GetBinError(ib+1);
00291       rjeto->SetBinError(ib+1,sqrt(err*err+val*val));
00292       //recjeteta data
00293       val = rjetEtaTrg2->GetBinContent(ib+1);
00294       rjetol->SetBinContent(ib+1,val);
00295       rjetol->SetBinEntries(ib+1,1);
00296       err = rjetEtaTrg2->GetBinError(ib+1);
00297       rjetol->SetBinError(ib+1,sqrt(err*err+val*val));
00298       //genjetphi relval
00299       val = gjetPhiTrg->GetBinContent(ib+1);
00300       gjpto->SetBinContent(ib+1,val);
00301       gjpto->SetBinEntries(ib+1,1);
00302       err = gjetPhiTrg->GetBinError(ib+1);
00303       gjpto->SetBinError(ib+1,sqrt(err*err+val*val));
00304       //genjetphi data
00305       val = gjetPhiTrg2->GetBinContent(ib+1);
00306       gjptol->SetBinContent(ib+1,val);
00307       gjptol->SetBinEntries(ib+1,1);
00308       err = gjetPhiTrg2->GetBinError(ib+1);
00309       gjptol->SetBinError(ib+1,sqrt(err*err+val*val));
00310       //recjetphi relval
00311       val = rjetPhiTrg->GetBinContent(ib+1);
00312       rjpto->SetBinContent(ib+1,val);
00313       rjpto->SetBinEntries(ib+1,1);
00314       err = rjetPhiTrg->GetBinError(ib+1);
00315       rjpto->SetBinError(ib+1,sqrt(err*err+val*val));
00316       //recjetphi data
00317       val = rjetPhiTrg2->GetBinContent(ib+1);
00318       rjptol->SetBinContent(ib+1,val);
00319       rjptol->SetBinEntries(ib+1,1);
00320       err = rjetPhiTrg2->GetBinError(ib+1);
00321       rjptol->SetBinError(ib+1,sqrt(err*err+val*val));
00322       //genht relval
00323       val = ghtTrg->GetBinContent(ib+1);
00324       ghto->SetBinContent(ib+1,val);
00325       ghto->SetBinEntries(ib+1,1);
00326       err = ghtTrg->GetBinError(ib+1);
00327       ghto->SetBinError(ib+1,sqrt(err*err+val*val));
00328       //genht data
00329       val = ghtTrg2->GetBinContent(ib+1);
00330       ghtol->SetBinContent(ib+1,val);
00331       ghtol->SetBinEntries(ib+1,1);
00332       err = ghtTrg2->GetBinError(ib+1);
00333       ghtol->SetBinError(ib+1,sqrt(err*err+val*val));
00334       //recht relval
00335       val = rhtTrg->GetBinContent(ib+1);
00336       rhto->SetBinContent(ib+1,val);
00337       rhto->SetBinEntries(ib+1,1);
00338       err = rhtTrg->GetBinError(ib+1);
00339       rhto->SetBinError(ib+1,sqrt(err*err+val*val));
00340       //recht data
00341       val = rhtTrg2->GetBinContent(ib+1);
00342       rhtol->SetBinContent(ib+1,val);
00343       rhtol->SetBinEntries(ib+1,1);
00344       err = rhtTrg2->GetBinError(ib+1);
00345       rhtol->SetBinError(ib+1,sqrt(err*err+val*val));
00346 
00347 
00348       //std::cout <<"MET:"<<_meTurnOnMET->getBinContent(ib+1)<<" "<<gmetTrg->GetBinContent(ib+1)<<" "<<_meTurnOnMET->getBinError(ib+1)<<" "<<gmetTrg->GetBinError(ib+1)<<std::endl;
00349       //std::cout <<"JET:"<<_meTurnOnJetPt->getBinContent(ib+1)<<" "<<gjetTrg->GetBinContent(ib+1)<<" "<<_meTurnOnJetPt->getBinError(ib+1)<<" "<<gjetTrg->GetBinError(ib+1)<<std::endl;
00350     }
00351     dqm->bookProfile("Gen Missing ET Turn-On RelVal",gmto);
00352     dqm->bookProfile("Gen Missing ET Turn-On Data",gmtol);
00353     dqm->bookProfile("Reco Missing ET Turn-On RelVal",rmto);
00354     dqm->bookProfile("Reco Missing ET Turn-On Data",rmtol);
00355     dqm->bookProfile("Gen Jet Pt Turn-On RelVal",gjto);
00356     dqm->bookProfile("Gen Jet Pt Turn-On Data",gjtol);
00357     dqm->bookProfile("Reco Jet Pt Turn-On RelVal",rjto);
00358     dqm->bookProfile("Reco Jet Pt Turn-On Data",rjtol);
00359     dqm->bookProfile("Gen Jet Eta Turn-On RelVal",gjeto);
00360     dqm->bookProfile("Gen Jet Eta Turn-On Data",gjetol);
00361     dqm->bookProfile("Reco Jet Eta Turn-On RelVal",rjeto);
00362     dqm->bookProfile("Reco Jet Eta Turn-On Data",rjetol);
00363     dqm->bookProfile("Gen Jet Phi Turn-On RelVal",gjpto);
00364     dqm->bookProfile("Gen Jet Phi Turn-On Data",gjptol);
00365     dqm->bookProfile("Reco Jet Phi Turn-On RelVal",rjpto);
00366     dqm->bookProfile("Reco Jet Phi Turn-On Data",rjptol);
00367     dqm->bookProfile("Gen HT Turn-On RelVal",ghto);
00368     dqm->bookProfile("Gen HT Turn-On Data",ghtol);
00369     dqm->bookProfile("Reco HT Turn-On RelVal",rhto);
00370     dqm->bookProfile("Reco HT Turn-On Data",rhtol);
00371     delete gjto;
00372     delete gjtol;
00373     delete gjeto;
00374     delete gjetol;
00375     delete gjpto;
00376     delete gjptol;
00377     delete rjto;
00378     delete rjtol;
00379     delete rjeto;
00380     delete rjetol;
00381     delete rjpto;
00382     delete rjptol;
00383     delete gmto;
00384     delete gmtol;
00385     delete rmto;
00386     delete rmtol;
00387     delete ghto;
00388     delete ghtol;
00389     delete rhto;
00390     delete rhtol;
00391     delete gmetTrg;
00392     delete gmetTrg2;
00393     delete gmetTrgLow;
00394     delete gmet;
00395     delete rmetTrg;
00396     delete rmetTrg2;
00397     delete rmetTrgLow;
00398     delete rmet;
00399     delete gjetTrg;
00400     delete gjetTrg2;
00401     delete gjetTrgLow;
00402     delete gjet;
00403     delete rjetTrg;
00404     delete rjetTrg2;
00405     delete rjetTrgLow;
00406     delete rjet;
00407     delete gjetEtaTrg;
00408     delete gjetEtaTrg2;
00409     delete gjetEtaTrgLow;
00410     delete gjetEta;
00411     delete rjetEtaTrg;
00412     delete rjetEtaTrg2;
00413     delete rjetEtaTrgLow;
00414     delete rjetEta;
00415     delete gjetPhiTrg;
00416     delete gjetPhiTrg2;
00417     delete gjetPhiTrgLow;
00418     delete gjetPhi;
00419     delete rjetPhiTrg;
00420     delete rjetPhiTrg2;
00421     delete rjetPhiTrgLow;
00422     delete rjetPhi;
00423     delete ghtTrg;
00424     delete ghtTrg2;
00425     delete ghtTrgLow;
00426     delete ght;
00427     delete rhtTrg;
00428     delete rhtTrg2;
00429     delete rhtTrgLow;
00430     delete rht;
00431 
00432     dqm->goUp(); 
00433   }
00434 }
00435 void JetMETDQMPostProcessor::endJob()
00436 {
00437   /*
00439   // setup DQM stor               //
00441 
00442   DQMStore * dqm = 0;
00443   dqm = edm::Service<DQMStore>().operator->();
00444 
00445   if ( ! dqm ) {
00446     edm::LogInfo("JetMETDQMPostProcessor") << "Cannot create DQMStore instance\n";
00447     return;
00448   }
00449 
00450 
00451   //go to the directory to be processed
00452   if(dqm->dirExists(subDir_)) dqm->cd(subDir_);
00453   else {
00454    edm::LogWarning("JetMETDQMPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
00455     return;
00456   }
00457 
00458   std::vector<std::string> subdirectories = dqm->getSubdirs();
00459   for(std::vector<std::string>::iterator dir = subdirectories.begin() ;dir!= subdirectories.end(); dir++ ){
00460     dqm->cd(*dir);
00461     
00462     MonitorElement*_meTurnOnMET = dqm->book1D("_meTurnOnMET","Missing ET Turn-On",100,0,500);
00463     MonitorElement*_meTurnOnJetPt = dqm->book1D("_meTurnOnJetPt","Jet Pt Turn-On",100,0,500);
00464     
00465     //std::vector<std::string> mes = dqm->getMEs();
00466     //for(std::vector<std::string>::iterator me = mes.begin() ;me!= mes.end(); me++ )
00467     //  std::cout <<*me <<std::endl;
00468     //std::cout <<std::endl;
00469     
00470     _meTurnOnMET->getTH1F()->Add(dqm->get(dqm->pwd() + "/_meGenMETTrg")->getTH1F(),1);
00471     _meTurnOnMET->getTH1F()->Sumw2();
00472     dqm->get(dqm->pwd() + "/_meGenMET")->getTH1F()->Sumw2();
00473     _meTurnOnMET->getTH1F()->Divide(_meTurnOnMET->getTH1F(),dqm->get(dqm->pwd() + "/_meGenMET")->getTH1F(),1,1,"B");
00474     
00475     _meTurnOnJetPt->getTH1F()->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrg")->getTH1F(),1);
00476     _meTurnOnJetPt->getTH1F()->Sumw2();
00477     dqm->get(dqm->pwd() + "/_meGenJetPt")->getTH1F()->Sumw2();
00478     _meTurnOnJetPt->getTH1F()->Divide(_meTurnOnJetPt->getTH1F(),dqm->get(dqm->pwd() + "/_meGenJetPt")->getTH1F(),1,1,"B");
00479     
00480     dqm->goUp();
00481   }
00482   */
00483 }
00484 DEFINE_FWK_MODULE(JetMETDQMPostProcessor);