unelg / CutLang

This is the development Repository for CutLang
Other
9 stars 14 forks source link

Union Issue #154

Open ahmetcansansar opened 1 year ago

ahmetcansansar commented 1 year ago

In the ADL file below, we want to create an object called "lepDerive" that is union of "eleDerive" and "muDerive".

object muA : MUO
  select Pt(MUO) > 10

object muDerive : muA
  select ALL
  #select Pt(muA) > 0

object eleA : ELE
  select Pt(ELE) > 10

object eleDerive : eleA
  select ALL
  #select Pt(eleA) > 0

object lepDerive : Union(eleDerive, muDerive)

region test
  select ALL
  select Size(lepDerive) >= 1
aliyilmaz1 commented 1 day ago

I used CutLang micromamba CLA v2.14.1 compiled on Sat Nov 19 16:13:13 UTC 2022

Inconsistent Efficiency Calculation for goodLeps in BP_3

in adl file:

object goodPhotons take Photon

select Pt(Photon) > 10 # Require photon transverse momentum > 10 GeV select AbsEta(Photon) < 2.5 # Require photon to be within detector range (eta < 2.5)

object goodElectrons take Electron

select Pt(Electron) > 10 # Require Electron transverse momentum > 10 GeV select AbsEta(Electron) < 2.5 # Require Electron to be within detector range (eta < 2.5)

object goodMuons take Muon

select Pt(Muon) > 10 # Require Electron transverse momentum > 10 GeV select AbsEta(Muon) < 2.5 # Require Electron to be within detector range (eta < 2.5)

object goodLeps : Union( goodElectrons, goodMuons )

and the output is :

Efficiencies for analysis : BP_1 goodMuonRegion Based on 3e+06 events: ALL : 1 +- 0 evt: 3000000 Size(goodMuons) >= 2 && Size(goodPhotons) >= 1 && MET > 0 : 0.02186 +- 8.44e-05 evt: 65586 {ZmmRecoGood}m ~= 91.2 : 1 +- 0 evt: 65586 {ZmmRecoGood}q == 0 : 0.9962 +- 0.000241 evt: 65335 PDGID(goodMuons[0]) + PDGID(goodMuons[1]) == 0 : 0.9958 +- 0.000252 evt: 65063 {goodMuons[0]}q * {goodMuons[1]}q == -1 : 1 +- 0 evt: 65063 {ZmmRecoGood}m [] 70 110 : 0.9759 +- 0.000601 evt: 63494 --> Overall efficiency = 2.12 % +- 0.00831 % Bins for analysis : BP_1 saving... saved.

Efficiencies for analysis : BP_2 goodElectronRegion Based on 3e+06 events: ALL : 1 +- 0 evt: 3000000 Size(goodElectrons) >= 2 && Size(goodPhotons) >= 1 && MET > 0 : 0.01509 +- 7.04e-05 evt: 45271 {ZeeRecoGood}m ~= 91.2 : 1 +- 0 evt: 45271 {ZeeRecoGood}q == 0 : 0.9941 +- 0.00036 evt: 45004 PDGID(goodElectrons[0]) + PDGID(goodElectrons[1]) == 0 : 0.9841 +- 0.00059 evt: 44288 {goodElectrons[0]}q * {goodElectrons[1]}q == -1 : 1 +- 0 evt: 44288 {ZeeRecoGood}m [] 70 110 : 0.9772 +- 0.000709 evt: 43278 --> Overall efficiency = 1.44 % +- 0.00688 % Bins for analysis : BP_2 saving... saved.

Efficiencies for analysis : BP_3 goodLeptonRegion Based on 3e+06 events: ALL : 1 +- 0 evt: 3000000 Size(goodLeps) >= 2 && Size(goodPhotons) >= 1 && MET > 0 : 0.03763 +- 0.00011 evt: 112881 {ZllRecoGood}m ~= 91.2 : 1 +- 0 evt: 112881 {ZllRecoGood}q == 0 : 0.9887 +- 0.000315 evt: 111606 PDGID(goodLeps[0]) + PDGID(goodLeps[1]) == 0 : 0.9635 +- 0.000561 evt: 107531 {goodLeps[0]}q * {goodLeps[1]}q == -1 : 1 +- 0 evt: 107531 {ZllRecoGood}m [] 70 110 : 0.977 +- 0.000457 evt: 105056 --> Overall efficiency = 3.5 % +- 0.0106 % Bins for analysis : BP_3

Description of the Issue: The reported number of goodLeps is inconsistent with the sum of goodElectrons and goodMuons in the event analysis.

Expected Behavior: The sum of goodElectrons (43,278) and goodMuons (63,494) is 106,772. This should match the number of goodLeps in the analysis. Observed Behavior: The reported number of goodLeps is 105,056, which is 1716 events fewer than expected. I think the Union function in cutlang.adl might not correctly handle.