Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ComputeEfficiency/compute_eff.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
else:
print(f"Total number of GenTaus matching with Tau/L1Tau passing {HLT_name} requirements: {N_num}")

if HLT_name == 'HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1':
print(f"Total number of hadronic GenTaus with with vis. pt <= 20 & eta< 2.1 and 1 Muon from Tau: {N_den}")
if PNetMode:
print(f"Total number of GenTaus matching with Jet/L1Tau passing MuTau path with Pnet param {PNetparam}: {N_num}")
else:
print(f"Total number of GenTaus matching with Tau/L1Tau passing {HLT_name} requirements: {N_num}")

if HLT_name == 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseDeepTauPFTauHPS30_eta2p1_CrossL1':
print(f"Total number of hadronic GenTaus with with vis. pt <= 20 & eta< 2.1 and 1 Electron from Tau: {N_den}")
if PNetMode:
print(f"Total number of GenTaus matching with Jet/L1Tau passing ETau path with Pnet param {PNetparam}: {N_num}")
else:
print(f"Total number of GenTaus matching with Tau/L1Tau passing {HLT_name} requirements: {N_num}")

print('Computed Eff: ')
print(f"Eff : {eff}")
print(f"Eff_up : {err_low}")
Expand Down
27 changes: 25 additions & 2 deletions ComputeEfficiency/compute_eff_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@


# only one file otherwise it's too long
FileNameList_eff = f"/afs/cern.ch/work/p/pdebryas/PNetAtHLT/data/EfficiencyDen/{HLT_name}/ZprimeToTauTau_M-4000.root"
#FileNameList_eff = f"/afs/cern.ch/work/s/skeshri/TauHLT/Braden/TauHLTOptimzation/PnetAtHLT/EfficiencyDen/{HLT_name}/ZprimeToTauTau_M-4000.root"
FileNameList_eff = f"/afs/cern.ch/work/s/skeshri/TauHLT/Braden/Forked/TauTriggerDev/EfficiencyDen/{HLT_name}/GluGlutoHHto2B2Tau_kl-1p00_kt-1p00_c2-3p00.root"
#FileNameList_eff = files_from_path(f"/afs/cern.ch/work/p/pdebryas/PNetAtHLT/data/EfficiencyDen/{HLT_name}/")

if HLT_name == 'HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1':
Expand All @@ -41,7 +42,29 @@
print(f'Quick EffAlgo computation for {HLT_name}:')
N_den, N_num = dataset_eff.ComputeEffAlgo_HLTLooseDeepTauPFTauHPS180_L2NN_eta2p1_v3()

if HLT_name == 'HLT_Ele24_eta2p1_WPTight_Gsf_PNetTauhPFJetPt30_Loose_eta2p3_CrossL1':
from HLTClass.ETauDataset import ETauDataset
dataset_eff = ETauDataset(FileNameList_eff)

if PNetMode:
print(f'Quick EffAlgo computation for SingleTau path with PNet param {PNetparam}:')
N_den, N_num = dataset_eff.ComputeEffAlgo_ETauPNet(PNetparam)
else:
print(f'Quick EffAlgo computation for {HLT_name}:')
N_den, N_num = dataset_eff.ComputeEffAlgo_ETauDeepNet()

if HLT_name == 'HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1':
from HLTClass.MuTauDataset import MuTauDataset
dataset_eff = MuTauDataset(FileNameList_eff)

if PNetMode:
print(f'Quick EffAlgo computation for SingleTau path with PNet param {PNetparam}:')
N_den, N_num = dataset_eff.ComputeEffAlgo_MuTauPNet(PNetparam)
else:
print(f'Quick EffAlgo computation for {HLT_name}:')
N_den, N_num = dataset_eff.ComputeEffAlgo_MuTauDeepNet()

EffAlgo, EffAlgo_low, EffAlgo_up = compute_ratio_witherr(N_num, N_den)
print(f"Eff : {EffAlgo}")
print(f"Eff_up : {EffAlgo_up}")
print(f"Eff_down : {EffAlgo_low}")
print(f"Eff_down : {EffAlgo_low}")
32 changes: 30 additions & 2 deletions ComputeEfficiency/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run(self):
shutil.rmtree(output_tmp_folder)
os.makedirs(output_tmp_folder)

HLT_config = ['HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1', 'HLT_LooseDeepTauPFTauHPS180_L2NN_eta2p1_v3', 'HLT_DoubleTauOrSingleTau']
HLT_config = ['HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1', 'HLT_LooseDeepTauPFTauHPS180_L2NN_eta2p1_v3', 'HLT_DoubleTauOrSingleTau','HLT_Ele24_eta2p1_WPTight_Gsf_LooseDeepTauPFTauHPS30_eta2p1_CrossL1','HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1']
if self.HLT_name not in HLT_config:
print(f'HLT name {self.HLT_name} not implemented in the code')
raise
Expand All @@ -64,6 +64,16 @@ def run(self):
MC_dataset = DoubleORSingleTauDataset(FileName)
MC_dataset.save_Event_Nden_eff_DoubleORSingleTau(output_tmp_file)

if self.HLT_name == 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseDeepTauPFTauHPS30_eta2p1_CrossL1':
from HLTClass.ETauDataset import ETauDataset
MC_dataset = ETauDataset(FileName)
MC_dataset.save_Event_Nden_eff_ETau(output_tmp_file)

if self.HLT_name == 'HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1':
from HLTClass.MuTauDataset import MuTauDataset
MC_dataset = MuTauDataset(FileName)
MC_dataset.save_Event_Nden_eff_MuTau(output_tmp_file)

