CMS 3D CMS Logo

DataCertificationJetMET Class Reference

Description: <one line="" class="" summary>="">. More...

#include <DQMOffline/JetMET/src/DataCertificationJetMET.cc>

Inheritance diagram for DataCertificationJetMET:

edm::EDAnalyzer

List of all members.

Public Member Functions

 DataCertificationJetMET (const edm::ParameterSet &)
 ~DataCertificationJetMET ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

edm::ParameterSet conf_
DQMStoredbe
edm::Service< TFileServicefs_
DQMStorerdbe


Detailed Description

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Definition at line 54 of file DataCertificationJetMET.cc.


Constructor & Destructor Documentation

DataCertificationJetMET::DataCertificationJetMET ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 84 of file DataCertificationJetMET.cc.

00084                                                                               :conf_(iConfig)
00085 {
00086   // now do what ever initialization is needed
00087 }

DataCertificationJetMET::~DataCertificationJetMET (  ) 

Definition at line 90 of file DataCertificationJetMET.cc.

00091 { 
00092    // do anything here that needs to be done at desctruction time
00093    // (e.g. close files, deallocate resources etc.)
00094 }


Member Function Documentation

void DataCertificationJetMET::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 103 of file DataCertificationJetMET.cc.

References edm::EventSetup::get(), and edm::Event::getByLabel().

00104 {
00105   using namespace edm;
00106    
00107 #ifdef THIS_IS_AN_EVENT_EXAMPLE
00108   Handle<ExampleData> pIn;
00109   iEvent.getByLabel("example",pIn);
00110 #endif
00111    
00112 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
00113   ESHandle<SetupData> pSetup;
00114   iSetup.get<SetupRecord>().get(pSetup);
00115 #endif
00116 
00117 }

void DataCertificationJetMET::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 320 of file DataCertificationJetMET.cc.

References DQMStore::book1D(), DQMStore::book2D(), conf_, GenMuonPlsPt100GeV_cfg::cout, data_certificate(), dbe, DEBUG, lat::endl(), EgammaValidation_cff::filename, MonitorElement::Fill(), fitd(), fitdd(), g1, g2, DQMStore::get(), DQMStore::getAllContents(), DQMStore::getSubdirs(), MonitorElement::getTH1F(), edm::ParameterSet::getUntrackedParameter(), i, name, NJetAlgo, NL3Flags, DQMStore::open(), DQMStore::pwd(), rdbe, python::OfflineDbClientMP_cfg::RunNumber, and DQMStore::setCurrentFolder().

