///To print informations about DR functions running #define debug false #include #include #include #include #include #include #include #include #include #include #include ///Headers to TProcPool #include #include #include #include #include #include "TStopwatch.h" #define pi 3.14159265358979312 #define pedestal -99 ///Reset Value to Variables ///Scale Factors to normalize Deltas #define scale_dPt 50. #define scale_dEta 5. #define scale_dPhi pi ///Final state #define nObjs 6 //#define nData 100 #define nData 1000 #define nMonteCarlo 10000 using namespace std; ///========== Compute Distance Between Events - Minimum Distance Method =============== ///Takes the combination that gives minimum distance when >1 equals final states Double_t ComputeDR_MinDist(TTreeReaderArray DataId, TTreeReaderArray DataPt, TTreeReaderArray DataPtRes, TTreeReaderArray DataEta, TTreeReaderArray DataEtaRes, TTreeReaderArray McId, TTreeReaderArray McPt, TTreeReaderArray McEta){ ///================================================================================================ ///Checks the final states int dt_el= 0, dt_mu= 0, mc_el= 0, mc_mu=0; for(int u=0; u>>> Data ("< vmin_imc; vmin_imc.clear(); for(int idt=0; idt 0) for(int g=0; g>> "; dPt = (DataPt[idt]-McPt[imc])/(scale_dPt*DataPtRes[idt]); dEta = (DataEta[idt]-McEta[imc])/(scale_dEta*DataEtaRes[idt]); particles_distance = sqrt(dPt*dPt + dEta*dEta); if( debug ) cout<<"particles_distance = "<> MCPos: "< MCs; #if 0 std::string Data_Path("../VBF_Samples/StructToTProcPool/NewVBF_QED4_QCD0_SIG_FastME_1.root"); MCs.push_back("../VBF_Samples/StructToTProcPool/NewVBF_QED4_QCD0_SIG_FastME_2.root"); MCs.push_back("../VBF_Samples/StructToTProcPool/NewVBF_QED4_QCD0_BKG_FastME_2.root"); #else std::string Data_Path("data/NewVBF_QED4_QCD0_SIG_FastME_1.root"); MCs.push_back("data/NewVBF_QED4_QCD0_SIG_FastME_2.root"); MCs.push_back("data/NewVBF_QED4_QCD0_BKG_FastME_2.root"); #endif ///------------------------------------------------------------------------------------------ ///TProcPool declarations auto workItem = [Data_Path](TTreeReader &tread) -> TObject* { TH1D *h = new TH1D("Distances", "Distances between Data and MC events", 200, 0, 20); h->SetDirectory(0); ///This is for MC TTreeReaderArray McId(tread, "Particle.id"); TTreeReaderArray McPt(tread, "Particle.pt"); //TTreeReaderArray McPtRes(tread, "Particle.pt_res"); TTreeReaderArray McEta(tread, "Particle.eta"); //TTreeReaderArray McEtaRes(tread, "Particle.eta_res"); ///This is for Data TFile *fData = TFile::Open((TString)Data_Path); TTreeReader refReader("VBF",fData); TTreeReaderArray DataId(refReader, "Particle.id"); TTreeReaderArray DataPt(refReader, "Particle.pt"); TTreeReaderArray DataPtRes(refReader, "Particle.pt_res"); TTreeReaderArray DataEta(refReader, "Particle.eta"); TTreeReaderArray DataEtaRes(refReader, "Particle.eta_res"); //cout<<"\ntreadEntries: "<> Pt: "<> Pt: "< vmin_imc; vmin_imc.clear(); for(int idt=0; idt 0) for(int g=0; g>> "; dPt = (DataPt[idt]-McPt[imc])/(scale_dPt*DataPtRes[idt]); dEta = (DataEta[idt]-McEta[imc])/(scale_dEta*DataEtaRes[idt]); particles_distance = sqrt(dPt*dPt + dEta*dEta); if( debug ) cout<<"particles_distance = "<> MCPos: "<Fill(event_distance); } } delete fData; return h; }; ///For timming the process TStopwatch t; t.Start(); ///-------------------------- TH1D *hf = 0; if (ncores > 0) { cout<<"::: Starting Analysis with TProcPool :::"<Add(hfx); } delete fMC; } hf->Merge(hl); } //hf->Print(); hf->DrawClone(); ///Stoping timming t.Stop(); t.Print(); } ///====================================================================================================