{ //Program reads experimental lepton ntuple and plots momentum , theta, phi lepton distribution, // for the LVL1 and LVL2 events, and ploting the ratios, to obtain the efficiency of the LVL2 // trigger as a function of theta, phi, momentum gROOT->Reset(); Text_t text[100]; TH1F *hmom1[2]; TH1F *hmom[2][3][3][3]; // [LVL1,LVL2][sys0, sys1, sys0 and sys1][cut][polarity] TH1F *htheta[2][3][3][3]; // [LVL1,LVL2][sys0, sys1, sys0 and sys1][cut][polarity] TH1F *hphi[2][3][3][3]; // [LVL1,LVL2][sys0, sys1, sys0 and sys1][cut][polarity] // TH1F *trigger1 =new TH1F("trigger1","trigger1"); // TH1F *trigger0 =new TH1F("trigger0","trigger0"); for(Int_t m=0;m<2;m++) // trigger { sprintf(text,"hmom1_triger%d",m); hmom1[m] = new TH1F(text,"Momentum",50,0.,2000); for (Int_t l=0;l<3;l++) { for (Int_t k=0;k<3;k++) { for (Int_t j=0;j<3;j++) { sprintf(text,"hmom_triger%d_cut%d_sys%d_pol%d",m,l,k,j); hmom[m][l][k][j] = new TH1F(text,"Momentum",50,0.,2000); sprintf(text,"htheta_triger%d_cut%d_sys%d_pol%d",m,l,k,j); htheta[m][l][k][j] = new TH1F(text,"Theta",45,0.,90.); sprintf(text,"hphi_triger%d_cut%d_sys%d_pol%d",m,l,k,j); hphi[m][l][k][j] = new TH1F(text,"Phi",90,0.,360.); } } } } TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("../leptons_AUG04_gen3_newShower_FullTarget_GOOD_MDC_HV.root"); if (!f) { f = new TFile("../leptons_AUG04_gen3_newShower_FullTarget_GOOD_MDC_HV.root"); } TTree *pLepExp = (TTree*)gDirectory->Get("pLep"); // Declaration of leave types Float_t pid; Float_t rich_pmat; Float_t rich_acharge; Float_t rich_npad; Float_t rich_rcent; Float_t tof; Float_t beta; Float_t mom; Float_t charge; Float_t mass2; Float_t show_maxF; Float_t show_sum0; Float_t mdc_theta; Float_t mdc_phi; Float_t rich_theta; Float_t rich_phi; Float_t rk_theta; Float_t rk_phi; Float_t sec; Float_t sys; Float_t isrich; Float_t ismdc; Float_t istof; Float_t istofino; Float_t isshower; Float_t chi2inmdc; Float_t chi2outmdc; Float_t trackr; Float_t trackz; Float_t dist2vertex; Float_t pull; Float_t splinechi2; Float_t qmetamatch; Float_t closestleptoncandidateisfitted; Float_t closesthadroncandidateisfitted; Float_t anglewithclosestleptoncandidate; Float_t anglewithclosesthadroncandidate; Float_t trigger_ds_flag; Float_t trigger_ds_fact; Float_t trigger_decision; Float_t trigger_tbit; Float_t mult; Float_t IOm_chi2; Float_t rkchi2; Float_t tofinomult; Float_t inmdcdedx; Float_t inmdcdedxsigma; Float_t outmdcdedx; Float_t outmdcdedxsigma; Float_t show_sum1; Float_t show_sum2; Float_t evtNr; // Set branch addresses. pLepExp->SetBranchAddress("pid",&pid); pLepExp->SetBranchAddress("rich_pmat",&rich_pmat); pLepExp->SetBranchAddress("rich_acharge",&rich_acharge); pLepExp->SetBranchAddress("rich_npad",&rich_npad); pLepExp->SetBranchAddress("rich_rcent",&rich_rcent); pLepExp->SetBranchAddress("tof",&tof); pLepExp->SetBranchAddress("beta",&beta); pLepExp->SetBranchAddress("mom",&mom); pLepExp->SetBranchAddress("charge",&charge); pLepExp->SetBranchAddress("mass2",&mass2); pLepExp->SetBranchAddress("show_maxF",&show_maxF); pLepExp->SetBranchAddress("show_sum0",&show_sum0); pLepExp->SetBranchAddress("mdc_theta",&mdc_theta); pLepExp->SetBranchAddress("mdc_phi",&mdc_phi); pLepExp->SetBranchAddress("rich_theta",&rich_theta); pLepExp->SetBranchAddress("rich_phi",&rich_phi); pLepExp->SetBranchAddress("rk_theta",&rk_theta); pLepExp->SetBranchAddress("rk_phi",&rk_phi); pLepExp->SetBranchAddress("sec",&sec); pLepExp->SetBranchAddress("sys",&sys); pLepExp->SetBranchAddress("isrich",&isrich); pLepExp->SetBranchAddress("ismdc",&ismdc); pLepExp->SetBranchAddress("istof",&istof); pLepExp->SetBranchAddress("istofino",&istofino); pLepExp->SetBranchAddress("isshower",&isshower); pLepExp->SetBranchAddress("chi2inmdc",&chi2inmdc); pLepExp->SetBranchAddress("chi2outmdc",&chi2outmdc); pLepExp->SetBranchAddress("trackr",&trackr); pLepExp->SetBranchAddress("trackz",&trackz); pLepExp->SetBranchAddress("dist2vertex",&dist2vertex); pLepExp->SetBranchAddress("pull",&pull); pLepExp->SetBranchAddress("splinechi2",&splinechi2); pLepExp->SetBranchAddress("qmetamatch",&qmetamatch); pLepExp->SetBranchAddress("closestleptoncandidateisfitted",&closestleptoncandidateisfitted); pLepExp->SetBranchAddress("closesthadroncandidateisfitted",&closesthadroncandidateisfitted); pLepExp->SetBranchAddress("anglewithclosestleptoncandidate",&anglewithclosestleptoncandidate); pLepExp->SetBranchAddress("anglewithclosesthadroncandidate",&anglewithclosesthadroncandidate); pLepExp->SetBranchAddress("trigger_ds_flag",&trigger_ds_flag); pLepExp->SetBranchAddress("trigger_ds_fact",&trigger_ds_fact); pLepExp->SetBranchAddress("trigger_decision",&trigger_decision); pLepExp->SetBranchAddress("trigger_tbit",&trigger_tbit); pLepExp->SetBranchAddress("mult",&mult); pLepExp->SetBranchAddress("IOm_chi2",&IOm_chi2); pLepExp->SetBranchAddress("rkchi2",&rkchi2); pLepExp->SetBranchAddress("tofinomult",&tofinomult); pLepExp->SetBranchAddress("inmdcdedx",&inmdcdedx); pLepExp->SetBranchAddress("inmdcdedxsigma",&inmdcdedxsigma); pLepExp->SetBranchAddress("outmdcdedx",&outmdcdedx); pLepExp->SetBranchAddress("outmdcdedxsigma",&outmdcdedxsigma); pLepExp->SetBranchAddress("show_sum1",&show_sum1); pLepExp->SetBranchAddress("show_sum2",&show_sum2); pLepExp->SetBranchAddress("evtNr",&evtNr); Long64_t nentries = pLepExp->GetEntries(); Int_t nbytes =0; Bool_t occured; Int_t polarity; Int_t allpid; Int_t system, allsystem; Int_t cut, nocut, cut1, cut2; Int_t trigger, triggerLVL1; for (Long64_t i=0; iGetEntry(i); // definition of the trigger condition // only LVL1 evetns are analized, efficiency os obtain inside LVL1 if(trigger_ds_flag ==1 && ((trigger_tbit & 16 )>0)) { trigger=0; if(trigger_decision>0) trigger=1; // definition of the polarity polarity=0; if (pid==2) polarity=1; else if(pid==3) polarity=2; else {cout<<"error Wrong PID detected !!!"< LVL1, trigger=1 -> LVL2 // cut =0 -> NO cuts, cut=1 -> RICH cut, cut=2 -> ALL cuts (rich && shower && tof && tofino) // system =0 -> BOTH systems, system =1 -> Tofino/PreShower, system =2 -> Tof // polarity =0 -> no selection for pid, polarity =1 -> positrons, polarity =2 -> electrons, ////////////////////////////////////////////////////////////////////////////////////////////// // filling histograms hmom [0][0][0][0]->Fill(mom); htheta[0][0][0][0]->Fill(mdc_theta); hphi [0][0][0][0]->Fill(mdc_phi); hmom [0][0][system][polarity]->Fill(mom); htheta[0][0][system][polarity]->Fill(mdc_theta); hphi [0][0][system][polarity]->Fill(mdc_phi); hmom [0][0][0][polarity]->Fill(mom); htheta[0][0][0][polarity]->Fill(mdc_theta); hphi [0][0][0][polarity]->Fill(mdc_phi); hmom [0][0][system][0]->Fill(mom); htheta[0][0][system][0]->Fill(mdc_theta); hphi [0][0][system][0]->Fill(mdc_phi); if(cut1) { hmom [0][cut1][0][0]->Fill(mom); htheta[0][cut1][0][0]->Fill(mdc_theta); hphi [0][cut1][0][0]->Fill(mdc_phi); hmom [0][cut1][system][polarity]->Fill(mom); htheta[0][cut1][system][polarity]->Fill(mdc_theta); hphi [0][cut1][system][polarity]->Fill(mdc_phi); hmom [0][cut1][0][polarity]->Fill(mom); htheta[0][cut1][0][polarity]->Fill(mdc_theta); hphi [0][cut1][0][polarity]->Fill(mdc_phi); hmom [0][cut1][system][0]->Fill(mom); htheta[0][cut1][system][0]->Fill(mdc_theta); hphi [0][cut1][system][0]->Fill(mdc_phi); } if(cut2) { hmom [0][cut2][0][0]->Fill(mom); htheta[0][cut2][0][0]->Fill(mdc_theta); hphi [0][cut2][0][0]->Fill(mdc_phi); hmom [0][cut2][system][polarity]->Fill(mom); htheta[0][cut2][system][polarity]->Fill(mdc_theta); hphi [0][cut2][system][polarity]->Fill(mdc_phi); hmom [0][cut2][0][polarity]->Fill(mom); htheta[0][cut2][0][polarity]->Fill(mdc_theta); hphi [0][cut2][0][polarity]->Fill(mdc_phi); hmom [0][cut2][system][0]->Fill(mom); htheta[0][cut2][system][0]->Fill(mdc_theta); hphi [0][cut2][system][0]->Fill(mdc_phi); } if(trigger==1) { hmom1[trigger]->Fill(mom); hmom [trigger][0][system][polarity]->Fill(mom); htheta[trigger][0][system][polarity]->Fill(mdc_theta); hphi [trigger][0][system][polarity]->Fill(mdc_phi); hmom [trigger][0][0][polarity]->Fill(mom); htheta[trigger][0][0][polarity]->Fill(mdc_theta); hphi [trigger][0][0][polarity]->Fill(mdc_phi); hmom [trigger][0][system][0]->Fill(mom); htheta[trigger][0][system][0]->Fill(mdc_theta); hphi [trigger][0][system][0]->Fill(mdc_phi); hmom [trigger][0][0][0]->Fill(mom); htheta[trigger][0][0][0]->Fill(mdc_theta); hphi [trigger][0][0][0]->Fill(mdc_phi); if(cut1) { hmom [trigger][cut1][system][polarity]->Fill(mom); htheta[trigger][cut1][system][polarity]->Fill(mdc_theta); hphi [trigger][cut1][system][polarity]->Fill(mdc_phi); hmom [trigger][cut1][0][polarity]->Fill(mom); htheta[trigger][cut1][0][polarity]->Fill(mdc_theta); hphi [trigger][cut1][0][polarity]->Fill(mdc_phi); hmom [trigger][cut1][system][0]->Fill(mom); htheta[trigger][cut1][system][0]->Fill(mdc_theta); hphi [trigger][cut1][system][0]->Fill(mdc_phi); hmom [trigger][cut1][0][0]->Fill(mom); htheta[trigger][cut1][0][0]->Fill(mdc_theta); hphi [trigger][cut1][0][0]->Fill(mdc_phi); } if(cut2) { hmom [trigger][cut2][system][polarity]->Fill(mom); htheta[trigger][cut2][system][polarity]->Fill(mdc_theta); hphi [trigger][cut2][system][polarity]->Fill(mdc_phi); hmom [trigger][cut2][0][polarity]->Fill(mom); htheta[trigger][cut2][0][polarity]->Fill(mdc_theta); hphi [trigger][cut2][0][polarity]->Fill(mdc_phi); hmom [trigger][cut2][system][0]->Fill(mom); htheta[trigger][cut2][system][0]->Fill(mdc_theta); hphi [trigger][cut2][system][0]->Fill(mdc_phi); hmom [trigger][cut2][0][0]->Fill(mom); htheta[trigger][cut2][0][0]->Fill(mdc_theta); hphi [trigger][cut2][0][0]->Fill(mdc_phi); } } } }//event loop TFile *out = new TFile("hist_LVL1_LVL2_Full_GOODhv_TriggerDec_3.root","recreate"); for(Int_t m=0;m<2;m++) { for(Int_t l=0;l<3;l++) { for(Int_t k=0;k<3;k++) { for(Int_t j=0;j<3;j++) { hmom[m][l][k][j]->Write(); htheta[m][l][k][j]->Write(); hphi[m][l][k][j]->Write(); } } } } out->Close(); }