#define elec_geo20_cxx #include "elec_geo20.h" #include #include #include #include #include #include using namespace std; using std::vector; void elec_geo20::Loop(string num) { using namespace std; using std::vector; if (!(gInterpreter->IsLoaded("vector"))) gInterpreter->ProcessLine("#include "); gSystem->Exec("rm -f AutoDict*vector*vector*float*"); gInterpreter->GenerateDictionary("vector >", "vector"); // Flags bool writeOutput = true; bool doReconstruction = false; bool doTriggerfilling = false; //TFile *newfile = new TFile("outpumt_electrons300mev_histo.root", "recreate"); if(writeOutput) { TFile *newfile = new TFile(("output_electrons"+num+".recov08_histo.root").c_str(), "recreate"); cout << "creating output file "+num+" mev" << endl; } const int ptbin = 2000; const int etabin = 2000; const int mubin = 43; const int ptxmin = 0; const int ptxmax = 300000; const int etaxmin = -4; const int etaxmax = 4; const int muxmin = -1.5; const int muxmax = 41.5; TH1F *pt_mc = new TH1F("pt_mc", "pt_mc", 2000, 0, ptxmax); TH1F *eta_mc = new TH1F("eta_mc", "eta_mc", 2000, etaxmin, etaxmax); TH1F *phi_mc = new TH1F("phi_mc", "phi_mc", 2000, etaxmin, etaxmax); TH1F *pt_mc_2lead = new TH1F("pt_mc_2lead", "pt_mc_2lead", 2000, 0, ptxmax); TH1F *eta_mc_2lead = new TH1F("eta_mc_2lead", "eta_mc_2lead", 2000, etaxmin, etaxmax); TH1F *phi_mc_2lead = new TH1F("phi_mc_2lead", "phi_mc_2lead", 2000, etaxmin, etaxmax); TH1F *pt_mc_diff = new TH1F("pt_mc_diff", "pt_mc_diff", 2000, 0, ptxmax); TH2F *ptdr_mc = new TH2F("ptdr_mc", "ptdr_mc", 2000, 0, ptxmax, 2000, 0, 0.5); TH2F *ptdr_mc_cut = new TH2F("ptdr_mc_cut", "ptdr_mc_cut", 2000, 0, ptxmax, 2000, 0, 0.5); TH2F *ptdr_reco = new TH2F("ptdr_reco", "ptdr_reco", 2000, 0, ptxmax, 2000, 0, 0.5); TProfile *ptdrProf = new TProfile("ptdrProf", "ptdrProf", 2000, 0, 300000, 0, 0.5); TH2F *recopt_eff = new TH2F("recopt_eff", "recopt_eff", 2000, 0, ptxmax, 2000, 0, 1.2); TH2F *recoMpt_eff = new TH2F("recoMpt_eff", "recoMpt_eff", 2000, 0, ptxmax, 2000, 0, 1.2); TProfile *recopt_prof = new TProfile("recopt_prof", "recopt_prof", 2000, 0, ptxmax, 0, 1.2 ); TProfile *recoMpt_prof = new TProfile("recoMpt_prof", "recoMpt_prof", 2000, 0, ptxmax, 0, 1.2 ); TH2F *recoeta_eff = new TH2F("recoeta_eff", "recoeta_eff", 2000, etaxmin, etaxmax, 2000, 0, 1.2); TH2F *recoMeta_eff = new TH2F("recoMeta_eff", "recoMeta_eff", 2000, etaxmin, etaxmax, 2000, 0, 1.2); TProfile *recoeta_prof = new TProfile("recoeta_prof", "recoeta_prof", 2000, etaxmin, etaxmax, 0, 1.2 ); TProfile *recoMeta_prof = new TProfile("recoMeta_prof", "recoMeta_prof", 2000, etaxmin, etaxmax, 0, 1.2 ); TH2F *recomu_eff = new TH2F("recomu_eff", "recomu_eff", mubin, muxmin, muxmax, 2000, 0, 1.2); TH2F *recoMmu_eff = new TH2F("recoMmu_eff", "recoMmu_eff", mubin, muxmin, muxmax, 2000, 0, 1.2); TProfile *recomu_prof = new TProfile("recomu_prof", "recomu_prof", mubin, muxmin, muxmax, 0, 1.2 ); TProfile *recoMmu_prof = new TProfile("recoMmu_prof", "recoMmu_prof", mubin, muxmin, muxmax, 0, 1.2 ); const int fcuts = 5; const char* str_fhtcut[] = {"_0-003", "_003-005", "_005-01", "_01-03", "_03-1" }; TH1F *dr_mc[fcuts]; TH1F *dR_recMC[fcuts]; TH1F *dR_recMC_noDup[fcuts]; TH1F *dR_recMC_cl[fcuts]; TH1F *dR_TrkTruth1[fcuts]; TH1F *dR_TrkTruth1_ptcut[fcuts]; //~ TH1F *dR_TrkTruth1_etacut[fcuts]; //~ TH1F *dR_TrkCl1[fcuts]; //~ TH1F *dR_reco[fcuts]; for( int fcut=0;fcutGetEntriesFast(); cout << "nentries: " << nentries << endl; Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentryGetEntry(jentry); if(jentry % 1000 == 0) cout << jentry << endl; //cout <<"actual mu: " << actualIntPerXing << " avg mu: " << averageIntPerXing << endl; float mcpt[2] = -99; float mceta[2] = -99; float mcphi[2] = -99; int j = 0; if(mc_n < 2) continue; for(Int_t i=0; i 0) { mcpt_lead = mcpt[0]; mceta_lead = mceta[0]; mcphi_lead = mcphi[0]; mcpt_2lead = mcpt[1]; mceta_2lead = mceta[1]; mcphi_2lead = mcphi[1]; } else { mcpt_lead = mcpt[1]; mceta_lead = mceta[1]; mcphi_lead = mcphi[1]; mcpt_2lead = mcpt[0]; mceta_2lead = mceta[0]; mcphi_2lead = mcphi[0]; } mcpt_lead_inv = 1/mcpt_lead; // Inverse of leading pt lepton float theta_lead = 2*atan(exp(-mceta_lead)); float theta_2lead = 2*atan(exp(-mceta_2lead)); ptdr_mc->Fill(mcpt_lead, delR_truth); if(mcpt_lead < 10000) continue; if(mcpt_2lead < 10000) continue; if(mceta_lead > 2.5 || mceta_2lead > 2.5) continue; ptdr_mc_cut->Fill(mcpt_lead, delR_truth); pt_mc->Fill(mcpt_lead); eta_mc->Fill(mceta_lead); phi_mc->Fill(mcphi_lead); pt_mc_2lead->Fill(mcpt_2lead); eta_mc_2lead->Fill(mceta_2lead); phi_mc_2lead->Fill(mcphi_2lead); pt_mc_diff->Fill(fabs(mcptdiff)); //Filling dR for different pT bins float ptcut[] = {0, 0.003, 0.005, 0.01, 0.03, 1 }; // { inf-333GeV, 333-200GeV, 200-125GeV, 125-100GeV, 100-33GeV, 33-0GeV } float mcpt_inv_gev = mcpt_lead_inv*1000; //~ for(int kk=0; kk ptcut[kk] && mcpt_inv_gev < ptcut[kk+1]) { dr_mc[kk]->Fill(delR_truth); } //~ } for(int el1=0; el1Write(); delete newfile; } cout << "check3" << endl; } //End of Loop float deltaPhi(float phi1, float phi2) { float dphi = phi1 - phi2; while (dphi < -TMath::Pi()) dphi += 2 * TMath::Pi(); while (dphi > TMath::Pi()) dphi -= 2 * TMath::Pi(); return dphi; } float deltaVtx(float vx1, float vy1, float vz1, float vx2, float vy2, float vz2) { float dvx = vx1 - vx2; float dvy = vy1 - vy2; float dvz = vz1 - vz2; float dvr = TMath::Sqrt(dvx*dvx + dvy*dvy + dvz*dvz); return dvr; } float deltaR(float eta1, float phi1, float eta2, float phi2) { float dphi = deltaPhi(phi1, phi2); float deta = fabs(eta1-eta2); float dr = TMath::Sqrt(dphi*dphi + deta*deta); return dr; }