00321 {
00322   
00323   int verbose  = 0;
00324   int testType = 1;
00325 
00326   //----------------------------------------------------------------
00327   // Open input files
00328   //----------------------------------------------------------------
00329 
00330   verbose   = conf_.getUntrackedParameter<int>("Verbose");
00331   testType  = conf_.getUntrackedParameter<int>("TestType");
00332 
00333   std::string filename    = conf_.getUntrackedParameter<std::string>("fileName");
00334   std::string reffilename = conf_.getUntrackedParameter<std::string>("refFileName");
00335   std::cout << "Reference FileName = " << reffilename << std::endl;
00336   std::cout << "FileName           = " << filename    << std::endl;
00337 
00338   // -- Current Run
00339   dbe = edm::Service<DQMStore>().operator->();
00340   dbe->open(filename);
00341 
00342   dbe->setCurrentFolder("/");
00343   std::string currDir = dbe->pwd();
00344   std::cout << "--- Current Directory " << currDir << std::endl;
00345 
00346   std::vector<std::string> subDirVec = dbe->getSubdirs();
00347 
00348   std::string RunDir;
00349   std::string RunNum;
00350   int         RunNumber;
00351 
00352   // TODO: Make sure this is correct....
00353   for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
00354        ic != subDirVec.end(); ic++) {
00355     RunDir = *ic;
00356     RunNum = *ic;
00357   }
00358   RunNum.erase(0,4);
00359   RunNumber = atoi(RunNum.c_str());
00360   std::cout << "--- >>" << RunNumber << "<<" << std::endl;
00361 
00362   // --- Reference set of histograms
00363   rdbe = edm::Service<DQMStore>().operator->();
00364   rdbe->open(reffilename);
00365 
00366   std::vector<MonitorElement*> mes = dbe->getAllContents("");
00367   std::cout << "found " << mes.size() << " monitoring elements!" << std::endl;
00368 
00369   // TH1F *bla = fs_->make<TH1F>("bla","bla",256,0,256);
00370   // int totF;
00371 
00372   //
00373   // Data certification starts
00374   //----------------------------------------------------------------
00375 
00376   const int nLSBins=500;
00377 
00378   //Double_t par[6];
00379   //double chindf[6];
00380   //double para[6][6];
00381 
00382   TF1 *g1    = new TF1("g1","gaus",-50,50);
00383   TF1 *g2    = new TF1("g2","gaus",-500,500);
00384   TF1 *dgaus = new TF1("dgaus","gaus(0)+gaus(3)",-500,500);
00385   //TF1 *sgaus = new TF1("sgaus","gaus",-500,500);
00386 
00387   TH1F *hMExy[6];
00388   TF1  *fitfun[6];
00389   TF1  *fitfun1[6];
00390   TF1  *fitfun2[6];
00391   TH2F *hCaloMEx_LS;
00392   TH2F *hCaloMEy_LS;
00393   TH2F *hCaloMExNoHF_LS;
00394   TH2F *hCaloMEyNoHF_LS;
00395 
00396 
00397   // ****************************
00398   // ****************************
00399 
00400   // --- Save Data Certification results to the root file
00401   //     We save both flags and values
00402   dbe->setCurrentFolder(RunDir+"/JetMET/Data Certification/");    
00403   MonitorElement* mJetDCFL1 = dbe->book1D("JetDCFLayer1", "Jet DC F L1", 1, 0, 1);
00404   MonitorElement* mJetDCFL2 = dbe->book1D("JetDCFLayer2", "Jet DC F L2", NJetAlgo, 0, NJetAlgo);
00405   MonitorElement* mJetDCFL3 = dbe->book1D("JetDCFLayer3", "Jet DC F L3", NJetAlgo*NL3Flags, 0, NJetAlgo*NL3Flags);
00406 
00407   MonitorElement* mJetDCVL1 = dbe->book1D("JetDCVLayer1", "Jet DC V L1", NJetAlgo, 0, NJetAlgo);
00408   MonitorElement* mJetDCVL2 = dbe->book1D("JetDCVLayer2", "Jet DC V L2", NJetAlgo, 0, NJetAlgo);
00409   MonitorElement* mJetDCVL3 = dbe->book1D("JetDCVLayer3", "Jet DC V L3", NJetAlgo*NL3Flags, 0, NJetAlgo*NL3Flags);
00410 
00411   MonitorElement* mMETDCFL1 = dbe->book2D("METDCFLayer1", "MET DC F L1", 3,0,3,500,0.,500.);
00412   MonitorElement* mMETDCFL2 = dbe->book2D("METDCFLayer2", "MET DC F L2", 3,0,3,500,0.,500.);
00413   MonitorElement* mMETDCFL3 = dbe->book2D("METDCFLayer3", "MET DC F L3", 3,0,3,500,0.,500.);
00414 
00415   MonitorElement* mMETDCVL1 = dbe->book2D("METDCVLayer1", "MET DC V L1", 3,0,3,500,0.,500.);
00416   MonitorElement* mMETDCVL2 = dbe->book2D("METDCVLayer2", "MET DC V L2", 3,0,3,500,0.,500.);
00417   MonitorElement* mMETDCVL3 = dbe->book2D("METDCVLayer3", "MET DC V L3", 3,0,3,500,0.,500.);
00418 
00419 
00420   Double_t test_Pt, test_Eta, test_Phi, test_Constituents, test_HFrac;
00421   test_Pt = test_Eta = test_Phi = test_Constituents = test_HFrac = 0;
00422   
00423   Double_t test_Pt_Barrel,  test_Phi_Barrel;
00424   Double_t test_Pt_EndCap,  test_Phi_EndCap;
00425   Double_t test_Pt_Forward, test_Phi_Forward;
00426   test_Pt_Barrel  = test_Phi_Barrel  = 0;
00427   test_Pt_EndCap  = test_Phi_EndCap  = 0;
00428   test_Pt_Forward = test_Phi_Forward = 0;
00429 
00430   Int_t Jet_DCF_L1[NJetAlgo];
00431   Int_t Jet_DCF_L2[NJetAlgo];
00432   Int_t Jet_DCF_L3[NJetAlgo][NL3Flags];
00433 
00434   //  Int_t Jet_DCV_L1[NJetAlgo];
00435   //  Int_t Jet_DCV_L2[NJetAlgo];
00436   //  Int_t Jet_DCV_L3[NJetAlgo][NL3Flags];
00437 
00438   //  Int_t Jet_DC[NJetAlgo];
00439   std::string Jet_Tag_L1[2];
00440   Jet_Tag_L1[0]    = "JetMET_Jet";
00441   Jet_Tag_L1[1]    = "JetMET_MET";
00442 
00443   std::string Jet_Tag_L2[NJetAlgo];
00444   Jet_Tag_L2[0] = "JetMET_Jet_IterativeCone";
00445   Jet_Tag_L2[1] = "JetMET_Jet_SISCone";
00446   Jet_Tag_L2[2] = "JetMET_Jet_PFlow";
00447   Jet_Tag_L2[3] = "JetMET_Jet_JPT";
00448 
00449   std::string Jet_Tag_L3[NJetAlgo][NL3Flags];
00450   Jet_Tag_L3[0][0] = "JetMET_Jet_IterativeCone_Barrel";
00451   Jet_Tag_L3[0][1] = "JetMET_Jet_IterativeCone_EndCap";
00452   Jet_Tag_L3[0][2] = "JetMET_Jet_IterativeCone_Forward";
00453   Jet_Tag_L3[1][0] = "JetMET_Jet_SISCone_Barrel";
00454   Jet_Tag_L3[1][1] = "JetMET_Jet_SISCone_EndCap";
00455   Jet_Tag_L3[1][2] = "JetMET_Jet_SISCone_Forward";
00456   Jet_Tag_L3[2][0] = "JetMET_Jet_PFlow_Barrel";
00457   Jet_Tag_L3[2][1] = "JetMET_Jet_PFlow_EndCap";
00458   Jet_Tag_L3[2][2] = "JetMET_Jet_PFlow_Forward";
00459   Jet_Tag_L3[3][0] = "JetMET_Jet_JPT_Barrel";
00460   Jet_Tag_L3[3][1] = "JetMET_Jet_JPT_EndCap";
00461   Jet_Tag_L3[3][2] = "JetMET_Jet_JPT_Forward";
00462   
00463   //  rdbe->setCurrentFolder(RunDir+"/JetMET/Run summary/SISConeJets");
00464   //  std::string refHistoName = RunDir+"/JetMET/Run summary/PFJetAnalyzer/Pt";
00465 
00466   std::string refHistoName;
00467   std::string newHistoName;
00468 
00469   // --- Loop over jet algorithms for Layer 2
00470   for (int iAlgo=0; iAlgo<NJetAlgo; iAlgo++) {    
00471 
00472     if (iAlgo == 0) {
00473       refHistoName = RunDir+"/JetMET/Run summary/IterativeConeJets/";
00474       //      newHistoName = RunDir+"/JetMET/Run summary/IterativeConeJets/";
00475       newHistoName = RunDir+"/JetMET/Run summary/SISConeJets/";
00476     }
00477     if (iAlgo == 1) {
00478       refHistoName = RunDir+"/JetMET/Run summary/SISConeJets/";
00479       newHistoName = RunDir+"/JetMET/Run summary/SISConeJets/";
00480     }
00481     if (iAlgo == 2) {
00482       refHistoName = RunDir+"/JetMET/Run summary/PFJets/";
00483       newHistoName = RunDir+"/JetMET/Run summary/PFJets/";
00484     }
00485     if (iAlgo == 3) {
00486       refHistoName = RunDir+"/JetMET/Run summary/JPT/";
00487       newHistoName = RunDir+"/JetMET/Run summary/JPT/";
00488     }
00489 
00490 
00491 
00492     // ----------------
00493     // --- Layer 2
00494     MonitorElement * meRef = rdbe->get(refHistoName+"Pt");
00495     MonitorElement * meNew = dbe->get(newHistoName+"Pt");
00496     if ((meRef) && (meNew)) {
00497       TH1F *refHisto = meRef->getTH1F();
00498       TH1F *newHisto = meNew->getTH1F();
00499       if ((refHisto) && (newHisto)) {
00500         switch (testType) {
00501         case 1 :
00502           test_Pt = newHisto->KolmogorovTest(refHisto,"UO");
00503           break;
00504         case 2 :
00505           test_Pt = newHisto->Chi2Test(refHisto);
00506           break;
00507         }
00508         if (verbose > 0) std::cout << ">>> Test (" << testType 
00509                                    << ") Result = " << test_Pt << std::endl;    
00510       }
00511     }
00512 
00513     meRef = rdbe->get(refHistoName+"Eta");
00514     meNew = dbe->get(newHistoName+"Eta");
00515     if ((meRef) && (meNew)) {
00516       TH1F *refHisto = meRef->getTH1F();
00517       TH1F *newHisto = meNew->getTH1F();
00518       if ((refHisto) && (newHisto)) {
00519         switch (testType) {
00520         case 1 :
00521           test_Eta = newHisto->KolmogorovTest(refHisto,"UO");
00522         case 2:
00523           test_Eta = newHisto->Chi2Test(refHisto);
00524         }
00525         if (verbose > 0) std::cout << ">>> Test (" << testType 
00526                                    << ") Result = " << test_Eta << std::endl;    
00527       }
00528     }
00529 
00530     meRef = rdbe->get(refHistoName+"Phi");
00531     meNew = dbe->get(newHistoName+"Phi");
00532     if ((meRef) && (meNew)) {
00533       TH1F *refHisto = meRef->getTH1F();
00534       TH1F *newHisto = meNew->getTH1F();
00535       if ((refHisto) && (newHisto)) {
00536         switch (testType) {
00537         case 1 :
00538           test_Phi = newHisto->KolmogorovTest(refHisto,"UO");
00539         case 2:
00540           test_Phi = newHisto->Chi2Test(refHisto);
00541         }
00542         if (verbose > 0) std::cout << ">>> Test (" << testType 
00543                                    << ") Result = " << test_Phi << std::endl;    
00544       }
00545     }
00546      
00547     meRef = rdbe->get(refHistoName+"Constituents");
00548     meNew = dbe->get(newHistoName+"Constituents");
00549     if ((meRef) && (meNew)) {
00550       TH1F *refHisto = meRef->getTH1F();
00551       TH1F *newHisto = meNew->getTH1F();
00552       if ((refHisto) && (newHisto)) {
00553         switch (testType) {
00554         case 1 :          
00555           test_Constituents = newHisto->KolmogorovTest(refHisto,"UO");
00556         case 2 :
00557           test_Constituents = newHisto->Chi2Test(refHisto);
00558         }
00559         if (verbose > 0) std::cout << ">>> Test (" << testType 
00560                                    << ") Result = " << test_Constituents << std::endl;    
00561       }
00562     }
00563      
00564     meRef = rdbe->get(refHistoName+"EnergyFractionHadronic");
00565     meNew = dbe->get(newHistoName+"EnergyFractionHadronic");
00566     if ((meRef) && (meNew)) {
00567       TH1F *refHisto = meRef->getTH1F();
00568       TH1F *newHisto = meNew->getTH1F();
00569       if ((refHisto) && (newHisto)) {
00570         switch (testType) {
00571         case 1 :
00572           test_HFrac = newHisto->KolmogorovTest(refHisto,"UO");
00573         case 2:
00574           test_HFrac = newHisto->Chi2Test(refHisto);
00575         }
00576         if (verbose > 0) std::cout << ">>> Test (" << testType 
00577                                    << ") Result = " << test_HFrac << std::endl;         
00578       }
00579     }
00580 
00581     if ( (test_Pt     > 0.95) && (test_Eta          > 0.95) && 
00582          (test_Phi    > 0.95) && (test_Constituents > 0.95) && 
00583          (test_HFrac  > 0.95) )  {      
00584 
00585       Jet_DCF_L2[iAlgo] = 1;
00586       // --- Fill DC results histogram
00587       mJetDCFL2->Fill(iAlgo);
00588     } else {
00589       Jet_DCF_L2[iAlgo] = 0;
00590     }
00591 
00592     // ----------------
00593     // --- Layer 3
00594     // --- Barrel
00595     meRef = rdbe->get(refHistoName+"Pt_Barrel");
00596     meNew = dbe->get(newHistoName+"Pt_Barrel");
00597     if ((meRef) && (meNew)) {
00598       TH1F *refHisto = meRef->getTH1F();
00599       TH1F *newHisto = meNew->getTH1F();
00600       if ((refHisto) && (newHisto)) {
00601         switch (testType) {
00602         case 1 :
00603           test_Pt_Barrel = newHisto->KolmogorovTest(refHisto,"UO");
00604         case 2 :
00605           test_Pt_Barrel = newHisto->Chi2Test(refHisto);
00606         }
00607         if (verbose > 0) std::cout << ">>> Test (" << testType 
00608                                    << ") Result = " << test_Pt_Barrel << std::endl;     
00609       }
00610     }
00611 
00612     meRef = rdbe->get(refHistoName+"Phi_Barrel");
00613     meNew = dbe->get(newHistoName+"Phi_Barrel");
00614     if ((meRef) && (meNew)) {
00615       TH1F *refHisto = meRef->getTH1F();
00616       TH1F *newHisto = meNew->getTH1F();
00617       if ((refHisto) && (newHisto)) {
00618         switch (testType) {
00619         case 1 :
00620           test_Phi_Barrel = newHisto->KolmogorovTest(refHisto,"UO");
00621         case 2 :
00622           test_Phi_Barrel = newHisto->Chi2Test(refHisto);
00623         }
00624         if (verbose > 0) std::cout << ">>> Test (" << testType 
00625                                    << ") Result = " << test_Phi_Barrel << std::endl;            
00626       }
00627     }
00628 
00629     // --- EndCap
00630     meRef = rdbe->get(refHistoName+"Pt_EndCap");
00631     meNew = dbe->get(newHistoName+"Pt_EndCap");
00632     if ((meRef) && (meNew)) {
00633       TH1F *refHisto = meRef->getTH1F();
00634       TH1F *newHisto = meNew->getTH1F();
00635       if ((refHisto) && (newHisto)) {
00636         switch (testType) {
00637         case 1 :
00638           test_Pt_EndCap = newHisto->KolmogorovTest(refHisto,"UO");
00639         case 2 :
00640           test_Pt_EndCap = newHisto->Chi2Test(refHisto);
00641         }
00642         if (verbose > 0) std::cout << ">>> Test (" << testType 
00643                                    << ") Result = " << test_Pt_EndCap << std::endl;     
00644       }
00645     }
00646 
00647     meRef = rdbe->get(refHistoName+"Phi_EndCap");
00648     meNew = dbe->get(newHistoName+"Phi_EndCap");
00649     if ((meRef) && (meNew)) {
00650       TH1F *refHisto = meRef->getTH1F();
00651       TH1F *newHisto = meNew->getTH1F();
00652       if ((refHisto) && (newHisto)) {
00653         switch (testType) {
00654         case 1 :
00655           test_Phi_EndCap = newHisto->KolmogorovTest(refHisto,"UO");
00656         case 2 :
00657           test_Phi_EndCap = newHisto->Chi2Test(refHisto);
00658         }
00659         if (verbose > 0) std::cout << ">>> Test (" << testType 
00660                                    << ") Result = " << test_Phi_EndCap << std::endl;            
00661 
00662       }
00663     }
00664 
00665     // --- Forward
00666     meRef = rdbe->get(refHistoName+"Pt_Forward");
00667     meNew = dbe->get(newHistoName+"Pt_Forward");
00668     if ((meRef) && (meNew)) {
00669       TH1F *refHisto = meRef->getTH1F();
00670       TH1F *newHisto = meNew->getTH1F();
00671       if ((refHisto) && (newHisto)) {
00672         switch (testType) {
00673         case 1 :
00674           test_Pt_Forward = newHisto->KolmogorovTest(refHisto,"UO");
00675         case 2:
00676           test_Pt_Forward = newHisto->Chi2Test(refHisto);
00677         }
00678         if (verbose > 0) std::cout << ">>> Test (" << testType 
00679                                    << ") Result = " << test_Pt_Forward << std::endl;            
00680       }
00681     }
00682 
00683     meRef = rdbe->get(refHistoName+"Phi_Forward");
00684     meNew = dbe->get(newHistoName+"Phi_Forward");
00685     if ((meRef) && (meNew)) {
00686       TH1F *refHisto = meRef->getTH1F();
00687       TH1F *newHisto = meNew->getTH1F();
00688       if ((refHisto) && (newHisto)) {
00689         switch (testType) {
00690         case 1 :
00691           test_Phi_Forward = newHisto->KolmogorovTest(refHisto,"UO");
00692         case 2 :
00693           test_Phi_Forward = newHisto->Chi2Test(refHisto);
00694         }
00695         if (verbose > 0) std::cout << ">>> Test (" << testType 
00696                                    << ") Result = " << test_Phi_Forward << std::endl;           
00697 
00698       }
00699     }
00700 
00701 
00702     if ( (test_Pt_Barrel > 0.95) && (test_Phi_Barrel > 0.95) ) {
00703       Jet_DCF_L3[iAlgo][0] = 1;
00704       // --- Fill DC results histogram
00705       mJetDCFL3->Fill(iAlgo+0*NL3Flags);
00706     } else {
00707       Jet_DCF_L3[iAlgo][0] = 0;
00708     }
00709     if ( (test_Pt_EndCap > 0.95) && (test_Phi_EndCap > 0.95) ) {
00710       Jet_DCF_L3[iAlgo][1] = 1;
00711       // --- Fill DC results histogram
00712       mJetDCFL3->Fill(iAlgo+1*NL3Flags);
00713     } else {
00714       Jet_DCF_L3[iAlgo][1] = 0;
00715     }
00716     if ( (test_Pt_Forward > 0.95) && (test_Phi_Forward > 0.95) ) {
00717       Jet_DCF_L3[iAlgo][2] = 1;
00718       // --- Fill DC results histogram
00719       mJetDCFL3->Fill(iAlgo+2*NL3Flags);
00720     } else {
00721       Jet_DCF_L3[iAlgo][2] = 0;
00722     }
00723 
00724   }
00725 
00726   // --- End of loop over jet algorithms
00727   int allOK = 1;
00728   for (int iAlgo=0; iAlgo<NJetAlgo; iAlgo++) {   
00729     if (Jet_DCF_L1[iAlgo] == 0) allOK = 0;
00730   }
00731   if (allOK == 1) mJetDCFL1->Fill(1);
00732 
00733 
00734   // JET Data Certification Results
00735   if (DEBUG) {
00736     std::cout << std::endl;
00737     printf("%6d %15d %-35s %10d\n",RunNumber,0,"JetMET", allOK);
00738     for (int iAlgo=0; iAlgo<NJetAlgo; iAlgo++) {    
00739       printf("%6d %15d %-35s %10d\n",RunNumber,0,Jet_Tag_L2[iAlgo].c_str(), Jet_DCF_L2[iAlgo]);
00740     }
00741     for (int iAlgo=0; iAlgo<NJetAlgo; iAlgo++) {    
00742       for (int iL3Flag=0; iL3Flag<NL3Flags; iL3Flag++) {    
00743         printf("%6d %15d %-35s %10d\n",RunNumber,0,Jet_Tag_L3[iAlgo][iL3Flag].c_str(), Jet_DCF_L3[iAlgo][iL3Flag]);
00744       }
00745     }
00746     std::cout << std::endl;    
00747   }
00748 
00749   // ****************************
00750   // Loop over Monitoring Elements and fill working histograms
00751   for(std::vector<MonitorElement*>::const_iterator ime = mes.begin(); ime!=mes.end(); ++ime) {
00752     std::string name = (*ime)->getName();
00753 
00754     if (name == "METTask_CaloMEx")     hMExy[0] = (*ime)->getTH1F();
00755     if (name == "METTask_CaloMEy")     hMExy[1] = (*ime)->getTH1F();
00756     if (name == "METTask_CaloMExNoHF") hMExy[2] = (*ime)->getTH1F();
00757     if (name == "METTask_CaloMEyNoHF") hMExy[3] = (*ime)->getTH1F();
00758 
00759     if (name == "METTask_CaloMEx_LS")     hCaloMEx_LS     = (*ime)->getTH2F();
00760     if (name == "METTask_CaloMEy_LS")     hCaloMEy_LS     = (*ime)->getTH2F();
00761     if (name == "METTask_CaloMExNoHF_LS") hCaloMExNoHF_LS = (*ime)->getTH2F();
00762     if (name == "METTask_CaloMEyNoHF_LS") hCaloMEyNoHF_LS = (*ime)->getTH2F();
00763 
00764   }
00765 
00766   for (int i=0;i<4;i++) {
00767     if (hMExy[i]->GetSum()>0.){
00768       fitd(hMExy[i],dgaus,g1,g2,verbose);
00769       fitfun[i]  = hMExy[i]->GetFunction("dgaus");
00770       fitfun1[i] = (TF1*)g1->Clone();
00771       fitfun2[i] = (TF1*)g2->Clone();
00772     }
00773   }
00774 
00775   // Slice *_LS histograms
00776   TH1D *CaloMEx_LS[500];
00777   TH1D *CaloMEy_LS[500];
00778   TH1D *CaloMExNoHF_LS[500];
00779   TH1D *CaloMEyNoHF_LS[500];
00780   TF1 *fitfun_CaloMEx_LS[500];
00781   TF1 *fitfun_CaloMEy_LS[500];
00782   TF1 *fitfun_CaloMExNoHF_LS[500];
00783   TF1 *fitfun_CaloMEyNoHF_LS[500];
00784   TF1 *fitfun1_CaloMEx_LS[500];
00785   TF1 *fitfun1_CaloMEy_LS[500];
00786   TF1 *fitfun1_CaloMExNoHF_LS[500];
00787   TF1 *fitfun1_CaloMEyNoHF_LS[500];
00788   TF1 *fitfun2_CaloMEx_LS[500];
00789   TF1 *fitfun2_CaloMEy_LS[500];
00790   TF1 *fitfun2_CaloMExNoHF_LS[500];
00791   TF1 *fitfun2_CaloMEyNoHF_LS[500];
00792   int JetMET_MET[500];
00793   int JetMET_MET_All[500];
00794   int JetMET_MEx_All[500];
00795   int JetMET_MEy_All[500];
00796   int JetMET_MET_NoHF[500];
00797   int JetMET_MEx_NoHF[500];
00798   int JetMET_MEy_NoHF[500];
00799   for (int i=0;i<500;i++){
00800     JetMET_MET[i]     =-1;
00801     JetMET_MET_All[i] =-1;
00802     JetMET_MEx_All[i] =-1;
00803     JetMET_MEy_All[i] =-1;
00804     JetMET_MET_NoHF[i]=-1;
00805     JetMET_MEx_NoHF[i]=-1;
00806     JetMET_MEy_NoHF[i]=-1;
00807   }
00808   char ctitle[100];
00809 
00810   // (LS=0 assigned to the entire run)
00811   for (int LS=1; LS<500; LS++){
00812 
00813     // Projection returns a 
00814     sprintf(ctitle,"CaloMEx_%04d",LS);     CaloMEx_LS[LS]=hCaloMEx_LS->ProjectionX(ctitle,LS+1,LS+1);
00815     sprintf(ctitle,"CaloMEy_%04d",LS);     CaloMEy_LS[LS]=hCaloMEy_LS->ProjectionX(ctitle,LS+1,LS+1);
00816     sprintf(ctitle,"CaloMExNoHF_%04d",LS); CaloMExNoHF_LS[LS]=hCaloMExNoHF_LS->ProjectionX(ctitle,LS+1,LS+1);
00817     sprintf(ctitle,"CaloMEyNoHF_%04d",LS); CaloMEyNoHF_LS[LS]=hCaloMEyNoHF_LS->ProjectionX(ctitle,LS+1,LS+1);
00818 
00819     if (CaloMEx_LS[LS]->GetSum()>0.) {
00820       fitdd(CaloMEx_LS[LS],dgaus,g1,g2,verbose);
00821         fitfun_CaloMEx_LS[LS]=CaloMEx_LS[LS]->GetFunction("dgaus");
00822         fitfun1_CaloMEx_LS[LS]=(TF1*)g1->Clone();
00823         fitfun2_CaloMEx_LS[LS]=(TF1*)g2->Clone();
00824     }
00825     if (CaloMEy_LS[LS]->GetSum()>0.) {
00826       fitdd(CaloMEy_LS[LS],dgaus,g1,g2,verbose);
00827         fitfun_CaloMEy_LS[LS]=CaloMEy_LS[LS]->GetFunction("dgaus");
00828         fitfun1_CaloMEy_LS[LS]=(TF1*)g1->Clone();
00829         fitfun2_CaloMEy_LS[LS]=(TF1*)g2->Clone();
00830     }
00831     if (CaloMExNoHF_LS[LS]->GetSum()>0.) {
00832       fitdd(CaloMExNoHF_LS[LS],dgaus,g1,g2,verbose);
00833         fitfun_CaloMExNoHF_LS[LS]=CaloMExNoHF_LS[LS]->GetFunction("dgaus");
00834         fitfun1_CaloMExNoHF_LS[LS]=(TF1*)g1->Clone();
00835         fitfun2_CaloMExNoHF_LS[LS]=(TF1*)g2->Clone();
00836     }
00837     if (CaloMEyNoHF_LS[LS]->GetSum()>0.) {
00838       fitdd(CaloMEyNoHF_LS[LS],dgaus,g1,g2,verbose);
00839         fitfun_CaloMEyNoHF_LS[LS]=CaloMEyNoHF_LS[LS]->GetFunction("dgaus");
00840         fitfun1_CaloMEyNoHF_LS[LS]=(TF1*)g1->Clone();
00841         fitfun2_CaloMEyNoHF_LS[LS]=(TF1*)g2->Clone();
00842     }
00843   }
00844 
00845 
00846   //----------------------------------------------------------------
00847   //--- Print out data certification summary
00848   //----------------------------------------------------------------
00849 
00850   if (verbose) {
00851   std::cout << std::endl;
00852   printf("| Variable                       |   Reduced chi^2              | Mean               | Width      |\n");
00853   }
00854   //
00855   // Entire run
00856   for (int i=0;i<4;i++){
00857     int nmean=1;
00858     if (fitfun[i]->GetNumberFreeParameters()==3) nmean=4;
00859     if (verbose)
00860     printf("| %-30s | %8.3f/%8.3f = %8.3f | %8.3f+-%8.3f | %8.3f+-%8.3f |\n",
00861            hMExy[i]->GetName(),
00862            fitfun[i]->GetChisquare(),double(fitfun[i]->GetNDF()),
00863            fitfun[i]->GetChisquare()/double(fitfun[i]->GetNDF()),
00864            fitfun[i]->GetParameter(nmean),  fitfun[i]->GetParError(nmean+1),
00865            fitfun[i]->GetParameter(nmean+1),fitfun[i]->GetParError(nmean+1));
00866     if (i==0)
00867       JetMET_MEx_All[0]=data_certificate(fitfun[i]->GetChisquare()/double(fitfun[i]->GetNDF()),
00868                                           fitfun[i]->GetParameter(nmean),
00869                                           5.,10.);
00870     if (i==1)
00871       JetMET_MEy_All[0]=data_certificate(fitfun[i]->GetChisquare()/double(fitfun[i]->GetNDF()),
00872                                           fitfun[i]->GetParameter(nmean),
00873                                           5.,10.);
00874     if (i==2)
00875       JetMET_MEx_NoHF[0]=data_certificate(fitfun[i]->GetChisquare()/double(fitfun[i]->GetNDF()),
00876                                           fitfun[i]->GetParameter(nmean),
00877                                           5.,10.);
00878     if (i==3)
00879       JetMET_MEy_NoHF[0]=data_certificate(fitfun[i]->GetChisquare()/double(fitfun[i]->GetNDF()),
00880                                           fitfun[i]->GetParameter(nmean),
00881                                           5.,10.);
00882   }
00883   //
00884   // Each lumi section
00885   // (LS=0 assigned to the entire run)
00886   for (int LS=1; LS<500; LS++){
00887     if (CaloMEx_LS[LS]->GetSum()>0.) {
00888       int nmean=1;
00889       if (fitfun_CaloMEx_LS[LS]->GetNumberFreeParameters()==3) nmean=4;
00890       if (verbose)
00891       printf("\n| %-30s | %8.3f/%8.3f = %8.3f | %8.3f+-%8.3f | %8.3f+-%8.3f |\n",
00892              CaloMEx_LS[LS]->GetName(),
00893              fitfun_CaloMEx_LS[LS]->GetChisquare(),double(fitfun_CaloMEx_LS[LS]->GetNDF()),
00894              fitfun_CaloMEx_LS[LS]->GetChisquare()/double(fitfun_CaloMEx_LS[LS]->GetNDF()),
00895              fitfun_CaloMEx_LS[LS]->GetParameter(nmean),  fitfun_CaloMEx_LS[LS]->GetParError(nmean),
00896              fitfun_CaloMEx_LS[LS]->GetParameter(nmean+1),fitfun_CaloMEx_LS[LS]->GetParError(nmean+1));
00897       JetMET_MEx_All[LS]=data_certificate(fitfun_CaloMEx_LS[LS]->GetChisquare()/double(fitfun_CaloMEx_LS[LS]->GetNDF()),
00898                                           fitfun_CaloMEx_LS[LS]->GetParameter(nmean),
00899                                           5.,10.);
00900     }
00901     if (CaloMEy_LS[LS]->GetSum()>0.) {
00902       int nmean=1;
00903       if (fitfun_CaloMEy_LS[LS]->GetNumberFreeParameters()==3) nmean=4;
00904       if (verbose)
00905       printf("| %-30s | %8.3f/%8.3f = %8.3f | %8.3f+-%8.3f | %8.3f+-%8.3f |\n",
00906              CaloMEy_LS[LS]->GetName(),
00907              fitfun_CaloMEy_LS[LS]->GetChisquare(),double(fitfun_CaloMEy_LS[LS]->GetNDF()),
00908              fitfun_CaloMEy_LS[LS]->GetChisquare()/double(fitfun_CaloMEy_LS[LS]->GetNDF()),
00909              fitfun_CaloMEy_LS[LS]->GetParameter(nmean),  fitfun_CaloMEy_LS[LS]->GetParError(nmean),
00910              fitfun_CaloMEy_LS[LS]->GetParameter(nmean+1),fitfun_CaloMEy_LS[LS]->GetParError(nmean+1));
00911       JetMET_MEy_All[LS]=data_certificate(fitfun_CaloMEy_LS[LS]->GetChisquare()/double(fitfun_CaloMEy_LS[LS]->GetNDF()),
00912                                           fitfun_CaloMEy_LS[LS]->GetParameter(nmean),
00913                                           5.,10.);
00914     }
00915     if (CaloMExNoHF_LS[LS]->GetSum()>0.) {
00916       int nmean=1;
00917       if (fitfun_CaloMExNoHF_LS[LS]->GetNumberFreeParameters()==3) nmean=4;
00918       if (verbose)
00919       printf("| %-30s | %8.3f/%8.3f = %8.3f | %8.3f+-%8.3f | %8.3f+-%8.3f |\n",
00920              CaloMExNoHF_LS[LS]->GetName(),
00921              fitfun_CaloMExNoHF_LS[LS]->GetChisquare(),double(fitfun_CaloMExNoHF_LS[LS]->GetNDF()),
00922              fitfun_CaloMExNoHF_LS[LS]->GetChisquare()/double(fitfun_CaloMExNoHF_LS[LS]->GetNDF()),
00923              fitfun_CaloMExNoHF_LS[LS]->GetParameter(nmean),  fitfun_CaloMExNoHF_LS[LS]->GetParError(nmean),
00924              fitfun_CaloMExNoHF_LS[LS]->GetParameter(nmean+1),fitfun_CaloMExNoHF_LS[LS]->GetParError(nmean+1));
00925       JetMET_MEx_NoHF[LS]=data_certificate(fitfun_CaloMExNoHF_LS[LS]->GetChisquare()/double(fitfun_CaloMExNoHF_LS[LS]->GetNDF()),
00926                                            fitfun_CaloMExNoHF_LS[LS]->GetParameter(nmean),
00927                                            5.,10.);
00928     }
00929     if (CaloMEyNoHF_LS[LS]->GetSum()>0.) {
00930       int nmean=1;
00931       if (fitfun_CaloMEyNoHF_LS[LS]->GetNumberFreeParameters()==3) nmean=4;
00932       if (verbose)
00933       printf("| %-30s | %8.3f/%8.3f = %8.3f | %8.3f+-%8.3f | %8.3f+-%8.3f |\n",
00934              CaloMEyNoHF_LS[LS]->GetName(),
00935              fitfun_CaloMEyNoHF_LS[LS]->GetChisquare(),double(fitfun_CaloMEyNoHF_LS[LS]->GetNDF()),
00936              fitfun_CaloMEyNoHF_LS[LS]->GetChisquare()/double(fitfun_CaloMEyNoHF_LS[LS]->GetNDF()),
00937              fitfun_CaloMEyNoHF_LS[LS]->GetParameter(nmean),  fitfun_CaloMEyNoHF_LS[LS]->GetParError(nmean),
00938              fitfun_CaloMEyNoHF_LS[LS]->GetParameter(nmean+1),fitfun_CaloMEyNoHF_LS[LS]->GetParError(nmean+1));
00939       JetMET_MEy_NoHF[LS]=data_certificate(fitfun_CaloMEyNoHF_LS[LS]->GetChisquare()/double(fitfun_CaloMEyNoHF_LS[LS]->GetNDF()),
00940                                            fitfun_CaloMEyNoHF_LS[LS]->GetParameter(nmean),
00941                                            5.,10.);
00942     }
00943   } // loop over LS
00944 
00945 
00946   //
00947   // Data certification format
00948   std::cout << std::endl;
00949   printf("   run,       lumi-sec, tag name,                                   output\n");
00950   for (int LS=0; LS<nLSBins; LS++){
00951     JetMET_MET_All[LS] = JetMET_MEx_All[LS] * JetMET_MEy_All[LS];
00952     JetMET_MET_NoHF[LS]= JetMET_MEx_NoHF[LS]* JetMET_MEy_NoHF[LS];
00953     JetMET_MET[LS]     = JetMET_MET_All[LS] * JetMET_MET_NoHF[LS];
00954 
00955     // -- Fill the DC Result Histograms    
00956     mMETDCFL2->Fill(0,LS,JetMET_MET_All[LS]);
00957     mMETDCFL2->Fill(1,LS,JetMET_MET_NoHF[LS]);
00958     mMETDCFL2->Fill(2,LS,JetMET_MET[LS]);
00959 
00960     //    std::cout  << ">>> " << LS << " " << JetMET_MET_All[LS] << " " 
00961     //         << JetMET_MET_NoHF[LS] << " " << JetMET_MET[LS] << std::endl;
00962 
00963     if (JetMET_MET[LS]>-1.) {
00964       if (LS==0 || LS==1){
00965         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET",     JetMET_MET[LS]);
00966         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET_All", JetMET_MET_All[LS]);
00967         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET_NoHF",JetMET_MET_NoHF[LS]);
00968       }
00969       else if (JetMET_MET[LS-1]==-1.) { 
00970         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET",     JetMET_MET[LS]);
00971         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET_All", JetMET_MET_All[LS]);
00972         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET_NoHF",JetMET_MET_NoHF[LS]);
00973       }
00974       else {
00975         if (JetMET_MET[LS]!=JetMET_MET[LS-1])
00976         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET",     JetMET_MET[LS]);
00977         if (JetMET_MET_All[LS]!=JetMET_MET_All[LS-1])
00978         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET_All", JetMET_MET_All[LS]);
00979         if (JetMET_MET_NoHF[LS]!=JetMET_MET_NoHF[LS-1])
00980         printf("%6d %15d %-35s %10d\n",RunNumber,LS,"JetMET_MET_NoHF",JetMET_MET_NoHF[LS]);
00981       }
00982     }
00983   }
00984 
00985   std::cout << std::endl;
00986 
00987   // -- 
00988   
00989 }