# Hadd the tmp files to a single root file
hadd_anatuple(output_tmp_folder, output_root_file)
shutil.rmtree(output_tmp_folder)
Expand Down Expand Up @@ -113,7 +123,7 @@ def run(self):
if not os.path.exists(input_root_file):
raise('Input root file does not exist')

HLT_config = ['HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1', 'HLT_LooseDeepTauPFTauHPS180_L2NN_eta2p1_v3', 'HLT_DoubleTauOrSingleTau']
HLT_config = ['HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1', 'HLT_LooseDeepTauPFTauHPS180_L2NN_eta2p1_v3', 'HLT_DoubleTauOrSingleTau','HLT_Ele24_eta2p1_WPTight_Gsf_LooseDeepTauPFTauHPS30_eta2p1_CrossL1','HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1']
if self.HLT_name not in HLT_config:
print(f'HLT name {self.HLT_name} not implemented in the code')
raise
Expand Down Expand Up @@ -144,3 +154,21 @@ def run(self):
MC_dataset.produceRoot_DoubleORSinglePNet(output_root_file, self.PNetparam)
else:
MC_dataset.produceRoot_DoubleORSingleDeepTau(output_root_file)

if self.HLT_name == 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseDeepTauPFTauHPS30_eta2p1_CrossL1':
from HLTClass.ETauDataset import ETauDataset

MC_dataset = ETauDataset(input_root_file)
if self.PNetMode:
MC_dataset.produceRoot_ETauPNet(output_root_file, self.PNetparam)
else:
MC_dataset.produceRoot_ETauDeepNet(output_root_file)

if self.HLT_name == 'HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1':
from HLTClass.MuTauDataset import MuTauDataset

MC_dataset = MuTauDataset(input_root_file)
if self.PNetMode:
MC_dataset.produceRoot_MuTauPNet(output_root_file, self.PNetparam)
else:
MC_dataset.produceRoot_MuTauDeepNet(output_root_file)
2 changes: 1 addition & 1 deletion ComputeRate/compute_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
print('Computed rate: ')
print(f"rate : {eff*L1A_physics}")
print(f"rate_up : {err_low*L1A_physics}")
print(f"rate_down : {err_up*L1A_physics}")
print(f"rate_down : {err_up*L1A_physics}")
13 changes: 12 additions & 1 deletion ComputeRate/compute_rate_quick.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@
else:
N_den, N_num = dataset_rate.get_Nnum_Nden_HLT_DoubleORSingleDeepTau()

if HLT_name == 'HLT_Ele24_eta2p1_WPTight_Gsf_PNetTauhPFJetPt30_Loose_eta2p3_CrossL1':
from HLTClass.ETauDataset import ETauDataset

dataset_rate = ETauDataset(FileNameList_rate)

if PNetMode:
N_den, N_num = dataset_rate.get_Nnum_Nden_ETauPNet(PNetparam)
else:
N_den, N_num = dataset_rate.get_Nnum_Nden_ETauDeepNet()


rate, rate_low, rate_up = compute_ratio_witherr(N_num, N_den)

print(f"Rate : {rate*L1A_physics}")
print(f"Rate_up : {rate_up*L1A_physics}")
print(f"Rate_down : {rate_low*L1A_physics}")
print(f"Rate_down : {rate_low*L1A_physics}")
20 changes: 19 additions & 1 deletion ComputeRate/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def run(self):
event_counter[intput_root_file] = {}
print(f"For {os.path.basename(intput_root_file)}:")

HLT_config = ['HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1', 'HLT_LooseDeepTauPFTauHPS180_L2NN_eta2p1_v3', 'HLT_DoubleTauOrSingleTau']
HLT_config = ['HLT_DoubleMediumDeepTauPFTauHPS35_L2NN_eta2p1', 'HLT_LooseDeepTauPFTauHPS180_L2NN_eta2p1_v3', 'HLT_DoubleTauOrSingleTau','HLT_Ele24_eta2p1_WPTight_Gsf_PNetTauhPFJetPt30_Loose_eta2p3_CrossL1','HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1']
if self.HLT_name not in HLT_config:
print(f'HLT name {self.HLT_name} not implemented in the code')
raise
Expand Down Expand Up @@ -139,6 +139,24 @@ def run(self):
else:
N_den_i, N_num_i = eph_dataset.get_Nnum_Nden_HLT_DoubleORSingleDeepTau()

if self.HLT_name == 'HLT_Ele24_eta2p1_WPTight_Gsf_PNetTauhPFJetPt30_Loose_eta2p3_CrossL1':
from HLTClass.ETauDataset import ETauDataset

eph_dataset = ETauDataset(intput_root_file)
if self.PNetMode:
N_den_i, N_num_i = eph_dataset.get_Nnum_Nden_ETauPNet(self.PNetparam)
else:
N_den_i, N_num_i = eph_dataset.get_Nnum_Nden_HLT_ETauDeepNet()

if self.HLT_name == 'HLT_IsoMu20_eta2p1_LooseDeepTauPFTauHPS27_eta2p1_CrossL1':
from HLTClass.MuTauDataset import MuTauDataset

eph_dataset = MuTauDataset(intput_root_file)
if self.PNetMode:
N_den_i, N_num_i = eph_dataset.get_Nnum_Nden_MuTauPNet(self.PNetparam)
else:
N_den_i, N_num_i = eph_dataset.get_Nnum_Nden_HLT_MuTauDeepNet()

event_counter[intput_root_file]['N_den'] = N_den_i
event_counter[intput_root_file]['N_num'] = N_num_i

Expand Down
Loading