legacymc_extractor.py
Go to the documentation of this file.
1 
2 from fts.metadata_extractors import BaseMetadataExtractor
3 
4 class LegacyMC(BaseMetadataExtractor):
5  name = "legacy_nova_mc_metadata"
6 
7  def extract(self,filestate, *args, **kwargs):
8 
9  type_trans = {'sim' : 'importedSimulated'
10  }
11  tier_trans = {'pid' : 'pid' ,
12  'reco' : 'reconstructed'
13  }
14  swap_trans = {'' : 'none' ,
15  'nonswap' : 'none' ,
16  'fluxswap' : 'swap' ,
17  'fluxtau' : 'fluxtau' ,
18  'nueonly' : 'nueonly' ,
19  '200adc' : 'none' ,
20  '400adc' : 'none' ,
21  'rock' : 'none' ,
22  'eps' : 'none'
23  }
24  hpol_trans = {'' : 'NA' ,
25  'fhc' : 'fhc' ,
26  'rhc' : 'rhc'
27  }
28 
29  fname = filestate.getFileName()
30  fn_m1 = fname.split('_')
31  nflds = len(fn_m1)
32  fn_m2 = fn_m1[nflds-1].split('.')
33  if ( nflds == 11 ):
34  hindx = fn_m1[7]
35  sindx = fn_m1[8]
36  elif ( nflds == 10 ):
37  hindx = fn_m1[7]
38  sindx = ''
39  elif ( nflds == 9 ):
40  hindx = ''
41  sindx = ''
42 
43  novalbl = fn_m1[0] + '_' + fn_m1[5]
44  if ( hindx != '' ): novalbl = novalbl + '_' + hindx
45  if ( sindx != '' ): novalbl = novalbl + '_' + sindx
46  novasub = fn_m1[4][1:]
47  if ( novasub != "1" and novasub != "2" ):
48  novasub = "1"
49  novalbl = novalbl + '_' + fn_m1[4]
50 
51  metadata = {
52  'Simulated.detectorID' : fn_m1[0],
53  'Simulated.firstRun' : fn_m1[1][1:],
54  'Simulated.firstSubRun' : fn_m1[2][1:],
55  'Simulated.base_release' : fn_m1[3],
56  'Simulated.generator' : fn_m1[5],
57  'Simulated.number_of_spills' : fn_m1[6],
58  'Simulated.horn_polarity' : hpol_trans[ hindx ],
59  'Simulated.swap' : swap_trans[ sindx ],
60  'file_type' : type_trans[ fn_m2[1] ],
61  'data_tier' : tier_trans[ fn_m2[2] ],
62  'file_format' : fn_m2[3],
63  'runs' : [[ int(fn_m1[1][1:]) , 'monte-carlo' ]],
64  'event_count' : int(fn_m1[6]),
65  'group' : 'nova',
66  'NOVA.SubVersion' : novasub,
67  'NOVA.Label' : novalbl,
68  }
69 
70 
71  # return directly with the answer
72  return metadata
73 
74 
75 legacymcExtractor = LegacyMC()
76 
void split(double tt, double *fr)
def extract(self, filestate, args, kwargs)