ATLAS Offline Software
Loading...
Searching...
No Matches
extract_chain_from_json.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
3# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4
5import json
6import pprint
7
8import argparse
9parser = argparse.ArgumentParser(description='Get the inputs for chain extraction')
10
11parser.add_argument('--chain', dest='chain', action='store', default='',
12 help='What chain are we extracting')
13parser.add_argument('--menu_json', dest='input_json', action='store', default='',
14 help='What menu are we extracting the chain from')
15
16args = parser.parse_args()
17
18chain = args.chain
19input_json = args.input_json
20
21the_menu = json.loads(open(input_json).read())
22
23print("...extracting",chain,"from menu json",input_json)
24
25if chain not in the_menu['chains']:
26 raise Exception("The requested chain isn't in the provided menu json, please try again.")
27
28pprint.pprint(the_menu['chains'][chain])
29
30print("Steps in the chain:")
31
32for isq,seq in enumerate(the_menu['chains'][chain]['sequencers']):
33
34 if not seq:
35 print('step',isq+1,'is empty')
36 continue
37 else:
38 print('step',isq+1,'is sequence ',seq)
39
40 other_chains = []
41 for chain in the_menu['chains']:
42 if seq in the_menu['chains'][chain]['sequencers']:
43 other_chains += [chain]
44 if len(other_chains) > 0:
45 print (' also used in the following chains:')
46 pprint.pprint(other_chains)
47 else:
48 print (' is not used in any other chains.')
49
50 print (' contains algorithms/hypos:')
51 pprint.pprint(the_menu['sequencers'][seq])
void print(char *figname, TCanvas *c1)
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)