wrtabb / dy-analysis Goto Github PK
View Code? Open in Web Editor NEWMy first Drell-Yan analysis
My first Drell-Yan analysis
Lines 407 to 472 in b2b79be
//Defining histograms | |
TH1F*hMCInvMass = new TH1F("hMCInvMass","",43,massbins); | |
hMCInvMass->Sumw2(); | |
hMCInvMass->SetFillColor(kOrange-2); | |
hMCInvMass->SetLineColor(kOrange+3); | |
hMCInvMass->GetXaxis()->SetTitle("m_{ee} [GeV]"); | |
hMCInvMass->GetXaxis()->SetMoreLogLabels(); | |
hMCInvMass->GetXaxis()->SetNoExponent(); | |
hMCInvMass->SetTitle("MC vs. Data Invariant Mass"); | |
TH1F*hMCInvMasslinear = new TH1F("hMCInvMasslinear","",30,binLow,binHigh); | |
hMCInvMasslinear->Sumw2(); | |
hMCInvMasslinear->SetFillColor(kOrange-2); | |
hMCInvMasslinear->SetLineColor(kOrange+3); | |
hMCInvMasslinear->GetXaxis()->SetTitle("m_{ee} [GeV]"); | |
hMCInvMasslinear->GetXaxis()->SetMoreLogLabels(); | |
hMCInvMasslinear->GetXaxis()->SetNoExponent(); | |
hMCInvMasslinear->SetTitle("MC vs. Data Invariant Mass"); | |
TH1F*hDataInvMass = new TH1F("hDataInvMass","",43,massbins); | |
hDataInvMass->Sumw2(); | |
hDataInvMass->SetLineColor(kBlack); | |
hDataInvMass->SetMarkerColor(kBlack); | |
hDataInvMass->SetMarkerSize(1); | |
hDataInvMass->SetMarkerStyle(20); | |
hDataInvMass->GetXaxis()->SetTitle("m_{ee} [GeV]"); | |
hDataInvMass->GetXaxis()->SetNoExponent(); | |
hDataInvMass->GetXaxis()->SetMoreLogLabels(); | |
TH1F*hDataInvMasslinear = new TH1F("hDataInvMasslinear","",30,binLow,binHigh); | |
hDataInvMasslinear->Sumw2(); | |
hDataInvMasslinear->SetLineColor(kBlack); | |
hDataInvMasslinear->SetMarkerColor(kBlack); | |
hDataInvMasslinear->SetMarkerSize(1); | |
hDataInvMasslinear->SetMarkerStyle(20); | |
hDataInvMasslinear->GetXaxis()->SetTitle("m_{ee} [GeV]"); | |
hDataInvMasslinear->GetXaxis()->SetNoExponent(); | |
hDataInvMasslinear->GetXaxis()->SetMoreLogLabels(); | |
TH1F*hFakes = new TH1F("hFakes","",43,massbins); | |
//W+Jets and QCD | |
//iChain 0-7 | |
hFakes->Sumw2(); | |
hFakes->SetFillColor(kViolet+5); | |
hFakes->SetLineColor(kViolet+3); | |
TH1F*hFakeslinear = new TH1F("hFakeslinear","",30,binLow,binHigh); | |
hFakeslinear->Sumw2(); | |
hFakeslinear->SetFillColor(kViolet+5); | |
hFakeslinear->SetLineColor(kViolet+3); | |
hFakeslinear->GetYaxis()->SetRangeUser(0.00001,100000); | |
TH1F*hEW = new TH1F("hEW","",43,massbins); | |
//WW, ZZ, WZ | |
//iChain 8,9,10 | |
hEW->Sumw2(); | |
hEW->SetFillColor(kRed+2); | |
hEW->SetLineColor(kRed+4); | |
TH1F*hEWlinear = new TH1F("hEWlinear","",30,binLow,binHigh); | |
hEWlinear->Sumw2(); | |
hEWlinear->SetFillColor(kRed+2); | |
hEWlinear->SetLineColor(kRed+4); | |
TH1F*hTops = new TH1F("hTops","",43,massbins); | |
//tt, tW | |
//iChain 11,12,13 | |
hTops->Sumw2(); | |
hTops->SetFillColor(kBlue+2); | |
hTops->SetLineColor(kBlue+3); | |
TH1F*hTopslinear = new TH1F("hTopslinear","",30,binLow,binHigh); | |
hTopslinear->Sumw2(); | |
hTopslinear->SetFillColor(kBlue+2); | |
hTopslinear->SetLineColor(kBlue+3); |
Lines 113 to 333 in 747641a
//Loading trees | |
cout << "Loading ntuples" << endl; | |
TString subDirectory[numChains] = | |
{ | |
"WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/crab_WJetsToLNu_amcatnlo", | |
"QCD_Pt-20to30_EMEnriched_TuneCUETP8M1_13TeV_pythia8", | |
"QCD_Pt-30to50_EMEnriched_TuneCUETP8M1_13TeV_pythia8/", | |
"QCD_Pt-50to80_EMEnriched_TuneCUETP8M1_13TeV_pythia8/", | |
"QCD_Pt-80to120_EMEnriched_TuneCUETP8M1_13TeV_pythia8/", | |
"QCD_Pt-120to170_EMEnriched_TuneCUETP8M1_13TeV_pythia8/", | |
"QCD_Pt-170to300_EMEnriched_TuneCUETP8M1_13TeV_pythia8/", | |
"QCD_Pt-300toInf_EMEnriched_TuneCUETP8M1_13TeV_pythia8/", | |
"WW_TuneCUETP8M1_13TeV-pythia8", | |
"ZZ_TuneCUETP8M1_13TeV-pythia8", | |
"WZ_TuneCUETP8M1_13TeV-pythia8", | |
"TT_TuneCUETP8M2T4_13TeV-powheg-pythia8", | |
"ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1", | |
"ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1", | |
"DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/crab_DYLL_M10to50_", | |
"DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/crab_DYLL_M100to200", | |
"DYJetsToLL_M-200to400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-200to400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-400to500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-400to500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-500to700_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-500to700_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-700to800_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-700to800_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-800to1000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-800to1000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-1000to1500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-1000to1500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-1500to2000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-1500to2000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-2000to3000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-2000to3000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DoubleEG/crab_DoubleEG_RunB/ntuple_skim_" | |
}; | |
TString sub10to50[3] = | |
{ | |
"ext1v1/skims/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M10to50_ext1v1_skim.root", | |
"v1/skims/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M10to50_v1_skim.root", | |
"v2/skims/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M10to50_v2_skim.root" | |
}; | |
TString sub100to200[2] = | |
{ | |
"/skims/DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M100to200_skim.root", | |
"_ext/skims/DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M100to200_ext_skim.root" | |
}; | |
TString subQCD30to50[2] = | |
{ | |
"crab_QCDEMEnriched_Pt30to50", | |
"crab_QCDEMEnriched_Pt30to50_ext1" | |
}; | |
TString subQCD50to80[2] = | |
{ | |
"crab_QCDEMEnriched_Pt50to80", | |
"crab_QCDEMEnriched_Pt50to80_ext1" | |
}; | |
TString subQCD80to120[2] = | |
{ | |
"crab_QCDEMEnriched_Pt80to120", | |
"crab_QCDEMEnriched_Pt80to120_ext1" | |
}; | |
TString subQCD120to170[2] = | |
{ | |
"crab_QCDEMEnriched_Pt120to170", | |
"crab_QCDEMEnriched_Pt120to170_ext1" | |
}; | |
TString inputBaseDirName = | |
"/mnt/hadoop/user/uscms01/pnfs/unl.edu/data4/cms/store/user/ikrav/DrellYan_13TeV_2016/v2p3/"; | |
TChain*chains[numChains]; | |
TString files; | |
Long64_t totalentries = 0; | |
for(int iChain=0;iChain<numChains;iChain++) | |
{ | |
chains[iChain] = new TChain(treeName); | |
for(int k=0;k<100;k++)//Loop over individual files: ntuple_skim_k.root | |
{ | |
if(iChain<2 || (iChain>5&&iChain<14))//0,1,6,7,8,9,10,11,12,13 | |
{//W+Jets, QCD20to30, QCD170to300, QCD300toInf, ZZ, WW, WZ, TT, tW top, tW anti | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+="/ntuple_skim_"; | |
files+=k; | |
files+=".root"; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
if(iChain==2)//2 | |
{//QCD 30to50 | |
for(int j=0;j<2;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+=subQCD30to50[j]; | |
files+="/ntuple_skim_"; | |
files+=k; | |
files+=".root"; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==3)//3 | |
{//QCD 50to80 | |
for(int j=0;j<2;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+=subQCD50to80[j]; | |
files+="/ntuple_skim_"; | |
files+=k; | |
files+=".root"; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==4)//4 | |
{//QCD 80to120 | |
for(int j=0;j<2;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+=subQCD80to120[j]; | |
files+="/ntuple_skim_"; | |
files+=k; | |
files+=".root"; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==5)//5 | |
{//QCD 120to170 | |
for(int j=0;j<2;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+=subQCD120to170[j]; | |
files+="/ntuple_skim_"; | |
files+=k; | |
files+=".root"; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==25) | |
{//Data sample | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files += k; | |
files += ".root"; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==14) | |
{//MC Sample 10to50 | |
for(int j=0;j<3;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+=sub10to50[j]; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==16) | |
{//MC sample 100to200 | |
for(int j=0;j<2;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectory[iChain]; | |
files+=sub100to200[j]; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
} | |
if(iChain==15 || (iChain>16&&iChain<25)) | |
{//MC samples other than 10to50 and 100to200 | |
files = inputBaseDirName; | |
files += subDirectory[iChain]; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Entries: " << chains[iChain]->GetEntries() << endl; | |
} | |
//Setting addresses for all branches | |
chains[iChain]->SetBranchAddress("Nelectrons", &Nelectrons, &b_Nelectrons); | |
chains[iChain]->SetBranchAddress("Electron_pT", &Electron_pT, &b_Electron_pT); | |
chains[iChain]->SetBranchAddress("Electron_eta",&Electron_eta, &b_Electron_eta); | |
chains[iChain]->SetBranchAddress("Electron_phi",&Electron_phi, &b_Electron_phi); | |
chains[iChain]->SetBranchAddress("Electron_passMediumID",&Electron_passMediumID,&b_Electron_passMediumID); | |
chains[iChain]->SetBranchAddress("HLT_ntrig",&HLT_ntrig,&b_HLT_ntrig); | |
chains[iChain]->SetBranchAddress("HLT_trigType",&HLT_trigType,&b_HLT_trigType); | |
chains[iChain]->SetBranchAddress("HLT_trigFired",&HLT_trigFired,&b_HLT_trigFired); | |
chains[iChain]->SetBranchAddress("HLT_trigName",&pHLT_trigName); | |
totalentries=totalentries+chains[iChain]->GetEntries(); | |
}//end iChain loop |
Line 214 in 025383f
Long64_t subDirectorySize; |
Lines 92 to 165 in b5c3ea6
TChain*chains[numChains]; | |
int nFiles; | |
Long64_t totalentries = 0; | |
TString files; | |
TString subDirectoryMC[numChains] = | |
{ | |
"DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/crab_DYLL_M10to50_", | |
"DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/crab_DYLL_M100to200", | |
"DYJetsToLL_M-200to400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-200to400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-400to500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-400to500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-500to700_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-500to700_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-700to800_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-700to800_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-800to1000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-800to1000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-1000to1500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-1000to1500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-1500to2000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-1500to2000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root", | |
"DYJetsToLL_M-2000to3000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/skims/DYJetsToLL_M-2000to3000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_skim.root" | |
}; | |
TString sub10to50[3] = | |
{ | |
"ext1v1/skims/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M10to50_ext1v1_skim.root", | |
"v1/skims/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M10to50_v1_skim.root", | |
"v2/skims/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M10to50_v2_skim.root" | |
}; | |
TString sub100to200[2] = | |
{ | |
"/skims/DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M100to200_skim.root", | |
"_ext/skims/DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_crab_DYLL_M100to200_ext_skim.root" | |
}; | |
TString inputBaseDirName = | |
"/mnt/hadoop/user/uscms01/pnfs/unl.edu/data4/cms/store/user/ikrav/DrellYan_13TeV_2016/v2p3/"; | |
for(int iChain=0;iChain<numChains;iChain++) | |
{ | |
chains[iChain] = new TChain(treeName); | |
nFiles = 0; | |
if(iChain==0) | |
{ | |
for(int j=0;j<3;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectoryMC[iChain]; | |
files+=sub10to50[j]; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Number of Entries: " << chains[iChain]->GetEntries() << endl; | |
}//end j loop | |
}//end if iChain==0 | |
if(iChain==2) | |
{ | |
for(int j=0;j<2;j++) | |
{ | |
files = inputBaseDirName; | |
files+=subDirectoryMC[iChain]; | |
files+=sub100to200[j]; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Number of Entries: " << chains[iChain]->GetEntries() << endl; | |
}//end j loop | |
}//end if iChain==2 | |
else if(iChain!=0 && iChain!=2) | |
{ | |
files = inputBaseDirName; | |
files += subDirectoryMC[iChain]; | |
std::ifstream testFileStream(files); | |
if(!(bool)testFileStream) continue; | |
chains[iChain]->Add(files); | |
cout << "File: " << files << " loaded" << endl; | |
cout << "Number of Entries: " << chains[iChain]->GetEntries() << endl; | |
} |
Line 551 in f6a0b28
legend->Draw("same"); |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.