///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 #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 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; 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"); ///------------------------------------------------------------------------------------------ ///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"); Double_t event_distance = -1; int iData = 0, nMc = 0; cout<<"treadEntries: "<> 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); //h->Fill( ComputeDR_MinDist(DataId, DataPt, DataPtRes, DataEta, DataEtaRes, McId, McPt, McEta) ); ///To distiguish between right and wrong framework if( dt_el == mc_el || dt_mu == mc_mu ) h->Fill(event_distance); } //h->Fill(event_distance); //vminDist.push_back(min_dr_sig); } delete fData; return h; }; ///For timming the process time_t start, stop, delaied; double seconds, elapsed_time; string unity = "s"; time(&start); ///-------------------------- ///The process TProcPool workers(ncores); auto hf = workers.ProcTree(MCs, workItem); //hf->Print(); //hf->DrawClone(); ///Stoping timming time(&stop); cout<<":::::::::: Process Finished ::::::::::::"<= 60){ elapsed_time = seconds/60.; unity = "min."; } if(seconds >= 3600){ elapsed_time = seconds/3600.; unity = "h"; } cout<<":: Time Consumed: "<