#define ElectronAnalyser_cxx #include "ElectronAnalyser.h" #include #include #include #include "TMath.h" #include "TSpectrum.h" #include "TVirtualFitter.h" #include void ElectronAnalyser::Loop() { // In a ROOT session, you can do: // Root > .L ElectronAnalyser.C // Root > ElectronAnalyser t // Root > t.GetEntry(12); // Fill t data members with entry number 12 // Root > t.Show(); // Show values of entry 12 // Root > t.Show(16); // Read and show values of entry 16 // Root > t.Loop(); // Loop on all entries // // This is the loop skeleton where: // jentry is the global entry number in the chain // ientry is the entry number in the current Tree // Note that the argument to GetEntry must be: // jentry for TChain::GetEntry // ientry for TTree::GetEntry and TBranch::GetEntry // // To read only selected branches, Insert statements like: // METHOD1: // fChain->SetBranchStatus("*",0); // disable all branches // fChain->SetBranchStatus("branchname",1); // activate branchname // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch int DSflag = 0; // DSflag = 0 for MC; DSflag = 1 for Run2016; DSflag = 2 for Run2016B; DSflag = 3 for Run2016C; DSflag = 4 for Run2016D; DSflag = 5 for Run2016E; DSflag = 6 for Run2016F; DSflag = 7 for Run2016G; DSflag = 8 for Run2016H; int corflag = 3; // corflag = 1 for pt_r9_eta bins; corflag = 2 for r9_eta bins; corflag = 3 for eta bins; // Define output root file containing all Mass histos if (DSflag == 0) TFile *fout = new TFile ("test.root","RECREATE"); // if (DSflag == 0) TFile *fout = new TFile ("DYJetsM50_Mass.root","RECREATE"); if (DSflag == 1) TFile *fout = new TFile ("SingleElectron2016_Mass.root","RECREATE"); if (DSflag == 2) TFile *fout = new TFile ("SingleElectron2016B_Mass.root","RECREATE"); if (DSflag == 3) TFile *fout = new TFile ("SingleElectron2016C_Mass.root","RECREATE"); if (DSflag == 4) TFile *fout = new TFile ("SingleElectron2016D_Mass.root","RECREATE"); if (DSflag == 5) TFile *fout = new TFile ("SingleElectron2016E_Mass.root","RECREATE"); if (DSflag == 6) TFile *fout = new TFile ("SingleElectron2016F_Mass.root","RECREATE"); if (DSflag == 7) TFile *fout = new TFile ("SingleElectron2016G_Mass.root","RECREATE"); if (DSflag == 8) TFile *fout = new TFile ("SingleElectron2016H_Mass.root","RECREATE"); TH1D *h_nLepGood = new TH1D("nLepGood", "nLepGood", 5, 0., 5.); TH1D *h_LepGood_pt = new TH1D("LepGood_pt", "LepGood_pt", 100, 0., 100.); TH1D *h_LepGood_eta = new TH1D("LepGood_eta", "LepGood_eta", 100, -2.5, 2.5); TH1D *h_LepGood_r9 = new TH1D("LepGood_r9", "LepGood_r9", 100, 0., 1.); TH1D *h_LepGood_eSuperClusterOverP = new TH1D("LepGood_eSuperClusterOverP", "LepGood_eSuperClusterOverP", 100, 0., 2.); TH1D *h_DeltaEoPcor = new TH1D("DeltaEoPcor", "DeltaEoPcor", 100, -0.2, 0.2); TH1D *h_DeltaEoPcor_barrel = new TH1D("DeltaEoPcor_barrel", "DeltaEoPcor_barrel", 100, -0.2, 0.2); TH1D *h_DeltaEoPcor_centralbarrel = new TH1D("DeltaEoPcor_centralbarrel", "DeltaEoPcor_centralbarrel", 100, -0.2, 0.2); TH1D *h_DeltaEoPcor_endcaps = new TH1D("DeltaEoPcor_endcaps", "DeltaEoPcor_endcaps", 100, -0.2, 0.2); TH1D *h_DeltaEoPcor_centralendcaps = new TH1D("DeltaEoPcor_centralendcaps", "DeltaEoPcor_centralendcaps", 100, -0.2, 0.2); TH1D *h_DeltaMasscor = new TH1D("DeltaMasscor", "DeltaMasscor", 100, -0.2, 0.2); TH1D *h_DeltaMasscor_barrel = new TH1D("DeltaMasscor_barrel", "DeltaMasscor_barrel", 100, -0.2, 0.2); TH1D *h_DeltaMasscor_centralbarrel = new TH1D("DeltaMasscor_centralbarrel", "DeltaMasscor_centralbarrel", 100, -0.2, 0.2); TH1D *h_DeltaMasscor_endcaps = new TH1D("DeltaMasscor_endcaps", "DeltaMasscor_endcaps", 100, -0.2, 0.2); TH1D *h_DeltaMasscor_centralendcaps = new TH1D("DeltaMasscor_centralendcaps", "DeltaMasscor_centralendcaps", 100, -0.2, 0.2); TH1D *h_mZ = new TH1D("mZ", "Standard Z mass",150, 75., 105.); TH1D *h_mZ_DYcor = new TH1D("mZ_DYcor", "DY corrected Z mass",150, 75., 105.); TH1D *h_mZ_Wcor = new TH1D("mZ_Wcor", "W corrected Z mass",150, 75., 105.); TH1D *h_mZ_BB = new TH1D("mZ_BB", "Standard Z mass Both Electrons in Barrel",150, 75., 105.); TH1D *h_mZ_BB_DYcor = new TH1D("mZ_BB_DYcor", "DY Corrected Z mass Both Electrons in Barrel",150, 75., 105.); TH1D *h_mZ_BB_Wcor = new TH1D("mZ_BB_Wcor", "W Corrected Z mass Both Electrons in Barrel",150, 75., 105.); TH1D *h_mZ_EE = new TH1D("mZ_EE", "Standard Z mass Both Electrons in Endcaps",150, 75., 105.); TH1D *h_mZ_EE_DYcor = new TH1D("mZ_EE_DYcor", "DY Corrected Z mass Both Electrons in Endcaps",150, 75., 105.); TH1D *h_mZ_EE_Wcor = new TH1D("mZ_EE_Wcor", "W Corrected Z mass Both Electrons in Endcaps",150, 75., 105.); TH1D *h_mZ_BE = new TH1D("mZ_BE", "Standard Z mass One Electron in Barrel & One Electron in Endcap",150, 75., 105.); TH1D *h_mZ_BE_DYcor = new TH1D("mZ_BE_DYcor", "DY Corrected Z mass One Electron in Barrel & One Electron in Endcap",150, 75., 105.); TH1D *h_mZ_BE_Wcor = new TH1D("mZ_BE_Wcor", "W Corrected Z mass One Electron in Barrel & One Electron in Endcap",150, 75., 105.); TH1D *h_mZ_BcentralBcentral = new TH1D("mZ_BcentralBcentral", "Standard Z mass Both Electrons in Central Barrel",150, 75., 105.); TH1D *h_mZ_BcentralBcentral_DYcor = new TH1D("mZ_BcentralBcentral_DYcor", "DY Corrected Z mass Both Electrons in Central Barrel",150, 75., 105.); TH1D *h_mZ_BcentralBcentral_Wcor = new TH1D("mZ_BcentralBcentral_Wcor", "W Corrected Z mass Both Electrons in Central Barrel",150, 75., 105.); TH1D *h_mZ_BcentralBforward = new TH1D("mZ_BcentralBforward", "Standard Z mass One Electron in Central Barrel & One Electron in Forward Barrel ",150, 75., 105.); TH1D *h_mZ_BcentralBforward_DYcor = new TH1D("mZ_BcentralBforward_DYcor", "DY Corrected Z mass One Electron in Central Barrel & One Electron in Forward Barrel",150, 75., 105.); TH1D *h_mZ_BcentralBforward_Wcor = new TH1D("mZ_BcentralBforward_Wcor", "W Corrected Z mass One Electron in Central Barrel & One Electron in Forward Barrel",150, 75., 105.); TH1D *h_mZ_BcentralEcentral = new TH1D("mZ_BcentralEcentral", "Standard Z mass One Electron in Central Barrel & One Electron in Central Endcap",150, 75., 105.); TH1D *h_mZ_BcentralEcentral_DYcor = new TH1D("mZ_BcentralEcentral_DYcor", "DY Corrected Z mass One Electron in Central Barrel & One Electron in Central Endcap",150, 75., 105.); TH1D *h_mZ_BcentralEcentral_Wcor = new TH1D("mZ_BcentralEcentral_Wcor", "W Corrected Z mass One Electron in Central Barrel & One Electron in Central Endcap",150, 75., 105.); TH1D *h_mZ_BcentralEforward = new TH1D("mZ_BcentralEforward", "Standard Z mass One Electron in Central Barrel & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_BcentralEforward_DYcor = new TH1D("mZ_BcentralEforward_DYcor", "DY Corrected Z mass One Electron in Central Barrel & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_BcentralEforward_Wcor = new TH1D("mZ_BcentralEforward_Wcor", "W Corrected Z mass One Electron in Central Barrel & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_BforwardBforward = new TH1D("mZ_BforwardBforward", "Standard Z mass Both Electrons in Forward Barrel",150, 75., 105.); TH1D *h_mZ_BforwardBforward_DYcor = new TH1D("mZ_BforwardBforward_DYcor", "DY Corrected Z mass Both Electrons in Forward Barrel",150, 75., 105.); TH1D *h_mZ_BforwardBforward_Wcor = new TH1D("mZ_BforwardBforward_Wcor", "W Corrected Z mass Both Electrons in Forward Barrel",150, 75., 105.); TH1D *h_mZ_BforwardEcentral = new TH1D("mZ_BforwardEcentral", "Standard Z mass One Electron in Forward Barrel & One Electron in Central Endcap",150, 75., 105.); TH1D *h_mZ_BforwardEcentral_DYcor = new TH1D("mZ_BforwardEcentral_DYcor", "DY Corrected Z mass One Electron in Forward Barrel & One Electron in Central Endcap",150, 75., 105.); TH1D *h_mZ_BforwardEcentral_Wcor = new TH1D("mZ_BforwardEcentral_Wcor", "W Corrected Z mass One Electron in ForwardBarrel & One Electron in Central Endcap",150, 75., 105.); TH1D *h_mZ_BforwardEforward = new TH1D("mZ_BforwardEforward", "Standard Z mass One Electron in Forward Barrel & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_BforwardEforward_DYcor = new TH1D("mZ_BforwardEforward_DYcor", "DY Corrected Z mass One Electron in Forward Barrel & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_BforwardEforward_Wcor = new TH1D("mZ_BforwardEforward_Wcor", "W Corrected Z mass One Electron in Forward Barrel & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_EcentralEcentral = new TH1D("mZ_EcentralEcentral", "Standard Z mass Both Electrons in Central Endcaps",150, 75., 105.); TH1D *h_mZ_EcentralEcentral_DYcor = new TH1D("mZ_EcentralEcentral_DYcor", "DY Corrected Z mass Both Electrons in Central Endcaps",150, 75., 105.); TH1D *h_mZ_EcentralEcentral_Wcor = new TH1D("mZ_EcentralEcentral_Wcor", "W Corrected Z mass Both Electrons in Central Endcaps",150, 75., 105.); TH1D *h_mZ_EcentralEforward = new TH1D("mZ_EcentralEforward", "Standard Z mass One Electron in Central Endcap & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_EcentralEforward_DYcor = new TH1D("mZ_EcentralEforward_DYcor", "DY Corrected Z mass One Electron in Central Endcap & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_EcentralEforward_Wcor = new TH1D("mZ_EcentralEforward_Wcor", "W Corrected Z mass One Electron in Central Endcap & One Electron in Forward Endcap",150, 75., 105.); TH1D *h_mZ_EforwardEforward = new TH1D("mZ_EforwardEforward", "Standard Z mass Both Electrons in Forward Endcaps",150, 75., 105.); TH1D *h_mZ_EforwardEforward_DYcor = new TH1D("mZ_EforwardEforward_DYcor", "DY Corrected Z mass Both Electrons in Forward Endcaps",150, 75., 105.); TH1D *h_mZ_EforwardEforward_Wcor = new TH1D("mZ_EforwardEforward_Wcor", "W Corrected Z mass Both Electrons in Forward Endcaps",150, 75., 105.); TH1D *h_mZ_Bcentral = new TH1D("mZ_Bcentral", "Standard Z mass One Electron in Central Barrel",150, 75., 105.); TH1D *h_mZ_Bcentral_DYcor = new TH1D("mZ_Bcentral_DYcor", "DY Corrected Z mass One Electron in Central Barrel",150, 75., 105.); TH1D *h_mZ_Bcentral_Wcor = new TH1D("mZ_Bcentral_Wcor", "W Corrected Z mass One Electron in Central Barrel",150, 75., 105.); TH1D *h_mZ_Bforward = new TH1D("mZ_Bforward", "Standard Z mass One Electron in Forward Barrel",150, 75., 105.); TH1D *h_mZ_Bforward_DYcor = new TH1D("mZ_Bforward_DYcor", "DY Corrected Z mass One Electron Forward Barrel",150, 75., 105.); TH1D *h_mZ_Bforward_Wcor = new TH1D("mZ_Bforward_Wcor", "W Corrected Z mass One Electron Forward Barrel",150, 75., 105.); TH1D *h_mZ_Ecentral = new TH1D("mZ_Ecentral", "Standard Z mass One Electron in Central Endcaps",150, 75., 105.); TH1D *h_mZ_Ecentral_DYcor = new TH1D("mZ_Ecentral_DYcor", "DY Corrected Z mass One Electron in Central Endcaps",150, 75., 105.); TH1D *h_mZ_Ecentral_Wcor = new TH1D("mZ_Ecentral_Wcor", "W Corrected Z mass One Electron in Central Endcaps",150, 75., 105.); TH1D *h_mZ_Eforward = new TH1D("mZ_Eforward", "Standard Z mass One Electron in Forward Endcaps",150, 75., 105.); TH1D *h_mZ_Eforward_DYcor = new TH1D("mZ_Eforward_DYcor", "DY Corrected Z mass One Electron Forward Endcaps",150, 75., 105.); TH1D *h_mZ_Eforward_Wcor = new TH1D("mZ_Eforward_Wcor", "W Corrected Z mass One Electron Forward Endcaps",150, 75., 105.); TH2D *h_mZvsEta = new TH2D("mZvsEta", "Standard Z mass",100, -2.5, 2.5, 150, 75., 105.); TH2D *h_mZvsEta_DYcor = new TH2D("mZvsEta_DYcor", "DY corrected Z mass",100, -2.5, 2.5, 150, 75., 105.); TH1D *h_mZ_BB_pt[5]; char *mZ_BB_pt[50] = new char[50]; TH1D *h_mZ_BB_DYcor_pt[5]; char *mZ_BB_DYcor_pt[50] = new char[50]; TH1D *h_mZ_BB_Wcor_pt[5]; char *mZ_BB_Wcor_pt[50] = new char[50]; TH1D *h_mZ_EE_pt[5]; char *mZ_EE_pt[50] = new char[50]; TH1D *h_mZ_EE_DYcor_pt[5]; char *mZ_EE_DYcor_pt[50] = new char[50]; TH1D *h_mZ_EE_Wcor_pt[5]; char *mZ_EE_Wcor_pt[50] = new char[50]; TH1D *h_mZ_eta[50]; char *mZ_eta[50] = new char[50]; TH1D *h_mZ_DYcor_eta[50]; char *mZ_DYcor_eta[50] = new char[50]; TH1D *h_mZ_Wcor_eta[50]; char *mZ_Wcor_eta[50] = new char[50]; // char filenameMass[500]; // char filenameMassDYcor[500]; // char filenameMassWcor[500]; char filenamecorDY[500]; char filenamecorW[500]; //Define input text files containing fit results of EoP histos & output text files for masses // if (DSflag == 0) sprintf(filenameMass,"DYJetsM50_StandardMass.dat"); // if (DSflag == 0) sprintf(filenameMassDYcor,"DYJetsM50_DYcorrectedMass.dat"); // if (DSflag == 0) sprintf(filenameMassWcor,"DYJetsM50_WcorrectedMass.dat"); // if (DSflag == 0) sprintf(filenamecorDY,"DYJetsM50_BuildEoPhis_EoP.txt"); if (DSflag == 0) sprintf(filenamecorW,"WJets_BuildEoPhis_EoP.txt"); // if (DSflag == 1) sprintf(filenameMass,"DoubleElectronAB_StandardMass.dat"); // if (DSflag == 1) sprintf(filenameMassDYcor,"DoubleElectronAB_DYcorrectedMass.dat"); // if (DSflag == 1) sprintf(filenameMassWcor,"DoubleElectronAB_WcorrectedMass.dat"); // if (DSflag == 1) sprintf(filenamecorDY,"DoubleElectronAB_BuildEoPhis_EoP.txt"); if (DSflag == 1) sprintf(filenamecorW,"SingleElectron2016_BuildEoPhis_EoP.txt"); // if (DSflag == 2) sprintf(filenameMass,"DoubleElectronC_StandardMass.dat"); // if (DSflag == 2) sprintf(filenameMassDYcor,"DoubleElectronC_DYcorrectedMass.dat"); // if (DSflag == 2) sprintf(filenameMassWcor,"DoubleElectronC_WcorrectedMass.dat"); // if (DSflag == 2) sprintf(filenamecorDY,"DoubleElectronC_BuildEoPhis_EoP.txt"); if (DSflag == 2) sprintf(filenamecorW,"SingleElectron2016B_BuildEoPhis_EoP.txt"); // if (DSflag == 3) sprintf(filenameMass,"DoubleElectronD_StandardMass.dat"); // if (DSflag == 3) sprintf(filenameMassDYcor,"DoubleElectronD_DYcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenameMassWcor,"DoubleElectronD_WcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenamecorDY,"DoubleElectronD_BuildEoPhis_EoP.txt"); if (DSflag == 3) sprintf(filenamecorW,"SingleElectron2016C_BuildEoPhis_EoP.txt"); // if (DSflag == 3) sprintf(filenameMass,"DoubleElectronD_StandardMass.dat"); // if (DSflag == 3) sprintf(filenameMassDYcor,"DoubleElectronD_DYcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenameMassWcor,"DoubleElectronD_WcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenamecorDY,"DoubleElectronD_BuildEoPhis_EoP.txt"); if (DSflag == 4) sprintf(filenamecorW,"SingleElectron2016D_BuildEoPhis_EoP.txt"); // if (DSflag == 3) sprintf(filenameMass,"DoubleElectronD_StandardMass.dat"); // if (DSflag == 3) sprintf(filenameMassDYcor,"DoubleElectronD_DYcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenameMassWcor,"DoubleElectronD_WcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenamecorDY,"DoubleElectronD_BuildEoPhis_EoP.txt"); if (DSflag == 5) sprintf(filenamecorW,"SingleElectron2016E_BuildEoPhis_EoP.txt"); // if (DSflag == 3) sprintf(filenameMass,"DoubleElectronD_StandardMass.dat"); // if (DSflag == 3) sprintf(filenameMassDYcor,"DoubleElectronD_DYcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenameMassWcor,"DoubleElectronD_WcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenamecorDY,"DoubleElectronD_BuildEoPhis_EoP.txt"); if (DSflag == 6) sprintf(filenamecorW,"SingleElectron2016F_BuildEoPhis_EoP.txt"); // if (DSflag == 3) sprintf(filenameMass,"DoubleElectronD_StandardMass.dat"); // if (DSflag == 3) sprintf(filenameMassDYcor,"DoubleElectronD_DYcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenameMassWcor,"DoubleElectronD_WcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenamecorDY,"DoubleElectronD_BuildEoPhis_EoP.txt"); if (DSflag == 7) sprintf(filenamecorW,"SingleElectron2016G_BuildEoPhis_EoP.txt"); // if (DSflag == 3) sprintf(filenameMass,"DoubleElectronD_StandardMass.dat"); // if (DSflag == 3) sprintf(filenameMassDYcor,"DoubleElectronD_DYcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenameMassWcor,"DoubleElectronD_WcorrectedMass.dat"); // if (DSflag == 3) sprintf(filenamecorDY,"DoubleElectronD_BuildEoPhis_EoP.txt"); if (DSflag == 8) sprintf(filenamecorW,"SingleElectron2016H_BuildEoPhis_EoP.txt"); // ofstream dimFileMass(filenameMass); // ofstream dimFileMassDYcor(filenameMassDYcor); // ofstream dimFileMassWcor(filenameMassWcor); // ifstream dimFilecorDY(filenamecorDY); ifstream dimFilecorW(filenamecorW); // if(!dimFilecorDY) cout << "no DY input file" << endl; if(!dimFilecorW) cout << "no W input file" << endl; int ihist = 0; int ih = 0; if (corflag == 1) { int nptstep = 5; int nr9step = 2; int netastep = 50; double ptstep[5] = {5., 5., 10., 20., 30.}; double r9step[2] = {0.94, 0.06}; } if (corflag == 2) { int nptstep = 1; int nr9step = 2; int netastep = 50; double ptstep[1] = {70.}; double r9step[2] = {0.94, 0.06}; } if (corflag == 3) { int nptstep = 1; int nr9step = 1; int netastep = 50; double ptstep[1] = {70}; double r9step[1] = {1.}; } double etastep = 0.1; int nlB, nlE; double EoPcorDY[500] = {0.}; double EoPcorW[500] = {0.}; double theta[5], p[5], px[5], py[5], pz[5], pDYcor[5], pDYcorx[5], pDYcory[5], pDYcorz[5], pWcor[5], pWcorx[5], pWcory[5], pWcorz[5], mZ_DYcor, mZ_Wcor; double ptmin, ptmax, r9min, r9max, etamin, etamax; int nptplotstep = 5; double ptplotstep[5] = {5., 5., 10., 20., 30.}; for (int ipt=0; ipt> EoPcorDY[ih]; dimFilecorW >> EoPcorW[ih]; h_DeltaEoPcor->Fill(EoPcorDY[ih]-EoPcorW[ih]); } } ihist = ihist + 1; } for (int ieta=0; ietaGetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentry<10;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; h_nLepGood->Fill(nLepGood); // Define selection if( (HLT_SingleEl == 1 || HLT_DoubleEl == 1) && nLepGood == 2) { // from now consider only these events for (int ilg = 0; ilg < 2; ilg++) { // loop on both electrons if(LepGood_pt[ilg] > 30.&& abs(LepGood_eta[ilg]) < 2.5 && LepGood_tightId[ilg] >=3 && LepGood_hltId[ilg] > 0 && LepGood_convVeto[ilg] == 1 && LepGood_r9[ilg] > 0.93 && LepGood_r9[ilg] <= 0.95 ) { // from now consider only trhese events // cout << evt << " " << mZ1 << " " << nLepGood << " " << LepGood_pt[ilg] << " " << LepGood_eta[ilg] << " " << LepGood_phi[ilg] << endl; h_LepGood_pt->Fill(LepGood_pt[ilg]); h_LepGood_eta->Fill(LepGood_eta[ilg]); h_LepGood_r9->Fill(LepGood_r9[ilg]); h_LepGood_eSuperClusterOverP->Fill(LepGood_eSuperClusterOverP[ilg]); ptmax = 30.; for (int ipt=0; ipt ptmin && LepGood_pt[ilg] <= ptmax) { r9max = 0.; for (int ir9=0; ir9 r9min && LepGood_r9[ilg] < r9max) { etamax = -2.5; for (int ieta=0; ieta etamin && LepGood_eta[ilg] < etamax) { ih = ipt*nr9step*netastep + ir9*netastep + ieta; theta[ilg] = 2 * atan(exp(-LepGood_eta[ilg])); p[ilg] = LepGood_pt[ilg]/sin(theta[ilg]); px[ilg] = p[ilg] * sin(theta[ilg]) * cos(LepGood_phi[ilg]); py[ilg] = p[ilg] * sin(theta[ilg]) * sin(LepGood_phi[ilg]); pz[ilg] = p[ilg] * cos(theta[ilg]); // cout << p[ilg] << " " << theta[ilg] << " " << LepGood_phi[ilg] << endl; // Corrections for DYJetsM50 if (DSflag==0) { if (LepGood_r9[ilg] <= 0.90) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -1.5) EoPcorDY[ih] = 0.915897 - 0.973947 * LepGood_eta[ilg] - 2.18883 * LepGood_eta[ilg]*LepGood_eta[ilg] - 1.88666 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.674788 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.0855776 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin I to IV fit if (LepGood_eta[ilg] >= -1.5 && LepGood_eta[ilg] <= 1.5) EoPcorDY[ih] = 1.01847 + 0.00706414 * LepGood_eta[ilg] - 0.0412876 * LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00682249 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.0219888 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin I to IV fit if (LepGood_eta[ilg] > 1.5 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = 23.7445 - 48.9902 * LepGood_eta[ilg] + 38.7772 * LepGood_eta[ilg]*LepGood_eta[ilg] - 13.3589 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 1.69734 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin I to IV fit } if (LepGood_r9[ilg] > 0.90 && LepGood_r9[ilg] <= 0.93) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -1.2) EoPcorDY[ih] = 1.69939 + 1.81896 * LepGood_eta[ilg] + 1.69536 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.688515 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.107346 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin V fit if (LepGood_eta[ilg] >= -1.2 && LepGood_eta[ilg] <= 1.5) EoPcorDY[ih] = 1.02147 + 0.00200813 * LepGood_eta[ilg] - 0.030145 * LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00285248 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00175982 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.001073 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00556949 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin V fit if (LepGood_eta[ilg] > 1.5 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = 1.59522 - 1.57988 * LepGood_eta[ilg] + 1.463 * LepGood_eta[ilg]*LepGood_eta[ilg] - 0.576306 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.0861661 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin V fit } if (LepGood_r9[ilg] > 0.93 && LepGood_r9[ilg] <= 0.95) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -1.4) EoPcorDY[ih] = 3.82913 + 8.85376 * LepGood_eta[ilg] + 10.7163 * LepGood_eta[ilg]*LepGood_eta[ilg] + 6.31452 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 1.81563 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.203132 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VI fit if (LepGood_eta[ilg] >= -1.4 && LepGood_eta[ilg] <= 1.4) EoPcorDY[ih] = 1.00085 - 0.00150926 * LepGood_eta[ilg] - 0.000872114 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00490786 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.0208602 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00266277 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00926447 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VI fit if (LepGood_eta[ilg] > 1.4 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = 0.282142 + 2.75873 * LepGood_eta[ilg] - 4.07041 * LepGood_eta[ilg]*LepGood_eta[ilg] + 2.84835 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.954014 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.124232 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VI fit } if (LepGood_r9[ilg] > 0.95 && LepGood_r9[ilg] <= 0.96) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -0.95) EoPcorDY[ih] = 1.94978 + 3.00107 * LepGood_eta[ilg] + 3.58706 * LepGood_eta[ilg]*LepGood_eta[ilg] + 2.07258 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.58203 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.0632826 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VII fit if (LepGood_eta[ilg] >= -0.95 && LepGood_eta[ilg] <= 0.95) EoPcorDY[ih] = 0.993834 + 0.000431757 * LepGood_eta[ilg] - 0.00376466 * LepGood_eta[ilg]*LepGood_eta[ilg] - 7.57156e-05 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00432465 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00111633 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.0101464 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VII fit if (LepGood_eta[ilg] > 0.95 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = 0.447702 + 2.11335 * LepGood_eta[ilg] - 3.16479 * LepGood_eta[ilg]*LepGood_eta[ilg] + 2.26958 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.785933 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.106192 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VII fit } if (LepGood_r9[ilg] > 0.96 && LepGood_r9[ilg] <= 0.97) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -1.25) EoPcorDY[ih] = 1.20705 + 0.399562 * LepGood_eta[ilg] + 0.210562 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.0322917 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VIII fit if (LepGood_eta[ilg] >= -1.25 && LepGood_eta[ilg] <= 1.25) EoPcorDY[ih] = 0.991765 - 0.00124271 * LepGood_eta[ilg] + 0.00527778 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00593906 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.0274587 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00302832 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.0110447 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VIII fit if (LepGood_eta[ilg] > 1.25 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = 0.798465 + 0.318659 * LepGood_eta[ilg] - 0.190798 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.0396224 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin VIII fit } if (LepGood_r9[ilg] > 0.97 && LepGood_r9[ilg] <= 0.98) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -1.25) EoPcorDY[ih] = 81.0863 + 275.372 * LepGood_eta[ilg] + 388.976 * LepGood_eta[ilg]*LepGood_eta[ilg] + 289.162 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 119.406 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 25.9914 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 2.33197 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin IX fit if (LepGood_eta[ilg] >= -1.25 && LepGood_eta[ilg] <= 1.25) EoPcorDY[ih] = 0.99079 - 0.000649128 * LepGood_eta[ilg] - 0.00572828 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00558826 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00180345 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00342593 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00167485 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin IX fit if (LepGood_eta[ilg] > 1.25 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = -17.926 + 55.8892 * LepGood_eta[ilg] - 67.1724 * LepGood_eta[ilg]*LepGood_eta[ilg] + 41.9457 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 14.3077 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 2.51237 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.175412 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin IX fit } if (LepGood_r9[ilg] > 0.98 && LepGood_r9[ilg] <= 1.00) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -1.35) EoPcorDY[ih] = 74.6579 + 296.569 * LepGood_eta[ilg] + 474.07 * LepGood_eta[ilg]*LepGood_eta[ilg] + 389.466 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 174.681 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 40.7643 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 3.88195 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin X fit if (LepGood_eta[ilg] >= -1.35 && LepGood_eta[ilg] <= 1.35) EoPcorDY[ih] = 0.990077 - 0.00191071 * LepGood_eta[ilg] - 0.0156111 * LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00616324 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 0.00477385 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00322578 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 0.00212328 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin X fit if (LepGood_eta[ilg] > 1.35 && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = -312.099 + 991.262 * LepGood_eta[ilg] - 1296.01 * LepGood_eta[ilg]*LepGood_eta[ilg] + 895.997 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 345.593 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] + 70.5288 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg] - 5.95049 * LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]*LepGood_eta[ilg]; // R9 Bin X fit } } // Corrections for SingleElectron2016 if (DSflag==1) { if (LepGood_eta[ilg] > -2.5 && LepGood_eta[ilg] < -2.) EoPcorDY[ih] = 0.850425 - 0.0617 * LepGood_eta[ilg]; if (LepGood_eta[ilg] >= -2. && LepGood_eta[ilg] < -1.5) EoPcorDY[ih] = 1.14013 + 0.0938 * LepGood_eta[ilg]; if (LepGood_eta[ilg] >= -1.5 && LepGood_eta[ilg] < -1.) EoPcorDY[ih] = 0.942771 - 0.046021 * LepGood_eta[ilg]; if (LepGood_eta[ilg] >= -1. && LepGood_eta[ilg] <= 1.) EoPcorDY[ih] = 0.993864 + 0.000915799 * LepGood_eta[ilg] - 0.00372521 * LepGood_eta[ilg]*LepGood_eta[ilg]; if (LepGood_eta[ilg] > 1. && LepGood_eta[ilg] <= 1.5) EoPcorDY[ih] = 0.90807 + 0.074163 * LepGood_eta[ilg]; if (LepGood_eta[ilg] > 1.5 && LepGood_eta[ilg] <= 2.) EoPcorDY[ih] = 1.19009 - 0.1271* LepGood_eta[ilg]; if (LepGood_eta[ilg] > 2. && LepGood_eta[ilg] < 2.5) EoPcorDY[ih] = 0.84046 + 0.0652 * LepGood_eta[ilg]; } pDYcor[ilg] = p[ilg] / EoPcorDY[ih]; pDYcorx[ilg] = px[ilg] / EoPcorDY[ih]; pDYcory[ilg] = py[ilg] / EoPcorDY[ih]; pDYcorz[ilg] = pz[ilg] / EoPcorDY[ih]; EoPcorW[ih] = EoPcorDY[ih]; pWcor[ilg] = p[ilg] / EoPcorW[ih]; pWcorx[ilg] = px[ilg] / EoPcorW[ih]; pWcory[ilg] = py[ilg] / EoPcorW[ih]; pWcorz[ilg] = pz[ilg] / EoPcorW[ih]; if (abs(LepGood_eta[ilg]) < 1.556) h_DeltaEoPcor_barrel->Fill(EoPcorDY[ih]-EoPcorW[ih]); if (abs(LepGood_eta[ilg]) < 1.) h_DeltaEoPcor_centralbarrel->Fill(EoPcorDY[ih]-EoPcorW[ih]); if (abs(LepGood_eta[ilg]) < 2.5 && abs(LepGood_eta[ilg]) > 1.556) h_DeltaEoPcor_endcaps->Fill(EoPcorDY[ih]-EoPcorW[ih]); if (abs(LepGood_eta[ilg]) < 2. && abs(LepGood_eta[ilg]) > 1.556) h_DeltaEoPcor_centralendcaps->Fill(EoPcorDY[ih]-EoPcorW[ih]); } } } } } } } } if( (HLT_SingleEl == 1 || HLT_DoubleEl == 1) && nLepGood <= 2 && LepGood_pt[0] > 30. && LepGood_pt[1] > 30. && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[1]) < 2.5 && LepGood_tightId[0] >=3 && LepGood_tightId[1] >=3 && LepGood_hltId[0] > 0 && LepGood_hltId[1] > 0 && LepGood_convVeto[0] == 1 && LepGood_convVeto[1] == 1 && LepGood_r9[0] > 0.93 && LepGood_r9[0] <= 0.95 && LepGood_r9[1] > 0.93 && LepGood_r9[1] <= 0.95 && (LepGood_charge[0]/LepGood_charge[1] < 0.)) { // from now consider only these events mZ_DYcor = sqrt ((pDYcor[0]+pDYcor[1])**2 - ( (pDYcorx[0]+pDYcorx[1])**2 + (pDYcory[0]+pDYcory[1])**2 + (pDYcorz[0]+pDYcorz[1])**2 )); mZ_Wcor = sqrt ((p[0]+p[1])**2 - ( (px[0]+px[1])**2 + (py[0]+py[1])**2 + (pz[0]+pz[1])**2 )); if ( abs(mZ1 - mZ_Wcor) < 0.0001) { h_DeltaMasscor->Fill(mZ_DYcor-mZ_Wcor); if (abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[1]) < 1.556) h_DeltaMasscor_barrel->Fill(mZ_DYcor-mZ_Wcor); if (abs(LepGood_eta[0]) < 1. && abs(LepGood_eta[1]) < 1.) h_DeltaMasscor_centralbarrel->Fill(mZ_DYcor-mZ_Wcor); if (abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[0]) > 1.556 && abs(LepGood_eta[1]) < 2.5 && abs(LepGood_eta[1]) > 1.556) h_DeltaMasscor_endcaps->Fill(mZ_DYcor-mZ_Wcor); if (abs(LepGood_eta[0]) < 2. && abs(LepGood_eta[0]) > 1.556 && abs(LepGood_eta[1]) < 2. && abs(LepGood_eta[1]) > 1.556) h_DeltaMasscor_centralendcaps->Fill(mZ_DYcor-mZ_Wcor); // dimFileMass << mZ1 << endl ; // dimFileMassDYcor << mZ_DYcor << endl ; // dimFileMassWcor << mZ_Wcor << endl ; // All regions h_mZ->Fill(mZ1); h_mZ_DYcor->Fill(mZ_DYcor); h_mZ_Wcor->Fill(mZ_Wcor); // Both electrons in barrel if(abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[1]) < 1.556) { h_mZ_BB->Fill(mZ1); h_mZ_BB_DYcor->Fill(mZ_DYcor); h_mZ_BB_Wcor->Fill(mZ_Wcor); } // Both electrons in endcaps if(abs(LepGood_eta[0]) > 1.556 && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[1]) > 1.556 && abs(LepGood_eta[1]) < 2.5) { h_mZ_EE->Fill(mZ1); h_mZ_EE_DYcor->Fill(mZ_DYcor); h_mZ_EE_Wcor->Fill(mZ_Wcor); } //One electron in barrel region and the other in endcap if( (abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[1]) < 2.5 && abs(LepGood_eta[1]) > 1.556) || (abs(LepGood_eta[1]) < 1.556 && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[0]) > 1.556) ) { h_mZ_BE->Fill(mZ1); h_mZ_BE_DYcor->Fill(mZ_DYcor); h_mZ_BE_Wcor->Fill(mZ_Wcor); } // Both electrons in barrel central region if(abs(LepGood_eta[0]) < 1. && abs(LepGood_eta[1]) < 1.) { h_mZ_BcentralBcentral->Fill(mZ1); h_mZ_BcentralBcentral_DYcor->Fill(mZ_DYcor); h_mZ_BcentralBcentral_Wcor->Fill(mZ_Wcor); } //One electron in barrel central region and the other in barrel forward region if( (abs(LepGood_eta[0]) < 1. && abs(LepGood_eta[1]) < 1.556 && abs(LepGood_eta[1]) > 1.) || (abs(LepGood_eta[1]) < 1. && abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[0]) > 1.) ) { h_mZ_BcentralBforward->Fill(mZ1); h_mZ_BcentralBforward_DYcor->Fill(mZ_DYcor); h_mZ_BcentralBforward_Wcor->Fill(mZ_Wcor); } //One electron in barrel central region and the other in endcap central region if( (abs(LepGood_eta[0]) < 1. && abs(LepGood_eta[1]) < 2. && abs(LepGood_eta[1]) > 1.556) || (abs(LepGood_eta[1]) < 1. && abs(LepGood_eta[0]) < 2. && abs(LepGood_eta[0]) > 1.556) ) { h_mZ_BcentralEcentral->Fill(mZ1); h_mZ_BcentralEcentral_DYcor->Fill(mZ_DYcor); h_mZ_BcentralEcentral_Wcor->Fill(mZ_Wcor); } //One electron in barrel central region and the other in endcap forward region if( (abs(LepGood_eta[0]) < 1. && abs(LepGood_eta[1]) < 2.5 && abs(LepGood_eta[1]) > 2.) || (abs(LepGood_eta[1]) < 1. && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[0]) > 2.) ) { h_mZ_BcentralEforward->Fill(mZ1); h_mZ_BcentralEforward_DYcor->Fill(mZ_DYcor); h_mZ_BcentralEforward_Wcor->Fill(mZ_Wcor); } // Both electrons in barrel forward region if(abs(LepGood_eta[0]) > 1. && abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[1]) > 1. && abs(LepGood_eta[1]) < 1.556) { h_mZ_BforwardBforward->Fill(mZ1); h_mZ_BforwardBforward_DYcor->Fill(mZ_DYcor); h_mZ_BforwardBforward_Wcor->Fill(mZ_Wcor); } //One electron in barrel forward region and the other in endcap central region if( (abs(LepGood_eta[0]) > 1. && abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[1]) < 2. && abs(LepGood_eta[1]) > 1.556) || (abs(LepGood_eta[1]) > 1. && abs(LepGood_eta[1]) < 1.556 && abs(LepGood_eta[0]) < 2. && abs(LepGood_eta[0]) > 1.556) ) { h_mZ_BforwardEcentral->Fill(mZ1); h_mZ_BforwardEcentral_DYcor->Fill(mZ_DYcor); h_mZ_BforwardEcentral_Wcor->Fill(mZ_Wcor); } //One electron in barrel forward region and the other in endcap forward region if( (abs(LepGood_eta[0]) > 1. && abs(LepGood_eta[0]) < 1.556 && abs(LepGood_eta[1]) < 2.5 && abs(LepGood_eta[1]) > 2.) || (abs(LepGood_eta[1]) > 1. && abs(LepGood_eta[1]) < 1.556 && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[0]) > 2.) ) { h_mZ_BforwardEforward->Fill(mZ1); h_mZ_BforwardEforward_DYcor->Fill(mZ_DYcor); h_mZ_BforwardEforward_Wcor->Fill(mZ_Wcor); } // Both electrons in endcap central region if(abs(LepGood_eta[0]) > 1.556 && abs(LepGood_eta[0]) < 2. && abs(LepGood_eta[1]) > 1.556 && abs(LepGood_eta[1]) < 2.) { h_mZ_EcentralEcentral->Fill(mZ1); h_mZ_EcentralEcentral_DYcor->Fill(mZ_DYcor); h_mZ_EcentralEcentral_Wcor->Fill(mZ_Wcor); } //One electron in endcap central region and the other in endcap forward region if( (abs(LepGood_eta[0]) > 1.556 && abs(LepGood_eta[0]) < 2. && abs(LepGood_eta[1]) < 2.5 && abs(LepGood_eta[1]) > 2.) || (abs(LepGood_eta[1]) > 1.556 && abs(LepGood_eta[1]) < 2. && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[0]) > 2.) ) { h_mZ_EcentralEforward->Fill(mZ1); h_mZ_EcentralEforward_DYcor->Fill(mZ_DYcor); h_mZ_EcentralEforward_Wcor->Fill(mZ_Wcor); } // Both electrons in endcap forward region if(abs(LepGood_eta[0]) > 2. && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[1]) > 2. && abs(LepGood_eta[1]) < 2.5) { h_mZ_EforwardEforward->Fill(mZ1); h_mZ_EforwardEforward_DYcor->Fill(mZ_DYcor); h_mZ_EforwardEforward_Wcor->Fill(mZ_Wcor); } // Only one electron in barrel central region if( (abs(LepGood_eta[0]) < 1. && abs(LepGood_eta[1]) > 1.) ||(abs(LepGood_eta[1]) < 1. && abs(LepGood_eta[0]) > 1.) ) { h_mZ_Bcentral->Fill(mZ1); h_mZ_Bcentral_DYcor->Fill(mZ_DYcor); h_mZ_Bcentral_Wcor->Fill(mZ_Wcor); } // Only one electron in barrel forward region if( (abs(LepGood_eta[0]) > 1. && abs(LepGood_eta[0]) < 1.556 && (abs(LepGood_eta[1]) < 1. || abs(LepGood_eta[1]) > 1.556) ) || (abs(LepGood_eta[1]) > 1. && abs(LepGood_eta[1]) < 1.556 && (abs(LepGood_eta[0]) < 1. || abs(LepGood_eta[0]) > 1.556) ) ) { h_mZ_Bforward->Fill(mZ1); h_mZ_Bforward_DYcor->Fill(mZ_DYcor); h_mZ_Bforward_Wcor->Fill(mZ_Wcor); } // Only one electron in endcap central region if( (abs(LepGood_eta[0]) > 1.556 && abs(LepGood_eta[0]) < 2. && (abs(LepGood_eta[1]) < 1.556 || abs(LepGood_eta[1]) > 2.) ) || (abs(LepGood_eta[1]) > 1.556 && abs(LepGood_eta[1]) < 2. && (abs(LepGood_eta[0]) < 1.556 || abs(LepGood_eta[0]) > 2.) ) ) { h_mZ_Ecentral->Fill(mZ1); h_mZ_Ecentral_DYcor->Fill(mZ_DYcor); h_mZ_Ecentral_Wcor->Fill(mZ_Wcor); } // Only one electron in endcap forward region if( (abs(LepGood_eta[0]) > 2. && abs(LepGood_eta[0]) < 2.5 && abs(LepGood_eta[1]) < 2.) || (abs(LepGood_eta[1]) > 2. && abs(LepGood_eta[1]) < 2.5 && abs(LepGood_eta[0]) < 2.) ) { h_mZ_Eforward->Fill(mZ1); h_mZ_Eforward_DYcor->Fill(mZ_DYcor); h_mZ_Eforward_Wcor->Fill(mZ_Wcor); } // Different pt ranges for one of the electrons ptmax = 30.; for (int ipt=0; ipt ptmin && LepGood_pt[0] <= ptmax ) || (LepGood_pt[1] > ptmin && LepGood_pt[0] <= ptmax)) ) { h_mZ_BB_pt[ipt]->Fill(mZ1); h_mZ_BB_DYcor_pt[ipt]->Fill(mZ_DYcor); h_mZ_BB_Wcor_pt[ipt]->Fill(mZ_Wcor); } if ( abs(LepGood_eta[0]) > 2. && abs(LepGood_eta[1]) > 2. && ((LepGood_pt[0] > ptmin && LepGood_pt[0] <= ptmax ) || (LepGood_pt[1] > ptmin && LepGood_pt[0] <= ptmax )) ) { h_mZ_EE_pt[ipt]->Fill(mZ1); h_mZ_EE_DYcor_pt[ipt]->Fill(mZ_DYcor); h_mZ_EE_Wcor_pt[ipt]->Fill(mZ_Wcor); } } // Different eta ranges for one of the electrons etamax = -2.5; for (int ieta=0; ieta etamin && LepGood_eta[0] < etamax) || (LepGood_eta[1] > etamin && LepGood_eta[1] < etamax) ) { h_mZ_eta[ieta]->Fill(mZ1); h_mZ_DYcor_eta[ieta]->Fill(mZ_DYcor); h_mZ_Wcor_eta[ieta]->Fill(mZ_Wcor); } } } } } } h_mZ-> Write(); h_mZ_DYcor->Write(); h_mZ_Wcor->Write(); h_mZ_BB->Write(); h_mZ_BB_DYcor->Write(); h_mZ_BB_Wcor->Write(); h_mZ_EE->Write(); h_mZ_EE_DYcor->Write(); h_mZ_EE_Wcor->Write(); for (int ipt=0; iptWrite(); h_mZ_BB_DYcor_pt[ipt]->Write(); h_mZ_BB_Wcor_pt[ipt]->Write(); h_mZ_EE_pt[ipt]->Write(); h_mZ_EE_DYcor_pt[ipt]->Write(); h_mZ_EE_Wcor_pt[ipt]->Write(); } for (int ieta=0; ietaWrite(); h_mZ_DYcor_eta[ieta]->Write(); h_mZ_Wcor_eta[ieta]->Write(); } h_mZ_BE->Write(); h_mZ_BE_DYcor->Write(); h_mZ_BE_Wcor->Write(); h_mZ_BcentralBcentral->Write(); h_mZ_BcentralBcentral_DYcor->Write(); h_mZ_BcentralBcentral_Wcor->Write(); h_mZ_BcentralBforward->Write(); h_mZ_BcentralBforward_DYcor->Write(); h_mZ_BcentralBforward_Wcor->Write(); h_mZ_BcentralEcentral->Write(); h_mZ_BcentralEcentral_DYcor->Write(); h_mZ_BcentralEcentral_Wcor->Write(); h_mZ_BcentralEforward->Write(); h_mZ_BcentralEforward_DYcor->Write(); h_mZ_BcentralEforward_Wcor->Write(); h_mZ_BforwardBforward->Write(); h_mZ_BforwardBforward_DYcor->Write(); h_mZ_BforwardBforward_Wcor->Write(); h_mZ_BforwardEcentral->Write(); h_mZ_BforwardEcentral_DYcor->Write(); h_mZ_BforwardEcentral_Wcor->Write(); h_mZ_BforwardEforward->Write(); h_mZ_BforwardEforward_DYcor->Write(); h_mZ_BforwardEforward_Wcor->Write(); h_mZ_EcentralEcentral->Write(); h_mZ_EcentralEcentral_DYcor->Write(); h_mZ_EcentralEcentral_Wcor->Write(); h_mZ_EcentralEforward->Write(); h_mZ_EcentralEforward_DYcor->Write(); h_mZ_EcentralEforward_Wcor->Write(); h_mZ_EforwardEforward->Write(); h_mZ_EforwardEforward_DYcor->Write(); h_mZ_EforwardEforward_Wcor->Write(); h_mZ_Bcentral->Write(); h_mZ_Bcentral_DYcor->Write(); h_mZ_Bcentral_Wcor->Write(); h_mZ_Bforward->Write(); h_mZ_Bforward_DYcor->Write(); h_mZ_Bforward_Wcor->Write(); h_mZ_Ecentral->Write(); h_mZ_Ecentral_DYcor->Write(); h_mZ_Ecentral_Wcor->Write(); h_mZ_Eforward->Write(); h_mZ_Eforward_DYcor->Write(); h_mZ_Eforward_Wcor->Write(); h_DeltaEoPcor->Write(); h_DeltaEoPcor_barrel->Write(); h_DeltaEoPcor_centralbarrel->Write(); h_DeltaEoPcor_endcaps->Write(); h_DeltaEoPcor_centralendcaps->Write(); h_DeltaMasscor->Write(); h_DeltaMasscor_barrel->Write(); h_DeltaMasscor_centralbarrel->Write(); h_DeltaMasscor_endcaps->Write(); h_DeltaMasscor_centralendcaps->Write(); fout->Close(); //Fit histograms // dimFile << "500" << " " << entries << " " << xmean << " " << xRMS << " " << chi2 << " " << par0 << " " << par1 << " " << par2 << " " << endl ; // dimFilefit << par1 << endl ; }