void DataCertificationJetMET::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 993 of file DataCertificationJetMET.cc.

References conf_, GenMuonPlsPt100GeV_cfg::cout, dbe, lat::endl(), edm::ParameterSet::getUntrackedParameter(), iggi_31X_cfg::outputFileName, and DQMStore::save().

00993                                 {
00994 
00995   //  LogTrace(metname)<<"[DataCertificationJetMET] Saving the histos";
00996   //  bool outputFile            = conf_.getParameter<bool>("OutputFile");
00997   //  std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00998 
00999   bool outputFile            = conf_.getUntrackedParameter<bool>("OutputFile");
01000   std::string outputFileName = conf_.getUntrackedParameter<std::string>("OutputFileName");
01001 
01002   std::cout << ">>> endJob " << outputFile << std:: endl;
01003 
01004   if(outputFile){
01005     //    dbe->showDirStructure();
01006     dbe->save(outputFileName);
01007   }
01008 }


Member Data Documentation

edm::ParameterSet DataCertificationJetMET::conf_ [private]

Definition at line 66 of file DataCertificationJetMET.cc.

Referenced by beginJob(), and endJob().

DQMStore* DataCertificationJetMET::dbe [private]

Definition at line 67 of file DataCertificationJetMET.cc.

Referenced by beginJob(), and endJob().

edm::Service<TFileService> DataCertificationJetMET::fs_ [private]

Definition at line 69 of file DataCertificationJetMET.cc.

DQMStore* DataCertificationJetMET::rdbe [private]

Definition at line 68 of file DataCertificationJetMET.cc.

Referenced by beginJob().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:17:38 2009 for CMSSW by  doxygen 1.5.4