ATLAS Offline Software
Loading...
Searching...
No Matches
AtlRunQuery Namespace Reference

Functions

 main ()

Function Documentation

◆ main()

AtlRunQuery.main ( )

Definition at line 14 of file AtlRunQuery.py.

14def main():
15 arguments = sys.argv
16
17 if len(arguments) <= 1:
18 print('No query argument given')
19 return 1
20
21 fileindex = None
22
23 if arguments[1] == 'fileindex':
24 installpath = '/'.join(os.path.dirname(__file__).split('/')[:-1])
25 fileindex = arguments[2]
26 datapath = '/data/arq_%s/arq_%s' % (fileindex[:6],fileindex)
27 #queryfile = '%s/%s/query.txt' % (installpath,datapath)
28 queryfile = '%s/query.txt' % datapath
29 fh = open(queryfile,"r")
30 origQuery = fh.readline().strip()
31 fh.close()
32 arguments[1:] = origQuery.split()
33 else:
34 datapath='data'
35 origQuery = ' '.join(arguments[1:])
36
37 ignoreParser = origQuery.startswith('--')
38
39 from CoolRunQuery.AtlRunQueryOptions import AtlRunQueryOptions
40 if ignoreParser:
41
42 (options, args) = AtlRunQueryOptions().parse()
43 atlqueryarg = origQuery
44
45 else:
46
47 from CoolRunQuery.AtlRunQueryParser import ArgumentParser
48 ap = ArgumentParser()
49
50 # special treatment of some extra tools: pileup calc, det mask decoding, help(not implemented)
51 firstarg = arguments[1].lower()
52 if firstarg in ['pileup','detmask','help']:
53 tabletemplate = '<table class="othertable" style="width:60%%"><tr><th>Query result:</th></tr><tr><td>\n%s</td></tr></table><p></p><br><p></p>'
54 if firstarg == 'pileup':
55 from CoolRunQuery.AtlRunQueryUtils import Pileup
56 body = tabletemplate % (Pileup(arguments[2:]))
57 elif firstarg == 'detmask':
58 from CoolRunQuery.utils.AtlRunQueryLookup import DecodeDetectorMask
59 body = tabletemplate % ( DecodeDetectorMask( arguments[2], isRun2=True ))
60 else:
61 body = ''
62
63 # return a default page
64 from CoolRunQuery.html.AtlRunQueryPageMaker import PageMaker
65 from CoolRunQuery.AtlRunQueryQueryConfig import QC
66 QC.datapath = datapath
67 PageMaker.makePage(body, origQuery, removeExamples=True)
68 return 0
69
70 atlqueryarg = arguments[0].rsplit('/',1)[-1] + " " + ap.ParseArgument( ' '.join(arguments[1:]) )
71
72 if '--verbose' in atlqueryarg:
73 print(atlqueryarg)
74
75 (options, args) = AtlRunQueryOptions().parse(atlqueryarg)
76
77
78 from CoolRunQuery.AtlRunQueryLib import AtlRunQuery
79 print("Data path %s" % datapath)
80 AtlRunQuery(options, html="AUTO", origQuery=origQuery, datapath=datapath, parsedstring=atlqueryarg) # html can be "YES", "NO", "AUTO"
81 return 0
82
void print(char *figname, TCanvas *c1)
std::map< std::string, std::string > parse(const std::string &list)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
int main()
Definition hello.cxx:18