Dil
#1
Hello,

I need to calculate the efficiency using bin by bin (2D).I used following equation and code it as follows.

```
Efficiency=(h2_pim_4fold_exc)/(h2_pim_3fold_exc- normalized bgnd);
normlaized_bgnd= (h2_pim_3fold_bgnd/h2_pim_4fold_bgnd_notexc)* h2_pim_4fold_exc_notexc;
```

I am really disappointed the answer I got.Is something wrong with my code(sorry for the confused names for the histograms)

```
{
//f_bgd= (Integrate 3-fold)/(Integrated 4-fold !Exc) in bgnd region
TH2F *f_bgnd=(TH2F*)h2_pim_3fold_bgnd->Clone("f_bgnd");
f_bgnd->Divide(h2_pim_4fold_bgnd_notExc);
// normalized bgnd = f_bgd * (4-fold !Exc integrated over "exclusive" window of missing pi- M2)
TH2F* Normalized_bgnd=(TH2F*) f_bgnd->Clone("Normalized_bgnd");
Normalized_bgnd->Multiply(h2_pim_4fold_exc_notExc);
// (h2_pim_3fold_exc- normalized bgnd)
TH2F* Neg_Normalized_bgnd= (TH2F*) Normalized_bgnd->Clone("Neg_Normalized_bgnd");
Neg_Normalized_bgnd->Scale(-1);
h2_pim_3fold_exc->Add(Neg_Normalized_bgnd);
// Efficiency=(h2_pim_4fold_exc)/(h2_pim_3fold_exc- normalized bgnd);
TH2F * Efficiency= (TH2F*) h2_pim_4fold_exc->Clone("Efficiency");
Efficiency->Divide(h2_pim_4fold_exc,h2_pim_3fold_exc);
Efficiency->SetMarkerSize(1.5);
Efficiency->Draw("text30");
}
```

Any hint would be greatly appreciated.

Thanks

*Please read tips for efficient and successful posting and posting code*

*ROOT Version:* Not Provided

*Platform:* Not Provided

*Compiler:* Not Provided

moneta
#2
The code seems good to me and it seems to follow the operations you have shown above.

What is wrong with the result you have ?

Dil
#3
Hello moneto,

The following two ways gave me different answers.Which one is correct?

```
TH2F * Normalized_bgnd=(TH2F*)h2_pim_3fold_exc->Clone("Normalized_bgnd");
Normalized_bgnd->Divide(h2_pim_4fold_bgnd_notExc);
Normalized_bgnd->Multiply(h2_pim_4fold_exc_notExc);
```

```
//f_bgd= (Integrate 3-fold)/(Integrated 4-fold !Exc) in bgnd region
TH2F *f_bgnd=(TH2F*)h2_pim_3fold_bgnd->Clone("f_bgnd");
f_bgnd->Divide(h2_pim_4fold_bgnd_notExc);
// normalized bgnd = f_bgd * (4-fold !Exc integrated over "exclusive" window of missing pi- M2)
TH2F* Normalized_bgnd=(TH2F*) f_bgnd->Clone("Normalized_bgnd");
Normalized_bgnd->Multiply(h2_pim_4fold_exc_notExc);
```

Thanks

Dil
#4
Hello,

Can someone help me to do Efficiency calulation using TEfficiency?

```
{
//f_bgd= (Integrate 3-fold)/(Integrated 4-fold !Exc) in bgnd region
TH2F *f_bgnd=(TH2F*)h2_pim_3fold_bgnd->Clone("f_bgnd");
f_bgnd->Divide(h2_pim_4fold_bgnd_notExc);
// normalized bgnd = f_bgd * (4-fold !Exc integrated over "exclusive" window of missing pi- M2)
TH2F* Normalized_bgnd=(TH2F*) f_bgnd->Clone("Normalized_bgnd");
Normalized_bgnd->Multiply(h2_pim_4fold_exc_notExc);
// (h2_pim_3fold_exc- normalized bgnd)
TH2F* Neg_Normalized_bgnd= (TH2F*) Normalized_bgnd->Clone("Neg_Normalized_bgnd");
Neg_Normalized_bgnd->Scale(-1);
h2_pim_3fold_exc->Add(Neg_Normalized_bgnd);
// Efficiency=(h2_pim_4fold_exc)/(h2_pim_3fold_exc- normalized bgnd);
TH2F * Efficiency= (TH2F*) h2_pim_4fold_exc->Clone("Efficiency");
Efficiency->Divide(h2_pim_4fold_exc,h2_pim_3fold_exc);
Efficiency->SetMarkerSize(1.5);
Efficiency->Draw("text30");
}
```

Thanks

Dil

system
closed
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.