Skip to content

Commit

Permalink
restore cm_energy as before
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Aug 12, 2024
1 parent 23a76be commit 697470c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions validphys2/src/validphys/commondataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,13 @@ def folder(self):
def cm_energy(self):
"""Return the center of mass energy as GeV if it can be understood from the name
otherwise return None"""

if "NOTFIXED" in self.setname:
energy_string = self.setname.split("_")[2]
if energy_string == "NOTFIXED":
return None
if "GEV" in self.setname:
factor = 1
energy_string = [a for a in self.setname.split("_") if "GEV" in a][0]
elif "TEV" in self.setname:
if energy_string.endswith("GEV"):
factor = 1.0
elif energy_string.endswith("TEV"):
factor = 1000
energy_string = [a for a in self.setname.split("_") if "TEV" in a][0]
else:
return None
return float(energy_string[:-3].replace("P", ".")) * factor
Expand Down

0 comments on commit 697470c

Please sign in to comment.