CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DQMOffline/JetMET/src/PFJetAnalyzer.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2011/08/12 15:37:16 $
00005  *  $Revision: 1.20 $
00006  *  \author F. Chlebana - Fermilab
00007  */
00008 
00009 #include "DQMOffline/JetMET/interface/PFJetAnalyzer.h"
00010 #include "DataFormats/Common/interface/Handle.h"
00011 
00012 #include "DataFormats/JetReco/interface/PFJet.h"
00013 
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 
00016 #include <string>
00017 using namespace edm;
00018 
00019 
00020 PFJetAnalyzer::PFJetAnalyzer(const edm::ParameterSet& pSet) {
00021 
00022   parameters = pSet;
00023   _leadJetFlag = 0;
00024   _JetLoPass   = 0;
00025   _JetHiPass   = 0;
00026   _ptThreshold = 5.;
00027   _asymmetryThirdJetCut = 30.;
00028   _balanceThirdJetCut   = 0.2;
00029   _LooseCHFMin = -999.;
00030   _LooseNHFMax = -999.;
00031   _LooseCEFMax = -999.;
00032   _LooseNEFMax = -999.;
00033   _TightCHFMin = -999.;
00034   _TightNHFMax = -999.;
00035   _TightCEFMax = -999.;
00036   _TightNEFMax = -999.;
00037   _ThisCHFMin = -999.;
00038   _ThisNHFMax = -999.;
00039   _ThisCEFMax = -999.;
00040   _ThisNEFMax = -999.;
00041 
00042 }
00043 
00044 
00045 PFJetAnalyzer::~PFJetAnalyzer() { }
00046 
00047 
00048 void PFJetAnalyzer::beginJob(DQMStore * dbe) {
00049 
00050   metname = "pFJetAnalyzer";
00051 
00052   LogTrace(metname)<<"[PFJetAnalyzer] Parameters initialization";
00053   //dbe->setCurrentFolder("JetMET/Jet/PFJets");//old version, now name set to source, which 
00054   //can be set for each instance of PFJetAnalyzer called inside JetMETAnalyzer. Useful, e.g., to 
00055   //name differently the dir for all jets and cleaned jets 
00056   dbe->setCurrentFolder("JetMET/Jet/"+_source);
00057   // dbe->setCurrentFolder("JetMET/Jet/PFJets");
00058                         
00059   jetME = dbe->book1D("jetReco", "jetReco", 3, 1, 4);
00060   jetME->setBinLabel(2,"PFJets",1);
00061 
00062   // monitoring of eta parameter
00063   etaBin = parameters.getParameter<int>("etaBin");
00064   etaMin = parameters.getParameter<double>("etaMin");
00065   etaMax = parameters.getParameter<double>("etaMax");
00066 
00067   // monitoring of phi paramater
00068   phiBin = parameters.getParameter<int>("phiBin");
00069   phiMin = parameters.getParameter<double>("phiMin");
00070   phiMax = parameters.getParameter<double>("phiMax");
00071 
00072   // monitoring of the transverse momentum
00073   ptBin = parameters.getParameter<int>("ptBin");
00074   ptMin = parameters.getParameter<double>("ptMin");
00075   ptMax = parameters.getParameter<double>("ptMax");
00076 
00077   // 
00078   eBin = parameters.getParameter<int>("eBin");
00079   eMin = parameters.getParameter<double>("eMin");
00080   eMax = parameters.getParameter<double>("eMax");
00081 
00082   // 
00083   pBin = parameters.getParameter<int>("pBin");
00084   pMin = parameters.getParameter<double>("pMin");
00085   pMax = parameters.getParameter<double>("pMax");
00086 
00087   _ptThreshold = parameters.getParameter<double>("ptThreshold");
00088   _asymmetryThirdJetCut = parameters.getParameter<double>("asymmetryThirdJetCut");
00089   _balanceThirdJetCut   = parameters.getParameter<double>("balanceThirdJetCut");
00090 
00091   _TightCHFMin = parameters.getParameter<double>("TightCHFMin");
00092   _TightNHFMax = parameters.getParameter<double>("TightNHFMax");
00093   _TightCEFMax = parameters.getParameter<double>("TightCEFMax");
00094   _TightNEFMax = parameters.getParameter<double>("TightNEFMax");
00095   _LooseCHFMin = parameters.getParameter<double>("LooseCHFMin");
00096   _LooseNHFMax = parameters.getParameter<double>("LooseNHFMax");
00097   _LooseCEFMax = parameters.getParameter<double>("LooseCEFMax");
00098   _LooseNEFMax = parameters.getParameter<double>("LooseNEFMax");
00099 
00100   fillpfJIDPassFrac  = parameters.getParameter<int>("fillpfJIDPassFrac");
00101   makedijetselection = parameters.getParameter<int>("makedijetselection");
00102 
00103   _ThisCHFMin = parameters.getParameter<double>("ThisCHFMin");
00104   _ThisNHFMax = parameters.getParameter<double>("ThisNHFMax");
00105   _ThisCEFMax = parameters.getParameter<double>("ThisCEFMax");
00106   _ThisNEFMax = parameters.getParameter<double>("ThisNEFMax");
00107 
00108   // Generic Jet Parameters
00109   mPt                      = dbe->book1D("Pt",  "Pt", ptBin, ptMin, ptMax);
00110   mEta                     = dbe->book1D("Eta", "Eta", etaBin, etaMin, etaMax);
00111   mPhi                     = dbe->book1D("Phi", "Phi", phiBin, phiMin, phiMax);
00112   mConstituents            = dbe->book1D("Constituents", "# of Constituents", 50, 0, 100);
00113   mHFrac                   = dbe->book1D("HFrac", "HFrac", 120, -0.1, 1.1);
00114   mEFrac                   = dbe->book1D("EFrac", "EFrac", 120, -0.1, 1.1);
00115   //
00116   //mE                       = dbe->book1D("E", "E", eBin, eMin, eMax);
00117   //mP                       = dbe->book1D("P", "P", pBin, pMin, pMax);
00118   //mMass                    = dbe->book1D("Mass", "Mass", 100, 0, 25);
00119   //
00120   mPhiVSEta                = dbe->book2D("PhiVSEta", "PhiVSEta", 50, etaMin, etaMax, 24, phiMin, phiMax);
00121   
00122   if(makedijetselection!=1) {
00123     mPt_1                    = dbe->book1D("Pt1", "Pt1", 50, 0, 100);
00124     mPt_2                    = dbe->book1D("Pt2", "Pt2", 60, 0, 300);  
00125     mPt_3                    = dbe->book1D("Pt3", "Pt3", 100, 0, 5000);
00126     
00127     // Low and high pt trigger paths
00128     mPt_Lo                  = dbe->book1D("Pt_Lo", "Pt (Pass Low Pt Jet Trigger)", 20, 0, 100);
00129     //mEta_Lo                 = dbe->book1D("Eta_Lo", "Eta (Pass Low Pt Jet Trigger)", etaBin, etaMin, etaMax);
00130     mPhi_Lo                 = dbe->book1D("Phi_Lo", "Phi (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
00131     
00132     mPt_Hi                  = dbe->book1D("Pt_Hi", "Pt (Pass Hi Pt Jet Trigger)", 100, 0, 300);
00133     mEta_Hi                 = dbe->book1D("Eta_Hi", "Eta (Pass Hi Pt Jet Trigger)", etaBin, etaMin, etaMax);
00134     mPhi_Hi                 = dbe->book1D("Phi_Hi", "Phi (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
00135     
00136     mNJets                   = dbe->book1D("NJets", "Number of Jets", 100, 0, 100);
00137     
00138     mCHFracVSeta_lowPt= dbe->bookProfile("CHFracVSeta_lowPt","CHFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
00139     mNHFracVSeta_lowPt= dbe->bookProfile("NHFracVSeta_lowPt","NHFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
00140     mPhFracVSeta_lowPt= dbe->bookProfile("PhFracVSeta_lowPt","PhFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
00141     mElFracVSeta_lowPt= dbe->bookProfile("ElFracVSeta_lowPt","ElFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
00142     mMuFracVSeta_lowPt= dbe->bookProfile("MuFracVSeta_lowPt","MuFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
00143     mCHFracVSeta_mediumPt= dbe->bookProfile("CHFracVSeta_mediumPt","CHFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
00144     mNHFracVSeta_mediumPt= dbe->bookProfile("NHFracVSeta_mediumPt","NHFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
00145     mPhFracVSeta_mediumPt= dbe->bookProfile("PhFracVSeta_mediumPt","PhFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
00146     mElFracVSeta_mediumPt= dbe->bookProfile("ElFracVSeta_mediumPt","ElFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
00147     mMuFracVSeta_mediumPt= dbe->bookProfile("MuFracVSeta_mediumPt","MuFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
00148     mCHFracVSeta_highPt= dbe->bookProfile("CHFracVSeta_highPt","CHFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
00149     mNHFracVSeta_highPt= dbe->bookProfile("NHFracVSeta_highPt","NHFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
00150     mPhFracVSeta_highPt= dbe->bookProfile("PhFracVSeta_highPt","PhFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
00151     mElFracVSeta_highPt= dbe->bookProfile("ElFracVSeta_highPt","ElFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
00152     mMuFracVSeta_highPt= dbe->bookProfile("MuFracVSeta_highPt","MuFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
00153     
00154     //mPt_Barrel_Lo            = dbe->book1D("Pt_Barrel_Lo", "Pt Barrel (Pass Low Pt Jet Trigger)", 20, 0, 100);
00155     //mPhi_Barrel_Lo           = dbe->book1D("Phi_Barrel_Lo", "Phi Barrel (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
00156     mConstituents_Barrel     = dbe->book1D("Constituents_Barrel", "Constituents Barrel", 50, 0, 100);
00157     mHFrac_Barrel            = dbe->book1D("HFrac_Barrel", "HFrac Barrel", 100, 0, 1);
00158     mEFrac_Barrel            = dbe->book1D("EFrac_Barrel", "EFrac Barrel", 110, -0.05, 1.05);
00159     
00160     //mPt_EndCap_Lo            = dbe->book1D("Pt_EndCap_Lo", "Pt EndCap (Pass Low Pt Jet Trigger)", 20, 0, 100);
00161     //mPhi_EndCap_Lo           = dbe->book1D("Phi_EndCap_Lo", "Phi EndCap (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
00162     mConstituents_EndCap     = dbe->book1D("Constituents_EndCap", "Constituents EndCap", 50, 0, 100);
00163     mHFrac_EndCap            = dbe->book1D("HFrac_Endcap", "HFrac EndCap", 100, 0, 1);
00164     mEFrac_EndCap            = dbe->book1D("EFrac_Endcap", "EFrac EndCap", 110, -0.05, 1.05);
00165     
00166     //mPt_Forward_Lo           = dbe->book1D("Pt_Forward_Lo", "Pt Forward (Pass Low Pt Jet Trigger)", 20, 0, 100);
00167     //mPhi_Forward_Lo          = dbe->book1D("Phi_Forward_Lo", "Phi Forward (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
00168     mConstituents_Forward    = dbe->book1D("Constituents_Forward", "Constituents Forward", 50, 0, 100);
00169     mHFrac_Forward           = dbe->book1D("HFrac_Forward", "HFrac Forward", 100, 0, 1);
00170     mEFrac_Forward           = dbe->book1D("EFrac_Forward", "EFrac Forward", 110, -0.05, 1.05);
00171     
00172     mPt_Barrel_Hi            = dbe->book1D("Pt_Barrel_Hi", "Pt Barrel (Pass Hi Pt Jet Trigger)", 60, 0, 300);
00173     mPhi_Barrel_Hi           = dbe->book1D("Phi_Barrel_Hi", "Phi Barrel (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
00174     //mConstituents_Barrel_Hi  = dbe->book1D("Constituents_Barrel_Hi", "Constituents Barrel (Pass Hi Pt Jet Trigger)", 50, 0, 100);
00175     //mHFrac_Barrel_Hi         = dbe->book1D("HFrac_Barrel_Hi", "HFrac Barrel (Pass Hi Pt Jet Trigger)", 100, 0, 1);
00176     
00177     mPt_EndCap_Hi            = dbe->book1D("Pt_EndCap_Hi", "Pt EndCap (Pass Hi Pt Jet Trigger)", 60, 0, 300);
00178     mPhi_EndCap_Hi           = dbe->book1D("Phi_EndCap_Hi", "Phi EndCap (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
00179     //mConstituents_EndCap_Hi  = dbe->book1D("Constituents_EndCap_Hi", "Constituents EndCap (Pass Hi Pt Jet Trigger)", 50, 0, 100);
00180     //mHFrac_EndCap_Hi         = dbe->book1D("HFrac_EndCap_Hi", "HFrac EndCap (Pass Hi Pt Jet Trigger)", 100, 0, 1);
00181 
00182     mPt_Forward_Hi           = dbe->book1D("Pt_Forward_Hi", "Pt Forward (Pass Hi Pt Jet Trigger)", 60, 0, 300);
00183     mPhi_Forward_Hi          = dbe->book1D("Phi_Forward_Hi", "Phi Forward (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
00184     //mConstituents_Forward_Hi = dbe->book1D("Constituents_Forward_Hi", "Constituents Forward (Pass Hi Pt Jet Trigger)", 50, 0, 100);
00185     //mHFrac_Forward_Hi        = dbe->book1D("HFrac_Forward_Hi", "HFrac Forward (Pass Hi Pt Jet Trigger)", 100, 0, 1);
00186 
00187     mPhi_Barrel              = dbe->book1D("Phi_Barrel", "Phi_Barrel", phiBin, phiMin, phiMax);
00188     //mE_Barrel                = dbe->book1D("E_Barrel", "E_Barrel", eBin, eMin, eMax);
00189     mPt_Barrel               = dbe->book1D("Pt_Barrel", "Pt_Barrel", ptBin, ptMin, ptMax);
00190     // energy fractions
00191     mCHFrac_lowPt_Barrel     = dbe->book1D("CHFrac_lowPt_Barrel", "CHFrac_lowPt_Barrel", 120, -0.1, 1.1);
00192     mNHFrac_lowPt_Barrel     = dbe->book1D("NHFrac_lowPt_Barrel", "NHFrac_lowPt_Barrel", 120, -0.1, 1.1);
00193     mPhFrac_lowPt_Barrel     = dbe->book1D("PhFrac_lowPt_Barrel", "PhFrac_lowPt_Barrel", 120, -0.1, 1.1);
00194     mElFrac_lowPt_Barrel     = dbe->book1D("ElFrac_lowPt_Barrel", "ElFrac_lowPt_Barrel", 120, -0.1, 1.1);
00195     mMuFrac_lowPt_Barrel     = dbe->book1D("MuFrac_lowPt_Barrel", "MuFrac_lowPt_Barrel", 120, -0.1, 1.1);
00196     mCHFrac_mediumPt_Barrel  = dbe->book1D("CHFrac_mediumPt_Barrel", "CHFrac_mediumPt_Barrel", 120, -0.1, 1.1);
00197     mNHFrac_mediumPt_Barrel  = dbe->book1D("NHFrac_mediumPt_Barrel", "NHFrac_mediumPt_Barrel", 120, -0.1, 1.1);
00198     mPhFrac_mediumPt_Barrel  = dbe->book1D("PhFrac_mediumPt_Barrel", "PhFrac_mediumPt_Barrel", 120, -0.1, 1.1);
00199     mElFrac_mediumPt_Barrel  = dbe->book1D("ElFrac_mediumPt_Barrel", "ElFrac_mediumPt_Barrel", 120, -0.1, 1.1);
00200     mMuFrac_mediumPt_Barrel  = dbe->book1D("MuFrac_mediumPt_Barrel", "MuFrac_mediumPt_Barrel", 120, -0.1, 1.1);
00201     mCHFrac_highPt_Barrel    = dbe->book1D("CHFrac_highPt_Barrel", "CHFrac_highPt_Barrel", 120, -0.1, 1.1);
00202     mNHFrac_highPt_Barrel    = dbe->book1D("NHFrac_highPt_Barrel", "NHFrac_highPt_Barrel", 120, -0.1, 1.1);
00203     mPhFrac_highPt_Barrel    = dbe->book1D("PhFrac_highPt_Barrel", "PhFrac_highPt_Barrel", 120, -0.1, 1.1);
00204     mElFrac_highPt_Barrel    = dbe->book1D("ElFrac_highPt_Barrel", "ElFrac_highPt_Barrel", 120, -0.1, 1.1);
00205     mMuFrac_highPt_Barrel    = dbe->book1D("MuFrac_highPt_Barrel", "MuFrac_highPt_Barrel", 120, -0.1, 1.1);
00206     //energies
00207     mCHEn_lowPt_Barrel     = dbe->book1D("CHEn_lowPt_Barrel", "CHEn_lowPt_Barrel", ptBin, ptMin, ptMax);
00208     mNHEn_lowPt_Barrel     = dbe->book1D("NHEn_lowPt_Barrel", "NHEn_lowPt_Barrel", ptBin, ptMin, ptMax);
00209     mPhEn_lowPt_Barrel     = dbe->book1D("PhEn_lowPt_Barrel", "PhEn_lowPt_Barrel", ptBin, ptMin, ptMax);
00210     mElEn_lowPt_Barrel     = dbe->book1D("ElEn_lowPt_Barrel", "ElEn_lowPt_Barrel", ptBin, ptMin, ptMax);
00211     mMuEn_lowPt_Barrel     = dbe->book1D("MuEn_lowPt_Barrel", "MuEn_lowPt_Barrel", ptBin, ptMin, ptMax);
00212     mCHEn_mediumPt_Barrel  = dbe->book1D("CHEn_mediumPt_Barrel", "CHEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
00213     mNHEn_mediumPt_Barrel  = dbe->book1D("NHEn_mediumPt_Barrel", "NHEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
00214     mPhEn_mediumPt_Barrel  = dbe->book1D("PhEn_mediumPt_Barrel", "PhEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
00215     mElEn_mediumPt_Barrel  = dbe->book1D("ElEn_mediumPt_Barrel", "ElEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
00216     mMuEn_mediumPt_Barrel  = dbe->book1D("MuEn_mediumPt_Barrel", "MuEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
00217     mCHEn_highPt_Barrel    = dbe->book1D("CHEn_highPt_Barrel", "CHEn_highPt_Barrel", ptBin, ptMin, ptMax);
00218     mNHEn_highPt_Barrel    = dbe->book1D("NHEn_highPt_Barrel", "NHEn_highPt_Barrel", ptBin, ptMin, ptMax);
00219     mPhEn_highPt_Barrel    = dbe->book1D("PhEn_highPt_Barrel", "PhEn_highPt_Barrel", ptBin, ptMin, ptMax);
00220     mElEn_highPt_Barrel    = dbe->book1D("ElEn_highPt_Barrel", "ElEn_highPt_Barrel", ptBin, ptMin, ptMax);
00221     mMuEn_highPt_Barrel    = dbe->book1D("MuEn_highPt_Barrel", "MuEn_highPt_Barrel", ptBin, ptMin, ptMax);
00222     //multiplicities
00223     mChMultiplicity_lowPt_Barrel    = dbe->book1D("ChMultiplicity_lowPt_Barrel", "ChMultiplicity_lowPt_Barrel", 30,0,30);
00224     mNeuMultiplicity_lowPt_Barrel   = dbe->book1D("NeuMultiplicity_lowPt_Barrel", "NeuMultiplicity_lowPt_Barrel", 30,0,30);
00225     mMuMultiplicity_lowPt_Barrel    = dbe->book1D("MuMultiplicity_lowPt_Barrel", "MuMultiplicity_lowPt_Barrel", 30,0,30);
00226     mChMultiplicity_mediumPt_Barrel    = dbe->book1D("ChMultiplicity_mediumPt_Barrel", "ChMultiplicity_mediumPt_Barrel", 30,0,30);
00227     mNeuMultiplicity_mediumPt_Barrel   = dbe->book1D("NeuMultiplicity_mediumPt_Barrel", "NeuMultiplicity_mediumPt_Barrel", 30,0,30);
00228     mMuMultiplicity_mediumPt_Barrel    = dbe->book1D("MuMultiplicity_mediumPt_Barrel", "MuMultiplicity_mediumPt_Barrel", 30,0,30);
00229     mChMultiplicity_highPt_Barrel    = dbe->book1D("ChMultiplicity_highPt_Barrel", "ChMultiplicity_highPt_Barrel", 30,0,30);
00230     mNeuMultiplicity_highPt_Barrel   = dbe->book1D("NeuMultiplicity_highPt_Barrel", "NeuMultiplicity_highPt_Barrel", 30,0,30);
00231     mMuMultiplicity_highPt_Barrel    = dbe->book1D("MuMultiplicity_highPt_Barrel", "MuMultiplicity_highPt_Barrel", 30,0,30);
00232     //
00233     mCHFracVSpT_Barrel= dbe->bookProfile("CHFracVSpT_Barrel","CHFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
00234     mNHFracVSpT_Barrel= dbe->bookProfile("NHFracVSpT_Barrel","NHFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
00235     mPhFracVSpT_Barrel= dbe->bookProfile("PhFracVSpT_Barrel","PhFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
00236     mElFracVSpT_Barrel= dbe->bookProfile("ElFracVSpT_Barrel","ElFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
00237     mMuFracVSpT_Barrel= dbe->bookProfile("MuFracVSpT_Barrel","MuFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
00238     mCHFracVSpT_EndCap= dbe->bookProfile("CHFracVSpT_EndCap","CHFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
00239     mNHFracVSpT_EndCap= dbe->bookProfile("NHFracVSpT_EndCap","NHFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
00240     mPhFracVSpT_EndCap= dbe->bookProfile("PhFracVSpT_EndCap","PhFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
00241     mElFracVSpT_EndCap= dbe->bookProfile("ElFracVSpT_EndCap","ElFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
00242     mMuFracVSpT_EndCap= dbe->bookProfile("MuFracVSpT_EndCap","MuFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
00243     mHFHFracVSpT_Forward= dbe->bookProfile("HFHFracVSpT_Forward","HFHFracVSpT_Forward",ptBin, ptMin, ptMax,0.,1.2);
00244     mHFEFracVSpT_Forward= dbe->bookProfile("HFEFracVSpT_Forward","HFEFracVSpT_Forward",ptBin, ptMin, ptMax,0.,1.2);
00245 
00246     mPhi_EndCap              = dbe->book1D("Phi_EndCap", "Phi_EndCap", phiBin, phiMin, phiMax);
00247     //mE_EndCap                = dbe->book1D("E_EndCap", "E_EndCap", eBin, eMin, eMax);
00248     mPt_EndCap               = dbe->book1D("Pt_EndCap", "Pt_EndCap", ptBin, ptMin, ptMax);
00249     //energy fractions
00250     mCHFrac_lowPt_EndCap     = dbe->book1D("CHFrac_lowPt_EndCap", "CHFrac_lowPt_EndCap", 120, -0.1, 1.1);
00251     mNHFrac_lowPt_EndCap     = dbe->book1D("NHFrac_lowPt_EndCap", "NHFrac_lowPt_EndCap", 120, -0.1, 1.1);
00252     mPhFrac_lowPt_EndCap     = dbe->book1D("PhFrac_lowPt_EndCap", "PhFrac_lowPt_EndCap", 120, -0.1, 1.1);
00253     mElFrac_lowPt_EndCap     = dbe->book1D("ElFrac_lowPt_EndCap", "ElFrac_lowPt_EndCap", 120, -0.1, 1.1);
00254     mMuFrac_lowPt_EndCap     = dbe->book1D("MuFrac_lowPt_EndCap", "MuFrac_lowPt_EndCap", 120, -0.1, 1.1);
00255     mCHFrac_mediumPt_EndCap  = dbe->book1D("CHFrac_mediumPt_EndCap", "CHFrac_mediumPt_EndCap", 120, -0.1, 1.1);
00256     mNHFrac_mediumPt_EndCap  = dbe->book1D("NHFrac_mediumPt_EndCap", "NHFrac_mediumPt_EndCap", 120, -0.1, 1.1);
00257     mPhFrac_mediumPt_EndCap  = dbe->book1D("PhFrac_mediumPt_EndCap", "PhFrac_mediumPt_EndCap", 120, -0.1, 1.1);
00258     mElFrac_mediumPt_EndCap  = dbe->book1D("ElFrac_mediumPt_EndCap", "ElFrac_mediumPt_EndCap", 120, -0.1, 1.1);
00259     mMuFrac_mediumPt_EndCap  = dbe->book1D("MuFrac_mediumPt_EndCap", "MuFrac_mediumPt_EndCap", 120, -0.1, 1.1);
00260     mCHFrac_highPt_EndCap    = dbe->book1D("CHFrac_highPt_EndCap", "CHFrac_highPt_EndCap", 120, -0.1, 1.1);
00261     mNHFrac_highPt_EndCap    = dbe->book1D("NHFrac_highPt_EndCap", "NHFrac_highPt_EndCap", 120, -0.1, 1.1);
00262     mPhFrac_highPt_EndCap    = dbe->book1D("PhFrac_highPt_EndCap", "PhFrac_highPt_EndCap", 120, -0.1, 1.1);
00263     mElFrac_highPt_EndCap    = dbe->book1D("ElFrac_highPt_EndCap", "ElFrac_highPt_EndCap", 120, -0.1, 1.1);
00264     mMuFrac_highPt_EndCap    = dbe->book1D("MuFrac_highPt_EndCap", "MuFrac_highPt_EndCap", 120, -0.1, 1.1);
00265     //energies
00266     mCHEn_lowPt_EndCap     = dbe->book1D("CHEn_lowPt_EndCap", "CHEn_lowPt_EndCap", ptBin, ptMin, ptMax);
00267     mNHEn_lowPt_EndCap     = dbe->book1D("NHEn_lowPt_EndCap", "NHEn_lowPt_EndCap", ptBin, ptMin, ptMax);
00268     mPhEn_lowPt_EndCap     = dbe->book1D("PhEn_lowPt_EndCap", "PhEn_lowPt_EndCap", ptBin, ptMin, ptMax);
00269     mElEn_lowPt_EndCap     = dbe->book1D("ElEn_lowPt_EndCap", "ElEn_lowPt_EndCap", ptBin, ptMin, ptMax);
00270     mMuEn_lowPt_EndCap     = dbe->book1D("MuEn_lowPt_EndCap", "MuEn_lowPt_EndCap", ptBin, ptMin, ptMax);
00271     mCHEn_mediumPt_EndCap  = dbe->book1D("CHEn_mediumPt_EndCap", "CHEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
00272     mNHEn_mediumPt_EndCap  = dbe->book1D("NHEn_mediumPt_EndCap", "NHEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
00273     mPhEn_mediumPt_EndCap  = dbe->book1D("PhEn_mediumPt_EndCap", "PhEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
00274     mElEn_mediumPt_EndCap  = dbe->book1D("ElEn_mediumPt_EndCap", "ElEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
00275     mMuEn_mediumPt_EndCap  = dbe->book1D("MuEn_mediumPt_EndCap", "MuEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
00276     mCHEn_highPt_EndCap    = dbe->book1D("CHEn_highPt_EndCap", "CHEn_highPt_EndCap", ptBin, ptMin, ptMax);
00277     mNHEn_highPt_EndCap    = dbe->book1D("NHEn_highPt_EndCap", "NHEn_highPt_EndCap", ptBin, ptMin, ptMax);
00278     mPhEn_highPt_EndCap    = dbe->book1D("PhEn_highPt_EndCap", "PhEn_highPt_EndCap", ptBin, ptMin, ptMax);
00279     mElEn_highPt_EndCap    = dbe->book1D("ElEn_highPt_EndCap", "ElEn_highPt_EndCap", ptBin, ptMin, ptMax);
00280     mMuEn_highPt_EndCap    = dbe->book1D("MuEn_highPt_EndCap", "MuEn_highPt_EndCap", ptBin, ptMin, ptMax);
00281     //multiplicities
00282     mChMultiplicity_lowPt_EndCap    = dbe->book1D("ChMultiplicity_lowPt_EndCap", "ChMultiplicity_lowPt_EndCap", 30,0,30);
00283     mNeuMultiplicity_lowPt_EndCap   = dbe->book1D("NeuMultiplicity_lowPt_EndCap", "NeuMultiplicity_lowPt_EndCap", 30,0,30);
00284     mMuMultiplicity_lowPt_EndCap    = dbe->book1D("MuMultiplicity_lowPt_EndCap", "MuMultiplicity_lowPt_EndCap", 30,0,30);
00285     mChMultiplicity_mediumPt_EndCap    = dbe->book1D("ChMultiplicity_mediumPt_EndCap", "ChMultiplicity_mediumPt_EndCap", 30,0,30);
00286     mNeuMultiplicity_mediumPt_EndCap   = dbe->book1D("NeuMultiplicity_mediumPt_EndCap", "NeuMultiplicity_mediumPt_EndCap", 30,0,30);
00287     mMuMultiplicity_mediumPt_EndCap    = dbe->book1D("MuMultiplicity_mediumPt_EndCap", "MuMultiplicity_mediumPt_EndCap", 30,0,30);
00288     mChMultiplicity_highPt_EndCap    = dbe->book1D("ChMultiplicity_highPt_EndCap", "ChMultiplicity_highPt_EndCap", 30,0,30);
00289     mNeuMultiplicity_highPt_EndCap   = dbe->book1D("NeuMultiplicity_highPt_EndCap", "NeuMultiplicity_highPt_EndCap", 30,0,30);
00290     mMuMultiplicity_highPt_EndCap    = dbe->book1D("MuMultiplicity_highPt_EndCap", "MuMultiplicity_highPt_EndCap", 30,0,30);
00291 
00292     mPhi_Forward             = dbe->book1D("Phi_Forward", "Phi_Forward", phiBin, phiMin, phiMax);
00293     //mE_Forward               = dbe->book1D("E_Forward", "E_Forward", eBin, eMin, eMax);
00294     mPt_Forward              = dbe->book1D("Pt_Forward", "Pt_Forward", ptBin, ptMin, ptMax);
00295     //energy fraction
00296     mHFEFrac_lowPt_Forward    = dbe->book1D("HFEFrac_lowPt_Forward", "HFEFrac_lowPt_Forward", 120, -0.1, 1.1);
00297     mHFHFrac_lowPt_Forward    = dbe->book1D("HFHFrac_lowPt_Forward", "HFHFrac_lowPt_Forward", 120, -0.1, 1.1);
00298     mHFEFrac_mediumPt_Forward = dbe->book1D("HFEFrac_mediumPt_Forward", "HFEFrac_mediumPt_Forward", 120, -0.1, 1.1);
00299     mHFHFrac_mediumPt_Forward = dbe->book1D("HFHFrac_mediumPt_Forward", "HFHFrac_mediumPt_Forward", 120, -0.1, 1.1);
00300     mHFEFrac_highPt_Forward   = dbe->book1D("HFEFrac_highPt_Forward", "HFEFrac_highPt_Forward", 120, -0.1, 1.1);
00301     mHFHFrac_highPt_Forward   = dbe->book1D("HFHFrac_highPt_Forward", "HFHFrac_highPt_Forward", 120, -0.1, 1.1);
00302     //energies
00303     mHFEEn_lowPt_Forward    = dbe->book1D("HFEEn_lowPt_Forward", "HFEEn_lowPt_Forward", ptBin, ptMin, ptMax);
00304     mHFHEn_lowPt_Forward    = dbe->book1D("HFHEn_lowPt_Forward", "HFHEn_lowPt_Forward", ptBin, ptMin, ptMax);
00305     mHFEEn_mediumPt_Forward = dbe->book1D("HFEEn_mediumPt_Forward", "HFEEn_mediumPt_Forward", ptBin, ptMin, ptMax);
00306     mHFHEn_mediumPt_Forward = dbe->book1D("HFHEn_mediumPt_Forward", "HFHEn_mediumPt_Forward", ptBin, ptMin, ptMax);
00307     mHFEEn_highPt_Forward   = dbe->book1D("HFEEn_highPt_Forward", "HFEEn_highPt_Forward", ptBin, ptMin, ptMax);
00308     mHFHEn_highPt_Forward   = dbe->book1D("HFHEn_highPt_Forward", "HFHEn_highPt_Forward", ptBin, ptMin, ptMax);
00309     //multiplicities
00310     mChMultiplicity_lowPt_Forward     = dbe->book1D("ChMultiplicity_lowPt_Forward", "ChMultiplicity_lowPt_Forward", 30,0,30);
00311     mNeuMultiplicity_lowPt_Forward    = dbe->book1D("NeuMultiplicity_lowPt_Forward", "NeuMultiplicity_lowPt_Forward", 30,0,30);
00312     mMuMultiplicity_lowPt_Forward     = dbe->book1D("MuMultiplicity_lowPt_Forward", "MuMultiplicity_lowPt_Forward", 30,0,30);
00313     mChMultiplicity_mediumPt_Forward  = dbe->book1D("ChMultiplicity_mediumPt_Forward", "ChMultiplicity_mediumPt_Forward", 30,0,30);
00314     mNeuMultiplicity_mediumPt_Forward = dbe->book1D("NeuMultiplicity_mediumPt_Forward", "NeuMultiplicity_mediumPt_Forward", 30,0,30);
00315     mMuMultiplicity_mediumPt_Forward  = dbe->book1D("MuMultiplicity_mediumPt_Forward", "MuMultiplicity_mediumPt_Forward", 30,0,30);
00316     mChMultiplicity_highPt_Forward    = dbe->book1D("ChMultiplicity_highPt_Forward", "ChMultiplicity_highPt_Forward", 30,0,30);
00317     mNeuMultiplicity_highPt_Forward   = dbe->book1D("NeuMultiplicity_highPt_Forward", "NeuMultiplicity_highPt_Forward", 30,0,30);
00318     mMuMultiplicity_highPt_Forward    = dbe->book1D("MuMultiplicity_highPt_Forward", "MuMultiplicity_highPt_Forward", 30,0,30);
00319 
00320 
00321 
00322     // Leading Jet Parameters
00323     mEtaFirst                = dbe->book1D("EtaFirst", "EtaFirst", 100, -5, 5);
00324     mPhiFirst                = dbe->book1D("PhiFirst", "PhiFirst", 70, -3.5, 3.5);
00325     //mEFirst                  = dbe->book1D("EFirst", "EFirst", 100, 0, 1000);
00326     mPtFirst                 = dbe->book1D("PtFirst", "PtFirst", 100, 0, 500);
00327     if(fillpfJIDPassFrac==1) {
00328       mLooseJIDPassFractionVSeta= dbe->bookProfile("LooseJIDPassFractionVSeta","LooseJIDPassFractionVSeta",etaBin, etaMin, etaMax,0.,1.2);
00329       mLooseJIDPassFractionVSpt= dbe->bookProfile("LooseJIDPassFractionVSpt","LooseJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
00330       mTightJIDPassFractionVSeta= dbe->bookProfile("TightJIDPassFractionVSeta","TightJIDPassFractionVSeta",etaBin, etaMin, etaMax,0.,1.2);
00331       mTightJIDPassFractionVSpt= dbe->bookProfile("TightJIDPassFractionVSpt","TightJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
00332     }
00333   }
00334   
00335   //
00336   //if(makedijetselection!=1) {
00337   mChargedHadronEnergy = dbe->book1D("mChargedHadronEnergy", "mChargedHadronEnergy", 100, 0, 100);
00338   mNeutralHadronEnergy = dbe->book1D("mNeutralHadronEnergy", "mNeutralHadronEnergy", 100, 0, 100);
00339   mChargedEmEnergy     = dbe->book1D("mChargedEmEnergy ", "mChargedEmEnergy ", 100, 0, 100);
00340   mChargedMuEnergy     = dbe->book1D("mChargedMuEnergy", "mChargedMuEnergy", 100, 0, 100);
00341   mNeutralEmEnergy     = dbe->book1D("mNeutralEmEnergy", "mNeutralEmEnergy", 100, 0, 100);
00342   mChargedMultiplicity = dbe->book1D("mChargedMultiplicity ", "mChargedMultiplicity ", 100, 0, 100);
00343   mNeutralMultiplicity = dbe->book1D(" mNeutralMultiplicity", "mNeutralMultiplicity", 100, 0, 100);
00344   mMuonMultiplicity    = dbe->book1D("mMuonMultiplicity", "mMuonMultiplicity", 100, 0, 100);
00345   //__________________________________________________
00346   mNeutralFraction     = dbe->book1D("NeutralFraction","Neutral Fraction",100,0,1);
00347   //}
00348   
00349   mDPhi                = dbe->book1D("DPhi", "dPhi btw the two leading jets", 100, 0., acos(-1.));
00350   
00351   if(makedijetselection==1) {
00352     mDijetAsymmetry                   = dbe->book1D("DijetAsymmetry", "DijetAsymmetry", 100, -1., 1.);
00353     mDijetBalance                     = dbe->book1D("DijetBalance",   "DijetBalance",   100, -2., 2.);
00354     if (fillpfJIDPassFrac==1) {
00355       mLooseJIDPassFractionVSeta  = dbe->bookProfile("LooseJIDPassFractionVSeta","LooseJIDPassFractionVSeta",50, -3., 3.,0.,1.2);
00356       mLooseJIDPassFractionVSpt   = dbe->bookProfile("LooseJIDPassFractionVSpt","LooseJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
00357       mTightJIDPassFractionVSeta  = dbe->bookProfile("TightJIDPassFractionVSeta","TightJIDPassFractionVSeta",50, -3., 3.,0.,1.2);
00358       mTightJIDPassFractionVSpt   = dbe->bookProfile("TightJIDPassFractionVSpt","TightJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
00359       
00360     }
00361   }
00362   
00363 }
00364 
00365 void PFJetAnalyzer::endJob() {
00366   
00367 }
00368 
00369 void PFJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::PFJetCollection& pfJets) {
00370 
00371   int numofjets=0;
00372   double  fstPhi=0.;
00373   double  sndPhi=0.;
00374   double  diff = 0.;
00375   double  corr = 0.;
00376   double  dphi = -999. ;
00377 
00378   bool Thiscleaned=false; 
00379   bool Loosecleaned=false; 
00380   bool Tightcleaned=false; 
00381   bool ThisCHFcleaned=false;
00382   bool LooseCHFcleaned=false;
00383   bool TightCHFcleaned=false;
00384 
00385   srand( iEvent.id().event() % 10000);
00386 
00387   if(makedijetselection==1){
00388     //Dijet selection - careful: the pT is uncorrected!
00389     //if(makedijetselection==1 && pfJets.size()>=2){
00390     if(pfJets.size()>=2){
00391       double  dphiDJ = -999. ;
00392 
00393       bool LoosecleanedFirstJet =false; 
00394       bool LoosecleanedSecondJet=false; 
00395       bool TightcleanedFirstJet =false; 
00396       bool TightcleanedSecondJet=false; 
00397       bool LooseCHFcleanedFirstJet =false;
00398       bool LooseCHFcleanedSecondJet=false;
00399       bool TightCHFcleanedFirstJet =false;
00400       bool TightCHFcleanedSecondJet=false;
00401 
00402       //both jets pass pt threshold
00403       if ((pfJets.at(0)).pt() > _ptThreshold && (pfJets.at(1)).pt() > _ptThreshold ) {
00404         if(fabs((pfJets.at(0)).eta())<3. && fabs((pfJets.at(1)).eta())<3. ){
00405           //calculate dphi
00406           dphiDJ = fabs((pfJets.at(0)).phi()-(pfJets.at(1)).phi());
00407           if (dphiDJ > 3.14) dphiDJ=fabs(dphiDJ -6.28 );
00408           //fill DPhi histo (before cutting)
00409           if (mDPhi) mDPhi->Fill (dphiDJ);
00410           //dphi cut
00411           if(fabs(dphiDJ)>2.1){
00412             //first jet
00413             LooseCHFcleanedFirstJet=true;
00414             TightCHFcleanedFirstJet=true;
00415             if((pfJets.at(0).chargedHadronEnergy()/pfJets.at(0).energy())<=_LooseCHFMin && fabs(pfJets.at(0).eta())<2.4) LooseCHFcleanedFirstJet=false; //apply CHF>0 only if |eta|<2.4
00416             if((pfJets.at(0).chargedHadronEnergy()/pfJets.at(0).energy())<=_TightCHFMin && fabs(pfJets.at(0).eta())<2.4) TightCHFcleanedFirstJet=false; //apply CHF>0 only if |eta|<2.4
00417             if(LooseCHFcleanedFirstJet && (pfJets.at(0).neutralHadronEnergy()/pfJets.at(0).energy())<_LooseNHFMax && (pfJets.at(0).chargedEmEnergy()/pfJets.at(0).energy())<_LooseCEFMax && (pfJets.at(0).neutralEmEnergy()/pfJets.at(0).energy())<_LooseNEFMax) LoosecleanedFirstJet=true;
00418             if(TightCHFcleanedFirstJet && (pfJets.at(0).neutralHadronEnergy()/pfJets.at(0).energy())<_TightNHFMax && (pfJets.at(0).chargedEmEnergy()/pfJets.at(0).energy())<_TightCEFMax && (pfJets.at(0).neutralEmEnergy()/pfJets.at(0).energy())<_TightNEFMax) TightcleanedFirstJet=true;
00419 
00420             //second jet
00421             LooseCHFcleanedSecondJet=true;
00422             TightCHFcleanedSecondJet=true;
00423             if((pfJets.at(1).chargedHadronEnergy()/pfJets.at(1).energy())<=_LooseCHFMin && fabs(pfJets.at(1).eta())<2.4) LooseCHFcleanedSecondJet=false; //apply CHF>0 only if |eta|<2.4
00424             if((pfJets.at(1).chargedHadronEnergy()/pfJets.at(1).energy())<=_TightCHFMin && fabs(pfJets.at(1).eta())<2.4) TightCHFcleanedSecondJet=false; //apply CHF>0 only if |eta|<2.4
00425             if(LooseCHFcleanedSecondJet && (pfJets.at(1).neutralHadronEnergy()/pfJets.at(1).energy())<_LooseNHFMax && (pfJets.at(1).chargedEmEnergy()/pfJets.at(1).energy())<_LooseCEFMax && (pfJets.at(1).neutralEmEnergy()/pfJets.at(1).energy())<_LooseNEFMax) LoosecleanedSecondJet=true;
00426             if(TightCHFcleanedSecondJet && (pfJets.at(1).neutralHadronEnergy()/pfJets.at(1).energy())<_TightNHFMax && (pfJets.at(1).chargedEmEnergy()/pfJets.at(1).energy())<_TightCEFMax && (pfJets.at(1).neutralEmEnergy()/pfJets.at(1).energy())<_TightNEFMax) TightcleanedSecondJet=true;
00427       
00428             if(fillpfJIDPassFrac==1) {
00429               //fill the profile for jid efficiency 
00430               if(LoosecleanedFirstJet) {
00431                 mLooseJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),1.);
00432                 mLooseJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),1.);
00433               } else {
00434                 mLooseJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),0.);
00435                 mLooseJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),0.);
00436               }
00437               if(TightcleanedFirstJet) {
00438                 mTightJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),1.);
00439                 mTightJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),1.);
00440               } else {
00441                 mTightJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),0.);
00442                 mTightJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),0.);
00443               }
00444 
00445               if(LoosecleanedSecondJet) {
00446                 mLooseJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),1.);
00447                 mLooseJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),1.);
00448               } else {
00449                 mLooseJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),0.);
00450                 mLooseJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),0.);
00451               }
00452               if(TightcleanedSecondJet) {
00453                 mTightJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),1.);
00454                 mTightJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),1.);
00455               } else {
00456                 mTightJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),0.);
00457                 mTightJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),0.);
00458               }
00459             }
00460             
00461             if(LoosecleanedFirstJet && LoosecleanedSecondJet) {
00462               //Filling variables for first jet
00463               if (mPt)   mPt->Fill (pfJets.at(0).pt());
00464               if (mEta)  mEta->Fill (pfJets.at(0).eta());
00465               if (mPhi)  mPhi->Fill (pfJets.at(0).phi());
00466               if (mPhiVSEta) mPhiVSEta->Fill(pfJets.at(0).eta(),pfJets.at(0).phi());
00467               
00468               if (mConstituents) mConstituents->Fill (pfJets.at(0).nConstituents());
00469               if (mHFrac)        mHFrac->Fill (pfJets.at(0).chargedHadronEnergyFraction()+pfJets.at(0).neutralHadronEnergyFraction());
00470               if (mEFrac)        mEFrac->Fill (pfJets.at(0).chargedEmEnergyFraction() +pfJets.at(0).neutralEmEnergyFraction());
00471               
00472               //if (mE) mE->Fill (pfJets.at(0).energy());
00473               //if (mP) mP->Fill (pfJets.at(0).p());
00474               //if (mMass) mMass->Fill (pfJets.at(0).mass());
00475             
00476               if (mChargedHadronEnergy)  mChargedHadronEnergy->Fill (pfJets.at(0).chargedHadronEnergy());
00477               if (mNeutralHadronEnergy)  mNeutralHadronEnergy->Fill (pfJets.at(0).neutralHadronEnergy());
00478               if (mChargedEmEnergy) mChargedEmEnergy->Fill(pfJets.at(0).chargedEmEnergy());
00479               if (mChargedMuEnergy) mChargedMuEnergy->Fill (pfJets.at(0).chargedMuEnergy ());
00480               if (mNeutralEmEnergy) mNeutralEmEnergy->Fill(pfJets.at(0).neutralEmEnergy());
00481               if (mChargedMultiplicity ) mChargedMultiplicity->Fill(pfJets.at(0).chargedMultiplicity());
00482               if (mNeutralMultiplicity ) mNeutralMultiplicity->Fill(pfJets.at(0).neutralMultiplicity());
00483               if (mMuonMultiplicity )mMuonMultiplicity->Fill (pfJets.at(0). muonMultiplicity());
00484               //_______________________________________________________
00485               if (mNeutralFraction) mNeutralFraction->Fill (pfJets.at(0).neutralMultiplicity()/pfJets.at(0).nConstituents());
00486 
00487               //Filling variables for second jet
00488               if (mPt)   mPt->Fill (pfJets.at(1).pt());
00489               if (mEta)  mEta->Fill (pfJets.at(1).eta());
00490               if (mPhi)  mPhi->Fill (pfJets.at(1).phi());
00491               if (mPhiVSEta) mPhiVSEta->Fill(pfJets.at(1).eta(),pfJets.at(1).phi());
00492               
00493               if (mConstituents) mConstituents->Fill (pfJets.at(1).nConstituents());
00494               if (mHFrac)        mHFrac->Fill (pfJets.at(1).chargedHadronEnergyFraction()+pfJets.at(1).neutralHadronEnergyFraction());
00495               if (mEFrac)        mEFrac->Fill (pfJets.at(1).chargedEmEnergyFraction() +pfJets.at(1).neutralEmEnergyFraction());
00496               
00497               //if (mE) mE->Fill (pfJets.at(1).energy());
00498               //if (mP) mP->Fill (pfJets.at(1).p());
00499               //if (mMass) mMass->Fill (pfJets.at(1).mass());
00500             
00501               if (mChargedHadronEnergy)  mChargedHadronEnergy->Fill (pfJets.at(1).chargedHadronEnergy());
00502               if (mNeutralHadronEnergy)  mNeutralHadronEnergy->Fill (pfJets.at(1).neutralHadronEnergy());
00503               if (mChargedEmEnergy) mChargedEmEnergy->Fill(pfJets.at(1).chargedEmEnergy());
00504               if (mChargedMuEnergy) mChargedMuEnergy->Fill (pfJets.at(1).chargedMuEnergy ());
00505               if (mNeutralEmEnergy) mNeutralEmEnergy->Fill(pfJets.at(1).neutralEmEnergy());
00506               if (mChargedMultiplicity ) mChargedMultiplicity->Fill(pfJets.at(1).chargedMultiplicity());
00507               if (mNeutralMultiplicity ) mNeutralMultiplicity->Fill(pfJets.at(1).neutralMultiplicity());
00508               if (mMuonMultiplicity )mMuonMultiplicity->Fill (pfJets.at(1). muonMultiplicity());
00509               //_______________________________________________________
00510               if (mNeutralFraction) mNeutralFraction->Fill (pfJets.at(1).neutralMultiplicity()/pfJets.at(1).nConstituents());
00511 
00512             }// loose cleaned jets 1 and 2
00513           }// fabs dphi < 2.1
00514         }// fabs eta < 3
00515       }// pt jets > threshold
00516       //now do the dijet balance and asymmetry calculations
00517       if (fabs(pfJets.at(0).eta() < 1.4)) {
00518         double pt_dijet = (pfJets.at(0).pt() + pfJets.at(1).pt())/2;
00519 
00520         double dPhi = fabs((pfJets.at(0)).phi()-(pfJets.at(1)).phi());
00521         if (dPhi > 3.14) dPhi=fabs(dPhi -6.28 );
00522         
00523         if (dPhi > 2.7) {
00524           double pt_probe;
00525           double pt_barrel;
00526           int jet1, jet2;
00527 
00528           int randJet = rand() % 2;
00529 
00530           if (fabs(pfJets.at(1).eta() < 1.4)) {
00531             if (randJet) {
00532               jet1 = 0;
00533               jet2 = 1;
00534             }
00535             else {
00536               jet1 = 1;
00537               jet2 = 0;
00538             }
00539           
00540             /***Di-Jet Asymmetry****
00541              * leading jets eta < 1.4
00542              * leading jets dphi > 2.7
00543              * pt_third jet < threshold
00544              * A = (pt_1 - pt_2)/(pt_1 + pt_2)
00545              * jets 1 and two are randomly ordered
00546              */
00547             bool thirdJetCut = true;
00548             for (unsigned int third = 2; third < pfJets.size(); ++third) 
00549               if (pfJets.at(third).pt() > _asymmetryThirdJetCut) 
00550                 thirdJetCut = false;
00551             if (thirdJetCut) {
00552               double dijetAsymmetry = (pfJets.at(jet1).pt() - pfJets.at(jet2).pt()) / (pfJets.at(jet1).pt() + pfJets.at(jet2).pt());
00553               mDijetAsymmetry->Fill(dijetAsymmetry);
00554             }// end restriction on third jet pt in asymmetry calculation
00555               
00556           }
00557           else {
00558             jet1 = 0;
00559             jet2 = 1;
00560           }
00561           
00562           pt_barrel = pfJets.at(jet1).pt();
00563           pt_probe  = pfJets.at(jet2).pt();
00564           
00565           //dijet balance cuts
00566           /***Di-Jet Balance****
00567            * pt_dijet = (pt_probe+pt_barrel)/2
00568            * leading jets dphi > 2.7
00569            * reject evnets where pt_third/pt_dijet > 0.2
00570            * pv selection
00571            * B = (pt_probe - pt_barrel)/pt_dijet
00572            * select probe randomly from 2 jets if both leading jets are in the barrel
00573            */
00574           bool thirdJetCut = true;
00575           for (unsigned int third = 2; third < pfJets.size(); ++third) 
00576             if (pfJets.at(third).pt()/pt_dijet > _balanceThirdJetCut) 
00577               thirdJetCut = false;
00578           if (thirdJetCut) {
00579             double dijetBalance = (pt_probe - pt_barrel) / pt_dijet;
00580             mDijetBalance->Fill(dijetBalance);
00581           }// end restriction on third jet pt ratio in balance calculation
00582         }// dPhi > 2.7
00583       }// leading jet eta cut for asymmetry and balance calculations
00584     }// jet size >= 2
00585   } // do dijet selection
00586   else{
00587     for (reco::PFJetCollection::const_iterator jet = pfJets.begin(); jet!=pfJets.end(); ++jet){
00588       LogTrace(metname)<<"[JetAnalyzer] Analyze PFJet";
00589  
00590       Thiscleaned=false;
00591       Loosecleaned=false;
00592       Tightcleaned=false;
00593 
00594       if (jet == pfJets.begin()) {
00595         fstPhi = jet->phi();
00596         _leadJetFlag = 1;
00597       } else {
00598         _leadJetFlag = 0;
00599       }
00600 
00601       if (jet == (pfJets.begin()+1)) sndPhi = jet->phi();
00602       //  if (jet->pt() < _ptThreshold) return;
00603       if (jet->pt() > _ptThreshold) {
00604         numofjets++ ;
00605         jetME->Fill(2);
00606             
00607         //calculate the jetID
00608         ThisCHFcleaned=true;
00609         LooseCHFcleaned=true;
00610         TightCHFcleaned=true;
00611         if((jet->chargedHadronEnergy()/jet->energy())<=_ThisCHFMin && fabs(jet->eta())<2.4) ThisCHFcleaned=false; //apply CHF>0 only if |eta|<2.4
00612         if((jet->chargedHadronEnergy()/jet->energy())<=_LooseCHFMin && fabs(jet->eta())<2.4) LooseCHFcleaned=false; //apply CHF>0 only if |eta|<2.4
00613         if((jet->chargedHadronEnergy()/jet->energy())<=_TightCHFMin && fabs(jet->eta())<2.4) TightCHFcleaned=false; //apply CHF>0 only if |eta|<2.4
00614         if(ThisCHFcleaned && (jet->neutralHadronEnergy()/jet->energy())<_ThisNHFMax && (jet->chargedEmEnergy()/jet->energy())<_ThisCEFMax && (jet->neutralEmEnergy()/jet->energy())<_ThisNEFMax) Thiscleaned=true;
00615         if(LooseCHFcleaned && (jet->neutralHadronEnergy()/jet->energy())<_LooseNHFMax && (jet->chargedEmEnergy()/jet->energy())<_LooseCEFMax && (jet->neutralEmEnergy()/jet->energy())<_LooseNEFMax) Loosecleaned=true;
00616         if(TightCHFcleaned && (jet->neutralHadronEnergy()/jet->energy())<_TightNHFMax && (jet->chargedEmEnergy()/jet->energy())<_TightCEFMax && (jet->neutralEmEnergy()/jet->energy())<_TightNEFMax) Tightcleaned=true;
00617       
00618         if(fillpfJIDPassFrac==1) {
00619           //fill the profile for jid efficiency 
00620           if(Loosecleaned) {
00621             mLooseJIDPassFractionVSeta->Fill(jet->eta(),1.);
00622             mLooseJIDPassFractionVSpt->Fill(jet->pt(),1.);
00623           } else {
00624             mLooseJIDPassFractionVSeta->Fill(jet->eta(),0.);
00625             mLooseJIDPassFractionVSpt->Fill(jet->pt(),0.);
00626           }
00627           if(Tightcleaned) {
00628             mTightJIDPassFractionVSeta->Fill(jet->eta(),1.);
00629             mTightJIDPassFractionVSpt->Fill(jet->pt(),1.);
00630           } else {
00631             mTightJIDPassFractionVSeta->Fill(jet->eta(),0.);
00632             mTightJIDPassFractionVSpt->Fill(jet->pt(),0.);
00633           }
00634         }
00635       
00636         if(!Thiscleaned) continue;
00637       
00638         // Leading jet
00639         // Histograms are filled once per event
00640         if (_leadJetFlag == 1) { 
00641         
00642           if (mEtaFirst) mEtaFirst->Fill (jet->eta());
00643           if (mPhiFirst) mPhiFirst->Fill (jet->phi());
00644           //if (mEFirst)   mEFirst->Fill (jet->energy());
00645           if (mPtFirst)  mPtFirst->Fill (jet->pt());
00646         }
00647       
00648         // --- Passed the low pt jet trigger (no longer used)
00649         if (_JetLoPass == 1) {
00650         /*  if (fabs(jet->eta()) <= 1.3) {
00651             if (mPt_Barrel_Lo)           mPt_Barrel_Lo->Fill(jet->pt());
00652             if (mEta_Lo)          mEta_Lo->Fill(jet->eta());
00653             if (mPhi_Barrel_Lo)          mPhi_Barrel_Lo->Fill(jet->phi());
00654           }
00655           if ( (fabs(jet->eta()) > 1.3) && (fabs(jet->eta()) <= 3) ) {
00656             if (mPt_EndCap_Lo)           mPt_EndCap_Lo->Fill(jet->pt());
00657             if (mEta_Lo)          mEta_Lo->Fill(jet->eta());
00658             if (mPhi_EndCap_Lo)          mPhi_EndCap_Lo->Fill(jet->phi());
00659           }
00660           if (fabs(jet->eta()) > 3.0) {
00661             if (mPt_Forward_Lo)           mPt_Forward_Lo->Fill(jet->pt());
00662             if (mEta_Lo)          mEta_Lo->Fill(jet->eta());
00663             if (mPhi_Forward_Lo)          mPhi_Forward_Lo->Fill(jet->phi());
00664           }*/
00665           //if (mEta_Lo) mEta_Lo->Fill (jet->eta());
00666           if (mPhi_Lo) mPhi_Lo->Fill (jet->phi());
00667           if (mPt_Lo)  mPt_Lo->Fill (jet->pt());
00668         }
00669       
00670         // --- Passed the high pt jet trigger
00671         if (_JetHiPass == 1) {
00672           if (fabs(jet->eta()) <= 1.3) {
00673             if (mPt_Barrel_Hi && jet->pt()>100.)           mPt_Barrel_Hi->Fill(jet->pt());
00674             if (mEta_Hi && jet->pt()>100.)          mEta_Hi->Fill(jet->eta());
00675             if (mPhi_Barrel_Hi)          mPhi_Barrel_Hi->Fill(jet->phi());
00676             //if (mConstituents_Barrel_Hi) mConstituents_Barrel_Hi->Fill(jet->nConstituents()); 
00677             //if (mHFrac_Barrel_Hi)        mHFrac_Barrel_Hi->Fill(jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());       
00678           }
00679           if ( (fabs(jet->eta()) > 1.3) && (fabs(jet->eta()) <= 3) ) {
00680             if (mPt_EndCap_Hi && jet->pt()>100.)           mPt_EndCap_Hi->Fill(jet->pt());
00681             if (mEta_Hi && jet->pt()>100.)          mEta_Hi->Fill(jet->eta());
00682             if (mPhi_EndCap_Hi)          mPhi_EndCap_Hi->Fill(jet->phi());
00683             //if (mConstituents_EndCap_Hi) mConstituents_EndCap_Hi->Fill(jet->nConstituents()); 
00684             //if (mHFrac_EndCap_Hi)        mHFrac_EndCap_Hi->Fill(jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());       
00685           }
00686           if (fabs(jet->eta()) > 3.0) {
00687             if (mPt_Forward_Hi && jet->pt()>100.)           mPt_Forward_Hi->Fill(jet->pt());
00688             if (mEta_Hi && jet->pt()>100.)          mEta_Hi->Fill(jet->eta());
00689             if (mPhi_Forward_Hi)          mPhi_Forward_Hi->Fill(jet->phi());
00690             //if (mConstituents_Forward_Hi) mConstituents_Forward_Hi->Fill(jet->nConstituents());       
00691             //if (mHFrac_Forward_Hi)        mHFrac_Forward_Hi->Fill(jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());     
00692           }
00693         
00694           if (mEta_Hi && jet->pt()>100.) mEta_Hi->Fill (jet->eta());
00695           if (mPhi_Hi) mPhi_Hi->Fill (jet->phi());
00696           if (mPt_Hi)  mPt_Hi->Fill (jet->pt());
00697         }
00698       
00699         if (mPt)   mPt->Fill (jet->pt());
00700         if (mPt_1) mPt_1->Fill (jet->pt());
00701         if (mPt_2) mPt_2->Fill (jet->pt());
00702         if (mPt_3) mPt_3->Fill (jet->pt());
00703         if (mEta)  mEta->Fill (jet->eta());
00704         if (mPhi)  mPhi->Fill (jet->phi());
00705         if (mPhiVSEta) mPhiVSEta->Fill(jet->eta(),jet->phi());
00706       
00707         if (mConstituents) mConstituents->Fill (jet->nConstituents());
00708         if (mHFrac)        mHFrac->Fill (jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());
00709         if (mEFrac)        mEFrac->Fill (jet->chargedEmEnergyFraction() +jet->neutralEmEnergyFraction());
00710       
00711         if (jet->pt()<= 50) {
00712           if (mCHFracVSeta_lowPt) mCHFracVSeta_lowPt->Fill(jet->eta(),jet->chargedHadronEnergyFraction());
00713           if (mNHFracVSeta_lowPt) mNHFracVSeta_lowPt->Fill(jet->eta(),jet->neutralHadronEnergyFraction());
00714           if (mPhFracVSeta_lowPt) mPhFracVSeta_lowPt->Fill(jet->eta(),jet->neutralEmEnergyFraction());
00715           if (mElFracVSeta_lowPt) mElFracVSeta_lowPt->Fill(jet->eta(),jet->chargedEmEnergyFraction());
00716           if (mMuFracVSeta_lowPt) mMuFracVSeta_lowPt->Fill(jet->eta(),jet->chargedMuEnergyFraction());
00717         }
00718         if (jet->pt()>50. && jet->pt()<=140.) {
00719           if (mCHFracVSeta_mediumPt) mCHFracVSeta_mediumPt->Fill(jet->eta(),jet->chargedHadronEnergyFraction());
00720           if (mNHFracVSeta_mediumPt) mNHFracVSeta_mediumPt->Fill(jet->eta(),jet->neutralHadronEnergyFraction());
00721           if (mPhFracVSeta_mediumPt) mPhFracVSeta_mediumPt->Fill(jet->eta(),jet->neutralEmEnergyFraction());
00722           if (mElFracVSeta_mediumPt) mElFracVSeta_mediumPt->Fill(jet->eta(),jet->chargedEmEnergyFraction());
00723           if (mMuFracVSeta_mediumPt) mMuFracVSeta_mediumPt->Fill(jet->eta(),jet->chargedMuEnergyFraction());
00724         }
00725         if (jet->pt()>140.) {
00726           if (mCHFracVSeta_highPt) mCHFracVSeta_highPt->Fill(jet->eta(),jet->chargedHadronEnergyFraction());
00727           if (mNHFracVSeta_highPt) mNHFracVSeta_highPt->Fill(jet->eta(),jet->neutralHadronEnergyFraction());
00728           if (mPhFracVSeta_highPt) mPhFracVSeta_highPt->Fill(jet->eta(),jet->neutralEmEnergyFraction());
00729           if (mElFracVSeta_highPt) mElFracVSeta_highPt->Fill(jet->eta(),jet->chargedEmEnergyFraction());
00730           if (mMuFracVSeta_highPt) mMuFracVSeta_highPt->Fill(jet->eta(),jet->chargedMuEnergyFraction());
00731         }
00732 
00733         if (fabs(jet->eta()) <= 1.3) {
00734           if (mPt_Barrel)   mPt_Barrel->Fill (jet->pt());
00735           if (mPhi_Barrel)  mPhi_Barrel->Fill (jet->phi());
00736           //if (mE_Barrel)    mE_Barrel->Fill (jet->energy());
00737     if (mConstituents_Barrel)    mConstituents_Barrel->Fill(jet->nConstituents());      
00738     if (mHFrac_Barrel)           mHFrac_Barrel->Fill(jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction() );
00739     if (mEFrac_Barrel)           mEFrac->Fill (jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());        
00740           //fractions
00741           if (jet->pt()<=50.) {
00742             if (mCHFrac_lowPt_Barrel) mCHFrac_lowPt_Barrel->Fill(jet->chargedHadronEnergyFraction());
00743             if (mNHFrac_lowPt_Barrel) mNHFrac_lowPt_Barrel->Fill(jet->neutralHadronEnergyFraction());
00744             if (mPhFrac_lowPt_Barrel) mPhFrac_lowPt_Barrel->Fill(jet->neutralEmEnergyFraction());
00745             if (mElFrac_lowPt_Barrel) mElFrac_lowPt_Barrel->Fill(jet->chargedEmEnergyFraction());
00746             if (mMuFrac_lowPt_Barrel) mMuFrac_lowPt_Barrel->Fill(jet->chargedMuEnergyFraction());
00747             //
00748             if (mCHEn_lowPt_Barrel) mCHEn_lowPt_Barrel->Fill(jet->chargedHadronEnergy());
00749             if (mNHEn_lowPt_Barrel) mNHEn_lowPt_Barrel->Fill(jet->neutralHadronEnergy());
00750             if (mPhEn_lowPt_Barrel) mPhEn_lowPt_Barrel->Fill(jet->neutralEmEnergy());
00751             if (mElEn_lowPt_Barrel) mElEn_lowPt_Barrel->Fill(jet->chargedEmEnergy());
00752             if (mMuEn_lowPt_Barrel) mMuEn_lowPt_Barrel->Fill(jet->chargedMuEnergy());
00753           }
00754           if (jet->pt()>50. && jet->pt()<=140.) {
00755             if (mCHFrac_mediumPt_Barrel) mCHFrac_mediumPt_Barrel->Fill(jet->chargedHadronEnergyFraction());
00756             if (mNHFrac_mediumPt_Barrel) mNHFrac_mediumPt_Barrel->Fill(jet->neutralHadronEnergyFraction());
00757             if (mPhFrac_mediumPt_Barrel) mPhFrac_mediumPt_Barrel->Fill(jet->neutralEmEnergyFraction());
00758             if (mElFrac_mediumPt_Barrel) mElFrac_mediumPt_Barrel->Fill(jet->chargedEmEnergyFraction());
00759             if (mMuFrac_mediumPt_Barrel) mMuFrac_mediumPt_Barrel->Fill(jet->chargedMuEnergyFraction());
00760             //
00761             if (mCHEn_mediumPt_Barrel) mCHEn_mediumPt_Barrel->Fill(jet->chargedHadronEnergy());
00762             if (mNHEn_mediumPt_Barrel) mNHEn_mediumPt_Barrel->Fill(jet->neutralHadronEnergy());
00763             if (mPhEn_mediumPt_Barrel) mPhEn_mediumPt_Barrel->Fill(jet->neutralEmEnergy());
00764             if (mElEn_mediumPt_Barrel) mElEn_mediumPt_Barrel->Fill(jet->chargedEmEnergy());
00765             if (mMuEn_mediumPt_Barrel) mMuEn_mediumPt_Barrel->Fill(jet->chargedMuEnergy());
00766           }
00767           if (jet->pt()>140.) {
00768             if (mCHFrac_highPt_Barrel) mCHFrac_highPt_Barrel->Fill(jet->chargedHadronEnergyFraction());
00769             if (mNHFrac_highPt_Barrel) mNHFrac_highPt_Barrel->Fill(jet->neutralHadronEnergyFraction());
00770             if (mPhFrac_highPt_Barrel) mPhFrac_highPt_Barrel->Fill(jet->neutralEmEnergyFraction());
00771             if (mElFrac_highPt_Barrel) mElFrac_highPt_Barrel->Fill(jet->chargedEmEnergyFraction());
00772             if (mMuFrac_highPt_Barrel) mMuFrac_highPt_Barrel->Fill(jet->chargedMuEnergyFraction());
00773             //
00774             if (mCHEn_highPt_Barrel) mCHEn_highPt_Barrel->Fill(jet->chargedHadronEnergy());
00775             if (mNHEn_highPt_Barrel) mNHEn_highPt_Barrel->Fill(jet->neutralHadronEnergy());
00776             if (mPhEn_highPt_Barrel) mPhEn_highPt_Barrel->Fill(jet->neutralEmEnergy());
00777             if (mElEn_highPt_Barrel) mElEn_highPt_Barrel->Fill(jet->chargedEmEnergy());
00778             if (mMuEn_highPt_Barrel) mMuEn_highPt_Barrel->Fill(jet->chargedMuEnergy());
00779           }
00780           if(mChMultiplicity_lowPt_Barrel)  mChMultiplicity_lowPt_Barrel->Fill(jet->chargedMultiplicity());
00781           if(mNeuMultiplicity_lowPt_Barrel)  mNeuMultiplicity_lowPt_Barrel->Fill(jet->neutralMultiplicity());
00782           if(mMuMultiplicity_lowPt_Barrel)  mMuMultiplicity_lowPt_Barrel->Fill(jet->muonMultiplicity());
00783           if(mChMultiplicity_mediumPt_Barrel)  mChMultiplicity_mediumPt_Barrel->Fill(jet->chargedMultiplicity());
00784           if(mNeuMultiplicity_mediumPt_Barrel)  mNeuMultiplicity_mediumPt_Barrel->Fill(jet->neutralMultiplicity());
00785           if(mMuMultiplicity_mediumPt_Barrel)  mMuMultiplicity_mediumPt_Barrel->Fill(jet->muonMultiplicity());
00786           if(mChMultiplicity_highPt_Barrel)  mChMultiplicity_highPt_Barrel->Fill(jet->chargedMultiplicity());
00787           if(mNeuMultiplicity_highPt_Barrel)  mNeuMultiplicity_highPt_Barrel->Fill(jet->neutralMultiplicity());
00788           if(mMuMultiplicity_highPt_Barrel)  mMuMultiplicity_highPt_Barrel->Fill(jet->muonMultiplicity());
00789           //
00790           if (mCHFracVSpT_Barrel) mCHFracVSpT_Barrel->Fill(jet->pt(),jet->chargedHadronEnergyFraction());
00791           if (mNHFracVSpT_Barrel) mNHFracVSpT_Barrel->Fill(jet->pt(),jet->neutralHadronEnergyFraction());
00792           if (mPhFracVSpT_Barrel) mPhFracVSpT_Barrel->Fill(jet->pt(),jet->neutralEmEnergyFraction());
00793           if (mElFracVSpT_Barrel) mElFracVSpT_Barrel->Fill(jet->pt(),jet->chargedEmEnergyFraction());
00794           if (mMuFracVSpT_Barrel) mMuFracVSpT_Barrel->Fill(jet->pt(),jet->chargedMuEnergyFraction());
00795         }
00796         if ( (fabs(jet->eta()) > 1.3) && (fabs(jet->eta()) <= 3) ) {
00797           if (mPt_EndCap)   mPt_EndCap->Fill (jet->pt());
00798           if (mPhi_EndCap)  mPhi_EndCap->Fill (jet->phi());
00799           //if (mE_EndCap)    mE_EndCap->Fill (jet->energy());
00800     if (mConstituents_EndCap)    mConstituents_EndCap->Fill(jet->nConstituents());      
00801     if (mHFrac_EndCap)           mHFrac_EndCap->Fill(jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction());
00802     if (mEFrac_EndCap)           mEFrac->Fill (jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());
00803           //fractions
00804           if (jet->pt()<=50.) {
00805             if (mCHFrac_lowPt_EndCap) mCHFrac_lowPt_EndCap->Fill(jet->chargedHadronEnergyFraction());
00806             if (mNHFrac_lowPt_EndCap) mNHFrac_lowPt_EndCap->Fill(jet->neutralHadronEnergyFraction());
00807             if (mPhFrac_lowPt_EndCap) mPhFrac_lowPt_EndCap->Fill(jet->neutralEmEnergyFraction());
00808             if (mElFrac_lowPt_EndCap) mElFrac_lowPt_EndCap->Fill(jet->chargedEmEnergyFraction());
00809             if (mMuFrac_lowPt_EndCap) mMuFrac_lowPt_EndCap->Fill(jet->chargedMuEnergyFraction());
00810             //
00811             if (mCHEn_lowPt_EndCap) mCHEn_lowPt_EndCap->Fill(jet->chargedHadronEnergy());
00812             if (mNHEn_lowPt_EndCap) mNHEn_lowPt_EndCap->Fill(jet->neutralHadronEnergy());
00813             if (mPhEn_lowPt_EndCap) mPhEn_lowPt_EndCap->Fill(jet->neutralEmEnergy());
00814             if (mElEn_lowPt_EndCap) mElEn_lowPt_EndCap->Fill(jet->chargedEmEnergy());
00815             if (mMuEn_lowPt_EndCap) mMuEn_lowPt_EndCap->Fill(jet->chargedMuEnergy());
00816           }
00817           if (jet->pt()>50. && jet->pt()<=140.) {
00818             if (mCHFrac_mediumPt_EndCap) mCHFrac_mediumPt_EndCap->Fill(jet->chargedHadronEnergyFraction());
00819             if (mNHFrac_mediumPt_EndCap) mNHFrac_mediumPt_EndCap->Fill(jet->neutralHadronEnergyFraction());
00820             if (mPhFrac_mediumPt_EndCap) mPhFrac_mediumPt_EndCap->Fill(jet->neutralEmEnergyFraction());
00821             if (mElFrac_mediumPt_EndCap) mElFrac_mediumPt_EndCap->Fill(jet->chargedEmEnergyFraction());
00822             if (mMuFrac_mediumPt_EndCap) mMuFrac_mediumPt_EndCap->Fill(jet->chargedMuEnergyFraction());
00823             //
00824             if (mCHEn_mediumPt_EndCap) mCHEn_mediumPt_EndCap->Fill(jet->chargedHadronEnergy());
00825             if (mNHEn_mediumPt_EndCap) mNHEn_mediumPt_EndCap->Fill(jet->neutralHadronEnergy());
00826             if (mPhEn_mediumPt_EndCap) mPhEn_mediumPt_EndCap->Fill(jet->neutralEmEnergy());
00827             if (mElEn_mediumPt_EndCap) mElEn_mediumPt_EndCap->Fill(jet->chargedEmEnergy());
00828             if (mMuEn_mediumPt_EndCap) mMuEn_mediumPt_EndCap->Fill(jet->chargedMuEnergy());
00829           }
00830           if (jet->pt()>140.) {
00831             if (mCHFrac_highPt_EndCap) mCHFrac_highPt_EndCap->Fill(jet->chargedHadronEnergyFraction());
00832             if (mNHFrac_highPt_EndCap) mNHFrac_highPt_EndCap->Fill(jet->neutralHadronEnergyFraction());
00833             if (mPhFrac_highPt_EndCap) mPhFrac_highPt_EndCap->Fill(jet->neutralEmEnergyFraction());
00834             if (mElFrac_highPt_EndCap) mElFrac_highPt_EndCap->Fill(jet->chargedEmEnergyFraction());
00835             if (mMuFrac_highPt_EndCap) mMuFrac_highPt_EndCap->Fill(jet->chargedMuEnergyFraction());
00836             //
00837             if (mCHEn_highPt_EndCap) mCHEn_highPt_EndCap->Fill(jet->chargedHadronEnergy());
00838             if (mNHEn_highPt_EndCap) mNHEn_highPt_EndCap->Fill(jet->neutralHadronEnergy());
00839             if (mPhEn_highPt_EndCap) mPhEn_highPt_EndCap->Fill(jet->neutralEmEnergy());
00840             if (mElEn_highPt_EndCap) mElEn_highPt_EndCap->Fill(jet->chargedEmEnergy());
00841             if (mMuEn_highPt_EndCap) mMuEn_highPt_EndCap->Fill(jet->chargedMuEnergy());
00842           }
00843           if(mChMultiplicity_lowPt_EndCap)  mChMultiplicity_lowPt_EndCap->Fill(jet->chargedMultiplicity());
00844           if(mNeuMultiplicity_lowPt_EndCap)  mNeuMultiplicity_lowPt_EndCap->Fill(jet->neutralMultiplicity());
00845           if(mMuMultiplicity_lowPt_EndCap)  mMuMultiplicity_lowPt_EndCap->Fill(jet->muonMultiplicity());
00846           if(mChMultiplicity_mediumPt_EndCap)  mChMultiplicity_mediumPt_EndCap->Fill(jet->chargedMultiplicity());
00847           if(mNeuMultiplicity_mediumPt_EndCap)  mNeuMultiplicity_mediumPt_EndCap->Fill(jet->neutralMultiplicity());
00848           if(mMuMultiplicity_mediumPt_EndCap)  mMuMultiplicity_mediumPt_EndCap->Fill(jet->muonMultiplicity());
00849           if(mChMultiplicity_highPt_EndCap)  mChMultiplicity_highPt_EndCap->Fill(jet->chargedMultiplicity());
00850           if(mNeuMultiplicity_highPt_EndCap)  mNeuMultiplicity_highPt_EndCap->Fill(jet->neutralMultiplicity());
00851           if(mMuMultiplicity_highPt_EndCap)  mMuMultiplicity_highPt_EndCap->Fill(jet->muonMultiplicity());
00852           //
00853           if (mCHFracVSpT_EndCap) mCHFracVSpT_EndCap->Fill(jet->pt(),jet->chargedHadronEnergyFraction());
00854           if (mNHFracVSpT_EndCap) mNHFracVSpT_EndCap->Fill(jet->pt(),jet->neutralHadronEnergyFraction());
00855           if (mPhFracVSpT_EndCap) mPhFracVSpT_EndCap->Fill(jet->pt(),jet->neutralEmEnergyFraction());
00856           if (mElFracVSpT_EndCap) mElFracVSpT_EndCap->Fill(jet->pt(),jet->chargedEmEnergyFraction());
00857           if (mMuFracVSpT_EndCap) mMuFracVSpT_EndCap->Fill(jet->pt(),jet->chargedMuEnergyFraction());
00858         }
00859         if (fabs(jet->eta()) > 3.0) {
00860           if (mPt_Forward)   mPt_Forward->Fill (jet->pt());
00861           if (mPhi_Forward)  mPhi_Forward->Fill (jet->phi());
00862           //if (mE_Forward)    mE_Forward->Fill (jet->energy());
00863     if (mConstituents_Forward)    mConstituents_Forward->Fill(jet->nConstituents());    
00864     if (mHFrac_Forward)           mHFrac_Forward->Fill(jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction());        
00865     if (mEFrac_Forward)           mEFrac->Fill (jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());
00866           //fractions
00867           if (jet->pt()<=50.) {
00868             if(mHFEFrac_lowPt_Forward) mHFEFrac_lowPt_Forward->Fill(jet->HFEMEnergyFraction());
00869             if(mHFHFrac_lowPt_Forward) mHFHFrac_lowPt_Forward->Fill(jet->HFHadronEnergyFraction());
00870             //
00871             if(mHFEEn_lowPt_Forward) mHFEEn_lowPt_Forward->Fill(jet->HFEMEnergy());
00872             if(mHFHEn_lowPt_Forward) mHFHEn_lowPt_Forward->Fill(jet->HFHadronEnergy());
00873           }
00874           if (jet->pt()>50. && jet->pt()<=140.) {
00875             if(mHFEFrac_mediumPt_Forward) mHFEFrac_mediumPt_Forward->Fill(jet->HFEMEnergyFraction());
00876             if(mHFHFrac_mediumPt_Forward) mHFHFrac_mediumPt_Forward->Fill(jet->HFHadronEnergyFraction());
00877             //
00878             if(mHFEEn_mediumPt_Forward) mHFEEn_mediumPt_Forward->Fill(jet->HFEMEnergy());
00879             if(mHFHEn_mediumPt_Forward) mHFHEn_mediumPt_Forward->Fill(jet->HFHadronEnergy());
00880           }
00881           if (jet->pt()>140.) {
00882             if(mHFEFrac_highPt_Forward) mHFEFrac_highPt_Forward->Fill(jet->HFEMEnergyFraction());
00883             if(mHFHFrac_highPt_Forward) mHFHFrac_highPt_Forward->Fill(jet->HFHadronEnergyFraction());
00884             //
00885             if(mHFEEn_highPt_Forward) mHFEEn_highPt_Forward->Fill(jet->HFEMEnergy());
00886             if(mHFHEn_highPt_Forward) mHFHEn_highPt_Forward->Fill(jet->HFHadronEnergy());
00887           }
00888           if(mChMultiplicity_lowPt_Forward)  mChMultiplicity_lowPt_Forward->Fill(jet->chargedMultiplicity());
00889           if(mNeuMultiplicity_lowPt_Forward)  mNeuMultiplicity_lowPt_Forward->Fill(jet->neutralMultiplicity());
00890           if(mMuMultiplicity_lowPt_Forward)  mMuMultiplicity_lowPt_Forward->Fill(jet->muonMultiplicity());
00891           if(mChMultiplicity_mediumPt_Forward)  mChMultiplicity_mediumPt_Forward->Fill(jet->chargedMultiplicity());
00892           if(mNeuMultiplicity_mediumPt_Forward)  mNeuMultiplicity_mediumPt_Forward->Fill(jet->neutralMultiplicity());
00893           if(mMuMultiplicity_mediumPt_Forward)  mMuMultiplicity_mediumPt_Forward->Fill(jet->muonMultiplicity());
00894           if(mChMultiplicity_highPt_Forward)  mChMultiplicity_highPt_Forward->Fill(jet->chargedMultiplicity());
00895           if(mNeuMultiplicity_highPt_Forward)  mNeuMultiplicity_highPt_Forward->Fill(jet->neutralMultiplicity());
00896           if(mMuMultiplicity_highPt_Forward)  mMuMultiplicity_highPt_Forward->Fill(jet->muonMultiplicity());
00897           if(mHFHFracVSpT_Forward) mHFHFracVSpT_Forward->Fill(jet->pt(),jet->HFHadronEnergyFraction());
00898           if(mHFEFracVSpT_Forward) mHFEFracVSpT_Forward->Fill(jet->pt(),jet->HFEMEnergyFraction());
00899         }
00900         //if (mE) mE->Fill (jet->energy());
00901         //if (mP) mP->Fill (jet->p());
00902         //if (mMass) mMass->Fill (jet->mass());
00903             
00904         if (mChargedHadronEnergy)  mChargedHadronEnergy->Fill (jet->chargedHadronEnergy());
00905         if (mNeutralHadronEnergy)  mNeutralHadronEnergy->Fill (jet->neutralHadronEnergy());
00906         if (mChargedEmEnergy) mChargedEmEnergy->Fill(jet->chargedEmEnergy());
00907         if (mChargedMuEnergy) mChargedMuEnergy->Fill (jet->chargedMuEnergy ());
00908         if (mNeutralEmEnergy) mNeutralEmEnergy->Fill(jet->neutralEmEnergy());
00909         if (mChargedMultiplicity ) mChargedMultiplicity->Fill(jet->chargedMultiplicity());
00910         if (mNeutralMultiplicity ) mNeutralMultiplicity->Fill(jet->neutralMultiplicity());
00911         if (mMuonMultiplicity )mMuonMultiplicity->Fill (jet-> muonMultiplicity());
00912         //_______________________________________________________
00913         if (mNeutralFraction) mNeutralFraction->Fill (jet->neutralMultiplicity()/jet->nConstituents());
00914       
00915         //calculate correctly the dphi
00916         if(numofjets>1) {
00917           diff = fabs(fstPhi - sndPhi);
00918           corr = 2*acos(-1.) - diff;
00919           if(diff < acos(-1.)) { 
00920             dphi = diff; 
00921           } else { 
00922             dphi = corr;
00923           }
00924         } // numofjets>1
00925       } // JetPt>_ptThreshold
00926     } // PF jet loop
00927     if (mNJets)   mNJets->Fill (numofjets);
00928     if (mDPhi)    mDPhi->Fill (dphi);
00929   } // non dijet selection
00930 }