CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/Validation/RecoMET/src/METTester.cc

Go to the documentation of this file.
00001 #include "Validation/RecoMET/interface/METTester.h"
00002 // author: Mike Schmitt, University of Florida
00003 // first version 8/24/2006
00004 // modification: Bobby Scurlock
00005 // date:  03.11.2006
00006 // note:  added RMS(METx) vs SumET capability
00007 // modification: Rick Cavanaugh
00008 // date:  05.11.2006
00009 // note:  cleaned up constructor and beginJob, removed int conv. warning
00010 //        added configuration params
00011 // modification: Mike Schmitt
00012 // date:  02.28.2007
00013 // note:  code rewrite. Now uses STL map for monitoring element container. 
00014 // modification: Bobby Scurlock
00015 // date:  04.03.2007
00016 // note:  Eliminated automated resolution fitting. This is now done in a ROOT script.
00017 
00018 // date:  02.04.2009 
00019 // note:  Added option to use fine binning or course binning for histos
00020 //
00021 // modification: Samantha Hewamanage, Florida International University
00022 // date: 01.30.2012
00023 // note: Added few hists for various nvtx ranges to study PU effects.
00024 //       Cleaned up the code by making it readable and const'ing the
00025 //       variables that should be changed.
00026 //       Changed the number of bins from odd to even. Odd number of bins
00027 //       makes it impossible to rebin a hist.
00028 
00029 #include "FWCore/PluginManager/interface/ModuleDef.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031 
00032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00033 #include "FWCore/ServiceRegistry/interface/Service.h"
00034 
00035 #include "FWCore/Framework/interface/Event.h"
00036 #include "DataFormats/Common/interface/Handle.h"
00037 #include "FWCore/Framework/interface/ESHandle.h"
00038 
00039 #include "DataFormats/METReco/interface/CaloMET.h"
00040 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00041 #include "DataFormats/METReco/interface/GenMET.h"
00042 #include "DataFormats/METReco/interface/GenMETCollection.h"
00043 #include "DataFormats/METReco/interface/MET.h"
00044 #include "DataFormats/METReco/interface/METFwd.h"
00045 #include "DataFormats/METReco/interface/PFMET.h"
00046 #include "DataFormats/METReco/interface/PFMETCollection.h"
00047 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00048 #include "DataFormats/Common/interface/ValueMap.h"  
00049 #include "DataFormats/MuonReco/interface/Muon.h"
00050 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00051 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00052 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00053 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00054 #include "DataFormats/TrackReco/interface/Track.h"
00055 #include "DataFormats/VertexReco/interface/Vertex.h"
00056 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00057 
00058 #include <vector>
00059 #include <utility>
00060 #include <ostream>
00061 #include <fstream>
00062 #include <iostream>
00063 #include <algorithm>
00064 #include <cmath>
00065 #include <memory>
00066 #include "DQMServices/Core/interface/DQMStore.h"
00067 #include "TMath.h"
00068 
00069 METTester::METTester(const edm::ParameterSet& iConfig)
00070 {
00071         METType_                 = iConfig.getUntrackedParameter<std::string>("METType");
00072         inputMETLabel_           = iConfig.getParameter<edm::InputTag>("InputMETLabel");
00073         if(METType_ == "TCMET") {
00074                 inputCaloMETLabel_       = iConfig.getParameter<edm::InputTag>("InputCaloMETLabel");     
00075                 inputTrackLabel_         = iConfig.getParameter<edm::InputTag>("InputTrackLabel");    
00076                 inputMuonLabel_          = iConfig.getParameter<edm::InputTag>("InputMuonLabel");
00077                 inputElectronLabel_      = iConfig.getParameter<edm::InputTag>("InputElectronLabel");
00078                 inputBeamSpotLabel_      = iConfig.getParameter<edm::InputTag>("InputBeamSpotLabel");
00079                 minhits_                 = iConfig.getParameter<int>("minhits");
00080                 maxd0_                   = iConfig.getParameter<double>("maxd0");
00081                 maxchi2_                 = iConfig.getParameter<double>("maxchi2");
00082                 maxeta_                  = iConfig.getParameter<double>("maxeta");
00083                 maxpt_                   = iConfig.getParameter<double>("maxpt");
00084                 maxPtErr_                = iConfig.getParameter<double>("maxPtErr");
00085                 trkQuality_              = iConfig.getParameter<std::vector<int> >("trkQuality");
00086                 trkAlgos_                = iConfig.getParameter<std::vector<int> >("trkAlgos");
00087                 sample_                  = iConfig.getUntrackedParameter<std::string>("sample");
00088         }
00089         finebinning_             = iConfig.getUntrackedParameter<bool>("FineBinning");
00090         FolderName_              = iConfig.getUntrackedParameter<std::string>("FolderName");
00091 }
00092 
00093 
00094 void METTester::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
00095 {
00096         // get ahold of back-end interface
00097         dbe_ = edm::Service<DQMStore>().operator->();
00098 
00099         if (dbe_) {
00100                 //    TString dirName = "RecoMETV/METTask/MET/";
00101                 //TString dirName = "JetMET/EventInfo/CertificationSummary/MET_Global/";
00102                 //    TString dirName = "RecoMETV/MET_Global/";
00103                 TString dirName(FolderName_.c_str()); 
00104                 TString label(inputMETLabel_.label());
00105                 dirName += label;
00106                 dbe_->setCurrentFolder((std::string)dirName);
00107 
00108                 if (METType_ == "CaloMET")
00109                 { 
00110                         // CaloMET Histograms
00111                         if(!finebinning_)
00112                         {
00113                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1); 
00114                                 me["hNvertex"]                = dbe_->book1D("METTask_Nvertex","METTask_Nvertex",80,0,80);
00115                                 me["hCaloMEx"]                = dbe_->book1D("METTask_CaloMEx","METTask_CaloMEx",500,-1000,500); 
00116                                 me["hCaloMEy"]                = dbe_->book1D("METTask_CaloMEy","METTask_CaloMEy",500,-1000,500);
00117                                 //        me["hCaloEz"]                 = dbe_->book1D("METTask_CaloEz","METTask_CaloEz",2000,-500,501);
00118                                 me["hCaloMETSig"]             = dbe_->book1D("METTask_CaloMETSig","METTask_CaloMETSig",25,0,24.5);
00119                                 me["hCaloMET"]                = dbe_->book1D("METTask_CaloMET"            , "METTask_CaloMET"            , 1000,0,2000);
00120                                 me["hCaloMET_Nvtx0to5"]       = dbe_->book1D("METTask_CaloMET_Nvtx0to5"   , "METTask_CaloMET_Nvtx0to5"   , 1000,0,2000);
00121                                 me["hCaloMET_Nvtx6to10"]      = dbe_->book1D("METTask_CaloMET_Nvtx6to10"  , "METTask_CaloMET_Nvtx6to10"  , 1000,0,2000);
00122                                 me["hCaloMET_Nvtx11to15"]     = dbe_->book1D("METTask_CaloMET_Nvtx11to15" , "METTask_CaloMET_Nvtx11to15" , 1000,0,2000);
00123                                 me["hCaloMET_Nvtx16to20"]     = dbe_->book1D("METTask_CaloMET_Nvtx16to20" , "METTask_CaloMET_Nvtx16to20" , 1000,0,2000);
00124                                 me["hCaloMET_Nvtx21to30"]     = dbe_->book1D("METTask_CaloMET_Nvtx21to30" , "METTask_CaloMET_Nvtx21to30" , 1000,0,2000);
00125                                 me["hCaloMET_Nvtx30toInf"]    = dbe_->book1D("METTask_CaloMET_Nvtx30toInf", "METTask_CaloMET_Nvtx30toInf", 1000,0,2000);
00126                                 me["hCaloMETPhi"]             = dbe_->book1D("METTask_CaloMETPhi","METTask_CaloMETPhi",40,-4,4);
00127                                 me["hCaloSumET"]              = dbe_->book1D("METTask_CaloSumET"            , "METTask_CaloSumET"            , 800,0,8000);   //10GeV
00128                                 me["hCaloSumET_Nvtx0to5"]     = dbe_->book1D("METTask_CaloSumET_Nvtx0to5"   , "METTask_CaloSumET_Nvtx0to5"   , 800,0,8000);
00129                                 me["hCaloSumET_Nvtx6to10"]    = dbe_->book1D("METTask_CaloSumET_Nvtx6to10"  , "METTask_CaloSumET_Nvtx6to10"  , 800,0,8000);
00130                                 me["hCaloSumET_Nvtx11to15"]   = dbe_->book1D("METTask_CaloSumET_Nvtx11to15" , "METTask_CaloSumET_Nvtx11to15" , 800,0,8000);
00131                                 me["hCaloSumET_Nvtx16to20"]   = dbe_->book1D("METTask_CaloSumET_Nvtx16to20" , "METTask_CaloSumET_Nvtx16to20" , 800,0,8000);
00132                                 me["hCaloSumET_Nvtx21to30"]   = dbe_->book1D("METTask_CaloSumET_Nvtx21to30" , "METTask_CaloSumET_Nvtx21to30" , 800,0,8000);
00133                                 me["hCaloSumET_Nvtx30toInf"]  = dbe_->book1D("METTask_CaloSumET_Nvtx30toInf", "METTask_CaloSumET_Nvtx30toInf", 800,0,8000);
00134 
00135                                 me["hCaloMaxEtInEmTowers"]    = dbe_->book1D("METTask_CaloMaxEtInEmTowers","METTask_CaloMaxEtInEmTowers",600,0,3000);   //5GeV
00136                                 me["hCaloMaxEtInHadTowers"]   = dbe_->book1D("METTask_CaloMaxEtInHadTowers","METTask_CaloMaxEtInHadTowers",600,0,3000);  //5GeV
00137                                 me["hCaloEtFractionHadronic"] = dbe_->book1D("METTask_CaloEtFractionHadronic","METTask_CaloEtFractionHadronic",100,0,1);
00138                                 me["hCaloEmEtFraction"]       = dbe_->book1D("METTask_CaloEmEtFraction","METTask_CaloEmEtFraction",100,0,1);
00139                                 me["hCaloHadEtInHB"]          = dbe_->book1D("METTask_CaloHadEtInHB","METTask_CaloHadEtInHB",1000, 0, 5000);  //5GeV  
00140                                 me["hCaloHadEtInHO"]          = dbe_->book1D("METTask_CaloHadEtInHO","METTask_CaloHadEtInHO", 250, 0, 500);  //5GeV
00141                                 me["hCaloHadEtInHE"]          = dbe_->book1D("METTask_CaloHadEtInHE","METTask_CaloHadEtInHE", 200, 0, 400);  //5GeV
00142                                 me["hCaloHadEtInHF"]          = dbe_->book1D("METTask_CaloHadEtInHF","METTask_CaloHadEtInHF", 100, 0, 200);  //5GeV
00143                                 me["hCaloEmEtInHF"]           = dbe_->book1D("METTask_CaloEmEtInHF","METTask_CaloEmEtInHF",100, 0, 100);   //5GeV
00144                                 me["hCaloSETInpHF"]           = dbe_->book1D("METTask_CaloSETInpHF","METTask_CaloSETInpHF",500, 0, 1000);
00145                                 me["hCaloSETInmHF"]           = dbe_->book1D("METTask_CaloSETInmHF","METTask_CaloSETInmHF",500, 0, 1000);
00146                                 me["hCaloEmEtInEE"]           = dbe_->book1D("METTask_CaloEmEtInEE","METTask_CaloEmEtInEE",100, 0, 200);    //5GeV
00147                                 me["hCaloEmEtInEB"]           = dbe_->book1D("METTask_CaloEmEtInEB","METTask_CaloEmEtInEB",1200, 0, 6000);   //5GeV
00148 
00149                                 me["hCaloMETResolution_GenMETTrue"]    = dbe_->book1D("METTask_CaloMETResolution_GenMETTrue","METTask_CaloMETResolution_GenMETTrue", 500,-500,500); 
00150                                 me["hCaloMETResolution_GenMETCalo"]    = dbe_->book1D("METTask_CaloMETResolution_GenMETCalo","METTask_CaloMETResolution_GenMETCalo", 500,-500,500); 
00151 
00152                                 me["hCaloMETPhiResolution_GenMETTrue"] = dbe_->book1D("METTask_CaloMETPhiResolution_GenMETTrue","METTask_CaloMETPhiResolution_GenMETTrue", 80,0,4); 
00153                                 me["hCaloMETPhiResolution_GenMETCalo"] = dbe_->book1D("METTask_CaloMETPhiResolution_GenMETCalo","METTask_CaloMETPhiResolution_GenMETCalo", 80,0,4); 
00154 
00155                         } else 
00156                         {
00157 
00158                                 //FineBinnning
00159                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);
00160                                 me["hNvertex"]                = dbe_->book1D("METTask_Nvertex","METTask_Nvertex",80,0,80);
00161                                 me["hCaloMEx"]                = dbe_->book1D("METTask_CaloMEx","METTask_CaloMEx",4000,-1000,1000);
00162                                 me["hCaloMEy"]                = dbe_->book1D("METTask_CaloMEy","METTask_CaloMEy",4000,-1000,1000);
00163                                 //me["hCaloEz"]                 = dbe_->book1D("METTask_CaloEz","METTask_CaloEz",2000,-500,501);
00164                                 me["hCaloMETSig"]             = dbe_->book1D("METTask_CaloMETSig","METTask_CaloMETSig",50,0,50);
00165                                 me["hCaloMET"]                = dbe_->book1D("METTask_CaloMET","METTask_CaloMET",2000,0,2000);
00166                                 me["hCaloMET_Nvtx0to5"]       = dbe_->book1D("METTask_CaloMET_Nvtx0to5"   , "METTask_CaloMET_Nvtx0to5"   , 2000,0,2000);
00167                                 me["hCaloMET_Nvtx6to10"]      = dbe_->book1D("METTask_CaloMET_Nvtx6to10"  , "METTask_CaloMET_Nvtx6to10"  , 2000,0,2000);
00168                                 me["hCaloMET_Nvtx11to15"]     = dbe_->book1D("METTask_CaloMET_Nvtx11to15" , "METTask_CaloMET_Nvtx11to15" , 2000,0,2000);
00169                                 me["hCaloMET_Nvtx16to20"]     = dbe_->book1D("METTask_CaloMET_Nvtx16to20" , "METTask_CaloMET_Nvtx16to20" , 2000,0,2000);
00170                                 me["hCaloMET_Nvtx21to30"]     = dbe_->book1D("METTask_CaloMET_Nvtx21to30" , "METTask_CaloMET_Nvtx21to30" , 2000,0,2000);
00171                                 me["hCaloMET_Nvtx30toInf"]    = dbe_->book1D("METTask_CaloMET_Nvtx30toInf", "METTask_CaloMET_Nvtx30toInf", 2000,0,2000);
00172                                 me["hCaloMETPhi"]             = dbe_->book1D("METTask_CaloMETPhi","METTask_CaloMETPhi",40,-4,4);
00173                                 me["hCaloSumET"]              = dbe_->book1D("METTask_CaloSumET","METTask_CaloSumET",10000,0,10000);
00174                                 me["hCaloSumET_Nvtx0to5"]     = dbe_->book1D("METTask_CaloSumET_Nvtx0to5"   , "METTask_CaloSumET_Nvtx0to5"   , 10000,0,10000);
00175                                 me["hCaloSumET_Nvtx6to10"]    = dbe_->book1D("METTask_CaloSumET_Nvtx6to10"  , "METTask_CaloSumET_Nvtx6to10"  , 10000,0,10000);
00176                                 me["hCaloSumET_Nvtx11to15"]   = dbe_->book1D("METTask_CaloSumET_Nvtx11to15" , "METTask_CaloSumET_Nvtx11to15" , 10000,0,10000);
00177                                 me["hCaloSumET_Nvtx16to20"]   = dbe_->book1D("METTask_CaloSumET_Nvtx16to20" , "METTask_CaloSumET_Nvtx16to20" , 10000,0,10000);
00178                                 me["hCaloSumET_Nvtx21to30"]   = dbe_->book1D("METTask_CaloSumET_Nvtx21to30" , "METTask_CaloSumET_Nvtx21to30" , 10000,0,10000);
00179                                 me["hCaloSumET_Nvtx30toInf"]  = dbe_->book1D("METTask_CaloSumET_Nvtx30toInf", "METTask_CaloSumET_Nvtx30toInf", 10000,0,10000);
00180                                 me["hCaloMaxEtInEmTowers"]    = dbe_->book1D("METTask_CaloMaxEtInEmTowers","METTask_CaloMaxEtInEmTowers",4000,0,4000);
00181                                 me["hCaloMaxEtInHadTowers"]   = dbe_->book1D("METTask_CaloMaxEtInHadTowers","METTask_CaloMaxEtInHadTowers",4000,0,4000);
00182                                 me["hCaloEtFractionHadronic"] = dbe_->book1D("METTask_CaloEtFractionHadronic","METTask_CaloEtFractionHadronic",100,0,1);
00183                                 me["hCaloEmEtFraction"]       = dbe_->book1D("METTask_CaloEmEtFraction","METTask_CaloEmEtFraction",100,0,1);
00184                                 me["hCaloHadEtInHB"]          = dbe_->book1D("METTask_CaloHadEtInHB","METTask_CaloHadEtInHB",8000,0,8000);
00185                                 me["hCaloHadEtInHO"]          = dbe_->book1D("METTask_CaloHadEtInHO","METTask_CaloHadEtInHO",4000,0,4000);
00186                                 me["hCaloHadEtInHE"]          = dbe_->book1D("METTask_CaloHadEtInHE","METTask_CaloHadEtInHE",4000,0,4000);
00187                                 me["hCaloHadEtInHF"]          = dbe_->book1D("METTask_CaloHadEtInHF","METTask_CaloHadEtInHF",4000,0,4000);
00188                                 me["hCaloHadEtInEB"]          = dbe_->book1D("METTask_CaloHadEtInEB","METTask_CaloHadEtInEB",8000,0,8000);
00189                                 me["hCaloHadEtInEE"]          = dbe_->book1D("METTask_CaloHadEtInEE","METTask_CaloHadEtInEE",4000,0,4000);
00190                                 me["hCaloEmEtInHF"]           = dbe_->book1D("METTask_CaloEmEtInHF","METTask_CaloEmEtInHF",4000,0,4000);
00191                                 me["hCaloSETInpHF"]           = dbe_->book1D("METTask_CaloSETInpHF","METTask_CaloSETInpHF",4000,0,4000);
00192                                 me["hCaloSETInmHF"]           = dbe_->book1D("METTask_CaloSETInmHF","METTask_CaloSETInmHF",4000,0,4000);
00193                                 me["hCaloEmEtInEE"]           = dbe_->book1D("METTask_CaloEmEtInEE","METTask_CaloEmEtInEE",4000,0,4000);
00194                                 me["hCaloEmEtInEB"]           = dbe_->book1D("METTask_CaloEmEtInEB","METTask_CaloEmEtInEB",8000,0,8000);
00195 
00196                                 me["hCaloMETResolution_GenMETTrue"]    = dbe_->book1D("METTask_CaloMETResolution_GenMETTrue","METTask_CaloMETResolution_GenMETTrue", 2000,-1000,1000); 
00197                                 me["hCaloMETResolution_GenMETCalo"]    = dbe_->book1D("METTask_CaloMETResolution_GenMETCalo","METTask_CaloMETResolution_GenMETCalo", 2000,-1000,1000); 
00198 
00199                                 me["hCaloMETPhiResolution_GenMETTrue"] = dbe_->book1D("METTask_CaloMETPhiResolution_GenMETTrue","METTask_CaloMETPhiResolution_GenMETTrue", 80,0,4); 
00200                                 me["hCaloMETPhiResolution_GenMETCalo"] = dbe_->book1D("METTask_CaloMETPhiResolution_GenMETCalo","METTask_CaloMETPhiResolution_GenMETCalo", 80,0,4); 
00201                         }
00202                 
00203                 
00204                 } else if (METType_ == "GenMET") 
00205                 {
00206 
00207                         // GenMET Histograms
00208 
00209                         if(!finebinning_)
00210                         {
00211                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1); 
00212                                 me["hGenMEx"]                 = dbe_->book1D("METTask_GenMEx","METTask_GenMEx",1000,-999.5,999.5);
00213                                 me["hGenMEy"]                 = dbe_->book1D("METTask_GenMEy","METTask_GenMEy",1000,-999.5,999.5);
00214                                 //        me["hGenEz"]                  = dbe_->book1D("METTask_GenEz","METTask_GenEz",2000,-500,501);
00215                                 me["hGenMETSig"]              = dbe_->book1D("METTask_GenMETSig","METTask_GenMETSig",51,0,51);
00216                                 me["hGenMET"]                 = dbe_->book1D("METTask_GenMET","METTask_GenMET", 2000,-0.5,1999.5);
00217                                 me["hGenMETPhi"]              = dbe_->book1D("METTask_GenMETPhi","METTask_GenMETPhi",40,-4,4);
00218                                 me["hGenSumET"]               = dbe_->book1D("METTask_GenSumET","METTask_GenSumET",1000,-0.5,9999.5);
00219 
00220                                 me["hNeutralEMEtFraction"]    = dbe_->book1D("METTask_GenNeutralEMEtFraction", "METTask_GenNeutralEMEtFraction", 120, 0.0, 1.2 );
00221                                 me["hNeutralHadEtFraction"]   = dbe_->book1D("METTask_GenNeutralHadEtFraction", "METTask_GenNeutralHadEtFraction", 120, 0.0, 1.2 );
00222                                 me["hChargedEMEtFraction"]    = dbe_->book1D("METTask_GenChargedEMEtFraction", "METTask_GenChargedEMEtFraction", 120, 0.0, 1.2);
00223                                 me["hChargedHadEtFraction"]   = dbe_->book1D("METTask_GenChargedHadEtFraction", "METTask_GenChargedHadEtFraction", 120, 0.0,1.2);
00224                                 me["hMuonEtFraction"]         = dbe_->book1D("METTask_GenMuonEtFraction", "METTask_GenMuonEtFraction", 120, 0.0, 1.2 );
00225                                 me["hInvisibleEtFraction"]    = dbe_->book1D("METTask_GenInvisibleEtFraction", "METTask_GenInvisibleEtFraction", 120, 0.0, 1.2 );
00226 
00227                         } else 
00228                         {
00229                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);
00230                                 me["hGenMEx"]                 = dbe_->book1D("METTask_GenMEx","METTask_GenMEx",4000,-1000,1000);
00231                                 me["hGenMEy"]                 = dbe_->book1D("METTask_GenMEy","METTask_GenMEy",4000,-1000,1000);
00232                                 //me["hGenEz"]                  = dbe_->book1D("METTask_GenEz","METTask_GenEz",2000,-500,500);
00233                                 me["hGenMETSig"]              = dbe_->book1D("METTask_GenMETSig","METTask_GenMETSig",51,0,51);
00234                                 me["hGenMET"]                 = dbe_->book1D("METTask_GenMET","METTask_GenMET",2000,0,2000);
00235                                 me["hGenMETPhi"]              = dbe_->book1D("METTask_GenMETPhi","METTask_GenMETPhi",40,-4,4);
00236                                 me["hGenSumET"]               = dbe_->book1D("METTask_GenSumET","METTask_GenSumET",10000,0,10000);
00237                                 me["hNeutralEMEtFraction"]    = dbe_->book1D("METTask_GenNeutralEMEtFraction", "METTask_GenNeutralEMEtFraction", 120, 0.0, 1.2 );
00238                                 me["hNeutralHadEtFraction"]   = dbe_->book1D("METTask_GenNeutralHadEtFraction", "METTask_GenNeutralHadEtFraction", 120, 0.0, 1.2 );
00239                                 me["hChargedEMEtFraction"]    = dbe_->book1D("METTask_GenChargedEMEtFraction", "METTask_GenChargedEMEtFraction", 120, 0.0, 1.2);
00240                                 me["hChargedHadEtFraction"]   = dbe_->book1D("METTask_GenChargedHadEtFraction", "METTask_GenChargedHadEtFraction", 120, 0.0,1.2);
00241                                 me["hMuonEtFraction"]         = dbe_->book1D("METTask_GenMuonEtFraction", "METTask_GenMuonEtFraction", 120, 0.0, 1.2 );
00242                                 me["hInvisibleEtFraction"]    = dbe_->book1D("METTask_GenInvisibleEtFraction", "METTask_GenInvisibleEtFraction", 120, 0.0, 1.2 );
00243 
00244                         }
00245                 
00246                 } else if (METType_ == "MET")
00247                 {
00248 
00249                         // MET Histograms
00250                         if(!finebinning_)
00251                         {
00252                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1); 
00253                                 me["hMEx"]                = dbe_->book1D("METTask_MEx","METTask_MEx",1000,-999.5,999.5);
00254                                 me["hMEy"]                = dbe_->book1D("METTask_MEy","METTask_MEy",1000,-999.5,999.5);
00255                                 //me["hEz"]                 = dbe_->book1D("METTask_Ez","METTask_Ez",1000,-999.5,999.5);
00256                                 me["hMETSig"]             = dbe_->book1D("METTask_METSig","METTask_METSig",50,-0.5,49.5);
00257                                 me["hMET"]                = dbe_->book1D("METTask_MET","METTask_MET",1000,-0.5,1999.5);
00258                                 me["hMETPhi"]             = dbe_->book1D("METTask_METPhi","METTask_METPhi",40,-4,4);
00259                                 me["hSumET"]              = dbe_->book1D("METTask_SumET","METTask_SumET",1000,0,9999.5);   
00260 
00261                         } else
00262                         {
00263                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);
00264                                 me["hMEx"]                = dbe_->book1D("METTask_MEx","METTask_MEx",2000,-500,500);
00265                                 me["hMEy"]                = dbe_->book1D("METTask_MEy","METTask_MEy",2000,-500,500);
00266                                 //me["hEz"]                 = dbe_->book1D("METTask_Ez","METTask_Ez",2000,-500,500);
00267                                 me["hMETSig"]             = dbe_->book1D("METTask_METSig","METTask_METSig",51,0,51);
00268                                 me["hMET"]                = dbe_->book1D("METTask_MET","METTask_MET",2000,0,2000);
00269                                 me["hMETPhi"]             = dbe_->book1D("METTask_METPhi","METTask_METPhi",40,-4,4);
00270                                 me["hSumET"]              = dbe_->book1D("METTask_SumET","METTask_SumET",4000,0,4000);
00271 
00272                         }
00273                 
00274                 } else if (METType_ == "PFMET")
00275                 {
00276                         // PFMET Histograms                                                                                                                  
00277                         if(!finebinning_)
00278                         {
00279                                 me["hNevents"]            = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);   
00280                                 me["hNvertex"]            = dbe_->book1D("METTask_Nvertex","METTask_Nvertex",80,0,80);
00281                                 me["hMEx"]                = dbe_->book1D("METTask_MEx","METTask_MEx",1000,-1000,1000);
00282                                 me["hMEy"]                = dbe_->book1D("METTask_MEy","METTask_MEy",1000,-1000,1000);
00283                                 //        me["hEz"]                 = dbe_->book1D("METTask_Ez","METTask_Ez",2000,-500,500);
00284                                 me["hMETSig"]             = dbe_->book1D("METTask_METSig","METTask_METSig",51,0,51);
00285                                 me["hMET"]                = dbe_->book1D("METTask_MET","METTask_MET",1000,0,2000);
00286                                 me["hMET_Nvtx0to5"]       = dbe_->book1D("METTask_MET_Nvtx0to5"   , "METTask_MET_Nvtx0to5"   , 1000,0,2000);
00287                                 me["hMET_Nvtx6to10"]      = dbe_->book1D("METTask_MET_Nvtx6to10"  , "METTask_MET_Nvtx6to10"  , 1000,0,2000);
00288                                 me["hMET_Nvtx11to15"]     = dbe_->book1D("METTask_MET_Nvtx11to15" , "METTask_MET_Nvtx11to15" , 1000,0,2000);
00289                                 me["hMET_Nvtx16to20"]     = dbe_->book1D("METTask_MET_Nvtx16to20" , "METTask_MET_Nvtx16to20" , 1000,0,2000);
00290                                 me["hMET_Nvtx21to30"]     = dbe_->book1D("METTask_MET_Nvtx21to30" , "METTask_MET_Nvtx21to30" , 1000,0,2000);
00291                                 me["hMET_Nvtx30toInf"]    = dbe_->book1D("METTask_MET_Nvtx30toInf", "METTask_MET_Nvtx30toInf", 1000,0,2000);
00292                                 me["hMETPhi"]             = dbe_->book1D("METTask_METPhi","METTask_METPhi",40,-4,4);
00293                                 me["hSumET"]              = dbe_->book1D("METTask_SumET","METTask_SumET",1000,0,10000);     
00294                                 me["hSumET_Nvtx0to5"]     = dbe_->book1D("METTask_SumET_Nvtx0to5"   , "METTask_SumET_Nvtx0to5"   , 1000,0,2000);
00295                                 me["hSumET_Nvtx6to10"]    = dbe_->book1D("METTask_SumET_Nvtx6to10"  , "METTask_SumET_Nvtx6to10"  , 1000,0,2000);
00296                                 me["hSumET_Nvtx11to15"]   = dbe_->book1D("METTask_SumET_Nvtx11to15" , "METTask_SumET_Nvtx11to15" , 1000,0,2000);
00297                                 me["hSumET_Nvtx16to20"]   = dbe_->book1D("METTask_SumET_Nvtx16to20" , "METTask_SumET_Nvtx16to20" , 1000,0,2000);
00298                                 me["hSumET_Nvtx21to30"]   = dbe_->book1D("METTask_SumET_Nvtx21to30" , "METTask_SumET_Nvtx21to30" , 1000,0,2000);
00299                                 me["hSumET_Nvtx30toInf"]  = dbe_->book1D("METTask_SumET_Nvtx30toInf", "METTask_SumET_Nvtx30toInf", 1000,0,2000);
00300 
00301 
00302                                 me["hMETResolution_GenMETTrue"]      = dbe_->book1D("METTask_METResolution_GenMETTrue","METTask_METResolution_GenMETTrue", 500,-500,500); 
00303                                 me["hMETResolution_GenMETCalo"]      = dbe_->book1D("METTask_METResolution_GenMETCalo","METTask_METResolution_GenMETCalo", 500,-500,500); 
00304 
00305                                 me["hMETPhiResolution_GenMETTrue"] = dbe_->book1D("METTask_METPhiResolution_GenMETTrue","METTask_METPhiResolution_GenMETTrue", 80,0,4); 
00306                                 me["hMETPhiResolution_GenMETCalo"] = dbe_->book1D("METTask_METPhiResolution_GenMETCalo","METTask_METPhiResolution_GenMETCalo", 80,0,4); 
00307 
00308 
00309                                 me["hMETResolution_GenMETTrue_MET0to20"]    = dbe_->book1D("METTask_METResolution_GenMETTrue_MET0to20"   , "METTask_METResolution_GenMETTrue_MET0to20"   , 500,-500,500); 
00310                                 me["hMETResolution_GenMETTrue_MET20to40"]   = dbe_->book1D("METTask_METResolution_GenMETTrue_MET20to40"  , "METTask_METResolution_GenMETTrue_MET20to40"  , 500,-500,500); 
00311                                 me["hMETResolution_GenMETTrue_MET40to60"]   = dbe_->book1D("METTask_METResolution_GenMETTrue_MET40to60"  , "METTask_METResolution_GenMETTrue_MET40to60"  , 500,-500,500); 
00312                                 me["hMETResolution_GenMETTrue_MET60to80"]   = dbe_->book1D("METTask_METResolution_GenMETTrue_MET60to80"  , "METTask_METResolution_GenMETTrue_MET60to80"  , 500,-500,500); 
00313                                 me["hMETResolution_GenMETTrue_MET80to100"]  = dbe_->book1D("METTask_METResolution_GenMETTrue_MET80to100" , "METTask_METResolution_GenMETTrue_MET80to100" , 500,-500,500); 
00314                                 me["hMETResolution_GenMETTrue_MET100to150"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET100to150", "METTask_METResolution_GenMETTrue_MET100to150", 500,-500,500); 
00315                                 me["hMETResolution_GenMETTrue_MET150to200"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET150to200", "METTask_METResolution_GenMETTrue_MET150to200", 500,-500,500); 
00316                                 me["hMETResolution_GenMETTrue_MET200to300"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET200to300", "METTask_METResolution_GenMETTrue_MET200to300", 500,-500,500); 
00317                                 me["hMETResolution_GenMETTrue_MET300to400"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET300to400", "METTask_METResolution_GenMETTrue_MET300to400", 500,-500,500); 
00318                                 me["hMETResolution_GenMETTrue_MET400to500"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET400to500", "METTask_METResolution_GenMETTrue_MET400to500", 500,-500,500); 
00319                                 //this will be filled at the end of the job using info from above hists
00320                                 int nBins = 10;
00321                                 float bins[] = {0.,20.,40.,60.,80.,100.,150.,200.,300.,400.,500.};
00322                                 me["hMETResolution_GenMETTrue_METResolution"]     = dbe_->book1D("METTask_METResolution_GenMETTrue_InMETBins","METTask_METResolution_GenMETTrue_InMETBins",nBins, bins);
00323 
00324 
00325                         } else 
00326                         {
00327 
00328                                 //FineBin
00329                                 me["hNevents"]            = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);
00330                                 me["hNvertex"]            = dbe_->book1D("METTask_Nvertex","METTask_Nvertex",80,0,80);
00331                                 me["hMEx"]                = dbe_->book1D("METTask_MEx","METTask_MEx",2000,-500,500);
00332                                 me["hMEy"]                = dbe_->book1D("METTask_MEy","METTask_MEy",2000,-500,500);
00333                                 //me["hEz"]               = dbe_->book1D("METTask_Ez","METTask_Ez",2000,-500,500);
00334                                 me["hMETSig"]             = dbe_->book1D("METTask_METSig","METTask_METSig",51,0,51);
00335                                 me["hMET"]                = dbe_->book1D("METTask_MET","METTask_MET", 2000,0,2000);
00336                                 me["hMET_Nvtx0to5"]       = dbe_->book1D("METTask_MET_Nvtx0to5"   , "METTask_MET_Nvtx0to5"   , 2000,0,2000);
00337                                 me["hMET_Nvtx6to10"]      = dbe_->book1D("METTask_MET_Nvtx6to10"  , "METTask_MET_Nvtx6to10"  , 2000,0,2000);
00338                                 me["hMET_Nvtx11to15"]     = dbe_->book1D("METTask_MET_Nvtx11to15" , "METTask_MET_Nvtx11to15" , 2000,0,2000);
00339                                 me["hMET_Nvtx16to20"]     = dbe_->book1D("METTask_MET_Nvtx16to20" , "METTask_MET_Nvtx16to20" , 2000,0,2000);
00340                                 me["hMET_Nvtx21to30"]     = dbe_->book1D("METTask_MET_Nvtx21to30" , "METTask_MET_Nvtx21to30" , 2000,0,2000);
00341                                 me["hMET_Nvtx30toInf"]    = dbe_->book1D("METTask_MET_Nvtx30toInf", "METTask_MET_Nvtx30toInf", 2000,0,2000);
00342                                 me["hMETPhi"]             = dbe_->book1D("METTask_METPhi","METTask_METPhi",40,-4,4);
00343                                 me["hSumET"]              = dbe_->book1D("METTask_SumET","METTask_SumET",4000,0,4000);
00344                                 me["hSumET_Nvtx0to5"]     = dbe_->book1D("METTask_SumET_Nvtx0to5"   , "METTask_SumET_Nvtx0to5"   , 4000,0,4000);
00345                                 me["hSumET_Nvtx6to10"]    = dbe_->book1D("METTask_SumET_Nvtx6to10"  , "METTask_SumET_Nvtx6to10"  , 4000,0,4000);
00346                                 me["hSumET_Nvtx11to15"]   = dbe_->book1D("METTask_SumET_Nvtx11to15" , "METTask_SumET_Nvtx11to15" , 4000,0,4000);
00347                                 me["hSumET_Nvtx16to20"]   = dbe_->book1D("METTask_SumET_Nvtx16to20" , "METTask_SumET_Nvtx16to20" , 4000,0,4000);
00348                                 me["hSumET_Nvtx21to30"]   = dbe_->book1D("METTask_SumET_Nvtx21to30" , "METTask_SumET_Nvtx21to30" , 4000,0,4000);
00349                                 me["hSumET_Nvtx30toInf"]  = dbe_->book1D("METTask_SumET_Nvtx30toInf", "METTask_SumET_Nvtx30toInf", 4000,0,4000);
00350 
00351                                 me["hMETResolution_GenMETTrue"]      = dbe_->book1D("METTask_METResolution_GenMETTrue","METTask_METResolution_GenMETTrue",2000,-1000,1000);
00352                                 me["hMETResolution_GenMETCalo"]      = dbe_->book1D("METTask_METResolution_GenMETCalo","METTask_METResolution_GenMETCalo",2000,-1000,1000);
00353 
00354                                 me["hMETPhiResolution_GenMETTrue"] = dbe_->book1D("METTask_METPhiResolution_GenMETTrue","METTask_METPhiResolution_GenMETTrue", 80,0,4); 
00355                                 me["hMETPhiResolution_GenMETCalo"] = dbe_->book1D("METTask_METPhiResolution_GenMETCalo","METTask_METPhiResolution_GenMETCalo", 80,0,4); 
00356 
00357 
00358                                 me["hMETResolution_GenMETTrue_MET0to20"]    = dbe_->book1D("METTask_METResolution_GenMETTrue_MET0to20","METTask_METResolution_GenMETTrue_MET0to20"      , 2000,-1000,1000); 
00359                                 me["hMETResolution_GenMETTrue_MET20to40"]   = dbe_->book1D("METTask_METResolution_GenMETTrue_MET20to40","METTask_METResolution_GenMETTrue_MET20to40"    , 2000,-1000,1000); 
00360                                 me["hMETResolution_GenMETTrue_MET40to60"]   = dbe_->book1D("METTask_METResolution_GenMETTrue_MET40to60","METTask_METResolution_GenMETTrue_MET40to60"    , 2000,-1000,1000); 
00361                                 me["hMETResolution_GenMETTrue_MET60to80"]   = dbe_->book1D("METTask_METResolution_GenMETTrue_MET60to80","METTask_METResolution_GenMETTrue_MET60to80"    , 2000,-1000,1000); 
00362                                 me["hMETResolution_GenMETTrue_MET80to100"]  = dbe_->book1D("METTask_METResolution_GenMETTrue_MET80to100","METTask_METResolution_GenMETTrue_MET80to100"  , 2000,-1000,1000); 
00363                                 me["hMETResolution_GenMETTrue_MET100to150"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET100to150","METTask_METResolution_GenMETTrue_MET100to150", 2000,-1000,1000); 
00364                                 me["hMETResolution_GenMETTrue_MET150to200"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET150to200","METTask_METResolution_GenMETTrue_MET150to200", 2000,-1000,1000); 
00365                                 me["hMETResolution_GenMETTrue_MET200to300"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET200to300","METTask_METResolution_GenMETTrue_MET200to300", 2000,-1000,1000); 
00366                                 me["hMETResolution_GenMETTrue_MET300to400"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET300to400","METTask_METResolution_GenMETTrue_MET300to400", 2000,-1000,1000); 
00367                                 me["hMETResolution_GenMETTrue_MET400to500"] = dbe_->book1D("METTask_METResolution_GenMETTrue_MET400to500","METTask_METResolution_GenMETTrue_MET400to500", 2000,-1000,1000); 
00368 
00369                                 //this will be filled at the end of the job using info from above hists
00370                                 int nBins = 10;
00371                                 float bins[] = {0.,20.,40.,60.,80.,100.,150.,200.,300.,400.,500.};
00372                                 me["hMETResolution_GenMETTrue_METResolution"]     = dbe_->book1D("METTask_METResolution_GenMETTrue_InMETBins","METTask_METResolution_GenMETTrue_InMETBins",nBins, bins);
00373                         }
00374                 
00375                 } else if (METType_ == "TCMET" || inputMETLabel_.label() == "corMetGlobalMuons") 
00376                 {
00377                         //TCMET or MuonCorrectedCaloMET Histograms                                                                                                                  
00378                         if(!finebinning_)
00379                         {
00380                                 me["hNevents"]                = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);   
00381                                 me["hMEx"]                = dbe_->book1D("METTask_MEx","METTask_MEx",1000,-999.5,999.5);
00382                                 me["hMEy"]                = dbe_->book1D("METTask_MEy","METTask_MEy",1000,-999.5,999.5);
00383                                 me["hMETSig"]             = dbe_->book1D("METTask_METSig","METTask_METSig",51,0,51);
00384                                 me["hMET"]                = dbe_->book1D("METTask_MET","METTask_MET",1000,-0.5,1999.5);
00385                                 me["hMETPhi"]             = dbe_->book1D("METTask_METPhi","METTask_METPhi",40,-4,4);
00386                                 me["hSumET"]              = dbe_->book1D("METTask_SumET","METTask_SumET",1000,-0.50,9999.5);     
00387 
00388                                 me["hMExCorrection"]       = dbe_->book1D("METTask_MExCorrection","METTask_MExCorrection", 1000, -500.0,500.0);
00389                                 me["hMEyCorrection"]       = dbe_->book1D("METTask_MEyCorrection","METTask_MEyCorrection", 1000, -500.0,500.0);
00390                                 me["hMuonCorrectionFlag"]      = dbe_->book1D("METTask_CorrectionFlag", "METTask_CorrectionFlag", 6, -0.5, 5.5);
00391 
00392                                 me["hMETResolution_GenMETTrue"]      = dbe_->book1D("METTask_METResolution_GenMETTrue","METTask_METResolution_GenMETTrue", 500,-500,500); 
00393                                 me["hMETResolution_GenMETCalo"]      = dbe_->book1D("METTask_METResolution_GenMETCalo","METTask_METResolution_GenMETCalo", 500,-500,500); 
00394 
00395                                 me["hMETPhiResolution_GenMETTrue"] = dbe_->book1D("METTask_METPhiResolution_GenMETTrue","METTask_METPhiResolution_GenMETTrue", 80,0,4); 
00396                                 me["hMETPhiResolution_GenMETCalo"] = dbe_->book1D("METTask_METPhiResolution_GenMETCalo","METTask_METPhiResolution_GenMETCalo", 80,0,4); 
00397 
00398                                 if( METType_ == "TCMET" ) {
00399                                         me["htrkPt"] = dbe_->book1D("METTask_trackPt", "METTask_trackPt", 50, 0, 500);
00400                                         me["htrkEta"] = dbe_->book1D("METTask_trackEta", "METTask_trackEta", 50, -2.5, 2.5);
00401                                         me["htrkNhits"] = dbe_->book1D("METTask_trackNhits", "METTask_trackNhits", 50, 0, 50);
00402                                         me["htrkChi2"] = dbe_->book1D("METTask_trackNormalizedChi2", "METTask_trackNormalizedChi2", 20, 0, 20);
00403                                         me["htrkD0"] = dbe_->book1D("METTask_trackD0", "METTask_trackd0", 50, -1, 1);
00404                                         me["htrkQuality"] = dbe_->book1D("METTask_trackQuality", "METTask_trackQuality", 30, -0.5, 29.5);
00405                                         me["htrkAlgo"] = dbe_->book1D("METTask_trackAlgo", "METTask_trackAlgo", 6, 3.5, 9.5);
00406                                         me["htrkPtErr"] = dbe_->book1D("METTask_trackPtErr", "METTask_trackPtErr", 200, 0, 2);
00407                                         me["helePt"] = dbe_->book1D("METTask_electronPt", "METTask_electronPt", 50, 0, 500);
00408                                         me["heleEta"] = dbe_->book1D("METTask_electronEta", "METTask_electronEta", 50, -2.5, 2.5);
00409                                         me["heleHoE"] = dbe_->book1D("METTask_electronHoverE", "METTask_electronHoverE", 25, 0, 0.5);
00410                                         me["hmuPt"] = dbe_->book1D("METTask_muonPt", "METTask_muonPt", 50, 0, 500);
00411                                         me["hmuEta"] = dbe_->book1D("METTask_muonEta", "METTask_muonEta", 50, -2.5, 2.5);
00412                                         me["hmuNhits"] = dbe_->book1D("METTask_muonNhits", "METTask_muonNhits", 50, 0, 50);
00413                                         me["hmuChi2"] = dbe_->book1D("METTask_muonNormalizedChi2", "METTask_muonNormalizedChi2", 20, 0, 20);
00414                                         me["hmuD0"] = dbe_->book1D("METTask_muonD0", "METTask_muonD0", 50, -1, 1);
00415                                         me["hnMus"] = dbe_->book1D("METTask_nMus", "METTask_nMus", 5, -0.5, 4.5);
00416                                         me["hnMusPis"] = dbe_->book1D("METTask_nMusAsPis", "METTask_nMusAsPis", 5, -0.5, 4.5);
00417                                         me["hmuSAhits"] = dbe_->book1D("METTask_muonSAhits", "METTask_muonSAhits", 51, -0.5, 50.5);
00418                                         me["hnEls"] = dbe_->book1D("METTask_nEls", "METTask_nEls", 5, -0.5, 4.5);
00419                                         me["hfracTrks"] = dbe_->book1D("METTask_fracTracks", "METTask_fracTracks", 100, 0, 1);
00420                                         me["hdMETx"] = dbe_->book1D("METTask_dMETx", "METTask_dMETx", 500, -250, 250);
00421                                         me["hdMETy"] = dbe_->book1D("METTask_dMETy", "METTask_dMETy", 500, -250, 250);
00422                                         me["hdMET"] = dbe_->book1D("METTask_dMET", "METTask_dMET", 500, -250, 250);
00423                                         me["hdMUx"] = dbe_->book1D("METTask_dMUx", "METTask_dMUx", 500, -250, 250);
00424                                         me["hdMUy"] = dbe_->book1D("METTask_dMUy", "METTask_dMUy", 500, -250, 250);
00425                                 }
00426                                 else if( inputMETLabel_.label() == "corMetGlobalMuons" ) {
00427                                         me["hmuPt"] = dbe_->book1D("METTask_muonPt", "METTask_muonPt", 50, 0, 500);
00428                                         me["hmuEta"] = dbe_->book1D("METTask_muonEta", "METTask_muonEta", 50, -2.5, 2.5);
00429                                         me["hmuNhits"] = dbe_->book1D("METTask_muonNhits", "METTask_muonNhits", 50, 0, 50);
00430                                         me["hmuChi2"] = dbe_->book1D("METTask_muonNormalizedChi2", "METTask_muonNormalizedChi2", 20, 0, 20);
00431                                         me["hmuD0"] = dbe_->book1D("METTask_muonD0", "METTask_muonD0", 50, -1, 1);
00432                                         me["hmuSAhits"] = dbe_->book1D("METTask_muonSAhits", "METTask_muonSAhits", 51, -0.5, 50.5);
00433                                 }
00434                         }
00435                         else
00436                         {
00437                                 //FineBin
00438                                 me["hNevents"]            = dbe_->book1D("METTask_Nevents","METTask_Nevents",1,0,1);
00439                                 me["hMEx"]                = dbe_->book1D("METTask_MEx","METTask_MEx",2000,-500,500);
00440                                 me["hMEy"]                = dbe_->book1D("METTask_MEy","METTask_MEy",2000,-500,500);
00441                                 me["hMETSig"]             = dbe_->book1D("METTask_METSig","METTask_METSig",51,0,51);
00442                                 me["hMET"]                = dbe_->book1D("METTask_MET","METTask_MET",2000,0,2002);
00443                                 me["hMETPhi"]             = dbe_->book1D("METTask_METPhi","METTask_METPhi",40,-4,4);
00444                                 me["hSumET"]              = dbe_->book1D("METTask_SumET","METTask_SumET",4000,0,4000);
00445                                 me["hMExCorrection"]      = dbe_->book1D("METTask_MExCorrection","METTask_MExCorrection", 2000, -500.0,500.0);
00446                                 me["hMEyCorrection"]      = dbe_->book1D("METTask_MEyCorrection","METTask_MEyCorrection", 2000, -500.0,500.0);
00447                                 me["hMuonCorrectionFlag"]     = dbe_->book1D("METTask_CorrectionFlag", "METTask_CorrectionFlag", 6, -0.5, 5.5);            
00448 
00449                                 me["hMETResolution_GenMETTrue"]      = dbe_->book1D("METTask_METResolution_GenMETTrue","METTask_METResolution_GenMETTrue",2000,-1000,1000);
00450                                 me["hMETResolution_GenMETCalo"]      = dbe_->book1D("METTask_METResolution_GenMETCalo","METTask_METResolution_GenMETCalo",2000,-1000,1000);
00451 
00452                                 me["hMETPhiResolution_GenMETTrue"] = dbe_->book1D("METTask_METPhiResolution_GenMETTrue","METTask_METPhiResolution_GenMETTrue", 80,0,4); 
00453                                 me["hMETPhiResolution_GenMETCalo"] = dbe_->book1D("METTask_METPhiResolution_GenMETCalo","METTask_METPhiResolution_GenMETCalo", 80,0,4); 
00454 
00455                                 if( METType_ == "TCMET" ) {
00456                                         me["htrkPt"] = dbe_->book1D("METTask_trackPt", "METTask_trackPt", 250, 0, 500);
00457                                         me["htrkEta"] = dbe_->book1D("METTask_trackEta", "METTask_trackEta", 250, -2.5, 2.5);
00458                                         me["htrkNhits"] = dbe_->book1D("METTask_trackNhits", "METTask_trackNhits", 50, 0, 50);
00459                                         me["htrkChi2"] = dbe_->book1D("METTask_trackNormalizedChi2", "METTask_trackNormalizedChi2", 100, 0, 20);
00460                                         me["htrkD0"] = dbe_->book1D("METTask_trackD0", "METTask_trackd0", 200, -1, 1);
00461                                         me["htrkQuality"] = dbe_->book1D("METTask_trackQuality", "METTask_trackQuality", 30, -0.5, 29.5);
00462                                         me["htrkAlgo"] = dbe_->book1D("METTask_trackAlgo", "METTask_trackAlgo", 6, 3.5, 9.5);
00463                                         me["htrkPtErr"] = dbe_->book1D("METTask_trackPtErr", "METTask_trackPtErr", 200, 0, 2);
00464                                         me["helePt"] = dbe_->book1D("METTask_electronPt", "METTask_electronPt", 250, 0, 500);
00465                                         me["heleEta"] = dbe_->book1D("METTask_electronEta", "METTask_electronEta", 250, -2.5, 2.5);
00466                                         me["heleHoE"] = dbe_->book1D("METTask_electronHoverE", "METTask_electronHoverE", 100, 0, 0.5);
00467                                         me["hmuPt"] = dbe_->book1D("METTask_muonPt", "METTask_muonPt", 250, 0, 500);
00468                                         me["hmuEta"] = dbe_->book1D("METTask_muonEta", "METTask_muonEta", 250, -2.5, 2.5);
00469                                         me["hmuNhits"] = dbe_->book1D("METTask_muonNhits", "METTask_muonNhits", 50, 0, 50);
00470                                         me["hmuChi2"] = dbe_->book1D("METTask_muonNormalizedChi2", "METTask_muonNormalizedChi2", 100, 0, 20);
00471                                         me["hmuD0"] = dbe_->book1D("METTask_muonD0", "METTask_muonD0", 200, -1, 1);
00472                                         me["hnMus"] = dbe_->book1D("METTask_nMus", "METTask_nMus", 5, -0.5, 4.5);
00473                                         me["hnMusPis"] = dbe_->book1D("METTask_nMusAsPis", "METTask_nMusAsPis", 5, -0.5, 4.5);
00474                                         me["hmuSAhits"] = dbe_->book1D("METTask_muonSAhits", "METTask_muonSAhits", 51, -0.5, 50.5);
00475                                         me["hnEls"] = dbe_->book1D("METTask_nEls", "METTask_nEls", 5, -0.5, 4.5);
00476                                         me["hfracTrks"] = dbe_->book1D("METTask_fracTracks", "METTask_fracTracks", 100, 0, 1);
00477                                         me["hdMETx"] = dbe_->book1D("METTask_dMETx", "METTask_dMETx", 500, -250, 250);
00478                                         me["hdMETy"] = dbe_->book1D("METTask_dMETy", "METTask_dMETy", 500, -250, 250);
00479                                         me["hdMET"] = dbe_->book1D("METTask_dMET", "METTask_dMET", 500, -250, 250);
00480                                         me["hdMUx"] = dbe_->book1D("METTask_dMUx", "METTask_dMUx", 500, -250, 250);
00481                                         me["hdMUy"] = dbe_->book1D("METTask_dMUy", "METTask_dMUy", 500, -250, 250);
00482                                 }
00483                                 else if( inputMETLabel_.label() == "corMetGlobalMuons" ) {
00484                                         me["hmuPt"] = dbe_->book1D("METTask_muonPt", "METTask_muonPt", 250, 0, 500);
00485                                         me["hmuEta"] = dbe_->book1D("METTask_muonEta", "METTask_muonEta", 250, -2.5, 2.5);
00486                                         me["hmuNhits"] = dbe_->book1D("METTask_muonNhits", "METTask_muonNhits", 50, 0, 50);
00487                                         me["hmuChi2"] = dbe_->book1D("METTask_muonNormalizedChi2", "METTask_muonNormalizedChi2", 100, 0, 20);
00488                                         me["hmuD0"] = dbe_->book1D("METTask_muonD0", "METTask_muonD0", 200, -1, 1);
00489                                         me["hmuSAhits"] = dbe_->book1D("METTask_muonSAhits", "METTask_muonSAhits", 51, -0.5, 50.5);
00490                                 }
00491                         }
00492 
00493                         if(METType_ == "TCMET")
00494                         {
00495                                 me["hMuonCorrectionFlag"]->setBinLabel(1,"Not Corrected");
00496                                 me["hMuonCorrectionFlag"]->setBinLabel(2,"Global Fit");
00497                                 me["hMuonCorrectionFlag"]->setBinLabel(3,"Tracker Fit");
00498                                 me["hMuonCorrectionFlag"]->setBinLabel(4,"SA Fit");
00499                                 me["hMuonCorrectionFlag"]->setBinLabel(5,"Treated as Pion");
00500                                 me["hMuonCorrectionFlag"]->setBinLabel(6,"Default fit");
00501                         }
00502                         else if( inputMETLabel_.label() == "corMetGlobalMuons") 
00503                         {
00504                                 me["hMuonCorrectionFlag"]->setBinLabel(1,"Not Corrected");
00505                                 me["hMuonCorrectionFlag"]->setBinLabel(2,"Global Fit");
00506                                 me["hMuonCorrectionFlag"]->setBinLabel(3,"Tracker Fit");
00507                                 me["hMuonCorrectionFlag"]->setBinLabel(4,"SA Fit");
00508                                 me["hMuonCorrectionFlag"]->setBinLabel(5,"Treated as Pion");
00509                                 me["hMuonCorrectionFlag"]->setBinLabel(6,"Default fit");
00510                         }
00511                 }
00512                 else
00513                 {
00514                         edm::LogInfo("OutputInfo") << " METType not correctly specified!'";// << outputFile_.c_str();
00515                 }
00516         }
00517 }
00518 
00519 void METTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00520 {
00521 
00522         edm::Handle<reco::VertexCollection> vertexHandle;
00523         iEvent.getByLabel("offlinePrimaryVertices", vertexHandle);
00524    if (! vertexHandle.isValid())
00525         {
00526                 std::cout << __FUNCTION__ << ":" << __LINE__ << ":vertexHandle handle not found!" << std::endl;
00527                 assert(false);
00528         }
00529         const int nvtx = vertexHandle->size();
00530 
00531         using namespace reco;
00532         if (METType_ == "CaloMET")
00533         { 
00534                 const CaloMET *calomet;
00535                 // Get CaloMET
00536                 edm::Handle<CaloMETCollection> calo;
00537                 iEvent.getByLabel(inputMETLabel_, calo);
00538                 if (!calo.isValid()) {
00539                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task";
00540                         edm::LogInfo("OutputInfo") << " MET Task cannot continue...!";
00541                         return;
00542                 } else {
00543                         const CaloMETCollection *calometcol = calo.product();
00544                         calomet = &(calometcol->front());
00545                 }
00546 
00547 
00548                 // ==========================================================
00549                 // Reconstructed MET Information
00550                 const double caloSumET = calomet->sumEt();
00551                 const double caloMETSig = calomet->mEtSig();
00552                 const double caloMET = calomet->pt();
00553                 const double caloMEx = calomet->px();
00554                 const double caloMEy = calomet->py();
00555                 const double caloMETPhi = calomet->phi();
00556                 const double caloMaxEtInEMTowers = calomet->maxEtInEmTowers();
00557                 const double caloMaxEtInHadTowers = calomet->maxEtInHadTowers();
00558                 const double caloEtFractionHadronic = calomet->etFractionHadronic();
00559                 const double caloEmEtFraction = calomet->emEtFraction();
00560                 const double caloHadEtInHB = calomet->hadEtInHB();
00561                 const double caloHadEtInHO = calomet->hadEtInHO();
00562                 const double caloHadEtInHE = calomet->hadEtInHE();
00563                 const double caloHadEtInHF = calomet->hadEtInHF();
00564                 const double caloEmEtInEB = calomet->emEtInEB();
00565                 const double caloEmEtInEE = calomet->emEtInEE();
00566                 const double caloEmEtInHF = calomet->emEtInHF();
00567                 const double caloSETInpHF = calomet->CaloSETInpHF();
00568                 const double caloSETInmHF = calomet->CaloSETInmHF();
00569 
00570                 edm::LogInfo("OutputInfo") << caloMET << " " << caloSumET << std::endl;
00571                 me["hNevents"]->Fill(0.5);
00572                 me["hCaloMEx"]->Fill(caloMEx);
00573                 me["hCaloMEy"]->Fill(caloMEy);
00574                 me["hCaloMET"]->Fill(caloMET);
00575                 me["hCaloMETPhi"]->Fill(caloMETPhi);
00576                 me["hCaloSumET"]->Fill(caloSumET);
00577                 me["hCaloMETSig"]->Fill(caloMETSig);
00578                 me["hCaloMaxEtInEmTowers"]->Fill(caloMaxEtInEMTowers);
00579                 me["hCaloMaxEtInHadTowers"]->Fill(caloMaxEtInHadTowers);
00580                 me["hCaloEtFractionHadronic"]->Fill(caloEtFractionHadronic);
00581                 me["hCaloEmEtFraction"]->Fill(caloEmEtFraction);
00582                 me["hCaloHadEtInHB"]->Fill(caloHadEtInHB);
00583                 me["hCaloHadEtInHO"]->Fill(caloHadEtInHO);
00584                 me["hCaloHadEtInHE"]->Fill(caloHadEtInHE);
00585                 me["hCaloHadEtInHF"]->Fill(caloHadEtInHF);
00586                 me["hCaloEmEtInEB"]->Fill(caloEmEtInEB);
00587                 me["hCaloEmEtInEE"]->Fill(caloEmEtInEE);
00588                 me["hCaloEmEtInHF"]->Fill(caloEmEtInHF);
00589                 me["hCaloSETInpHF"]->Fill(caloSETInpHF);
00590                 me["hCaloSETInmHF"]->Fill(caloSETInmHF);
00591                 
00592                 /******************************************
00593                  * For PU Studies
00594                  * ****************************************/
00595                 me["hNvertex"]->Fill(nvtx);
00596 
00597                 if (nvtx <= 5)
00598                 {
00599                         me["hCaloMET_Nvtx0to5"]->Fill(caloMET);
00600                         me["hCaloSumET_Nvtx0to5"]->Fill(caloSumET);
00601                 } else if (nvtx >= 6 && nvtx <= 10)
00602                 {
00603                         me["hCaloMET_Nvtx6to10"]->Fill(caloMET);
00604                         me["hCaloSumET_Nvtx6to10"]->Fill(caloSumET);
00605                 } else if (nvtx >= 11 && nvtx <= 15)
00606                 {
00607                         me["hCaloMET_Nvtx11to15"]->Fill(caloMET);
00608                         me["hCaloSumET_Nvtx11to15"]->Fill(caloSumET);
00609                 } else if (nvtx >= 16 && nvtx <= 20)
00610                 {
00611                         me["hCaloMET_Nvtx16to20"]->Fill(caloMET);
00612                         me["hCaloSumET_Nvtx16to20"]->Fill(caloSumET);
00613                 } else if (nvtx >= 21 && nvtx <= 30)
00614                 {
00615                         me["hCaloMET_Nvtx21to30"]->Fill(caloMET);
00616                         me["hCaloSumET_Nvtx21to30"]->Fill(caloSumET);
00617                 } else if (nvtx >= 31)
00618                 {
00619                         me["hCaloMET_Nvtx30toInf"]->Fill(caloMET);
00620                         me["hCaloSumET_Nvtx30toInf"]->Fill(caloSumET);
00621                 }
00622 
00623 
00624                 // Get Generated MET for Resolution plots
00625 
00626                 edm::Handle<GenMETCollection> genTrue;
00627                 iEvent.getByLabel("genMetTrue", genTrue);
00628                 if (genTrue.isValid()) {
00629                         const GenMETCollection *genmetcol = genTrue.product();
00630                         const GenMET *genMetTrue = &(genmetcol->front());
00631                         double genMET = genMetTrue->pt();
00632                         double genMETPhi = genMetTrue->phi();
00633 
00634                         me["hCaloMETResolution_GenMETTrue"]->Fill( caloMET - genMET );
00635                         me["hCaloMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( caloMETPhi - genMETPhi ) ) );
00636                 } else {
00637                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetTrue";
00638                 }    
00639 
00640 
00641                 edm::Handle<GenMETCollection> genCalo;
00642                 iEvent.getByLabel("genMetCalo", genCalo);
00643                 if (genCalo.isValid()) {
00644                         const GenMETCollection *genmetcol = genCalo.product();
00645                         const GenMET  *genMetCalo = &(genmetcol->front());
00646                         const double genMET = genMetCalo->pt();
00647                         const double genMETPhi = genMetCalo->phi();
00648 
00649                         me["hCaloMETResolution_GenMETCalo"]->Fill( caloMET - genMET );
00650                         me["hCaloMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( caloMETPhi - genMETPhi ) ) );
00651                 } else {
00652                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetCalo";
00653                 }    
00654 
00655 
00656         }       else if (METType_ == "GenMET")
00657         {
00658                 const GenMET *genmet;
00659                 // Get Generated MET
00660                 edm::Handle<GenMETCollection> gen;
00661                 iEvent.getByLabel(inputMETLabel_, gen);
00662                 if (!gen.isValid()) {
00663                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task";
00664                         edm::LogInfo("OutputInfo") << " MET Task cannot continue...!";
00665                         return;
00666                 } else {
00667                         const GenMETCollection *genmetcol = gen.product();
00668                         genmet = &(genmetcol->front());
00669                 }    
00670 
00671                 // ==========================================================
00672                 // Genenerated MET Information  
00673                 const double genSumET = genmet->sumEt();
00674                 const double genMET = genmet->pt();
00675                 const double genMEx = genmet->px();
00676                 const double genMEy = genmet->py();
00677                 const double genMETPhi = genmet->phi();
00678                 const double genMETSig = genmet->mEtSig();
00679                 /*
00680                         double genEmEnergy = genmet->emEnergy();
00681                         double genHadEnergy = genmet->hadEnergy();
00682                         double genInvisibleEnergy= genmet->invisibleEnergy();
00683                         double genAuxiliaryEnergy= genmet->auxiliaryEnergy();
00684                         */
00685 
00686                 const double NeutralEMEtFraction = genmet->NeutralEMEtFraction() ;
00687                 const double NeutralHadEtFraction = genmet->NeutralHadEtFraction() ;
00688                 const double ChargedEMEtFraction = genmet->ChargedEMEtFraction () ;
00689                 const double ChargedHadEtFraction = genmet->ChargedHadEtFraction();
00690                 const double MuonEtFraction = genmet->MuonEtFraction() ;
00691                 const double InvisibleEtFraction = genmet->InvisibleEtFraction() ;
00692 
00693                 me["hNevents"]->Fill(0);
00694                 me["hGenMEx"]->Fill(genMEx);
00695                 me["hGenMEy"]->Fill(genMEy);
00696                 me["hGenMET"]->Fill(genMET);
00697                 me["hGenMETPhi"]->Fill(genMETPhi);
00698                 me["hGenSumET"]->Fill(genSumET);
00699                 me["hGenMETSig"]->Fill(genMETSig);
00700                 //me["hGenEz"]->Fill(genEz);
00701 
00702                 me["hNeutralEMEtFraction"]->Fill( NeutralEMEtFraction );
00703                 me["hNeutralHadEtFraction"]->Fill( NeutralHadEtFraction );
00704                 me["hChargedEMEtFraction"]->Fill( ChargedEMEtFraction );
00705                 me["hChargedHadEtFraction"]->Fill( ChargedHadEtFraction );
00706                 me["hMuonEtFraction"]->Fill( MuonEtFraction );
00707                 me["hInvisibleEtFraction"]->Fill( InvisibleEtFraction );
00708 
00709                 me["hNevents"]->Fill(0.5);
00710         
00711         } else if( METType_ == "PFMET")
00712         {
00713                 const PFMET *pfmet;
00714                 edm::Handle<PFMETCollection> hpfmetcol;
00715                 iEvent.getByLabel(inputMETLabel_,hpfmetcol);
00716                 if (!hpfmetcol.isValid()){
00717                         edm::LogInfo("OutputInfo") << "falied to retrieve data require by MET Task";
00718                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00719                         return;
00720                 } else
00721                 {
00722                         const PFMETCollection *pfmetcol = hpfmetcol.product();
00723                         pfmet = &(pfmetcol->front());
00724                 }
00725                 // Reconstructed MET Information                                                                                                     
00726                 const double SumET = pfmet->sumEt();
00727                 const double MET = pfmet->pt();
00728                 const double MEx = pfmet->px();
00729                 const double MEy = pfmet->py();
00730                 const double METPhi = pfmet->phi();
00731                 const double METSig = pfmet->mEtSig();
00732                 me["hMEx"]->Fill(MEx);
00733                 me["hMEy"]->Fill(MEy);
00734                 me["hMET"]->Fill(MET);
00735                 me["hMETPhi"]->Fill(METPhi);
00736                 me["hSumET"]->Fill(SumET);
00737                 me["hMETSig"]->Fill(METSig);
00738                 me["hNevents"]->Fill(0.5);
00739 
00740                 /******************************************
00741                  * For PU Studies
00742                  * ****************************************/
00743                 
00744                 me["hNvertex"]->Fill(nvtx);
00745                 if (nvtx <= 5)
00746                 {
00747                         me["hMET_Nvtx0to5"]->Fill(MET);
00748                         me["hSumET_Nvtx0to5"]->Fill(SumET);
00749                 } else if (nvtx >= 6 && nvtx <= 10)
00750                 {
00751                         me["hMET_Nvtx6to10"]->Fill(MET);
00752                         me["hSumET_Nvtx6to10"]->Fill(SumET);
00753                 } else if (nvtx >= 11 && nvtx <= 15)
00754                 {
00755                         me["hMET_Nvtx11to15"]->Fill(MET);
00756                         me["hSumET_Nvtx11to15"]->Fill(SumET);
00757                 } else if (nvtx >= 16 && nvtx <= 20)
00758                 {
00759                         me["hMET_Nvtx16to20"]->Fill(MET);
00760                         me["hSumET_Nvtx16to20"]->Fill(SumET);
00761                 } else if (nvtx >= 21 && nvtx <= 30)
00762                 {
00763                         me["hMET_Nvtx21to30"]->Fill(MET);
00764                         me["hSumET_Nvtx21to30"]->Fill(SumET);
00765                 } else if (nvtx >= 31)
00766                 {
00767                         me["hMET_Nvtx30toInf"]->Fill(MET);
00768                         me["hSumET_Nvtx30toInf"]->Fill(SumET);
00769                 }
00770 
00771 
00772                 edm::Handle<GenMETCollection> genTrue;
00773                 iEvent.getByLabel("genMetTrue", genTrue);
00774                 if (genTrue.isValid()) {
00775                         const GenMETCollection *genmetcol = genTrue.product();
00776                         const GenMET *genMetTrue = &(genmetcol->front());
00777                         const double genMET = genMetTrue->pt();
00778                         const double genMETPhi = genMetTrue->phi();
00779 
00780                         me["hMETResolution_GenMETTrue"]->Fill( MET - genMET );
00781                         me["hMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
00782 
00783                         //pfMET resolution in pfMET bins : Sam, Feb, 2012
00784 
00785                         if (MET > 0 && MET < 20) me["hMETResolution_GenMETTrue_MET0to20"]->Fill( MET - genMET );
00786                         else if (MET > 20 && MET < 40) me["hMETResolution_GenMETTrue_MET20to40"]->Fill( MET - genMET );
00787                         else if (MET > 40 && MET < 60) me["hMETResolution_GenMETTrue_MET40to60"]->Fill( MET - genMET );
00788                         else if (MET > 60 && MET < 80) me["hMETResolution_GenMETTrue_MET60to80"]->Fill( MET - genMET );
00789                         else if (MET > 80 && MET <100) me["hMETResolution_GenMETTrue_MET80to100"]->Fill( MET - genMET );
00790                         else if (MET >100 && MET <150) me["hMETResolution_GenMETTrue_MET100to150"]->Fill( MET - genMET );
00791                         else if (MET >150 && MET <200) me["hMETResolution_GenMETTrue_MET150to200"]->Fill( MET - genMET );
00792                         else if (MET >200 && MET <300) me["hMETResolution_GenMETTrue_MET200to300"]->Fill( MET - genMET );
00793                         else if (MET >300 && MET <400) me["hMETResolution_GenMETTrue_MET300to400"]->Fill( MET - genMET );
00794                         else if (MET >400 && MET <500) me["hMETResolution_GenMETTrue_MET400to500"]->Fill( MET - genMET );
00795 
00796                         //This is an ugly hack I had to do.
00797                         //I wanted to fill just one histogram at the endo the job. I tried
00798                         //to do this in endjob() but it seems the file is closed before this
00799                         //step.
00800                         FillpfMETRes();
00801 
00802                 } else {
00803                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetTrue";
00804                 }    
00805 
00806 
00807                 edm::Handle<GenMETCollection> genCalo;
00808                 iEvent.getByLabel("genMetCalo", genCalo);
00809                 if (genCalo.isValid()) {
00810                         const GenMETCollection *genmetcol = genCalo.product();
00811                         const GenMET  *genMetCalo = &(genmetcol->front());
00812                         const double genMET = genMetCalo->pt();
00813                         const double genMETPhi = genMetCalo->phi();
00814 
00815                         me["hMETResolution_GenMETCalo"]->Fill( MET - genMET );
00816                         me["hMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
00817                 } else {
00818                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetCalo";
00819                 }    
00820 
00821 
00822 
00823         } else if (METType_ == "MET")
00824         {
00825                 const MET *met;
00826                 // Get Generated MET
00827                 edm::Handle<METCollection> hmetcol;
00828                 iEvent.getByLabel(inputMETLabel_, hmetcol);
00829                 if (!hmetcol.isValid()) {
00830                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task";
00831                         edm::LogInfo("OutputInfo") << " MET Task cannot continue...!";
00832                         return;
00833                 } else {
00834                         const METCollection *metcol = hmetcol.product();
00835                         met = &(metcol->front());
00836                 }   
00837 
00838                 // Reconstructed MET Information
00839                 const double SumET = met->sumEt();
00840                 const double MET = met->pt();
00841                 const double MEx = met->px();
00842                 const double MEy = met->py();
00843                 const double METPhi = met->phi();
00844                 const double METSig = met->mEtSig();
00845 
00846                 me["hMEx"]->Fill(MEx);
00847                 me["hMEy"]->Fill(MEy);
00848                 me["hMET"]->Fill(MET);
00849                 me["hMETPhi"]->Fill(METPhi);
00850                 me["hSumET"]->Fill(SumET);
00851                 me["hMETSig"]->Fill(METSig);
00852                 me["hNevents"]->Fill(0.5);
00853 
00854         } else if( METType_ == "TCMET" )
00855         {
00856                 const MET *tcMet;
00857                 edm::Handle<METCollection> htcMetcol;
00858                 iEvent.getByLabel(inputMETLabel_, htcMetcol);
00859 
00860                 const CaloMET *caloMet;
00861                 edm::Handle<CaloMETCollection> hcaloMetcol;
00862                 iEvent.getByLabel(inputCaloMETLabel_, hcaloMetcol);
00863 
00864                 edm::Handle< reco::MuonCollection > muon_h;
00865                 iEvent.getByLabel(inputMuonLabel_, muon_h);
00866 
00867                 //      edm::Handle< edm::View<reco::Track> > track_h;
00868                 edm::Handle<reco::TrackCollection> track_h;
00869                 iEvent.getByLabel(inputTrackLabel_, track_h);
00870 
00871                 edm::Handle< edm::View<reco::GsfElectron > > electron_h;
00872                 iEvent.getByLabel(inputElectronLabel_, electron_h);
00873 
00874                 edm::Handle< reco::BeamSpot > beamSpot_h;
00875                 iEvent.getByLabel(inputBeamSpotLabel_, beamSpot_h);
00876 
00877                 if(!htcMetcol.isValid()){
00878                         edm::LogInfo("OutputInfo") << "falied to retrieve data require by MET Task";
00879                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00880                         return;
00881                 }
00882                 else
00883                 {
00884                         const METCollection *tcMetcol = htcMetcol.product();
00885                         tcMet = &(tcMetcol->front());
00886                 }
00887 
00888                 if(!hcaloMetcol.isValid()){
00889                         edm::LogInfo("OutputInfo") << "falied to retrieve data require by MET Task";
00890                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00891                         return;
00892                 }
00893                 else
00894                 {
00895                         const CaloMETCollection *caloMetcol = hcaloMetcol.product();
00896                         caloMet = &(caloMetcol->front());
00897                 }
00898 
00899                 if(!muon_h.isValid()){
00900                         edm::LogInfo("OutputInfo") << "falied to retrieve muon data require by MET Task";
00901                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00902                         return;
00903                 }
00904 
00905                 if(!track_h.isValid()){
00906                         edm::LogInfo("OutputInfo") << "falied to retrieve track data require by MET Task";
00907                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00908                         return;
00909                 }
00910 
00911                 if(!electron_h.isValid()){
00912                         edm::LogInfo("OutputInfo") << "falied to retrieve electron data require by MET Task";
00913                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00914                         return;
00915                 }
00916 
00917                 if(!beamSpot_h.isValid()){
00918                         edm::LogInfo("OutputInfo") << "falied to retrieve beam spot data require by MET Task";
00919                         edm::LogInfo("OutputInfo") << "MET Taks cannot continue...!";
00920                         return;
00921                 }
00922 
00923                 math::XYZPoint bspot = ( beamSpot_h.isValid() ) ? beamSpot_h->position() : math::XYZPoint(0, 0, 0);
00924 
00925                 //Event selection-----------------------------------------------------------------------
00926 
00927                 edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > tcMet_ValueMap_Handle;
00928                 iEvent.getByLabel("muonTCMETValueMapProducer" , "muCorrData", tcMet_ValueMap_Handle);
00929 
00930                 //count muons
00931                 int nM = 0;
00932 
00933                 for( unsigned int mus = 0; mus < muon_h->size() ; mus++ ) {
00934 
00935                         reco::MuonRef muref( muon_h, mus);
00936                         if( muref->pt() < 20 ) continue;
00937 
00938                         reco::MuonMETCorrectionData muCorrData = (*tcMet_ValueMap_Handle)[muref];
00939                         int type = muCorrData.type();
00940 
00941                         if( type == 1 || type == 2 || type == 5 )  ++nM;
00942                 }
00943 
00944                 //count electrons
00945                 int nE = 0;
00946 
00947                 for( edm::View<reco::GsfElectron>::const_iterator eleit = electron_h->begin(); eleit != electron_h->end(); eleit++ ) {
00948                         if( eleit->p4().pt() < 20 ) continue;  
00949                         ++nE;
00950                 }
00951 
00952                 if( strcmp( sample_.c_str() , "zmm" ) == 0 && nM != 2 ) return;
00953 
00954                 if( strcmp( sample_.c_str() , "zee" ) == 0 && nE != 2 ) return;
00955 
00956                 if( strcmp( sample_.c_str() , "ttbar" ) == 0 && ( nE + nM ) == 0 ) return;
00957 
00958                 // Reconstructed TCMET Information                                                                                                     
00959                 const double SumET = tcMet->sumEt();
00960                 const double MET = tcMet->pt();
00961                 const double MEx = tcMet->px();
00962                 const double MEy = tcMet->py();
00963                 const double METPhi = tcMet->phi();
00964                 const double METSig = tcMet->mEtSig();
00965 
00966                 me["hMEx"]->Fill(MEx);
00967                 me["hMEy"]->Fill(MEy);
00968                 me["hMET"]->Fill(MET);
00969                 me["hMETPhi"]->Fill(METPhi);
00970                 me["hSumET"]->Fill(SumET);
00971                 me["hMETSig"]->Fill(METSig);
00972                 me["hNevents"]->Fill(0.5);
00973 
00974                 const double caloMET = caloMet->pt();
00975                 const double caloMEx = caloMet->px();
00976                 const double caloMEy = caloMet->py();
00977 
00978                 me["hdMETx"]->Fill(caloMEx-MEx);
00979                 me["hdMETy"]->Fill(caloMEy-MEy);
00980                 me["hdMET"]->Fill(caloMET-MET);
00981 
00982                 const unsigned int nTracks = track_h->size();
00983                 unsigned int nCorrTracks = 0;
00984                 unsigned int trackCount = 0;
00985                 for( reco::TrackCollection::const_iterator trkit = track_h->begin(); trkit != track_h->end(); trkit++ ) {
00986                         me["htrkPt"]->Fill( trkit->pt() );
00987                         me["htrkEta"]->Fill( trkit->eta() );
00988                         me["htrkNhits"]->Fill( trkit->numberOfValidHits() );
00989                         me["htrkChi2"]->Fill( trkit->chi2() / trkit->ndof() );
00990 
00991                         double d0 = -1 * trkit->dxy( bspot );
00992 
00993                         me["htrkD0"]->Fill( d0 );
00994 
00995                         me["htrkQuality"]->Fill( trkit->qualityMask() );
00996                         me["htrkAlgo"]->Fill( trkit->algo() );
00997                         me["htrkPtErr"]->Fill( trkit->ptError() / trkit->pt() );
00998 
00999                         reco::TrackRef trkref( track_h, trackCount );
01000 
01001                         if( isGoodTrack( trkref, d0) ) ++nCorrTracks;
01002                         ++trackCount;
01003                 }
01004 
01005                 const float frac = (float)nCorrTracks / (float)nTracks;
01006                 me["hfracTrks"]->Fill(frac);
01007 
01008                 int nEls = 0;
01009                 for( edm::View<reco::GsfElectron>::const_iterator eleit = electron_h->begin(); eleit != electron_h->end(); eleit++ ) {
01010                         me["helePt"]->Fill( eleit->p4().pt() );  
01011                         me["heleEta"]->Fill( eleit->p4().eta() );
01012                         me["heleHoE"]->Fill( eleit->hadronicOverEm() );
01013 
01014                         reco::TrackRef el_track = eleit->closestCtfTrackRef();
01015 
01016                         unsigned int ele_idx = el_track.isNonnull() ? el_track.key() : 99999;
01017 
01018                         if( eleit->hadronicOverEm() < 0.1 && ele_idx < nTracks )
01019                                 ++nEls;
01020                 }
01021 
01022                 me["hnEls"]->Fill(nEls);
01023 
01024                 for( reco::MuonCollection::const_iterator muonit = muon_h->begin(); muonit != muon_h->end(); muonit++ ) {
01025 
01026                         const reco::TrackRef siTrack = muonit->innerTrack();
01027 
01028                         me["hmuPt"]->Fill( muonit->p4().pt() );
01029                         me["hmuEta"]->Fill( muonit->p4().eta() );
01030                         me["hmuNhits"]->Fill( siTrack.isNonnull() ? siTrack->numberOfValidHits() : -999 );
01031                         me["hmuChi2"]->Fill( siTrack.isNonnull() ? siTrack->chi2()/siTrack->ndof() : -999 );
01032 
01033                         double d0 = siTrack.isNonnull() ? -1 * siTrack->dxy( bspot) : -999;
01034 
01035                         me["hmuD0"]->Fill( d0 );
01036                 }
01037 
01038                 //edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > tcMet_ValueMap_Handle;
01039                 //iEvent.getByLabel("muonTCMETValueMapProducer" , "muCorrData", tcMet_ValueMap_Handle);
01040 
01041                 edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > muon_ValueMap_Handle;
01042                 iEvent.getByLabel("muonMETValueMapProducer" , "muCorrData", muon_ValueMap_Handle);
01043 
01044                 const unsigned int nMuons = muon_h->size();      
01045 
01046                 int nMus = 0;
01047                 int nMusPis = 0;
01048                 double muDx = 0;
01049                 double muDy = 0;
01050                 for( unsigned int mus = 0; mus < nMuons; mus++ ) 
01051                 {
01052                         reco::MuonRef muref( muon_h, mus);
01053                         reco::MuonMETCorrectionData muCorrData = (*tcMet_ValueMap_Handle)[muref];
01054                         reco::MuonMETCorrectionData muonCorrData = (*muon_ValueMap_Handle)[muref];
01055 
01056                         me["hMExCorrection"] -> Fill(muCorrData.corrX());
01057                         me["hMEyCorrection"] -> Fill(muCorrData.corrY());
01058 
01059                         int type = muCorrData.type();
01060                         me["hMuonCorrectionFlag"]-> Fill(type);
01061 
01062                         if( type == 1 || type == 2 || type == 5 ) {
01063                                 ++nMus;
01064 
01065                                 if( type == 1 ) {
01066                                         muDx += muonCorrData.corrX() - muref->globalTrack()->px();
01067                                         muDy += muonCorrData.corrY() - muref->globalTrack()->py();
01068                                 }
01069                                 else if( type == 2 ) {
01070                                         muDx += muonCorrData.corrX() - muref->innerTrack()->px();
01071                                         muDy += muonCorrData.corrY() - muref->innerTrack()->py();
01072                                 }
01073                                 else if( type == 5 ) {
01074                                         muDx += muonCorrData.corrX() - muref->px();
01075                                         muDy += muonCorrData.corrY() - muref->py();
01076                                 }
01077                         }
01078                         else if( type == 4 )
01079                                 ++nMusPis;
01080                 }
01081 
01082                 me["hnMus"]->Fill(nMus);
01083                 me["hnMusPis"]->Fill(nMusPis);
01084                 me["hdMUx"]->Fill(muDx);
01085                 me["hdMUy"]->Fill(muDy);
01086 
01087                 edm::Handle<GenMETCollection> genTrue;
01088                 iEvent.getByLabel("genMetTrue", genTrue);
01089                 if (genTrue.isValid()) {
01090                         const GenMETCollection *genmetcol = genTrue.product();
01091                         const GenMET *genMetTrue = &(genmetcol->front());
01092                         const double genMET = genMetTrue->pt();
01093                         const double genMETPhi = genMetTrue->phi();
01094 
01095                         me["hMETResolution_GenMETTrue"]->Fill( MET - genMET );
01096                         me["hMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
01097                 } else {
01098                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetTrue";
01099                 }    
01100 
01101 
01102                 edm::Handle<GenMETCollection> genCalo;
01103                 iEvent.getByLabel("genMetCalo", genCalo);
01104                 if (genCalo.isValid()) {
01105                         const GenMETCollection *genmetcol = genCalo.product();
01106                         const GenMET  *genMetCalo = &(genmetcol->front());
01107                         const double genMET = genMetCalo->pt();
01108                         const double genMETPhi = genMetCalo->phi();
01109 
01110                         me["hMETResolution_GenMETCalo"]->Fill( MET - genMET );
01111                         me["hMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
01112                 } else {
01113                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetCalo";
01114                 }          
01115         }
01116         else if( inputMETLabel_.label() == "corMetGlobalMuons" )
01117         {
01118                 const CaloMET *corMetGlobalMuons = 0;
01119                 edm::Handle<CaloMETCollection> hcorMetGlobalMuonscol;
01120                 iEvent.getByLabel(inputMETLabel_, hcorMetGlobalMuonscol );
01121                 if(! hcorMetGlobalMuonscol.isValid()){
01122                         edm::LogInfo("OutputInfo") << "hcorMetGlobalMuonscol is NOT Valid";
01123                         edm::LogInfo("OutputInfo") << "MET Taks continues anyway...!";
01124                 }
01125                 else
01126                 {        
01127                         const CaloMETCollection *corMetGlobalMuonscol = hcorMetGlobalMuonscol.product();
01128                         corMetGlobalMuons = &(corMetGlobalMuonscol->front());
01129                 }
01130 
01131                 // Reconstructed TCMET Information                                                                                                     
01132                 const double SumET = corMetGlobalMuons->sumEt();
01133                 const double MET = corMetGlobalMuons->pt();
01134                 const double MEx = corMetGlobalMuons->px();
01135                 const double MEy = corMetGlobalMuons->py();
01136                 const double METPhi = corMetGlobalMuons->phi();
01137                 const double METSig = corMetGlobalMuons->mEtSig();
01138                 me["hMEx"]->Fill(MEx);
01139                 me["hMEy"]->Fill(MEy);
01140                 me["hMET"]->Fill(MET);
01141                 me["hMETPhi"]->Fill(METPhi);
01142                 me["hSumET"]->Fill(SumET);
01143                 me["hMETSig"]->Fill(METSig);
01144                 me["hNevents"]->Fill(0.5);
01145 
01146                 edm::Handle< edm::ValueMap<reco::MuonMETCorrectionData> > corMetGlobalMuons_ValueMap_Handle;
01147                 iEvent.getByLabel("muonMETValueMapProducer" , "muCorrData", corMetGlobalMuons_ValueMap_Handle);
01148 
01149                 edm::Handle< reco::MuonCollection > muon_Handle;
01150                 iEvent.getByLabel("muons", muon_Handle);
01151 
01152                 edm::Handle< reco::BeamSpot > beamSpot_h;
01153                 iEvent.getByLabel(inputBeamSpotLabel_, beamSpot_h);
01154 
01155                 if(!beamSpot_h.isValid()){
01156                         edm::LogInfo("OutputInfo") << "beamSpot is NOT Valid";
01157                         edm::LogInfo("OutputInfo") << "MET Taks continues anyway...!";
01158                 }
01159 
01160                 math::XYZPoint bspot = ( beamSpot_h.isValid() ) ? beamSpot_h->position() : math::XYZPoint(0, 0, 0);
01161 
01162                 for( reco::MuonCollection::const_iterator muonit = muon_Handle->begin(); muonit != muon_Handle->end(); muonit++ ) {
01163 
01164                         const reco::TrackRef siTrack = muonit->innerTrack();
01165                         const reco::TrackRef globalTrack = muonit->globalTrack();
01166 
01167                         me["hmuPt"]->Fill( muonit->p4().pt() );
01168                         me["hmuEta"]->Fill( muonit->p4().eta() );
01169                         me["hmuNhits"]->Fill( siTrack.isNonnull() ? siTrack->numberOfValidHits() : -999 );
01170                         me["hmuChi2"]->Fill( siTrack.isNonnull() ? siTrack->chi2()/siTrack->ndof() : -999 );
01171 
01172                         double d0 = siTrack.isNonnull() ? -1 * siTrack->dxy( bspot) : -999;
01173 
01174                         me["hmuD0"]->Fill( d0 );
01175 
01176                         int nHits = globalTrack.isNonnull() ? globalTrack->hitPattern().numberOfValidMuonHits() : -999;
01177 
01178                         me["hmuSAhits"]->Fill( nHits );
01179                 }
01180 
01181                 const unsigned int nMuons = muon_Handle->size();      
01182                 for( unsigned int mus = 0; mus < nMuons; mus++ ) 
01183                 {
01184                         reco::MuonRef muref( muon_Handle, mus);
01185                         reco::MuonMETCorrectionData muCorrData = (*corMetGlobalMuons_ValueMap_Handle)[muref];
01186 
01187                         me["hMExCorrection"] -> Fill(muCorrData.corrY());
01188                         me["hMEyCorrection"] -> Fill(muCorrData.corrX());
01189                         me["hMuonCorrectionFlag"]-> Fill(muCorrData.type());
01190                 }
01191 
01192                 edm::Handle<GenMETCollection> genTrue;
01193                 iEvent.getByLabel("genMetTrue", genTrue);
01194                 if (genTrue.isValid()) {
01195                         const GenMETCollection *genmetcol = genTrue.product();
01196                         const GenMET *genMetTrue = &(genmetcol->front());
01197                         const double genMET = genMetTrue->pt();
01198                         const double genMETPhi = genMetTrue->phi();
01199 
01200                         me["hMETResolution_GenMETTrue"]->Fill( MET - genMET );
01201                         me["hMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
01202                 } else {
01203                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetTrue";
01204                 }    
01205 
01206 
01207                 edm::Handle<GenMETCollection> genCalo;
01208                 iEvent.getByLabel("genMetCalo", genCalo);
01209                 if (genCalo.isValid()) {
01210                         const GenMETCollection *genmetcol = genCalo.product();
01211                         const GenMET  *genMetCalo = &(genmetcol->front());
01212                         const double genMET = genMetCalo->pt();
01213                         const double genMETPhi = genMetCalo->phi();
01214 
01215                         me["hMETResolution_GenMETCalo"]->Fill( MET - genMET );
01216                         me["hMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
01217                 } else {
01218                         edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetCalo";
01219                 }    
01220 
01221         }
01222 
01223 }
01224 
01225 void METTester::endJob() 
01226 { 
01227 }
01228 
01229 //void METTester::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
01230 void METTester::FillpfMETRes()
01231 {
01232         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(1, me["hMETResolution_GenMETTrue_MET0to20"]->getMean());
01233         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(2, me["hMETResolution_GenMETTrue_MET20to40"]->getMean());
01234         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(3, me["hMETResolution_GenMETTrue_MET40to60"]->getMean());
01235         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(4, me["hMETResolution_GenMETTrue_MET60to80"]->getMean());
01236         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(5, me["hMETResolution_GenMETTrue_MET80to100"]->getMean());
01237         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(6, me["hMETResolution_GenMETTrue_MET100to150"]->getMean());
01238         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(7, me["hMETResolution_GenMETTrue_MET150to200"]->getMean());
01239         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(8, me["hMETResolution_GenMETTrue_MET200to300"]->getMean());
01240         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(9, me["hMETResolution_GenMETTrue_MET300to400"]->getMean());
01241         me["hMETResolution_GenMETTrue_METResolution"]->setBinContent(10, me["hMETResolution_GenMETTrue_MET400to500"]->getMean());
01242         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(1, me["hMETResolution_GenMETTrue_MET0to20"]->getRMS());
01243         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(2, me["hMETResolution_GenMETTrue_MET20to40"]->getRMS());
01244         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(3, me["hMETResolution_GenMETTrue_MET40to60"]->getRMS());
01245         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(4, me["hMETResolution_GenMETTrue_MET60to80"]->getRMS());
01246         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(5, me["hMETResolution_GenMETTrue_MET80to100"]->getRMS());
01247         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(6, me["hMETResolution_GenMETTrue_MET100to150"]->getRMS());
01248         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(7, me["hMETResolution_GenMETTrue_MET150to200"]->getRMS());
01249         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(8, me["hMETResolution_GenMETTrue_MET200to300"]->getRMS());
01250         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(9, me["hMETResolution_GenMETTrue_MET300to400"]->getRMS());
01251         me["hMETResolution_GenMETTrue_METResolution"]->setBinError(10, me["hMETResolution_GenMETTrue_MET400to500"]->getRMS());
01252 
01253 }
01254 
01255 //determines if track is "good" - i.e. passes quality and kinematic cuts
01256 bool METTester::isGoodTrack( const reco::TrackRef track, float d0corr ) {
01257 
01258                 if( fabs( d0corr ) > maxd0_ ) return false;
01259                 if( track->numberOfValidHits() < minhits_ ) return false;
01260                 if( track->normalizedChi2() > maxchi2_ ) return false;
01261                 if( fabs( track->eta() ) > maxeta_ ) return false;
01262                 if( track->pt() > maxpt_ ) return false;
01263                 if( (track->ptError() / track->pt()) > maxPtErr_ ) return false;
01264 
01265                 int cut = 0;
01266                 for( unsigned int i = 0; i < trkQuality_.size(); i++ ) {
01267 
01268                         cut |= (1 << trkQuality_.at(i));
01269                 }
01270 
01271                 if( !( ( track->qualityMask() & cut ) == cut ) ) return false;
01272 
01273                 bool isGoodAlgo = false;
01274                 if( trkAlgos_.size() == 0 ) isGoodAlgo = true;
01275                 for( unsigned int i = 0; i < trkAlgos_.size(); i++ ) {
01276 
01277                         if( track->algo() == trkAlgos_.at(i) ) isGoodAlgo = true;
01278                 }
01279 
01280                 if( !isGoodAlgo ) return false;
01281 
01282                 return true;
01283 }