Dear Experts,
I am very much new to this type of problems. I want to do optimisation of one variable(pi0mom1) i.e. I want to plot F.O.M along y-axis and that variable along x-axis. F.O.M = Signal / [Signal + Background]. My condition for signal is that dstrf==1 and for background it is dstrf==5. I tried to write a code for it. Please have a look at it. But I am not getting the plot the way I wanted. Could you please correct that portion of the code or suggest me what to do.
Thanks in Advance.
void opti()
{
TChain chain1("h1");
chain1.Add("/home/souvik/belle/ND_mdst/kek_ND/useroot/evtgen_exp*.root");
Float_t pi0mass1, dstrf,pi0mass2,pi0mom1,pi0mom2,d0mass,deltam,mass,mom ;
chain1.SetBranchAddress("mass", &mass);
chain1.SetBranchAddress("d0mass", &d0mass);
chain1.SetBranchAddress("pi0mass1", &pi0mass1);
chain1.SetBranchAddress("pi0mass2", &pi0mass2);
chain1.SetBranchAddress("pi0mom1", &pi0mom1);
chain1.SetBranchAddress("pi0mom2", &pi0mom2);
chain1.SetBranchAddress("deltam", &deltam);
chain1.SetBranchAddress("mom", &mom);
chain1.SetBranchAddress("dstrf", &dstrf);
Float_t sc=1;//760318/249999; //761202 for mm amd 760318 for ee
Int_t i,j;
int n1=50;
Float_t h1=0.02 ;
Float_t S1[100],B1[100],x_var[100],Fom1[100],S2[50],B2[50] ;
Float_t sig1,sig2,bkg1,bkg2,x1,x2,FOM1=-200,FOM2=-200,LEcut,REcut;
for (i=0; i<n1; i++){
x_var[i] = 8.5+i*h1;
sig1=bkg1=0;
for (j=0; j<chain1.GetEntries(); j++){
chain1.GetEntry(j);
if(pi0mom1>x_var[i] && pi0mom1<6 && d0mass>1.78 && d0mass<1.95 && dstrf==1){
++sig1; }}
S1[i] = sig1/500000.0;
}
for (j=0; j<chain1.GetEntries(); j++){
chain1.GetEntry(j);
if(pi0mom1>x_var[i] && pi0mom1<6 && d0mass>1.78 && d0mass<1.95 && dstrf==5){
++bkg1;
}
}
Fom1[i]= S1[i]/ S1[i] + B1[i];
dF1[i] = sqrt((sig1*.000002*.000002)/(B1[i]*B1[i])+(bkg1*S1[i]*S1[i])/(4*B1[i]*B1[i]*B1[i]*B1[i]*bkg1));
dx[i]=0;
if(Fom1[i]>FOM1){
LEcut=x_var[i];
FOM1=Fom1[i];}
std::cout<<x_var[i]<<std::endl;
TCanvas *c1 = new TCanvas("c1","",0,0,700,400);
c1->SetFrameFillColor(kWhite);
c1->SetFillColor(kWhite);
c1->Divide(2,1);
TGraph *gr1 = new TGraphErrors(n1,x_var,Fom1);
c1->cd(1);
gr1->SetMarkerStyle(21);
gr1->Draw("AC");
}
Regards
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided