Skip to content

Commit 1668e1a

Browse files
committed
update with MC normalization and new Background estimation
1 parent 0c08c13 commit 1668e1a

20 files changed

+4664
-1177
lines changed

BgEstimation.cc

Lines changed: 1024 additions & 542 deletions
Large diffs are not rendered by default.

BgEstimation.h

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,75 @@
33

44
#include <TObject.h>
55
#include <TMinuit.h>
6+
#include <TFractionFitter.h>
67
#include <TLorentzVector.h>
78
#include <TMath.h>
9+
#include <TRandom2.h>
810
#include <TString.h>
911
#include <TStyle.h>
1012
#include <TLegend.h>
1113
#include <TCanvas.h>
14+
#include <TPad.h>
15+
#include <TGraphErrors.h>
1216
#include <TSystem.h>
1317
#include <vector>
1418
#include <stdio.h>
1519
#include <stdlib.h>
1620
#include <iostream>
1721
#include <string>
22+
#include <iomanip>
1823

19-
#include "MassFitFunction.h"
2024
#include "MassAnaInput.h"
21-
#include "HadWMassFitter.h"
22-
#include "PseudoExp.h"
23-
24-
//#include "LepTopMassFitter.h"
25+
#include "MassFitFunction.h"
26+
#include "ObjectInfo.h"
27+
#include "WFormat.h"
2528

2629
class BgEstimation : public TObject {
2730

2831
private:
2932

30-
MassFitFunction* fitFunc;
31-
MassAnaInput* fitInput;
32-
HadWMassFitter* wmfitter;
33-
PseudoExp* pseudoExp;
33+
double mL;
34+
double mH;
35+
36+
// for hadronic permutation
37+
38+
MassAnaInput* fitInput;
39+
ObjectInfo* objInfo;
3440

3541
string hfolder;
36-
TString theFolder;
42+
string plotType ;
3743
bool smearing ;
38-
vector<double> inputMean ;
3944

4045
public:
4146

4247
BgEstimation();
4348
~BgEstimation();
44-
45-
vector<double> Ratio42( int statIdx = 0 );
4649

47-
void MethodTest() ;
50+
vector<double> RatioXY(int njX, int njY, vector<string>& fNames, int index, bool doPlot = false, bool inclX = false, bool inclY = false, bool normMC = false );
51+
52+
vector<double> RatioXY( vector<string>& fNameX, vector<string>& fNameY, int index = -1., bool includeTt = false, bool doPlot = false );
53+
54+
vector<double> BgEstimate( vector<double>& R42, vector<double>& nData_2j );
55+
vector<double> BgEstimate( vector<double>& R42, double nData_2j );
56+
57+
void LepM2Plotter( vector<TH1D*>& h1Ds, TString Tag );
58+
59+
void RatioPlotter( vector<double>& nW1, vector<double>& nW2, TString Tag, double scale = 1. );
4860

49-
vector<double> XSection( vector<double>& R42, double n2J, double n4J ) ;
61+
//void CombinedRatio( int nx, int ny, bool inclX = false, bool inclY = false );
5062

51-
void EnsembleTest( int randomSeed );
52-
void EnsembleTest( int nRun, int randomSeed );
63+
vector<double> MtFitter( string& DataName, vector<string>& fNames, int phaseIdx = 0 );
64+
vector<double> JacobianFitter( TH1D* hData, vector<TH1D*>& hTemplates, int phaseIdx = 0, int fbin1 = 1, int fbin2 = 20);
5365

54-
vector<double> RunEnsembles( int treeSize, string fileName, double pMean, int nRun, int randomSeed, TTree* theTree = NULL, TH1D* hGen = NULL );
66+
vector<double> MeasureScale( string& dataFiles, vector<string>& fNames );
67+
double MeasureScale2D( string& dataFiles, vector<string>& fNames, double MtCut = 40, double METCut = 25, bool doQCD = true, bool isVjNorm = false );
68+
double MeasureScale1D( string& dataFiles, vector<string>& fNames, int hID, double MtCut = 40, double METCut = 25, bool doQCD = true, bool isVjNorm = false );
5569

56-
vector<double> StatErr( double m );
57-
vector<double> ErrAovB( double A, double s_A, double B, double s_B );
58-
vector<double> ErrAxB( double A, double s_A, double B, double s_B );
70+
double Chi2Normalization( TH2D* hData, TH2D* hMC, int Bx1, int Bx2, int By1, int By2, double s1, double s2, bool doFit = false );
71+
double Chi2Normalization( TH1D* hData, TH1D* hMC, int Bx1, int Bx2, double s1, double s2, TString plotname, bool doFit = false );
5972

6073
//ClassDef(BgEstimation, 1);
74+
6175

6276
};
6377

