CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
platform.py
Go to the documentation of this file.
1 from ROOT import TFile
2 
3 def platform(filename):
4  '''Detects the platform on which heppy is running, and returns BARE, CMSSW, or FCC.
5  '''
6  rootfile = TFile(filename)
7  keys = rootfile.GetListOfKeys()
8  cmssw_keys = ['MetaData', 'ParameterSets', 'Events', 'LuminosityBlocks', 'Runs']
9  is_cmssw = True
10  for key in cmssw_keys:
11  if key not in keys:
12  is_cmssw = False
13  if is_cmssw:
14  return 'CMSSW'
15  else:
16  return 'BARE'
17 
18 if __name__ == '__main__':
19  import sys
20  fnam = sys.argv[1]
21  print platform(fnam)
def platform
Definition: platform.py:3