Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Handle LumiData files that contain average instantaneous luminosity. #942

Merged
merged 3 commits into from
Nov 29, 2023
Merged
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
11 changes: 9 additions & 2 deletions src/coffea/lumi_tools/lumi_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ class LumiData:
brilcalc lumi -c /cvmfs/cms.cern.ch/SITECONF/local/JobConfig/site-local-config.xml \
-b "STABLE BEAMS" --normtag=/cvmfs/cms-bril.cern.ch/cms-lumi-pog/Normtags/normtag_PHYSICS.json \
-u /pb --byls --output-style csv -i Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt > lumi2017.csv

Note that some brilcalc files may be in different units than inverse picobarns, including possibly average instantaneous luminosity.
You should make sure that you understand the units of the LumiData file you are using before calculating luminosity with this tool.
If you are using a LumiData file containing avg. inst. luminosity, make sure to set is_inst_lumi=True in the constructor of this class.
"""

def __init__(self, lumi_csv):
seconds_per_lumi_LHC = 2**18 / (40079000 / 3564)

def __init__(self, lumi_csv, is_inst_lumi=False):
self._is_inst_lumi = is_inst_lumi
self._lumidata = np.loadtxt(
lumi_csv,
delimiter=",",
Expand Down Expand Up @@ -58,7 +65,7 @@ def get_lumi(self, runlumis):
runlumis = runlumis.array
tot_lumi = np.zeros((1,), dtype=np.dtype("float64"))
LumiData._get_lumi_kernel(runlumis[:, 0], runlumis[:, 1], self.index, tot_lumi)
return tot_lumi[0]
return tot_lumi[0] * (self.seconds_per_lumi_LHC if self._is_inst_lumi else 1.0)

@staticmethod
@numba.njit(parallel=False, fastmath=False)
Expand Down
Loading