DataCard.txt

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,86 @@
1-
#
1+
22
# This is the data card for the input of M2M3 analysis and TopMassFitter
33
# Auther : SCKao - UCRiverside
44
#
55

6+
#
7+
RootFiles = rootfiles/
8+
69
# Folder to store results
7-
Path = M2M3WMt_4JPFA/
10+
Path = PF_1J/
811

912
# Luminostiy( pb^-1 ) before July
10-
Lumi = 5
13+
Lumi = 1.93
14+
15+
# Number of Jets
16+
n_Jets = 1
17+
# inclusive=> YES: >= n_Jets, NO: == n_Jets
18+
Inclusive = YES
19+
20+
# jacobian test parameters
21+
# p3 : scale , must > 0 , p0,p1,p2 : shape parameters for Mt < 80
22+
# p4: mass of W , p5: width of W , p6: Gassian Convolution, only stable when p6 < 10
23+
PJacob = ( 15.4, 1., -20., 23.54, 80.4, 19.1, 1 )
24+
PSwitch = ( 1, 0, 0, 1, 0, 0, 0 )
1125

1226
# JES type 0: no JES, 1:JEC, 2:JES
1327
JESType = 0
1428
IsMES = OFF
1529

16-
# Number of Jets
17-
n_Jets = 4
18-
1930
# Number of b tagged
2031
# -1 : no btagged , 0: 1+2 btagged , 1: 1 btagged , 2: 2 btagged
2132
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagOctober09ExerciseUsePayload
2233
n_btag = -1
2334
bThreshold = 5
2435

36+
# plot type : png / gif / eps
37+
PlotType = png
38+
2539
# cross-sections for 7 TeV Collision
2640
# MuEnriched QCD is x-section*FilterEfficiency
27-
# ( tt_in, wj_mj, zj_mm, tq_in, tw_in, ww_in, wz_in, qcd_mux )
28-
channel= ( tt, wj, zj, tq, tw, ww, wz, qcd )
29-
xsec = ( 165, 9333.3, 933.3, 63, 10.6, 43, 18, 109853 )
30-
#xsec10 = ( 385, 14266, 1400, 130, 29, 74, 32, 109853 )
31-
EffHLT = ( 0.198, 0.645, 0.447, 0.247, 0.192, 0.13, 0.1, 0.379 )
32-
nEvents = ( 23692, 1334526, 933793, 126345, 89431, 14780, 10940, 1949012 )
41+
# ( tt_in, wj_lv, zj_ll, tq_in, tw_in, ww_in, wz_in, qcd_mux )
42+
channel= ( tt, wj, zj, tq, tw, ww, wz, qcd )
43+
xsec = ( 165, 28049, 2907, 20.48, 10.6, 43, 18, 79688 )
44+
EffHLT = ( 0.2991, 0.2063, 0.2968, 0.327, 0.2629, 0.13, 0.1, 0.7970 )
45+
nEvents = ( 443764, 2077337, 321975, 172830, 122617, 14780, 10940, 3488649 )
3346

3447
# set up the module to run, 0 => off , 1=> on
3548
# 0:ObjectInfo 1:HadTopFitter 2:LepTopFitter 3:EnsembleTest, 4: S/B Ratio 5:MethodTest 6:X-section Measure
36-
Module = ( 1, 1, 0 , 0, 0, 0, 0 )
49+
Module = ( 6, 0, 0 , 0, 0, 0, 0 )
3750
# Random Number Seed , 0 : using system time for the seed
3851
RandomSeed = 0
3952
# ON/OFF for MC matching
4053
MCMatching = OFF
4154

55+
#Cuts Et, Eta
56+
JetCuts = ( 30., 2.4 )
57+
#Cuts Et, Eta, Iso
58+
MuonCuts = ( 18., 2.1, 0.1)
4259
# M2M3 window, M2_Min, M2_Max, M3_Min, M3_Max
4360
#M2M3Cuts = ( 50, 110, 140, 200 )
4461
M2M3Cuts = ( 0, 300, 0, 350 )
4562
LepM2tCutL = 0
4663
dM3Cut = 999
4764

