CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFJetAnalyzer.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/04/12 15:42:58 $
5  * $Revision: 1.24 $
6  * \author F. Chlebana - Fermilab
7  */
8 
11 
13 
15 
16 #include <string>
17 using namespace edm;
18 
19 
21 
22  parameters = pSet;
23  _leadJetFlag = 0;
24  _JetLoPass = 0;
25  _JetHiPass = 0;
26  _ptThreshold = 5.;
27  _asymmetryThirdJetCut = 30.;
28  _balanceThirdJetCut = 0.2;
29  _LooseCHFMin = -999.;
30  _LooseNHFMax = -999.;
31  _LooseCEFMax = -999.;
32  _LooseNEFMax = -999.;
33  _TightCHFMin = -999.;
34  _TightNHFMax = -999.;
35  _TightCEFMax = -999.;
36  _TightNEFMax = -999.;
37  _ThisCHFMin = -999.;
38  _ThisNHFMax = -999.;
39  _ThisCEFMax = -999.;
40  _ThisNEFMax = -999.;
41 
42 }
43 
44 
46 
47 
49 
50  metname = "pFJetAnalyzer";
51 
52  LogTrace(metname)<<"[PFJetAnalyzer] Parameters initialization";
53  //dbe->setCurrentFolder("JetMET/Jet/PFJets");//old version, now name set to source, which
54  //can be set for each instance of PFJetAnalyzer called inside JetMETAnalyzer. Useful, e.g., to
55  //name differently the dir for all jets and cleaned jets
56  dbe->setCurrentFolder("JetMET/Jet/"+_source);
57  // dbe->setCurrentFolder("JetMET/Jet/PFJets");
58 
59  jetME = dbe->book1D("jetReco", "jetReco", 3, 1, 4);
60  jetME->setBinLabel(2,"PFJets",1);
61 
62  // monitoring of eta parameter
63  etaBin = parameters.getParameter<int>("etaBin");
64  etaMin = parameters.getParameter<double>("etaMin");
65  etaMax = parameters.getParameter<double>("etaMax");
66 
67  // monitoring of phi paramater
68  phiBin = parameters.getParameter<int>("phiBin");
69  phiMin = parameters.getParameter<double>("phiMin");
70  phiMax = parameters.getParameter<double>("phiMax");
71 
72  // monitoring of the transverse momentum
73  ptBin = parameters.getParameter<int>("ptBin");
74  ptMin = parameters.getParameter<double>("ptMin");
75  ptMax = parameters.getParameter<double>("ptMax");
76 
77  //
78  eBin = parameters.getParameter<int>("eBin");
79  eMin = parameters.getParameter<double>("eMin");
80  eMax = parameters.getParameter<double>("eMax");
81 
82  //
83  pBin = parameters.getParameter<int>("pBin");
84  pMin = parameters.getParameter<double>("pMin");
85  pMax = parameters.getParameter<double>("pMax");
86 
87  _ptThreshold = parameters.getParameter<double>("ptThreshold");
88  _asymmetryThirdJetCut = parameters.getParameter<double>("asymmetryThirdJetCut");
89  _balanceThirdJetCut = parameters.getParameter<double>("balanceThirdJetCut");
90 
91  _TightCHFMin = parameters.getParameter<double>("TightCHFMin");
92  _TightNHFMax = parameters.getParameter<double>("TightNHFMax");
93  _TightCEFMax = parameters.getParameter<double>("TightCEFMax");
94  _TightNEFMax = parameters.getParameter<double>("TightNEFMax");
95  _LooseCHFMin = parameters.getParameter<double>("LooseCHFMin");
96  _LooseNHFMax = parameters.getParameter<double>("LooseNHFMax");
97  _LooseCEFMax = parameters.getParameter<double>("LooseCEFMax");
98  _LooseNEFMax = parameters.getParameter<double>("LooseNEFMax");
99 
100  fillpfJIDPassFrac = parameters.getParameter<int>("fillpfJIDPassFrac");
101  makedijetselection = parameters.getParameter<int>("makedijetselection");
102 
103  _ThisCHFMin = parameters.getParameter<double>("ThisCHFMin");
104  _ThisNHFMax = parameters.getParameter<double>("ThisNHFMax");
105  _ThisCEFMax = parameters.getParameter<double>("ThisCEFMax");
106  _ThisNEFMax = parameters.getParameter<double>("ThisNEFMax");
107 
108  // Generic Jet Parameters
109  mPt = dbe->book1D("Pt", "Pt", ptBin, ptMin, ptMax);
110  mEta = dbe->book1D("Eta", "Eta", etaBin, etaMin, etaMax);
111  mPhi = dbe->book1D("Phi", "Phi", phiBin, phiMin, phiMax);
112  mConstituents = dbe->book1D("Constituents", "# of constituents", 50, 0, 100);
113  mHFrac = dbe->book1D("HFrac", "HFrac", 120, -0.1, 1.1);
114  mEFrac = dbe->book1D("EFrac", "EFrac", 120, -0.1, 1.1);
115 
116 
117  // Book NPV profiles
118  //----------------------------------------------------------------------------
119  mPt_profile = dbe->bookProfile("Pt_profile", "pt", nbinsPV, PVlow, PVup, ptBin, ptMin, ptMax);
120  mEta_profile = dbe->bookProfile("Eta_profile", "eta", nbinsPV, PVlow, PVup, etaBin, etaMin, etaMax);
121  mPhi_profile = dbe->bookProfile("Phi_profile", "phi", nbinsPV, PVlow, PVup, phiBin, phiMin, phiMax);
122  mConstituents_profile = dbe->bookProfile("Constituents_profile", "# of constituents", nbinsPV, PVlow, PVup, 50, 0, 100);
123  mHFrac_profile = dbe->bookProfile("HFrac_profile", "Hfrac", nbinsPV, PVlow, PVup, 120, -0.1, 1.1);
124  mEFrac_profile = dbe->bookProfile("EFrac_profile", "Efrac", nbinsPV, PVlow, PVup, 120, -0.1, 1.1);
125 
126 
127  // Set NPV profiles x-axis title
128  //----------------------------------------------------------------------------
129  mPt_profile ->setAxisTitle("nvtx",1);
130  mEta_profile ->setAxisTitle("nvtx",1);
131  mPhi_profile ->setAxisTitle("nvtx",1);
132  mConstituents_profile->setAxisTitle("nvtx",1);
133  mHFrac_profile ->setAxisTitle("nvtx",1);
134  mEFrac_profile ->setAxisTitle("nvtx",1);
135 
136 
137  //mE = dbe->book1D("E", "E", eBin, eMin, eMax);
138  //mP = dbe->book1D("P", "P", pBin, pMin, pMax);
139  //mMass = dbe->book1D("Mass", "Mass", 100, 0, 25);
140  //
141  mPhiVSEta = dbe->book2D("PhiVSEta", "PhiVSEta", 50, etaMin, etaMax, 24, phiMin, phiMax);
142 
143  if(makedijetselection!=1) {
144  mPt_1 = dbe->book1D("Pt1", "Pt1", 50, 0, 100);
145  mPt_2 = dbe->book1D("Pt2", "Pt2", 60, 0, 300);
146  mPt_3 = dbe->book1D("Pt3", "Pt3", 100, 0, 5000);
147 
148  // Low and high pt trigger paths
149  mPt_Lo = dbe->book1D("Pt_Lo", "Pt (Pass Low Pt Jet Trigger)", 20, 0, 100);
150  //mEta_Lo = dbe->book1D("Eta_Lo", "Eta (Pass Low Pt Jet Trigger)", etaBin, etaMin, etaMax);
151  mPhi_Lo = dbe->book1D("Phi_Lo", "Phi (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
152 
153  mPt_Hi = dbe->book1D("Pt_Hi", "Pt (Pass Hi Pt Jet Trigger)", 100, 0, 300);
154  mEta_Hi = dbe->book1D("Eta_Hi", "Eta (Pass Hi Pt Jet Trigger)", etaBin, etaMin, etaMax);
155  mPhi_Hi = dbe->book1D("Phi_Hi", "Phi (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
156 
157  mNJets = dbe->book1D("NJets", "number of jets", 100, 0, 100);
158 
159  mCHFracVSeta_lowPt= dbe->bookProfile("CHFracVSeta_lowPt","CHFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
160  mNHFracVSeta_lowPt= dbe->bookProfile("NHFracVSeta_lowPt","NHFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
161  mPhFracVSeta_lowPt= dbe->bookProfile("PhFracVSeta_lowPt","PhFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
162  mElFracVSeta_lowPt= dbe->bookProfile("ElFracVSeta_lowPt","ElFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
163  mMuFracVSeta_lowPt= dbe->bookProfile("MuFracVSeta_lowPt","MuFracVSeta_lowPt",etaBin, etaMin, etaMax,0.,1.2);
164  mCHFracVSeta_mediumPt= dbe->bookProfile("CHFracVSeta_mediumPt","CHFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
165  mNHFracVSeta_mediumPt= dbe->bookProfile("NHFracVSeta_mediumPt","NHFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
166  mPhFracVSeta_mediumPt= dbe->bookProfile("PhFracVSeta_mediumPt","PhFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
167  mElFracVSeta_mediumPt= dbe->bookProfile("ElFracVSeta_mediumPt","ElFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
168  mMuFracVSeta_mediumPt= dbe->bookProfile("MuFracVSeta_mediumPt","MuFracVSeta_mediumPt",etaBin, etaMin, etaMax,0.,1.2);
169  mCHFracVSeta_highPt= dbe->bookProfile("CHFracVSeta_highPt","CHFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
170  mNHFracVSeta_highPt= dbe->bookProfile("NHFracVSeta_highPt","NHFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
171  mPhFracVSeta_highPt= dbe->bookProfile("PhFracVSeta_highPt","PhFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
172  mElFracVSeta_highPt= dbe->bookProfile("ElFracVSeta_highPt","ElFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
173  mMuFracVSeta_highPt= dbe->bookProfile("MuFracVSeta_highPt","MuFracVSeta_highPt",etaBin, etaMin, etaMax,0.,1.2);
174 
175  //mPt_Barrel_Lo = dbe->book1D("Pt_Barrel_Lo", "Pt Barrel (Pass Low Pt Jet Trigger)", 20, 0, 100);
176  //mPhi_Barrel_Lo = dbe->book1D("Phi_Barrel_Lo", "Phi Barrel (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
177  mConstituents_Barrel = dbe->book1D("Constituents_Barrel", "Constituents Barrel", 50, 0, 100);
178  mHFrac_Barrel = dbe->book1D("HFrac_Barrel", "HFrac Barrel", 100, 0, 1);
179  mEFrac_Barrel = dbe->book1D("EFrac_Barrel", "EFrac Barrel", 110, -0.05, 1.05);
180 
181  //mPt_EndCap_Lo = dbe->book1D("Pt_EndCap_Lo", "Pt EndCap (Pass Low Pt Jet Trigger)", 20, 0, 100);
182  //mPhi_EndCap_Lo = dbe->book1D("Phi_EndCap_Lo", "Phi EndCap (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
183  mConstituents_EndCap = dbe->book1D("Constituents_EndCap", "Constituents EndCap", 50, 0, 100);
184  mHFrac_EndCap = dbe->book1D("HFrac_Endcap", "HFrac EndCap", 100, 0, 1);
185  mEFrac_EndCap = dbe->book1D("EFrac_Endcap", "EFrac EndCap", 110, -0.05, 1.05);
186 
187  //mPt_Forward_Lo = dbe->book1D("Pt_Forward_Lo", "Pt Forward (Pass Low Pt Jet Trigger)", 20, 0, 100);
188  //mPhi_Forward_Lo = dbe->book1D("Phi_Forward_Lo", "Phi Forward (Pass Low Pt Jet Trigger)", phiBin, phiMin, phiMax);
189  mConstituents_Forward = dbe->book1D("Constituents_Forward", "Constituents Forward", 50, 0, 100);
190  mHFrac_Forward = dbe->book1D("HFrac_Forward", "HFrac Forward", 100, 0, 1);
191  mEFrac_Forward = dbe->book1D("EFrac_Forward", "EFrac Forward", 110, -0.05, 1.05);
192 
193  mPt_Barrel_Hi = dbe->book1D("Pt_Barrel_Hi", "Pt Barrel (Pass Hi Pt Jet Trigger)", 60, 0, 300);
194  mPhi_Barrel_Hi = dbe->book1D("Phi_Barrel_Hi", "Phi Barrel (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
195  //mConstituents_Barrel_Hi = dbe->book1D("Constituents_Barrel_Hi", "Constituents Barrel (Pass Hi Pt Jet Trigger)", 50, 0, 100);
196  //mHFrac_Barrel_Hi = dbe->book1D("HFrac_Barrel_Hi", "HFrac Barrel (Pass Hi Pt Jet Trigger)", 100, 0, 1);
197 
198  mPt_EndCap_Hi = dbe->book1D("Pt_EndCap_Hi", "Pt EndCap (Pass Hi Pt Jet Trigger)", 60, 0, 300);
199  mPhi_EndCap_Hi = dbe->book1D("Phi_EndCap_Hi", "Phi EndCap (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
200  //mConstituents_EndCap_Hi = dbe->book1D("Constituents_EndCap_Hi", "Constituents EndCap (Pass Hi Pt Jet Trigger)", 50, 0, 100);
201  //mHFrac_EndCap_Hi = dbe->book1D("HFrac_EndCap_Hi", "HFrac EndCap (Pass Hi Pt Jet Trigger)", 100, 0, 1);
202 
203  mPt_Forward_Hi = dbe->book1D("Pt_Forward_Hi", "Pt Forward (Pass Hi Pt Jet Trigger)", 60, 0, 300);
204  mPhi_Forward_Hi = dbe->book1D("Phi_Forward_Hi", "Phi Forward (Pass Hi Pt Jet Trigger)", phiBin, phiMin, phiMax);
205  //mConstituents_Forward_Hi = dbe->book1D("Constituents_Forward_Hi", "Constituents Forward (Pass Hi Pt Jet Trigger)", 50, 0, 100);
206  //mHFrac_Forward_Hi = dbe->book1D("HFrac_Forward_Hi", "HFrac Forward (Pass Hi Pt Jet Trigger)", 100, 0, 1);
207 
208  mPhi_Barrel = dbe->book1D("Phi_Barrel", "Phi_Barrel", phiBin, phiMin, phiMax);
209  //mE_Barrel = dbe->book1D("E_Barrel", "E_Barrel", eBin, eMin, eMax);
210  mPt_Barrel = dbe->book1D("Pt_Barrel", "Pt_Barrel", ptBin, ptMin, ptMax);
211  // energy fractions
212  mCHFrac_lowPt_Barrel = dbe->book1D("CHFrac_lowPt_Barrel", "CHFrac_lowPt_Barrel", 120, -0.1, 1.1);
213  mNHFrac_lowPt_Barrel = dbe->book1D("NHFrac_lowPt_Barrel", "NHFrac_lowPt_Barrel", 120, -0.1, 1.1);
214  mPhFrac_lowPt_Barrel = dbe->book1D("PhFrac_lowPt_Barrel", "PhFrac_lowPt_Barrel", 120, -0.1, 1.1);
215  mElFrac_lowPt_Barrel = dbe->book1D("ElFrac_lowPt_Barrel", "ElFrac_lowPt_Barrel", 120, -0.1, 1.1);
216  mMuFrac_lowPt_Barrel = dbe->book1D("MuFrac_lowPt_Barrel", "MuFrac_lowPt_Barrel", 120, -0.1, 1.1);
217  mCHFrac_mediumPt_Barrel = dbe->book1D("CHFrac_mediumPt_Barrel", "CHFrac_mediumPt_Barrel", 120, -0.1, 1.1);
218  mNHFrac_mediumPt_Barrel = dbe->book1D("NHFrac_mediumPt_Barrel", "NHFrac_mediumPt_Barrel", 120, -0.1, 1.1);
219  mPhFrac_mediumPt_Barrel = dbe->book1D("PhFrac_mediumPt_Barrel", "PhFrac_mediumPt_Barrel", 120, -0.1, 1.1);
220  mElFrac_mediumPt_Barrel = dbe->book1D("ElFrac_mediumPt_Barrel", "ElFrac_mediumPt_Barrel", 120, -0.1, 1.1);
221  mMuFrac_mediumPt_Barrel = dbe->book1D("MuFrac_mediumPt_Barrel", "MuFrac_mediumPt_Barrel", 120, -0.1, 1.1);
222  mCHFrac_highPt_Barrel = dbe->book1D("CHFrac_highPt_Barrel", "CHFrac_highPt_Barrel", 120, -0.1, 1.1);
223  mNHFrac_highPt_Barrel = dbe->book1D("NHFrac_highPt_Barrel", "NHFrac_highPt_Barrel", 120, -0.1, 1.1);
224  mPhFrac_highPt_Barrel = dbe->book1D("PhFrac_highPt_Barrel", "PhFrac_highPt_Barrel", 120, -0.1, 1.1);
225  mElFrac_highPt_Barrel = dbe->book1D("ElFrac_highPt_Barrel", "ElFrac_highPt_Barrel", 120, -0.1, 1.1);
226  mMuFrac_highPt_Barrel = dbe->book1D("MuFrac_highPt_Barrel", "MuFrac_highPt_Barrel", 120, -0.1, 1.1);
227  //energies
228  mCHEn_lowPt_Barrel = dbe->book1D("CHEn_lowPt_Barrel", "CHEn_lowPt_Barrel", ptBin, ptMin, ptMax);
229  mNHEn_lowPt_Barrel = dbe->book1D("NHEn_lowPt_Barrel", "NHEn_lowPt_Barrel", ptBin, ptMin, ptMax);
230  mPhEn_lowPt_Barrel = dbe->book1D("PhEn_lowPt_Barrel", "PhEn_lowPt_Barrel", ptBin, ptMin, ptMax);
231  mElEn_lowPt_Barrel = dbe->book1D("ElEn_lowPt_Barrel", "ElEn_lowPt_Barrel", ptBin, ptMin, ptMax);
232  mMuEn_lowPt_Barrel = dbe->book1D("MuEn_lowPt_Barrel", "MuEn_lowPt_Barrel", ptBin, ptMin, ptMax);
233  mCHEn_mediumPt_Barrel = dbe->book1D("CHEn_mediumPt_Barrel", "CHEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
234  mNHEn_mediumPt_Barrel = dbe->book1D("NHEn_mediumPt_Barrel", "NHEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
235  mPhEn_mediumPt_Barrel = dbe->book1D("PhEn_mediumPt_Barrel", "PhEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
236  mElEn_mediumPt_Barrel = dbe->book1D("ElEn_mediumPt_Barrel", "ElEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
237  mMuEn_mediumPt_Barrel = dbe->book1D("MuEn_mediumPt_Barrel", "MuEn_mediumPt_Barrel", ptBin, ptMin, ptMax);
238  mCHEn_highPt_Barrel = dbe->book1D("CHEn_highPt_Barrel", "CHEn_highPt_Barrel", ptBin, ptMin, ptMax);
239  mNHEn_highPt_Barrel = dbe->book1D("NHEn_highPt_Barrel", "NHEn_highPt_Barrel", ptBin, ptMin, ptMax);
240  mPhEn_highPt_Barrel = dbe->book1D("PhEn_highPt_Barrel", "PhEn_highPt_Barrel", ptBin, ptMin, ptMax);
241  mElEn_highPt_Barrel = dbe->book1D("ElEn_highPt_Barrel", "ElEn_highPt_Barrel", ptBin, ptMin, ptMax);
242  mMuEn_highPt_Barrel = dbe->book1D("MuEn_highPt_Barrel", "MuEn_highPt_Barrel", ptBin, ptMin, ptMax);
243  //multiplicities
244  mChMultiplicity_lowPt_Barrel = dbe->book1D("ChMultiplicity_lowPt_Barrel", "ChMultiplicity_lowPt_Barrel", 30,0,30);
245  mNeuMultiplicity_lowPt_Barrel = dbe->book1D("NeuMultiplicity_lowPt_Barrel", "NeuMultiplicity_lowPt_Barrel", 30,0,30);
246  mMuMultiplicity_lowPt_Barrel = dbe->book1D("MuMultiplicity_lowPt_Barrel", "MuMultiplicity_lowPt_Barrel", 30,0,30);
247  mChMultiplicity_mediumPt_Barrel = dbe->book1D("ChMultiplicity_mediumPt_Barrel", "ChMultiplicity_mediumPt_Barrel", 30,0,30);
248  mNeuMultiplicity_mediumPt_Barrel = dbe->book1D("NeuMultiplicity_mediumPt_Barrel", "NeuMultiplicity_mediumPt_Barrel", 30,0,30);
249  mMuMultiplicity_mediumPt_Barrel = dbe->book1D("MuMultiplicity_mediumPt_Barrel", "MuMultiplicity_mediumPt_Barrel", 30,0,30);
250  mChMultiplicity_highPt_Barrel = dbe->book1D("ChMultiplicity_highPt_Barrel", "ChMultiplicity_highPt_Barrel", 30,0,30);
251  mNeuMultiplicity_highPt_Barrel = dbe->book1D("NeuMultiplicity_highPt_Barrel", "NeuMultiplicity_highPt_Barrel", 30,0,30);
252  mMuMultiplicity_highPt_Barrel = dbe->book1D("MuMultiplicity_highPt_Barrel", "MuMultiplicity_highPt_Barrel", 30,0,30);
253  //
254  mCHFracVSpT_Barrel= dbe->bookProfile("CHFracVSpT_Barrel","CHFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
255  mNHFracVSpT_Barrel= dbe->bookProfile("NHFracVSpT_Barrel","NHFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
256  mPhFracVSpT_Barrel= dbe->bookProfile("PhFracVSpT_Barrel","PhFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
257  mElFracVSpT_Barrel= dbe->bookProfile("ElFracVSpT_Barrel","ElFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
258  mMuFracVSpT_Barrel= dbe->bookProfile("MuFracVSpT_Barrel","MuFracVSpT_Barrel",ptBin, ptMin, ptMax,0.,1.2);
259  mCHFracVSpT_EndCap= dbe->bookProfile("CHFracVSpT_EndCap","CHFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
260  mNHFracVSpT_EndCap= dbe->bookProfile("NHFracVSpT_EndCap","NHFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
261  mPhFracVSpT_EndCap= dbe->bookProfile("PhFracVSpT_EndCap","PhFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
262  mElFracVSpT_EndCap= dbe->bookProfile("ElFracVSpT_EndCap","ElFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
263  mMuFracVSpT_EndCap= dbe->bookProfile("MuFracVSpT_EndCap","MuFracVSpT_EndCap",ptBin, ptMin, ptMax,0.,1.2);
264  mHFHFracVSpT_Forward= dbe->bookProfile("HFHFracVSpT_Forward","HFHFracVSpT_Forward",ptBin, ptMin, ptMax,0.,1.2);
265  mHFEFracVSpT_Forward= dbe->bookProfile("HFEFracVSpT_Forward","HFEFracVSpT_Forward",ptBin, ptMin, ptMax,0.,1.2);
266 
267  mPhi_EndCap = dbe->book1D("Phi_EndCap", "Phi_EndCap", phiBin, phiMin, phiMax);
268  //mE_EndCap = dbe->book1D("E_EndCap", "E_EndCap", eBin, eMin, eMax);
269  mPt_EndCap = dbe->book1D("Pt_EndCap", "Pt_EndCap", ptBin, ptMin, ptMax);
270  //energy fractions
271  mCHFrac_lowPt_EndCap = dbe->book1D("CHFrac_lowPt_EndCap", "CHFrac_lowPt_EndCap", 120, -0.1, 1.1);
272  mNHFrac_lowPt_EndCap = dbe->book1D("NHFrac_lowPt_EndCap", "NHFrac_lowPt_EndCap", 120, -0.1, 1.1);
273  mPhFrac_lowPt_EndCap = dbe->book1D("PhFrac_lowPt_EndCap", "PhFrac_lowPt_EndCap", 120, -0.1, 1.1);
274  mElFrac_lowPt_EndCap = dbe->book1D("ElFrac_lowPt_EndCap", "ElFrac_lowPt_EndCap", 120, -0.1, 1.1);
275  mMuFrac_lowPt_EndCap = dbe->book1D("MuFrac_lowPt_EndCap", "MuFrac_lowPt_EndCap", 120, -0.1, 1.1);
276  mCHFrac_mediumPt_EndCap = dbe->book1D("CHFrac_mediumPt_EndCap", "CHFrac_mediumPt_EndCap", 120, -0.1, 1.1);
277  mNHFrac_mediumPt_EndCap = dbe->book1D("NHFrac_mediumPt_EndCap", "NHFrac_mediumPt_EndCap", 120, -0.1, 1.1);
278  mPhFrac_mediumPt_EndCap = dbe->book1D("PhFrac_mediumPt_EndCap", "PhFrac_mediumPt_EndCap", 120, -0.1, 1.1);
279  mElFrac_mediumPt_EndCap = dbe->book1D("ElFrac_mediumPt_EndCap", "ElFrac_mediumPt_EndCap", 120, -0.1, 1.1);
280  mMuFrac_mediumPt_EndCap = dbe->book1D("MuFrac_mediumPt_EndCap", "MuFrac_mediumPt_EndCap", 120, -0.1, 1.1);
281  mCHFrac_highPt_EndCap = dbe->book1D("CHFrac_highPt_EndCap", "CHFrac_highPt_EndCap", 120, -0.1, 1.1);
282  mNHFrac_highPt_EndCap = dbe->book1D("NHFrac_highPt_EndCap", "NHFrac_highPt_EndCap", 120, -0.1, 1.1);
283  mPhFrac_highPt_EndCap = dbe->book1D("PhFrac_highPt_EndCap", "PhFrac_highPt_EndCap", 120, -0.1, 1.1);
284  mElFrac_highPt_EndCap = dbe->book1D("ElFrac_highPt_EndCap", "ElFrac_highPt_EndCap", 120, -0.1, 1.1);
285  mMuFrac_highPt_EndCap = dbe->book1D("MuFrac_highPt_EndCap", "MuFrac_highPt_EndCap", 120, -0.1, 1.1);
286  //energies
287  mCHEn_lowPt_EndCap = dbe->book1D("CHEn_lowPt_EndCap", "CHEn_lowPt_EndCap", ptBin, ptMin, ptMax);
288  mNHEn_lowPt_EndCap = dbe->book1D("NHEn_lowPt_EndCap", "NHEn_lowPt_EndCap", ptBin, ptMin, ptMax);
289  mPhEn_lowPt_EndCap = dbe->book1D("PhEn_lowPt_EndCap", "PhEn_lowPt_EndCap", ptBin, ptMin, ptMax);
290  mElEn_lowPt_EndCap = dbe->book1D("ElEn_lowPt_EndCap", "ElEn_lowPt_EndCap", ptBin, ptMin, ptMax);
291  mMuEn_lowPt_EndCap = dbe->book1D("MuEn_lowPt_EndCap", "MuEn_lowPt_EndCap", ptBin, ptMin, ptMax);
292  mCHEn_mediumPt_EndCap = dbe->book1D("CHEn_mediumPt_EndCap", "CHEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
293  mNHEn_mediumPt_EndCap = dbe->book1D("NHEn_mediumPt_EndCap", "NHEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
294  mPhEn_mediumPt_EndCap = dbe->book1D("PhEn_mediumPt_EndCap", "PhEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
295  mElEn_mediumPt_EndCap = dbe->book1D("ElEn_mediumPt_EndCap", "ElEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
296  mMuEn_mediumPt_EndCap = dbe->book1D("MuEn_mediumPt_EndCap", "MuEn_mediumPt_EndCap", ptBin, ptMin, ptMax);
297  mCHEn_highPt_EndCap = dbe->book1D("CHEn_highPt_EndCap", "CHEn_highPt_EndCap", ptBin, ptMin, ptMax);
298  mNHEn_highPt_EndCap = dbe->book1D("NHEn_highPt_EndCap", "NHEn_highPt_EndCap", ptBin, ptMin, ptMax);
299  mPhEn_highPt_EndCap = dbe->book1D("PhEn_highPt_EndCap", "PhEn_highPt_EndCap", ptBin, ptMin, ptMax);
300  mElEn_highPt_EndCap = dbe->book1D("ElEn_highPt_EndCap", "ElEn_highPt_EndCap", ptBin, ptMin, ptMax);
301  mMuEn_highPt_EndCap = dbe->book1D("MuEn_highPt_EndCap", "MuEn_highPt_EndCap", ptBin, ptMin, ptMax);
302  //multiplicities
303  mChMultiplicity_lowPt_EndCap = dbe->book1D("ChMultiplicity_lowPt_EndCap", "ChMultiplicity_lowPt_EndCap", 30,0,30);
304  mNeuMultiplicity_lowPt_EndCap = dbe->book1D("NeuMultiplicity_lowPt_EndCap", "NeuMultiplicity_lowPt_EndCap", 30,0,30);
305  mMuMultiplicity_lowPt_EndCap = dbe->book1D("MuMultiplicity_lowPt_EndCap", "MuMultiplicity_lowPt_EndCap", 30,0,30);
306  mChMultiplicity_mediumPt_EndCap = dbe->book1D("ChMultiplicity_mediumPt_EndCap", "ChMultiplicity_mediumPt_EndCap", 30,0,30);
307  mNeuMultiplicity_mediumPt_EndCap = dbe->book1D("NeuMultiplicity_mediumPt_EndCap", "NeuMultiplicity_mediumPt_EndCap", 30,0,30);
308  mMuMultiplicity_mediumPt_EndCap = dbe->book1D("MuMultiplicity_mediumPt_EndCap", "MuMultiplicity_mediumPt_EndCap", 30,0,30);
309  mChMultiplicity_highPt_EndCap = dbe->book1D("ChMultiplicity_highPt_EndCap", "ChMultiplicity_highPt_EndCap", 30,0,30);
310  mNeuMultiplicity_highPt_EndCap = dbe->book1D("NeuMultiplicity_highPt_EndCap", "NeuMultiplicity_highPt_EndCap", 30,0,30);
311  mMuMultiplicity_highPt_EndCap = dbe->book1D("MuMultiplicity_highPt_EndCap", "MuMultiplicity_highPt_EndCap", 30,0,30);
312 
313  mPhi_Forward = dbe->book1D("Phi_Forward", "Phi_Forward", phiBin, phiMin, phiMax);
314  //mE_Forward = dbe->book1D("E_Forward", "E_Forward", eBin, eMin, eMax);
315  mPt_Forward = dbe->book1D("Pt_Forward", "Pt_Forward", ptBin, ptMin, ptMax);
316  //energy fraction
317  mHFEFrac_lowPt_Forward = dbe->book1D("HFEFrac_lowPt_Forward", "HFEFrac_lowPt_Forward", 120, -0.1, 1.1);
318  mHFHFrac_lowPt_Forward = dbe->book1D("HFHFrac_lowPt_Forward", "HFHFrac_lowPt_Forward", 120, -0.1, 1.1);
319  mHFEFrac_mediumPt_Forward = dbe->book1D("HFEFrac_mediumPt_Forward", "HFEFrac_mediumPt_Forward", 120, -0.1, 1.1);
320  mHFHFrac_mediumPt_Forward = dbe->book1D("HFHFrac_mediumPt_Forward", "HFHFrac_mediumPt_Forward", 120, -0.1, 1.1);
321  mHFEFrac_highPt_Forward = dbe->book1D("HFEFrac_highPt_Forward", "HFEFrac_highPt_Forward", 120, -0.1, 1.1);
322  mHFHFrac_highPt_Forward = dbe->book1D("HFHFrac_highPt_Forward", "HFHFrac_highPt_Forward", 120, -0.1, 1.1);
323  //energies
324  mHFEEn_lowPt_Forward = dbe->book1D("HFEEn_lowPt_Forward", "HFEEn_lowPt_Forward", ptBin, ptMin, ptMax);
325  mHFHEn_lowPt_Forward = dbe->book1D("HFHEn_lowPt_Forward", "HFHEn_lowPt_Forward", ptBin, ptMin, ptMax);
326  mHFEEn_mediumPt_Forward = dbe->book1D("HFEEn_mediumPt_Forward", "HFEEn_mediumPt_Forward", ptBin, ptMin, ptMax);
327  mHFHEn_mediumPt_Forward = dbe->book1D("HFHEn_mediumPt_Forward", "HFHEn_mediumPt_Forward", ptBin, ptMin, ptMax);
328  mHFEEn_highPt_Forward = dbe->book1D("HFEEn_highPt_Forward", "HFEEn_highPt_Forward", ptBin, ptMin, ptMax);
329  mHFHEn_highPt_Forward = dbe->book1D("HFHEn_highPt_Forward", "HFHEn_highPt_Forward", ptBin, ptMin, ptMax);
330  //multiplicities
331  mChMultiplicity_lowPt_Forward = dbe->book1D("ChMultiplicity_lowPt_Forward", "ChMultiplicity_lowPt_Forward", 30,0,30);
332  mNeuMultiplicity_lowPt_Forward = dbe->book1D("NeuMultiplicity_lowPt_Forward", "NeuMultiplicity_lowPt_Forward", 30,0,30);
333  mMuMultiplicity_lowPt_Forward = dbe->book1D("MuMultiplicity_lowPt_Forward", "MuMultiplicity_lowPt_Forward", 30,0,30);
334  mChMultiplicity_mediumPt_Forward = dbe->book1D("ChMultiplicity_mediumPt_Forward", "ChMultiplicity_mediumPt_Forward", 30,0,30);
335  mNeuMultiplicity_mediumPt_Forward = dbe->book1D("NeuMultiplicity_mediumPt_Forward", "NeuMultiplicity_mediumPt_Forward", 30,0,30);
336  mMuMultiplicity_mediumPt_Forward = dbe->book1D("MuMultiplicity_mediumPt_Forward", "MuMultiplicity_mediumPt_Forward", 30,0,30);
337  mChMultiplicity_highPt_Forward = dbe->book1D("ChMultiplicity_highPt_Forward", "ChMultiplicity_highPt_Forward", 30,0,30);
338  mNeuMultiplicity_highPt_Forward = dbe->book1D("NeuMultiplicity_highPt_Forward", "NeuMultiplicity_highPt_Forward", 30,0,30);
339  mMuMultiplicity_highPt_Forward = dbe->book1D("MuMultiplicity_highPt_Forward", "MuMultiplicity_highPt_Forward", 30,0,30);
340 
341 
342 
343  // Leading Jet Parameters
344  mEtaFirst = dbe->book1D("EtaFirst", "EtaFirst", 100, -5, 5);
345  mPhiFirst = dbe->book1D("PhiFirst", "PhiFirst", 70, -3.5, 3.5);
346  //mEFirst = dbe->book1D("EFirst", "EFirst", 100, 0, 1000);
347  mPtFirst = dbe->book1D("PtFirst", "PtFirst", 100, 0, 500);
348  if(fillpfJIDPassFrac==1) {
349  mLooseJIDPassFractionVSeta= dbe->bookProfile("LooseJIDPassFractionVSeta","LooseJIDPassFractionVSeta",etaBin, etaMin, etaMax,0.,1.2);
350  mLooseJIDPassFractionVSpt= dbe->bookProfile("LooseJIDPassFractionVSpt","LooseJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
351  mTightJIDPassFractionVSeta= dbe->bookProfile("TightJIDPassFractionVSeta","TightJIDPassFractionVSeta",etaBin, etaMin, etaMax,0.,1.2);
352  mTightJIDPassFractionVSpt= dbe->bookProfile("TightJIDPassFractionVSpt","TightJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
353  }
354  }
355 
356 
357  mChargedHadronEnergy = dbe->book1D("mChargedHadronEnergy", "charged HAD energy", 100, 0, 100);
358  mNeutralHadronEnergy = dbe->book1D("mNeutralHadronEnergy", "neutral HAD energy", 100, 0, 100);
359  mChargedEmEnergy = dbe->book1D("mChargedEmEnergy ", "charged EM energy ", 100, 0, 100);
360  mChargedMuEnergy = dbe->book1D("mChargedMuEnergy", "charged Mu energy", 100, 0, 100);
361  mNeutralEmEnergy = dbe->book1D("mNeutralEmEnergy", "neutral EM energy", 100, 0, 100);
362  mChargedMultiplicity = dbe->book1D("mChargedMultiplicity", "charged multiplicity ", 100, 0, 100);
363  mNeutralMultiplicity = dbe->book1D("mNeutralMultiplicity", "neutral multiplicity", 100, 0, 100);
364  mMuonMultiplicity = dbe->book1D("mMuonMultiplicity", "muon multiplicity", 100, 0, 100);
365 
366 
367  // Book NPV profiles
368  //----------------------------------------------------------------------------
369  mChargedHadronEnergy_profile = dbe->bookProfile("mChargedHadronEnergy_profile", "charged HAD energy", nbinsPV, PVlow, PVup, 100, 0, 100);
370  mNeutralHadronEnergy_profile = dbe->bookProfile("mNeutralHadronEnergy_profile", "neutral HAD energy", nbinsPV, PVlow, PVup, 100, 0, 100);
371  mChargedEmEnergy_profile = dbe->bookProfile("mChargedEmEnergy_profile", "charged EM energy", nbinsPV, PVlow, PVup, 100, 0, 100);
372  mChargedMuEnergy_profile = dbe->bookProfile("mChargedMuEnergy_profile", "charged Mu energy", nbinsPV, PVlow, PVup, 100, 0, 100);
373  mNeutralEmEnergy_profile = dbe->bookProfile("mNeutralEmEnergy_profile", "neutral EM energy", nbinsPV, PVlow, PVup, 100, 0, 100);
374  mChargedMultiplicity_profile = dbe->bookProfile("mChargedMultiplicity_profile", "charged multiplicity", nbinsPV, PVlow, PVup, 100, 0, 100);
375  mNeutralMultiplicity_profile = dbe->bookProfile("mNeutralMultiplicity_profile", "neutral multiplicity", nbinsPV, PVlow, PVup, 100, 0, 100);
376  mMuonMultiplicity_profile = dbe->bookProfile("mMuonMultiplicity_profile", "muon multiplicity", nbinsPV, PVlow, PVup, 100, 0, 100);
377 
378  if (makedijetselection != 1) {
379  mNJets_profile = dbe->bookProfile("NJets_profile", "number of jets", nbinsPV, PVlow, PVup, 100, 0, 100);
380  }
381 
382 
383  // Set NPV profiles x-axis title
384  //----------------------------------------------------------------------------
385  mChargedHadronEnergy_profile->setAxisTitle("nvtx",1);
386  mNeutralHadronEnergy_profile->setAxisTitle("nvtx",1);
387  mChargedEmEnergy_profile ->setAxisTitle("nvtx",1);
388  mChargedMuEnergy_profile ->setAxisTitle("nvtx",1);
389  mNeutralEmEnergy_profile ->setAxisTitle("nvtx",1);
390  mChargedMultiplicity_profile->setAxisTitle("nvtx",1);
391  mNeutralMultiplicity_profile->setAxisTitle("nvtx",1);
392  mMuonMultiplicity_profile ->setAxisTitle("nvtx",1);
393 
394  if (makedijetselection != 1) {
395  mNJets_profile->setAxisTitle("nvtx",1);
396  }
397 
398 
399  //__________________________________________________
400  mNeutralFraction = dbe->book1D("NeutralFraction","Neutral Fraction",100,0,1);
401  //}
402 
403  mDPhi = dbe->book1D("DPhi", "dPhi btw the two leading jets", 100, 0., acos(-1.));
404 
405  if(makedijetselection==1) {
406  mDijetAsymmetry = dbe->book1D("DijetAsymmetry", "DijetAsymmetry", 100, -1., 1.);
407  mDijetBalance = dbe->book1D("DijetBalance", "DijetBalance", 100, -2., 2.);
408  if (fillpfJIDPassFrac==1) {
409  mLooseJIDPassFractionVSeta = dbe->bookProfile("LooseJIDPassFractionVSeta","LooseJIDPassFractionVSeta",50, -3., 3.,0.,1.2);
410  mLooseJIDPassFractionVSpt = dbe->bookProfile("LooseJIDPassFractionVSpt","LooseJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
411  mTightJIDPassFractionVSeta = dbe->bookProfile("TightJIDPassFractionVSeta","TightJIDPassFractionVSeta",50, -3., 3.,0.,1.2);
412  mTightJIDPassFractionVSpt = dbe->bookProfile("TightJIDPassFractionVSpt","TightJIDPassFractionVSpt",ptBin, ptMin, ptMax,0.,1.2);
413 
414  }
415  }
416 
417 }
418 
420 
421 }
422 
424  const edm::EventSetup& iSetup,
426  const int numPV)
427 {
428  int numofjets=0;
429  double fstPhi=0.;
430  double sndPhi=0.;
431  double diff = 0.;
432  double corr = 0.;
433  double dphi = -999. ;
434 
435  bool Thiscleaned=false;
436  bool Loosecleaned=false;
437  bool Tightcleaned=false;
438  bool ThisCHFcleaned=false;
439  bool LooseCHFcleaned=false;
440  bool TightCHFcleaned=false;
441 
442  srand( iEvent.id().event() % 10000);
443 
444 
445  if (makedijetselection == 1) {
446  //Dijet selection - careful: the pT is uncorrected!
447  //if(makedijetselection==1 && pfJets.size()>=2){
448  if(pfJets.size()>=2){
449  double dphiDJ = -999. ;
450 
451  bool LoosecleanedFirstJet =false;
452  bool LoosecleanedSecondJet=false;
453  bool TightcleanedFirstJet =false;
454  bool TightcleanedSecondJet=false;
455  bool LooseCHFcleanedFirstJet =false;
456  bool LooseCHFcleanedSecondJet=false;
457  bool TightCHFcleanedFirstJet =false;
458  bool TightCHFcleanedSecondJet=false;
459 
460  //both jets pass pt threshold
461  if ((pfJets.at(0)).pt() > _ptThreshold && (pfJets.at(1)).pt() > _ptThreshold ) {
462  if(fabs((pfJets.at(0)).eta())<3. && fabs((pfJets.at(1)).eta())<3. ){
463  //calculate dphi
464  dphiDJ = fabs((pfJets.at(0)).phi()-(pfJets.at(1)).phi());
465  if (dphiDJ > 3.14) dphiDJ=fabs(dphiDJ -6.28 );
466  //fill DPhi histo (before cutting)
467  if (mDPhi) mDPhi->Fill (dphiDJ);
468  //dphi cut
469  if(fabs(dphiDJ)>2.1){
470  //first jet
471  LooseCHFcleanedFirstJet=true;
472  TightCHFcleanedFirstJet=true;
473  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
474  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
475  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;
476  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;
477 
478  //second jet
479  LooseCHFcleanedSecondJet=true;
480  TightCHFcleanedSecondJet=true;
481  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
482  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
483  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;
484  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;
485 
486  if(fillpfJIDPassFrac==1) {
487  //fill the profile for jid efficiency
488  if(LoosecleanedFirstJet) {
489  mLooseJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),1.);
490  mLooseJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),1.);
491  } else {
492  mLooseJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),0.);
493  mLooseJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),0.);
494  }
495  if(TightcleanedFirstJet) {
496  mTightJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),1.);
497  mTightJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),1.);
498  } else {
499  mTightJIDPassFractionVSeta->Fill(pfJets.at(0).eta(),0.);
500  mTightJIDPassFractionVSpt->Fill(pfJets.at(0).pt(),0.);
501  }
502 
503  if(LoosecleanedSecondJet) {
504  mLooseJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),1.);
505  mLooseJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),1.);
506  } else {
507  mLooseJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),0.);
508  mLooseJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),0.);
509  }
510  if(TightcleanedSecondJet) {
511  mTightJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),1.);
512  mTightJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),1.);
513  } else {
514  mTightJIDPassFractionVSeta->Fill(pfJets.at(1).eta(),0.);
515  mTightJIDPassFractionVSpt->Fill(pfJets.at(1).pt(),0.);
516  }
517  }
518 
519  if(LoosecleanedFirstJet && LoosecleanedSecondJet) {
520  //Filling variables for first jet
521  if (mPt) mPt->Fill (pfJets.at(0).pt());
522  if (mEta) mEta->Fill (pfJets.at(0).eta());
523  if (mPhi) mPhi->Fill (pfJets.at(0).phi());
524  if (mPhiVSEta) mPhiVSEta->Fill(pfJets.at(0).eta(),pfJets.at(0).phi());
525 
526  if (mConstituents) mConstituents->Fill (pfJets.at(0).nConstituents());
527  if (mHFrac) mHFrac->Fill (pfJets.at(0).chargedHadronEnergyFraction()+pfJets.at(0).neutralHadronEnergyFraction());
528  if (mEFrac) mEFrac->Fill (pfJets.at(0).chargedEmEnergyFraction() +pfJets.at(0).neutralEmEnergyFraction());
529 
530  //if (mE) mE->Fill (pfJets.at(0).energy());
531  //if (mP) mP->Fill (pfJets.at(0).p());
532  //if (mMass) mMass->Fill (pfJets.at(0).mass());
533 
534  if (mChargedHadronEnergy) mChargedHadronEnergy->Fill (pfJets.at(0).chargedHadronEnergy());
535  if (mNeutralHadronEnergy) mNeutralHadronEnergy->Fill (pfJets.at(0).neutralHadronEnergy());
536  if (mChargedEmEnergy) mChargedEmEnergy->Fill(pfJets.at(0).chargedEmEnergy());
537  if (mChargedMuEnergy) mChargedMuEnergy->Fill (pfJets.at(0).chargedMuEnergy ());
538  if (mNeutralEmEnergy) mNeutralEmEnergy->Fill(pfJets.at(0).neutralEmEnergy());
539  if (mChargedMultiplicity ) mChargedMultiplicity->Fill(pfJets.at(0).chargedMultiplicity());
540  if (mNeutralMultiplicity ) mNeutralMultiplicity->Fill(pfJets.at(0).neutralMultiplicity());
541  if (mMuonMultiplicity )mMuonMultiplicity->Fill (pfJets.at(0). muonMultiplicity());
542  //_______________________________________________________
543  if (mNeutralFraction) mNeutralFraction->Fill (pfJets.at(0).neutralMultiplicity()/pfJets.at(0).nConstituents());
544 
545 
546  //Filling variables for second jet
547  if (mPt) mPt->Fill (pfJets.at(1).pt());
548  if (mEta) mEta->Fill (pfJets.at(1).eta());
549  if (mPhi) mPhi->Fill (pfJets.at(1).phi());
550  if (mPhiVSEta) mPhiVSEta->Fill(pfJets.at(1).eta(),pfJets.at(1).phi());
551 
552  if (mConstituents) mConstituents->Fill (pfJets.at(1).nConstituents());
553  if (mHFrac) mHFrac->Fill (pfJets.at(1).chargedHadronEnergyFraction()+pfJets.at(1).neutralHadronEnergyFraction());
554  if (mEFrac) mEFrac->Fill (pfJets.at(1).chargedEmEnergyFraction() +pfJets.at(1).neutralEmEnergyFraction());
555 
556  //if (mE) mE->Fill (pfJets.at(1).energy());
557  //if (mP) mP->Fill (pfJets.at(1).p());
558  //if (mMass) mMass->Fill (pfJets.at(1).mass());
559 
560  if (mChargedHadronEnergy) mChargedHadronEnergy->Fill (pfJets.at(1).chargedHadronEnergy());
561  if (mNeutralHadronEnergy) mNeutralHadronEnergy->Fill (pfJets.at(1).neutralHadronEnergy());
562  if (mChargedEmEnergy) mChargedEmEnergy->Fill(pfJets.at(1).chargedEmEnergy());
563  if (mChargedMuEnergy) mChargedMuEnergy->Fill (pfJets.at(1).chargedMuEnergy ());
564  if (mNeutralEmEnergy) mNeutralEmEnergy->Fill(pfJets.at(1).neutralEmEnergy());
565  if (mChargedMultiplicity ) mChargedMultiplicity->Fill(pfJets.at(1).chargedMultiplicity());
566  if (mNeutralMultiplicity ) mNeutralMultiplicity->Fill(pfJets.at(1).neutralMultiplicity());
567  if (mMuonMultiplicity )mMuonMultiplicity->Fill (pfJets.at(1). muonMultiplicity());
568  //_______________________________________________________
569  if (mNeutralFraction) mNeutralFraction->Fill (pfJets.at(1).neutralMultiplicity()/pfJets.at(1).nConstituents());
570 
571 
572  // Fill NPV profiles
573  //----------------------------------------------------------------
574  for (int iJet=0; iJet<2; iJet++) {
575 
576  if (mPt_profile) mPt_profile ->Fill(numPV, pfJets.at(iJet).pt());
577  if (mEta_profile) mEta_profile ->Fill(numPV, pfJets.at(iJet).eta());
578  if (mPhi_profile) mPhi_profile ->Fill(numPV, pfJets.at(iJet).phi());
579  if (mConstituents_profile) mConstituents_profile->Fill(numPV, pfJets.at(iJet).nConstituents());
580  if (mHFrac_profile) mHFrac_profile ->Fill(numPV, pfJets.at(iJet).chargedHadronEnergyFraction() + pfJets.at(iJet).neutralHadronEnergyFraction());
581  if (mEFrac_profile) mEFrac_profile ->Fill(numPV, pfJets.at(iJet).chargedEmEnergyFraction() + pfJets.at(iJet).neutralEmEnergyFraction());
582 
583  if (mChargedHadronEnergy_profile) mChargedHadronEnergy_profile->Fill(numPV, pfJets.at(iJet).chargedHadronEnergy());
584  if (mNeutralHadronEnergy_profile) mNeutralHadronEnergy_profile->Fill(numPV, pfJets.at(iJet).neutralHadronEnergy());
585  if (mChargedEmEnergy_profile) mChargedEmEnergy_profile ->Fill(numPV, pfJets.at(iJet).chargedEmEnergy());
586  if (mChargedMuEnergy_profile) mChargedMuEnergy_profile ->Fill(numPV, pfJets.at(iJet).chargedMuEnergy());
587  if (mNeutralEmEnergy_profile) mNeutralEmEnergy_profile ->Fill(numPV, pfJets.at(iJet).neutralEmEnergy());
588  if (mChargedMultiplicity_profile) mChargedMultiplicity_profile->Fill(numPV, pfJets.at(iJet).chargedMultiplicity());
589  if (mNeutralMultiplicity_profile) mNeutralMultiplicity_profile->Fill(numPV, pfJets.at(iJet).neutralMultiplicity());
590  if (mMuonMultiplicity_profile) mMuonMultiplicity_profile ->Fill(numPV, pfJets.at(iJet).muonMultiplicity());
591  }
592 
593 
594  }// loose cleaned jets 1 and 2
595  }// fabs dphi < 2.1
596  }// fabs eta < 3
597  }// pt jets > threshold
598  //now do the dijet balance and asymmetry calculations
599  if (fabs(pfJets.at(0).eta() < 1.4)) {
600  double pt_dijet = (pfJets.at(0).pt() + pfJets.at(1).pt())/2;
601 
602  double dPhi = fabs((pfJets.at(0)).phi()-(pfJets.at(1)).phi());
603  if (dPhi > 3.14) dPhi=fabs(dPhi -6.28 );
604 
605  if (dPhi > 2.7) {
606  double pt_probe;
607  double pt_barrel;
608  int jet1, jet2;
609 
610  int randJet = rand() % 2;
611 
612  if (fabs(pfJets.at(1).eta() < 1.4)) {
613  if (randJet) {
614  jet1 = 0;
615  jet2 = 1;
616  }
617  else {
618  jet1 = 1;
619  jet2 = 0;
620  }
621 
622  /***Di-Jet Asymmetry****
623  * leading jets eta < 1.4
624  * leading jets dphi > 2.7
625  * pt_third jet < threshold
626  * A = (pt_1 - pt_2)/(pt_1 + pt_2)
627  * jets 1 and two are randomly ordered
628  */
629  bool thirdJetCut = true;
630  for (unsigned int third = 2; third < pfJets.size(); ++third)
631  if (pfJets.at(third).pt() > _asymmetryThirdJetCut)
632  thirdJetCut = false;
633  if (thirdJetCut) {
634  double dijetAsymmetry = (pfJets.at(jet1).pt() - pfJets.at(jet2).pt()) / (pfJets.at(jet1).pt() + pfJets.at(jet2).pt());
635  mDijetAsymmetry->Fill(dijetAsymmetry);
636  }// end restriction on third jet pt in asymmetry calculation
637 
638  }
639  else {
640  jet1 = 0;
641  jet2 = 1;
642  }
643 
644  pt_barrel = pfJets.at(jet1).pt();
645  pt_probe = pfJets.at(jet2).pt();
646 
647  //dijet balance cuts
648  /***Di-Jet Balance****
649  * pt_dijet = (pt_probe+pt_barrel)/2
650  * leading jets dphi > 2.7
651  * reject evnets where pt_third/pt_dijet > 0.2
652  * pv selection
653  * B = (pt_probe - pt_barrel)/pt_dijet
654  * select probe randomly from 2 jets if both leading jets are in the barrel
655  */
656  bool thirdJetCut = true;
657  for (unsigned int third = 2; third < pfJets.size(); ++third)
658  if (pfJets.at(third).pt()/pt_dijet > _balanceThirdJetCut)
659  thirdJetCut = false;
660  if (thirdJetCut) {
661  double dijetBalance = (pt_probe - pt_barrel) / pt_dijet;
662  mDijetBalance->Fill(dijetBalance);
663  }// end restriction on third jet pt ratio in balance calculation
664  }// dPhi > 2.7
665  }// leading jet eta cut for asymmetry and balance calculations
666  }// jet size >= 2
667  } // do dijet selection
668  else{
669  for (reco::PFJetCollection::const_iterator jet = pfJets.begin(); jet!=pfJets.end(); ++jet){
670  LogTrace(metname)<<"[JetAnalyzer] Analyze PFJet";
671 
672  Thiscleaned=false;
673  Loosecleaned=false;
674  Tightcleaned=false;
675 
676  if (jet == pfJets.begin()) {
677  fstPhi = jet->phi();
678  _leadJetFlag = 1;
679  } else {
680  _leadJetFlag = 0;
681  }
682 
683  if (jet == (pfJets.begin()+1)) sndPhi = jet->phi();
684  // if (jet->pt() < _ptThreshold) return;
685  if (jet->pt() > _ptThreshold) {
686  numofjets++ ;
687  jetME->Fill(2);
688 
689  //calculate the jetID
690  ThisCHFcleaned=true;
691  LooseCHFcleaned=true;
692  TightCHFcleaned=true;
693  if((jet->chargedHadronEnergy()/jet->energy())<=_ThisCHFMin && fabs(jet->eta())<2.4) ThisCHFcleaned=false; //apply CHF>0 only if |eta|<2.4
694  if((jet->chargedHadronEnergy()/jet->energy())<=_LooseCHFMin && fabs(jet->eta())<2.4) LooseCHFcleaned=false; //apply CHF>0 only if |eta|<2.4
695  if((jet->chargedHadronEnergy()/jet->energy())<=_TightCHFMin && fabs(jet->eta())<2.4) TightCHFcleaned=false; //apply CHF>0 only if |eta|<2.4
696  if(ThisCHFcleaned && (jet->neutralHadronEnergy()/jet->energy())<_ThisNHFMax && (jet->chargedEmEnergy()/jet->energy())<_ThisCEFMax && (jet->neutralEmEnergy()/jet->energy())<_ThisNEFMax) Thiscleaned=true;
697  if(LooseCHFcleaned && (jet->neutralHadronEnergy()/jet->energy())<_LooseNHFMax && (jet->chargedEmEnergy()/jet->energy())<_LooseCEFMax && (jet->neutralEmEnergy()/jet->energy())<_LooseNEFMax) Loosecleaned=true;
698  if(TightCHFcleaned && (jet->neutralHadronEnergy()/jet->energy())<_TightNHFMax && (jet->chargedEmEnergy()/jet->energy())<_TightCEFMax && (jet->neutralEmEnergy()/jet->energy())<_TightNEFMax) Tightcleaned=true;
699 
700  if(fillpfJIDPassFrac==1) {
701  //fill the profile for jid efficiency
702  if(Loosecleaned) {
703  mLooseJIDPassFractionVSeta->Fill(jet->eta(),1.);
704  mLooseJIDPassFractionVSpt->Fill(jet->pt(),1.);
705  } else {
706  mLooseJIDPassFractionVSeta->Fill(jet->eta(),0.);
707  mLooseJIDPassFractionVSpt->Fill(jet->pt(),0.);
708  }
709  if(Tightcleaned) {
710  mTightJIDPassFractionVSeta->Fill(jet->eta(),1.);
711  mTightJIDPassFractionVSpt->Fill(jet->pt(),1.);
712  } else {
713  mTightJIDPassFractionVSeta->Fill(jet->eta(),0.);
714  mTightJIDPassFractionVSpt->Fill(jet->pt(),0.);
715  }
716  }
717 
718  if(!Thiscleaned) continue;
719 
720  // Leading jet
721  // Histograms are filled once per event
722  if (_leadJetFlag == 1) {
723 
724  if (mEtaFirst) mEtaFirst->Fill (jet->eta());
725  if (mPhiFirst) mPhiFirst->Fill (jet->phi());
726  //if (mEFirst) mEFirst->Fill (jet->energy());
727  if (mPtFirst) mPtFirst->Fill (jet->pt());
728  }
729 
730  // --- Passed the low pt jet trigger (no longer used)
731  if (_JetLoPass == 1) {
732  /* if (fabs(jet->eta()) <= 1.3) {
733  if (mPt_Barrel_Lo) mPt_Barrel_Lo->Fill(jet->pt());
734  if (mEta_Lo) mEta_Lo->Fill(jet->eta());
735  if (mPhi_Barrel_Lo) mPhi_Barrel_Lo->Fill(jet->phi());
736  }
737  if ( (fabs(jet->eta()) > 1.3) && (fabs(jet->eta()) <= 3) ) {
738  if (mPt_EndCap_Lo) mPt_EndCap_Lo->Fill(jet->pt());
739  if (mEta_Lo) mEta_Lo->Fill(jet->eta());
740  if (mPhi_EndCap_Lo) mPhi_EndCap_Lo->Fill(jet->phi());
741  }
742  if (fabs(jet->eta()) > 3.0) {
743  if (mPt_Forward_Lo) mPt_Forward_Lo->Fill(jet->pt());
744  if (mEta_Lo) mEta_Lo->Fill(jet->eta());
745  if (mPhi_Forward_Lo) mPhi_Forward_Lo->Fill(jet->phi());
746  }*/
747  //if (mEta_Lo) mEta_Lo->Fill (jet->eta());
748  if (mPhi_Lo) mPhi_Lo->Fill (jet->phi());
749  if (mPt_Lo) mPt_Lo->Fill (jet->pt());
750  }
751 
752  // --- Passed the high pt jet trigger
753  if (_JetHiPass == 1) {
754  if (fabs(jet->eta()) <= 1.3) {
755  if (mPt_Barrel_Hi && jet->pt()>100.) mPt_Barrel_Hi->Fill(jet->pt());
756  if (mEta_Hi && jet->pt()>100.) mEta_Hi->Fill(jet->eta());
757  if (mPhi_Barrel_Hi) mPhi_Barrel_Hi->Fill(jet->phi());
758  //if (mConstituents_Barrel_Hi) mConstituents_Barrel_Hi->Fill(jet->nConstituents());
759  //if (mHFrac_Barrel_Hi) mHFrac_Barrel_Hi->Fill(jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());
760  }
761  if ( (fabs(jet->eta()) > 1.3) && (fabs(jet->eta()) <= 3) ) {
762  if (mPt_EndCap_Hi && jet->pt()>100.) mPt_EndCap_Hi->Fill(jet->pt());
763  if (mEta_Hi && jet->pt()>100.) mEta_Hi->Fill(jet->eta());
764  if (mPhi_EndCap_Hi) mPhi_EndCap_Hi->Fill(jet->phi());
765  //if (mConstituents_EndCap_Hi) mConstituents_EndCap_Hi->Fill(jet->nConstituents());
766  //if (mHFrac_EndCap_Hi) mHFrac_EndCap_Hi->Fill(jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());
767  }
768  if (fabs(jet->eta()) > 3.0) {
769  if (mPt_Forward_Hi && jet->pt()>100.) mPt_Forward_Hi->Fill(jet->pt());
770  if (mEta_Hi && jet->pt()>100.) mEta_Hi->Fill(jet->eta());
771  if (mPhi_Forward_Hi) mPhi_Forward_Hi->Fill(jet->phi());
772  //if (mConstituents_Forward_Hi) mConstituents_Forward_Hi->Fill(jet->nConstituents());
773  //if (mHFrac_Forward_Hi) mHFrac_Forward_Hi->Fill(jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());
774  }
775 
776  if (mEta_Hi && jet->pt()>100.) mEta_Hi->Fill (jet->eta());
777  if (mPhi_Hi) mPhi_Hi->Fill (jet->phi());
778  if (mPt_Hi) mPt_Hi->Fill (jet->pt());
779  }
780 
781  if (mPt) mPt->Fill (jet->pt());
782  if (mPt_1) mPt_1->Fill (jet->pt());
783  if (mPt_2) mPt_2->Fill (jet->pt());
784  if (mPt_3) mPt_3->Fill (jet->pt());
785  if (mEta) mEta->Fill (jet->eta());
786  if (mPhi) mPhi->Fill (jet->phi());
787  if (mPhiVSEta) mPhiVSEta->Fill(jet->eta(),jet->phi());
788 
789  if (mConstituents) mConstituents->Fill (jet->nConstituents());
790  if (mHFrac) mHFrac->Fill (jet->chargedHadronEnergyFraction()+jet->neutralHadronEnergyFraction());
791  if (mEFrac) mEFrac->Fill (jet->chargedEmEnergyFraction() +jet->neutralEmEnergyFraction());
792 
793  if (jet->pt()<= 50) {
794  if (mCHFracVSeta_lowPt) mCHFracVSeta_lowPt->Fill(jet->eta(),jet->chargedHadronEnergyFraction());
795  if (mNHFracVSeta_lowPt) mNHFracVSeta_lowPt->Fill(jet->eta(),jet->neutralHadronEnergyFraction());
796  if (mPhFracVSeta_lowPt) mPhFracVSeta_lowPt->Fill(jet->eta(),jet->neutralEmEnergyFraction());
797  if (mElFracVSeta_lowPt) mElFracVSeta_lowPt->Fill(jet->eta(),jet->chargedEmEnergyFraction());
798  if (mMuFracVSeta_lowPt) mMuFracVSeta_lowPt->Fill(jet->eta(),jet->chargedMuEnergyFraction());
799  }
800  if (jet->pt()>50. && jet->pt()<=140.) {
801  if (mCHFracVSeta_mediumPt) mCHFracVSeta_mediumPt->Fill(jet->eta(),jet->chargedHadronEnergyFraction());
802  if (mNHFracVSeta_mediumPt) mNHFracVSeta_mediumPt->Fill(jet->eta(),jet->neutralHadronEnergyFraction());
803  if (mPhFracVSeta_mediumPt) mPhFracVSeta_mediumPt->Fill(jet->eta(),jet->neutralEmEnergyFraction());
804  if (mElFracVSeta_mediumPt) mElFracVSeta_mediumPt->Fill(jet->eta(),jet->chargedEmEnergyFraction());
805  if (mMuFracVSeta_mediumPt) mMuFracVSeta_mediumPt->Fill(jet->eta(),jet->chargedMuEnergyFraction());
806  }
807  if (jet->pt()>140.) {
808  if (mCHFracVSeta_highPt) mCHFracVSeta_highPt->Fill(jet->eta(),jet->chargedHadronEnergyFraction());
809  if (mNHFracVSeta_highPt) mNHFracVSeta_highPt->Fill(jet->eta(),jet->neutralHadronEnergyFraction());
810  if (mPhFracVSeta_highPt) mPhFracVSeta_highPt->Fill(jet->eta(),jet->neutralEmEnergyFraction());
811  if (mElFracVSeta_highPt) mElFracVSeta_highPt->Fill(jet->eta(),jet->chargedEmEnergyFraction());
812  if (mMuFracVSeta_highPt) mMuFracVSeta_highPt->Fill(jet->eta(),jet->chargedMuEnergyFraction());
813  }
814 
815  if (fabs(jet->eta()) <= 1.3) {
816  if (mPt_Barrel) mPt_Barrel->Fill (jet->pt());
817  if (mPhi_Barrel) mPhi_Barrel->Fill (jet->phi());
818  //if (mE_Barrel) mE_Barrel->Fill (jet->energy());
819  if (mConstituents_Barrel) mConstituents_Barrel->Fill(jet->nConstituents());
820  if (mHFrac_Barrel) mHFrac_Barrel->Fill(jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction() );
821  if (mEFrac_Barrel) mEFrac->Fill (jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());
822  //fractions
823  if (jet->pt()<=50.) {
824  if (mCHFrac_lowPt_Barrel) mCHFrac_lowPt_Barrel->Fill(jet->chargedHadronEnergyFraction());
825  if (mNHFrac_lowPt_Barrel) mNHFrac_lowPt_Barrel->Fill(jet->neutralHadronEnergyFraction());
826  if (mPhFrac_lowPt_Barrel) mPhFrac_lowPt_Barrel->Fill(jet->neutralEmEnergyFraction());
827  if (mElFrac_lowPt_Barrel) mElFrac_lowPt_Barrel->Fill(jet->chargedEmEnergyFraction());
828  if (mMuFrac_lowPt_Barrel) mMuFrac_lowPt_Barrel->Fill(jet->chargedMuEnergyFraction());
829  //
830  if (mCHEn_lowPt_Barrel) mCHEn_lowPt_Barrel->Fill(jet->chargedHadronEnergy());
831  if (mNHEn_lowPt_Barrel) mNHEn_lowPt_Barrel->Fill(jet->neutralHadronEnergy());
832  if (mPhEn_lowPt_Barrel) mPhEn_lowPt_Barrel->Fill(jet->neutralEmEnergy());
833  if (mElEn_lowPt_Barrel) mElEn_lowPt_Barrel->Fill(jet->chargedEmEnergy());
834  if (mMuEn_lowPt_Barrel) mMuEn_lowPt_Barrel->Fill(jet->chargedMuEnergy());
835  }
836  if (jet->pt()>50. && jet->pt()<=140.) {
837  if (mCHFrac_mediumPt_Barrel) mCHFrac_mediumPt_Barrel->Fill(jet->chargedHadronEnergyFraction());
838  if (mNHFrac_mediumPt_Barrel) mNHFrac_mediumPt_Barrel->Fill(jet->neutralHadronEnergyFraction());
839  if (mPhFrac_mediumPt_Barrel) mPhFrac_mediumPt_Barrel->Fill(jet->neutralEmEnergyFraction());
840  if (mElFrac_mediumPt_Barrel) mElFrac_mediumPt_Barrel->Fill(jet->chargedEmEnergyFraction());
841  if (mMuFrac_mediumPt_Barrel) mMuFrac_mediumPt_Barrel->Fill(jet->chargedMuEnergyFraction());
842  //
843  if (mCHEn_mediumPt_Barrel) mCHEn_mediumPt_Barrel->Fill(jet->chargedHadronEnergy());
844  if (mNHEn_mediumPt_Barrel) mNHEn_mediumPt_Barrel->Fill(jet->neutralHadronEnergy());
845  if (mPhEn_mediumPt_Barrel) mPhEn_mediumPt_Barrel->Fill(jet->neutralEmEnergy());
846  if (mElEn_mediumPt_Barrel) mElEn_mediumPt_Barrel->Fill(jet->chargedEmEnergy());
847  if (mMuEn_mediumPt_Barrel) mMuEn_mediumPt_Barrel->Fill(jet->chargedMuEnergy());
848  }
849  if (jet->pt()>140.) {
850  if (mCHFrac_highPt_Barrel) mCHFrac_highPt_Barrel->Fill(jet->chargedHadronEnergyFraction());
851  if (mNHFrac_highPt_Barrel) mNHFrac_highPt_Barrel->Fill(jet->neutralHadronEnergyFraction());
852  if (mPhFrac_highPt_Barrel) mPhFrac_highPt_Barrel->Fill(jet->neutralEmEnergyFraction());
853  if (mElFrac_highPt_Barrel) mElFrac_highPt_Barrel->Fill(jet->chargedEmEnergyFraction());
854  if (mMuFrac_highPt_Barrel) mMuFrac_highPt_Barrel->Fill(jet->chargedMuEnergyFraction());
855  //
856  if (mCHEn_highPt_Barrel) mCHEn_highPt_Barrel->Fill(jet->chargedHadronEnergy());
857  if (mNHEn_highPt_Barrel) mNHEn_highPt_Barrel->Fill(jet->neutralHadronEnergy());
858  if (mPhEn_highPt_Barrel) mPhEn_highPt_Barrel->Fill(jet->neutralEmEnergy());
859  if (mElEn_highPt_Barrel) mElEn_highPt_Barrel->Fill(jet->chargedEmEnergy());
860  if (mMuEn_highPt_Barrel) mMuEn_highPt_Barrel->Fill(jet->chargedMuEnergy());
861  }
862  if(mChMultiplicity_lowPt_Barrel) mChMultiplicity_lowPt_Barrel->Fill(jet->chargedMultiplicity());
863  if(mNeuMultiplicity_lowPt_Barrel) mNeuMultiplicity_lowPt_Barrel->Fill(jet->neutralMultiplicity());
864  if(mMuMultiplicity_lowPt_Barrel) mMuMultiplicity_lowPt_Barrel->Fill(jet->muonMultiplicity());
865  if(mChMultiplicity_mediumPt_Barrel) mChMultiplicity_mediumPt_Barrel->Fill(jet->chargedMultiplicity());
866  if(mNeuMultiplicity_mediumPt_Barrel) mNeuMultiplicity_mediumPt_Barrel->Fill(jet->neutralMultiplicity());
867  if(mMuMultiplicity_mediumPt_Barrel) mMuMultiplicity_mediumPt_Barrel->Fill(jet->muonMultiplicity());
868  if(mChMultiplicity_highPt_Barrel) mChMultiplicity_highPt_Barrel->Fill(jet->chargedMultiplicity());
869  if(mNeuMultiplicity_highPt_Barrel) mNeuMultiplicity_highPt_Barrel->Fill(jet->neutralMultiplicity());
870  if(mMuMultiplicity_highPt_Barrel) mMuMultiplicity_highPt_Barrel->Fill(jet->muonMultiplicity());
871  //
872  if (mCHFracVSpT_Barrel) mCHFracVSpT_Barrel->Fill(jet->pt(),jet->chargedHadronEnergyFraction());
873  if (mNHFracVSpT_Barrel) mNHFracVSpT_Barrel->Fill(jet->pt(),jet->neutralHadronEnergyFraction());
874  if (mPhFracVSpT_Barrel) mPhFracVSpT_Barrel->Fill(jet->pt(),jet->neutralEmEnergyFraction());
875  if (mElFracVSpT_Barrel) mElFracVSpT_Barrel->Fill(jet->pt(),jet->chargedEmEnergyFraction());
876  if (mMuFracVSpT_Barrel) mMuFracVSpT_Barrel->Fill(jet->pt(),jet->chargedMuEnergyFraction());
877  }
878  if ( (fabs(jet->eta()) > 1.3) && (fabs(jet->eta()) <= 3) ) {
879  if (mPt_EndCap) mPt_EndCap->Fill (jet->pt());
880  if (mPhi_EndCap) mPhi_EndCap->Fill (jet->phi());
881  //if (mE_EndCap) mE_EndCap->Fill (jet->energy());
882  if (mConstituents_EndCap) mConstituents_EndCap->Fill(jet->nConstituents());
883  if (mHFrac_EndCap) mHFrac_EndCap->Fill(jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction());
884  if (mEFrac_EndCap) mEFrac->Fill (jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());
885  //fractions
886  if (jet->pt()<=50.) {
887  if (mCHFrac_lowPt_EndCap) mCHFrac_lowPt_EndCap->Fill(jet->chargedHadronEnergyFraction());
888  if (mNHFrac_lowPt_EndCap) mNHFrac_lowPt_EndCap->Fill(jet->neutralHadronEnergyFraction());
889  if (mPhFrac_lowPt_EndCap) mPhFrac_lowPt_EndCap->Fill(jet->neutralEmEnergyFraction());
890  if (mElFrac_lowPt_EndCap) mElFrac_lowPt_EndCap->Fill(jet->chargedEmEnergyFraction());
891  if (mMuFrac_lowPt_EndCap) mMuFrac_lowPt_EndCap->Fill(jet->chargedMuEnergyFraction());
892  //
893  if (mCHEn_lowPt_EndCap) mCHEn_lowPt_EndCap->Fill(jet->chargedHadronEnergy());
894  if (mNHEn_lowPt_EndCap) mNHEn_lowPt_EndCap->Fill(jet->neutralHadronEnergy());
895  if (mPhEn_lowPt_EndCap) mPhEn_lowPt_EndCap->Fill(jet->neutralEmEnergy());
896  if (mElEn_lowPt_EndCap) mElEn_lowPt_EndCap->Fill(jet->chargedEmEnergy());
897  if (mMuEn_lowPt_EndCap) mMuEn_lowPt_EndCap->Fill(jet->chargedMuEnergy());
898  }
899  if (jet->pt()>50. && jet->pt()<=140.) {
900  if (mCHFrac_mediumPt_EndCap) mCHFrac_mediumPt_EndCap->Fill(jet->chargedHadronEnergyFraction());
901  if (mNHFrac_mediumPt_EndCap) mNHFrac_mediumPt_EndCap->Fill(jet->neutralHadronEnergyFraction());
902  if (mPhFrac_mediumPt_EndCap) mPhFrac_mediumPt_EndCap->Fill(jet->neutralEmEnergyFraction());
903  if (mElFrac_mediumPt_EndCap) mElFrac_mediumPt_EndCap->Fill(jet->chargedEmEnergyFraction());
904  if (mMuFrac_mediumPt_EndCap) mMuFrac_mediumPt_EndCap->Fill(jet->chargedMuEnergyFraction());
905  //
906  if (mCHEn_mediumPt_EndCap) mCHEn_mediumPt_EndCap->Fill(jet->chargedHadronEnergy());
907  if (mNHEn_mediumPt_EndCap) mNHEn_mediumPt_EndCap->Fill(jet->neutralHadronEnergy());
908  if (mPhEn_mediumPt_EndCap) mPhEn_mediumPt_EndCap->Fill(jet->neutralEmEnergy());
909  if (mElEn_mediumPt_EndCap) mElEn_mediumPt_EndCap->Fill(jet->chargedEmEnergy());
910  if (mMuEn_mediumPt_EndCap) mMuEn_mediumPt_EndCap->Fill(jet->chargedMuEnergy());
911  }
912  if (jet->pt()>140.) {
913  if (mCHFrac_highPt_EndCap) mCHFrac_highPt_EndCap->Fill(jet->chargedHadronEnergyFraction());
914  if (mNHFrac_highPt_EndCap) mNHFrac_highPt_EndCap->Fill(jet->neutralHadronEnergyFraction());
915  if (mPhFrac_highPt_EndCap) mPhFrac_highPt_EndCap->Fill(jet->neutralEmEnergyFraction());
916  if (mElFrac_highPt_EndCap) mElFrac_highPt_EndCap->Fill(jet->chargedEmEnergyFraction());
917  if (mMuFrac_highPt_EndCap) mMuFrac_highPt_EndCap->Fill(jet->chargedMuEnergyFraction());
918  //
919  if (mCHEn_highPt_EndCap) mCHEn_highPt_EndCap->Fill(jet->chargedHadronEnergy());
920  if (mNHEn_highPt_EndCap) mNHEn_highPt_EndCap->Fill(jet->neutralHadronEnergy());
921  if (mPhEn_highPt_EndCap) mPhEn_highPt_EndCap->Fill(jet->neutralEmEnergy());
922  if (mElEn_highPt_EndCap) mElEn_highPt_EndCap->Fill(jet->chargedEmEnergy());
923  if (mMuEn_highPt_EndCap) mMuEn_highPt_EndCap->Fill(jet->chargedMuEnergy());
924  }
925  if(mChMultiplicity_lowPt_EndCap) mChMultiplicity_lowPt_EndCap->Fill(jet->chargedMultiplicity());
926  if(mNeuMultiplicity_lowPt_EndCap) mNeuMultiplicity_lowPt_EndCap->Fill(jet->neutralMultiplicity());
927  if(mMuMultiplicity_lowPt_EndCap) mMuMultiplicity_lowPt_EndCap->Fill(jet->muonMultiplicity());
928  if(mChMultiplicity_mediumPt_EndCap) mChMultiplicity_mediumPt_EndCap->Fill(jet->chargedMultiplicity());
929  if(mNeuMultiplicity_mediumPt_EndCap) mNeuMultiplicity_mediumPt_EndCap->Fill(jet->neutralMultiplicity());
930  if(mMuMultiplicity_mediumPt_EndCap) mMuMultiplicity_mediumPt_EndCap->Fill(jet->muonMultiplicity());
931  if(mChMultiplicity_highPt_EndCap) mChMultiplicity_highPt_EndCap->Fill(jet->chargedMultiplicity());
932  if(mNeuMultiplicity_highPt_EndCap) mNeuMultiplicity_highPt_EndCap->Fill(jet->neutralMultiplicity());
933  if(mMuMultiplicity_highPt_EndCap) mMuMultiplicity_highPt_EndCap->Fill(jet->muonMultiplicity());
934  //
935  if (mCHFracVSpT_EndCap) mCHFracVSpT_EndCap->Fill(jet->pt(),jet->chargedHadronEnergyFraction());
936  if (mNHFracVSpT_EndCap) mNHFracVSpT_EndCap->Fill(jet->pt(),jet->neutralHadronEnergyFraction());
937  if (mPhFracVSpT_EndCap) mPhFracVSpT_EndCap->Fill(jet->pt(),jet->neutralEmEnergyFraction());
938  if (mElFracVSpT_EndCap) mElFracVSpT_EndCap->Fill(jet->pt(),jet->chargedEmEnergyFraction());
939  if (mMuFracVSpT_EndCap) mMuFracVSpT_EndCap->Fill(jet->pt(),jet->chargedMuEnergyFraction());
940  }
941  if (fabs(jet->eta()) > 3.0) {
942  if (mPt_Forward) mPt_Forward->Fill (jet->pt());
943  if (mPhi_Forward) mPhi_Forward->Fill (jet->phi());
944  //if (mE_Forward) mE_Forward->Fill (jet->energy());
945  if (mConstituents_Forward) mConstituents_Forward->Fill(jet->nConstituents());
946  if (mHFrac_Forward) mHFrac_Forward->Fill(jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction());
947  if (mEFrac_Forward) mEFrac->Fill (jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());
948  //fractions
949  if (jet->pt()<=50.) {
950  if(mHFEFrac_lowPt_Forward) mHFEFrac_lowPt_Forward->Fill(jet->HFEMEnergyFraction());
951  if(mHFHFrac_lowPt_Forward) mHFHFrac_lowPt_Forward->Fill(jet->HFHadronEnergyFraction());
952  //
953  if(mHFEEn_lowPt_Forward) mHFEEn_lowPt_Forward->Fill(jet->HFEMEnergy());
954  if(mHFHEn_lowPt_Forward) mHFHEn_lowPt_Forward->Fill(jet->HFHadronEnergy());
955  }
956  if (jet->pt()>50. && jet->pt()<=140.) {
957  if(mHFEFrac_mediumPt_Forward) mHFEFrac_mediumPt_Forward->Fill(jet->HFEMEnergyFraction());
958  if(mHFHFrac_mediumPt_Forward) mHFHFrac_mediumPt_Forward->Fill(jet->HFHadronEnergyFraction());
959  //
960  if(mHFEEn_mediumPt_Forward) mHFEEn_mediumPt_Forward->Fill(jet->HFEMEnergy());
961  if(mHFHEn_mediumPt_Forward) mHFHEn_mediumPt_Forward->Fill(jet->HFHadronEnergy());
962  }
963  if (jet->pt()>140.) {
964  if(mHFEFrac_highPt_Forward) mHFEFrac_highPt_Forward->Fill(jet->HFEMEnergyFraction());
965  if(mHFHFrac_highPt_Forward) mHFHFrac_highPt_Forward->Fill(jet->HFHadronEnergyFraction());
966  //
967  if(mHFEEn_highPt_Forward) mHFEEn_highPt_Forward->Fill(jet->HFEMEnergy());
968  if(mHFHEn_highPt_Forward) mHFHEn_highPt_Forward->Fill(jet->HFHadronEnergy());
969  }
970  if(mChMultiplicity_lowPt_Forward) mChMultiplicity_lowPt_Forward->Fill(jet->chargedMultiplicity());
971  if(mNeuMultiplicity_lowPt_Forward) mNeuMultiplicity_lowPt_Forward->Fill(jet->neutralMultiplicity());
972  if(mMuMultiplicity_lowPt_Forward) mMuMultiplicity_lowPt_Forward->Fill(jet->muonMultiplicity());
973  if(mChMultiplicity_mediumPt_Forward) mChMultiplicity_mediumPt_Forward->Fill(jet->chargedMultiplicity());
974  if(mNeuMultiplicity_mediumPt_Forward) mNeuMultiplicity_mediumPt_Forward->Fill(jet->neutralMultiplicity());
975  if(mMuMultiplicity_mediumPt_Forward) mMuMultiplicity_mediumPt_Forward->Fill(jet->muonMultiplicity());
976  if(mChMultiplicity_highPt_Forward) mChMultiplicity_highPt_Forward->Fill(jet->chargedMultiplicity());
977  if(mNeuMultiplicity_highPt_Forward) mNeuMultiplicity_highPt_Forward->Fill(jet->neutralMultiplicity());
978  if(mMuMultiplicity_highPt_Forward) mMuMultiplicity_highPt_Forward->Fill(jet->muonMultiplicity());
979  if(mHFHFracVSpT_Forward) mHFHFracVSpT_Forward->Fill(jet->pt(),jet->HFHadronEnergyFraction());
980  if(mHFEFracVSpT_Forward) mHFEFracVSpT_Forward->Fill(jet->pt(),jet->HFEMEnergyFraction());
981  }
982  //if (mE) mE->Fill (jet->energy());
983  //if (mP) mP->Fill (jet->p());
984  //if (mMass) mMass->Fill (jet->mass());
985 
986  if (mChargedHadronEnergy) mChargedHadronEnergy->Fill (jet->chargedHadronEnergy());
987  if (mNeutralHadronEnergy) mNeutralHadronEnergy->Fill (jet->neutralHadronEnergy());
988  if (mChargedEmEnergy) mChargedEmEnergy->Fill(jet->chargedEmEnergy());
989  if (mChargedMuEnergy) mChargedMuEnergy->Fill (jet->chargedMuEnergy ());
990  if (mNeutralEmEnergy) mNeutralEmEnergy->Fill(jet->neutralEmEnergy());
991  if (mChargedMultiplicity ) mChargedMultiplicity->Fill(jet->chargedMultiplicity());
992  if (mNeutralMultiplicity ) mNeutralMultiplicity->Fill(jet->neutralMultiplicity());
993  if (mMuonMultiplicity )mMuonMultiplicity->Fill (jet-> muonMultiplicity());
994  //_______________________________________________________
995  if (mNeutralFraction) mNeutralFraction->Fill (jet->neutralMultiplicity()/jet->nConstituents());
996 
997 
998  // Fill NPV profiles
999  //----------------------------------------------------------------------
1000  if (mPt_profile) mPt_profile ->Fill(numPV, jet->pt());
1001  if (mEta_profile) mEta_profile ->Fill(numPV, jet->eta());
1002  if (mPhi_profile) mPhi_profile ->Fill(numPV, jet->phi());
1003  if (mConstituents_profile) mConstituents_profile->Fill(numPV, jet->nConstituents());
1004  if (mHFrac_profile) mHFrac_profile ->Fill(numPV, jet->chargedHadronEnergyFraction() + jet->neutralHadronEnergyFraction());
1005  if (mEFrac_profile) mEFrac_profile ->Fill(numPV, jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction());
1006 
1007  if (mChargedHadronEnergy_profile) mChargedHadronEnergy_profile->Fill(numPV, jet->chargedHadronEnergy());
1008  if (mNeutralHadronEnergy_profile) mNeutralHadronEnergy_profile->Fill(numPV, jet->neutralHadronEnergy());
1009  if (mChargedEmEnergy_profile) mChargedEmEnergy_profile ->Fill(numPV, jet->chargedEmEnergy());
1010  if (mChargedMuEnergy_profile) mChargedMuEnergy_profile ->Fill(numPV, jet->chargedMuEnergy ());
1011  if (mNeutralEmEnergy_profile) mNeutralEmEnergy_profile ->Fill(numPV, jet->neutralEmEnergy());
1012  if (mChargedMultiplicity_profile) mChargedMultiplicity_profile->Fill(numPV, jet->chargedMultiplicity());
1013  if (mNeutralMultiplicity_profile) mNeutralMultiplicity_profile->Fill(numPV, jet->neutralMultiplicity());
1014  if (mMuonMultiplicity_profile) mMuonMultiplicity_profile ->Fill(numPV, jet->muonMultiplicity());
1015 
1016 
1017  //calculate correctly the dphi
1018  if(numofjets>1) {
1019  diff = fabs(fstPhi - sndPhi);
1020  corr = 2*acos(-1.) - diff;
1021  if(diff < acos(-1.)) {
1022  dphi = diff;
1023  } else {
1024  dphi = corr;
1025  }
1026  } // numofjets>1
1027  } // JetPt>_ptThreshold
1028  } // PF jet loop
1029  if (mNJets) mNJets->Fill (numofjets);
1030  if (mDPhi) mDPhi->Fill (dphi);
1031 
1032 
1033  if (mNJets_profile) mNJets_profile->Fill(numPV, numofjets);
1034 
1035 
1036  } // non dijet selection
1037 }
EventNumber_t event() const
Definition: EventID.h:44
dictionary parameters
Definition: Parameters.py:2
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
const std::string metname
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void endJob()
Finish up a job.
T eta() const
const int nbinsPV
const double PVup
int iEvent
Definition: GenABIO.cc:243
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
void beginJob(DQMStore *dbe)
Inizialize parameters for histo binning.
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
PFJetAnalyzer(const edm::ParameterSet &)
Constructor.
#define LogTrace(id)
const double PVlow
JetCorrectorParameters corr
Definition: classes.h:9
edm::EventID id() const
Definition: EventBase.h:56
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Signal rand(Signal arg)
Definition: vlib.cc:442
void analyze(const edm::Event &, const edm::EventSetup &, const reco::PFJetCollection &pfJets, const int numPV)
Get the analysis.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
tuple pfJets
Definition: pfJets_cff.py:8
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
virtual ~PFJetAnalyzer()
Destructor.
Definition: DDAxes.h:10