CMS 3D CMS Logo

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