4865
# number of pseudo experiments
49-
nPseudoExp = 10
66+
nPseudoExp = 1000
5067
# input mean for pseudo experiments
5168
# tt4J, wj4J, QCD4J, wj2J, qcd2J
5269
# InputMean = ( 25.36, 6.52, 8.97, 513.57, 503.29 ) .. old value for pf
5370

5471
# pfA
55-
InputMean = ( 24.81, 6.18, 7.90, 494.08, 478.29 )
72+
#InputMean = ( 24.81, 6.18, 7.90, 494.08, 478.29 )
5673
#For JES 1.1
5774
#InputMean = ( 27.34, 9.50, 13.03, 635.37, 609.13 )
5875
#For JES 0.9
5976
#InputMean = ( 21.77, 3.72, 4.91, 373.24, 343.07 )
6077
# caloA
61-
#InputMean = ( 24.43, 7.10, 7.80, 517.97, 413.42 )
78+
#InputMean = ( 41.18, 19.53, 8.37, 578.2, 446.8 )
79+
# tt4J, wj4J, QCD4J, z4J wj2J, qcd2J, z2J
80+
# Calo
81+
#InputMean = ( 26.52, 15.89, 6.82, 1.45 ,479.4, 394.1, 41.7 )
82+
# PF
83+
InputMean = ( 30.74, 13.79, 2.36, 1.47, 374.8, 175.7, 40.3 )
6284

6385
# ON/OFF for phase space smearing
6486
PhaseSmear = OFF
@@ -67,29 +89,32 @@ JES = 1.
6789

6890
# FileName list for pseudo experiment
6991
# '+' is the flag for TChain
70-
# FakeData = ( tt171_336, wj_336, zj_336, tq_336, tw_336, ww_336, wz_336, qcd+ )
92+
#TheData = ( data250nb_0J )
93+
TheData = ( data+ )
94+
#dataChain = ( data_mbias, data1_0716, data2_pv4_1, data2_pv4_2, data2_pv4_3 )
95+
dataChain = ( data_mbiaspf, data1_0716pf, data2_pv4_1pf, data2_pv4_2pf, data2_pv4_3pf )
96+
97+
FakeData = ( tt_361_0jpf, wj0+, qcd0+, zj_361_0jpf1, tq_361_0jpf1, tw_361_0jpf1 )
98+
wj0Chain = ( wj_361_0jpf1, wj_361_0jpf2, wj_361_0jpf3, wj_361_0jpf4, wj_361_0jpf5, wj_361_0jpf6, wj_361_0jpf7 )
99+
qcd0Chain = ( qcd_361_0jpf1, qcd_361_0jpf2, qcd_361_0jpf3, qcd_361_0jpf4, qcd_361_0jpf5, qcd_361_0jpf6, qcd_361_0jpf7 )
71100

72-
#FakeData = ( tt_356_4jcaloA, wj_356_4jcaloA, qcd+ )
73-
#qcdChain = ( qcd_356_4jcaloA1, qcd_356_4jcaloA2, qcd_356_4jcaloA3, qcd_356_4jcaloA4, qcd_356_4jcaloA5, qcd_356_4jcaloA6, qcd_356_4jcaloA7 )
74-
#2JSamples = ( tt_356_2jcaloA, wj_356_2jcaloA, qcd2J+ )
75-
#qcd2JChain = ( qcd_356_2jcaloA1, qcd_356_2jcaloA2, qcd_356_2jcaloA3, qcd_356_2jcaloA4, qcd_356_2jcaloA5, qcd_356_2jcaloA6, qcd_356_2jcaloA7 )
101+
4JSamples = ( tt_361_4jpf, wj+, qcd+, zj_361_4jpf1, tq_361_4jpf1, tw_361_4jpf1 )
102+
wjChain = ( wj_361_4jpf1, wj_361_4jpf2, wj_361_4jpf3, wj_361_4jpf4, wj_361_4jpf5, wj_361_4jpf6, wj_361_4jpf7 )
103+
qcdChain = ( qcd_361_4jpf1, qcd_361_4jpf2, qcd_361_4jpf3, qcd_361_4jpf4, qcd_361_4jpf5, qcd_361_4jpf6, qcd_361_4jpf7 )
76104

77-
FakeData = ( tt_356_4jpfA, wj_356_4jpfA, qcd+ )
78-
qcdChain = ( qcd_356_4jpfA1, qcd_356_4jpfA2, qcd_356_4jpfA3, qcd_356_4jpfA4, qcd_356_4jpfA5, qcd_356_4jpfA6, qcd_356_4jpfA7 )
79-
2JSamples = ( tt_356_2jpfA, wj_356_2jpfA, qcd2J+ )
80-
qcd2JChain = ( qcd_356_2jpfA1, qcd_356_2jpfA2, qcd_356_2jpfA3, qcd_356_2jpfA4, qcd_356_2jpfA5, qcd_356_2jpfA6, qcd_356_2jpfA7 )
105+
2JSamples = ( tt_361_2jpf, wj2+, qcd2J+, zj_361_2jpf1, tq_361_2jpf1, tw_361_2jpf1 )
106+
wj2Chain = ( wj_361_2jpf1, wj_361_2jpf2, wj_361_2jpf3, wj_361_2jpf4, wj_361_2jpf5, wj_361_2jpf6, wj_361_2jpf7 )
107+
qcd2JChain = ( qcd_361_2jpf1, qcd_361_2jpf2, qcd_361_2jpf3, qcd_361_2jpf4, qcd_361_2jpf5, qcd_361_2jpf6, qcd_361_2jpf7 )
81108

82109
# JES 1.1
83-
#FakeData = ( tt_356_4jpfB, wj_356_4jpfB, qcd+ )
84-
#qcdChain = ( qcd_356_4jpfB1, qcd_356_4jpfB2, qcd_356_4jpfB3, qcd_356_4jpfB4, qcd_356_4jpfB5, qcd_356_4jpfB6, qcd_356_4jpfB7 )
85-
#2JSamples = ( tt_356_2jpfB, wj_356_2jpfB, qcd2J+ )
86-
#3qcd2JChain = ( qcd_356_2jpfB1, qcd_356_2jpfB2, qcd_356_2jpfB3, qcd_356_2jpfB4, qcd_356_2jpfB5, qcd_356_2jpfB6, qcd_356_2jpfB7 )
110+
#FakeData = ( tt_361_0jcaloA, wj0+, qcd0+, zj_361_0jcaloA1, tq_361_0jcaloA1, tw_361_0jcaloA1 )
111+
#wj0Chain = ( wj_361_0jcaloA1, wj_361_0jcaloA2, wj_361_0jcaloA3, wj_361_0jcaloA4, wj_361_0jcaloA5, wj_361_0jcaloA6, wj_361_0jcaloA7 )
112+
#qcd0Chain = ( qcd_361_0jcaloA1, qcd_361_0jcaloA2, qcd_361_0jcaloA3, qcd_361_0jcaloA4, qcd_361_0jcaloA5, qcd_361_0jcaloA6, qcd_361_0jcaloA7 )
87113

88114
# JES 0.9
89-
#FakeData = ( tt_356_4jpfC, wj_356_4jpfC, qcd+ )
90-
#qcdChain = ( qcd_356_4jpfC1, qcd_356_4jpfC2, qcd_356_4jpfC3, qcd_356_4jpfC4, qcd_356_4jpfC5, qcd_356_4jpfC6, qcd_356_4jpfC7 )
91-
#2JSamples = ( tt_356_2jpfC, wj_356_2jpfC, qcd2J+ )
92-
#3qcd2JChain = ( qcd_356_2jpfC1, qcd_356_2jpfC2, qcd_356_2jpfC3, qcd_356_2jpfC4, qcd_356_2jpfC5, qcd_356_2jpfC6, qcd_356_2jpfC7 )
115+
#FakeData = ( tt_361_0jcaloB, wj0+, qcd0+, zj_361_0jcaloB1, tq_361_0jcaloB1, tw_361_0jcaloB1 )
116+
#wj0Chain = ( wj_361_0jcaloB1, wj_361_0jcaloB2, wj_361_0jcaloB3, wj_361_0jcaloB4, wj_361_0jcaloB5, wj_361_0jcaloB6, wj_361_0jcaloB7 )
117+
#qcd0Chain = ( qcd_361_0jcaloB1, qcd_361_0jcaloB2, qcd_361_0jcaloB3, qcd_361_0jcaloB4, qcd_361_0jcaloB5, qcd_361_0jcaloB6, qcd_361_0jcaloB7 )
93118

94119
# FileName list for parameterization, or ChainName+ ;
95120
Backgrounds = ( wj1_356, zj_336, tq_336, tw_336, ww_336, wz_336, qcd1_356 )

0 commit comments

Comments
 (0)