~maddevelopers/mg5amcnlo/2.9.4

« back to all changes in this revision

Viewing changes to madgraph/various/gen_crossxhtml.py

pass to v2.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
################################################################################
2
2
#
3
 
# Copyright (c) 2011 The MadGraph Development team and Contributors
 
3
# Copyright (c) 2011 The MadGraph5_aMC@NLO Development team and Contributors
4
4
#
5
 
# This file is a part of the MadGraph 5 project, an application which 
 
5
# This file is a part of the MadGraph5_aMC@NLO project, an application which 
6
6
# automatically generates Feynman diagrams and matrix elements for arbitrary
7
7
# high-energy processes in the Standard Model and beyond.
8
8
#
9
 
# It is subject to the MadGraph license which should accompany this 
 
9
# It is subject to the MadGraph5_aMC@NLO license which should accompany this 
10
10
# distribution.
11
11
#
12
 
# For more information, please visit: http://madgraph.phys.ucl.ac.be
 
12
# For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch
13
13
#
14
14
################################################################################
15
15
""" Create gen_crossxhtml """
20
20
import re
21
21
import pickle
22
22
import re
 
23
import glob
23
24
try:
24
25
    import internal.files as files
25
26
    import internal.save_load_object as save_load_object
26
 
except:
 
27
except ImportError:
27
28
    import madgraph.iolibs.files as files
28
29
    import madgraph.iolibs.save_load_object as save_load_object
29
30
 
92
93
"""
93
94
 
94
95
status_template = """
95
 
<H2 ALIGN=CENTER> Currently Running </H2>
 
96
<H2 ALIGN=CENTER> Currently Running %(run_mode_string)s</H2>
96
97
<TABLE BORDER=2 ALIGN=CENTER>
97
98
    <TR ALIGN=CENTER>
98
99
        <TH nowrap ROWSPAN=2 font color="#0000FF"> Run Name </TH>
115
116
                    %(pythia_card)s
116
117
                    %(pgs_card)s
117
118
                    %(delphes_card)s
 
119
                    %(shower_card)s
 
120
                    %(fo_analyse_card)s
118
121
        </TD>
119
122
        <TD nowrap ROWSPAN=2> %(results)s </TD> 
120
123
        %(status)s
161
164
            if not tag:
162
165
                self.current = self[run][-1]
163
166
            else:
164
 
                self.current = self[run][tag]
 
167
                assert tag in self[run].tags
 
168
                index = self[run].tags.index(tag)
 
169
                self.current = self[run][index]
 
170
                
165
171
        else:
166
172
            self.current = None
167
173
    
193
199
        if web is True:
194
200
            try:
195
201
                web = os.environ['SERVER_NAME']
196
 
            except:
 
202
            except Exception:
197
203
                web = 'my_computer'
198
204
        self['web'] = web
199
205
        self.web = web
295
301
    def add_detail(self, name, value, run=None, tag=None):
296
302
        """ add information to current run (cross/error/event)"""
297
303
        assert name in ['cross', 'error', 'nb_event', 'cross_pythia',
298
 
                        'nb_event_pythia','error_pythia']
 
304
                        'nb_event_pythia','error_pythia', 'run_mode']
299
305
 
300
306
        if not run and not self.current:
301
307
            return
311
317
            run[name] = int(value)
312
318
        elif name == 'nb_event_pythia':
313
319
            run[name] = int(value)
 
320
        elif name == 'run_mode':
 
321
            run[name] = value
314
322
        else:    
315
323
            run[name] = float(value)    
316
324
    
321
329
        if self.status and self.current:
322
330
            if isinstance(self.status, str):
323
331
                status = '<td ROWSPAN=2 colspan=4>%s</td>' %  self.status
324
 
            else:
325
 
                s = self.status
 
332
            else:                
 
333
                s = list(self.status)
 
334
                if s[0] == '$events':
 
335
                    if self.current['nb_event']:
 
336
                        nevent = self.current['nb_event']
 
337
                    else:
 
338
                        nevent = self[self.current['run_name']][0]['nb_event']
 
339
                    if nevent:
 
340
                        s[0] = nevent - int(s[1]) -int(s[2])
 
341
                    else:
 
342
                        s[0] = ''
326
343
                status ='''<td> %s </td> <td> %s </td> <td> %s </td>
327
344
                </tr><tr><td colspan=3><center> %s </center></td>''' % (s[0],s[1], s[2], s[3])
328
345
                
333
350
                            'run_name': self.current['run_name'],
334
351
                            'tag_name': self.current['tag'],
335
352
                            'unit': self[self.current['run_name']].info['unit']}
 
353
            # add the run_mode_string for amcatnlo_run
 
354
            if 'run_mode' in self.current.keys():
 
355
                run_mode_string = {'aMC@NLO': '(aMC@NLO)',
 
356
                                   'aMC@LO': '(aMC@LO)',
 
357
                                   'noshower': '(aMC@NLO)',
 
358
                                   'noshowerLO': '(aMC@LO)',
 
359
                                   'NLO': '(NLO f.o.)',
 
360
                                   'LO': '(LO f.o.)',
 
361
                                   'madevent':''}
 
362
                status_dict['run_mode_string'] = run_mode_string[self.current['run_mode']]
 
363
            else:
 
364
                status_dict['run_mode_string'] = ''
 
365
 
336
366
 
337
367
            if exists(pjoin(self.path, 'HTML',self.current['run_name'], 
338
368
                        'results.html')):
355
385
                status_dict['delphes_card'] = """ <a href="./Cards/delphes_card.dat">delphes_card</a><BR>"""
356
386
            else:
357
387
                status_dict['delphes_card'] = ""
358
 
                
 
388
            if exists(pjoin(self.path, 'Cards', 'shower_card.dat')):
 
389
                status_dict['shower_card'] = """ <a href="./Cards/shower_card.dat">shower_card</a><BR>"""
 
390
            else:
 
391
                status_dict['shower_card'] = ""
 
392
            if exists(pjoin(self.path, 'Cards', 'FO_analyse_card.dat')):
 
393
                status_dict['fo_analyse_card'] = """ <a href="./Cards/FO_analyse_card.dat">FO_analyse_card</a><BR>"""
 
394
            else:
 
395
                status_dict['fo_analyse_card'] = ""                
 
396
 
359
397
            if self.web:
360
398
                status_dict['stop_form'] = """
361
399
                 <TR ALIGN=CENTER><TD COLSPAN=7 text-align=center>
397
435
        text = crossxhtml_template % text_dict
398
436
        open(pjoin(self.path,'crossx.html'),'w').write(text)
399
437
        
 
438
 
 
439
class AllResultsNLO(AllResults):
 
440
    """Store the results for a NLO run of a given directory"""
 
441
    pass
400
442
       
401
443
 
402
444
class RunResults(list):
435
477
    
436
478
    def get_html(self, output_path, **opt):
437
479
        """WRITE HTML OUTPUT"""
438
 
 
439
480
        try:
440
481
            self.web = opt['web']
441
482
            self.info['web'] = self.web
442
 
        except:
 
483
        except Exception:
443
484
            self.web = False
444
485
 
445
486
        # check if more than one parton output
464
505
            
465
506
            text = text % self.info
466
507
 
467
 
 
468
508
        return text
 
509
 
469
510
    
470
511
    def return_tag(self, name):
471
512
        
567
608
        self['cross_pythia'] = ''
568
609
        self['nb_event_pythia'] = 0
569
610
        self['error'] = 0
570
 
        self.parton = [] 
 
611
        self['run_mode'] = 'madevent'
 
612
        self.parton = []
 
613
        self.reweight = [] 
571
614
        self.pythia = []
572
615
        self.pgs = []
573
616
        self.delphes = []
 
617
        self.shower = []
574
618
        # data 
575
619
        self.status = ''
576
 
        
577
 
    
 
620
 
578
621
    
579
622
    
580
623
    def update_status(self, level='all', nolevel=[]):
581
624
        """update the status of the current run """
582
625
 
 
626
        import misc as misc
583
627
        exists = os.path.exists
584
628
        run = self['run_name']
585
629
        tag =self['tag']
592
636
            if 'gridpack' not in self.parton and \
593
637
                    exists(pjoin(path,os.pardir ,os.pardir,"%s_gridpack.tar.gz" % run)):
594
638
                self.parton.append('gridpack')
 
639
        # Check if the output of the last status exists
 
640
        if level in ['reweight','all']:
 
641
            if 'plot' not in self.reweight and \
 
642
                         exists(pjoin(html_path,"plots_%s.html" % tag)):
 
643
                self.reweight.append('plot')
595
644
        
596
645
        if level in ['parton','all'] and 'parton' not in nolevel:
597
646
            
598
647
            if 'lhe' not in self.parton and \
599
648
                        (exists(pjoin(path,"unweighted_events.lhe.gz")) or
600
 
                         exists(pjoin(path,"unweighted_events.lhe"))):
 
649
                         exists(pjoin(path,"unweighted_events.lhe")) or
 
650
                         exists(pjoin(path,"events.lhe.gz")) or
 
651
                         exists(pjoin(path,"events.lhe"))):
601
652
                self.parton.append('lhe')
602
653
        
603
654
            if 'root' not in self.parton and \
611
662
            if 'param_card' not in self.parton and \
612
663
                                    exists(pjoin(path, "param_card.dat")):
613
664
                self.parton.append('param_card')
 
665
            
 
666
            if 'syst' not in self.parton and \
 
667
                                    exists(pjoin(path, "%s_parton_syscalc.log" %self['tag'])):
 
668
                self.parton.append('syst')
 
669
 
 
670
            if glob.glob(pjoin(path,"*.top")):
 
671
                if self['run_mode'] in ['LO', 'NLO']:
 
672
                    self.parton.append('top')
 
673
 
 
674
        if level in ['shower','all'] and 'shower' not in nolevel \
 
675
          and self['run_mode'] != 'madevent':
 
676
            # this is for hep/top files from amcatnlo
 
677
            if glob.glob(pjoin(path,"*.hep")) + \
 
678
               glob.glob(pjoin(path,"*.hep.gz")):
 
679
                self.shower.append('hep')
 
680
 
 
681
            if glob.glob(pjoin(path,"*.hepmc")) + \
 
682
               glob.glob(pjoin(path,"*.hepmc.gz")):
 
683
                self.shower.append('hepmc')
 
684
 
 
685
            if glob.glob(pjoin(path,"*.top")):
 
686
                if self['run_mode'] in ['LO', 'NLO']:
 
687
                    self.parton.append('top')
 
688
                else:
 
689
                    self.shower.append('top')
 
690
 
 
691
 
614
692
                
615
693
        if level in ['pythia', 'all']:
616
694
            
629
707
                             exists(pjoin(path,"%s_pythia_events.hep" % tag))):
630
708
                self.pythia.append('hep')
631
709
            
 
710
            if 'rwt' not in self.pythia and \
 
711
                            (exists(pjoin(path,"%s_syscalc.dat.gz" % tag)) or
 
712
                             exists(pjoin(path,"%s_syscalc.dat" % tag))):
 
713
                self.pythia.append('rwt')
 
714
            
632
715
            if 'root' not in self.pythia and \
633
716
                              exists(pjoin(path,"%s_pythia_events.root" % tag)):
634
717
                self.pythia.append('root')
698
781
        if level == 'parton':
699
782
            if 'gridpack' in self.parton:
700
783
                out += self.special_link("./%(run_name)s_gridpack.tar",
701
 
                                                         'gridpack', 'gridpack')
702
 
            
 
784
                                                    'gridpack', 'gridpack')
703
785
            if 'lhe' in self.parton:
704
 
                link = './Events/%(run_name)s/unweighted_events.lhe'
 
786
                if exists(pjoin(self.me_dir, 'Events', self['run_name'], 'unweighted_events.lhe')) or\
 
787
                  exists(pjoin(self.me_dir, 'Events', self['run_name'], 'unweighted_events.lhe.gz')):
 
788
                    link = './Events/%(run_name)s/unweighted_events.lhe'
 
789
                elif exists(pjoin(self.me_dir, 'Events', self['run_name'], 'events.lhe')) or\
 
790
                  exists(pjoin(self.me_dir, 'Events', self['run_name'], 'events.lhe.gz')):
 
791
                    link = './Events/%(run_name)s/events.lhe'
705
792
                level = 'parton'
706
793
                name = 'LHE'
707
794
                out += self.special_link(link, level, name) 
711
798
                out += ' <a href="./HTML/%(run_name)s/plots_parton.html">plots</a>'
712
799
            if 'param_card' in self.parton:
713
800
                out += ' <a href="./Events/%(run_name)s/param_card.dat">param_card</a>'
 
801
            if 'top' in self.parton:
 
802
            # fixed order plots
 
803
                for f in \
 
804
                  glob.glob(pjoin(self.me_dir, 'Events', self['run_name'], '*.top')):
 
805
                    out += " <a href=\"%s\">%s</a> " % (f, 'TOP')
 
806
            #if 'rwt' in self.parton:
 
807
            #    out += ' <a href="./Events/%(run_name)s/%(tag)s_parton_syscalc.log">systematic variation</a>'
714
808
 
715
809
            return out % self
716
810
        
 
811
        if level == 'reweight':
 
812
            if 'plot' in self.reweight:
 
813
                out += ' <a href="./HTML/%(run_name)s/plots_%(tag)s.html">plots</a>'           
 
814
            return out % self
 
815
 
717
816
        if level == 'pythia':          
718
817
            if 'log' in self.pythia:
719
818
                out += """ <a href="./Events/%(run_name)s/%(tag)s_pythia.log">LOG</a>"""
731
830
                out += """ <a href="./Events/%(run_name)s/%(tag)s_pythia_events.root">rootfile (LHE)</a>"""
732
831
            if 'lheroot' in self.pythia:
733
832
                out += """ <a href="./Events/%(run_name)s/%(tag)s_pythia_lhe_events.root">rootfile (LHE)</a>"""
 
833
            if 'rwt' in self.pythia:
 
834
                link = './Events/%(run_name)s/%(tag)s_systematics.dat'
 
835
                level = 'pythia'
 
836
                name = 'systematics'
 
837
                out += self.special_link(link, level, name)                 
734
838
            if 'plot' in self.pythia:
735
839
                out += ' <a href="./HTML/%(run_name)s/plots_pythia_%(tag)s.html">plots</a>'
736
840
            return out % self
737
841
 
738
 
 
739
842
        if level == 'pgs':
740
843
            if 'log' in self.pgs:
741
844
                out += """ <a href="./Events/%(run_name)s/%(tag)s_pgs.log">LOG</a>"""
751
854
            return out % self
752
855
        
753
856
        if level == 'delphes':
754
 
            
755
857
            if 'log' in self.delphes:
756
858
                out += """ <a href="./Events/%(run_name)s/%(tag)s_delphes.log">LOG</a>"""
757
859
            if 'lhco' in self.delphes:
764
866
            if 'plot' in self.delphes:
765
867
                out += """ <a href="./HTML/%(run_name)s/plots_delphes_%(tag)s.html">plots</a>"""            
766
868
            return out % self
 
869
 
 
870
        if level == 'shower':
 
871
        # this is to add the link to the results after shower for amcatnlo
 
872
            for kind in ['hep', 'hepmc', 'top']:
 
873
                if kind in self.shower:
 
874
                    for f in \
 
875
                      glob.glob(pjoin(self.me_dir, 'Events', self['run_name'], '*.' + kind)) + \
 
876
                      glob.glob(pjoin(self.me_dir, 'Events', self['run_name'], '*.' + kind + '.gz')):
 
877
                        out += " <a href=\"%s\">%s</a> " % (f, kind.upper())
 
878
            
 
879
            return out % self
767
880
                
768
881
    
769
882
    def get_nb_line(self):
770
883
        
771
884
        nb_line = 0
772
 
        for i in [self.parton, self.pythia, self.pgs, self.delphes]:
 
885
        for i in [self.parton, self.reweight, self.pythia, self.pgs, self.delphes, self.shower]:
773
886
            if len(i):
774
887
                nb_line += 1
775
888
        return max([nb_line,1])
789
902
        # Compute the text for eachsubpart
790
903
        
791
904
        sub_part_template_parton = """
792
 
        <td rowspan=%(cross_span)s><center><a href="./HTML/%(run)s/results.html"> %(cross).4g <font face=symbol>&#177;</font> %(err).2g </a></center></td>
 
905
        <td rowspan=%(cross_span)s><center><a href="./HTML/%(run)s/results.html"> %(cross).4g <font face=symbol>&#177;</font> %(err).2g</a> %(syst)s </center></td>
793
906
        <td rowspan=%(cross_span)s><center> %(nb_event)s<center></td><td> %(type)s </td>
794
907
        <td> %(links)s</td>
795
908
        <td> %(action)s</td>
796
909
        </tr>"""
797
910
        
 
911
        sub_part_template_reweight = """
 
912
        <td rowspan=%(cross_span)s><center> %(cross).4g </center></td>
 
913
        <td rowspan=%(cross_span)s><center> %(nb_event)s<center></td><td> %(type)s </td>
 
914
        <td> %(links)s</td>
 
915
        <td> %(action)s</td>
 
916
        </tr>"""        
 
917
        
798
918
        sub_part_template_pgs = """
799
919
        <td> %(type)s </td>
800
920
        <td> %(links)s</td>
801
921
        <td> %(action)s</td> 
802
922
        </tr>"""        
 
923
 
 
924
        sub_part_template_shower = """
 
925
        <td> %(type)s %(run_mode)s </td>
 
926
        <td> %(links)s</td>
 
927
        <td> %(action)s</td>
 
928
        </tr>"""
803
929
        
804
930
        # Compute the HTMl output for subpart
805
931
        nb_line = self.get_nb_line()
809
935
                self['nb_event'] = runresults[-2]['nb_event']
810
936
                self['cross'] = runresults[-2]['cross']
811
937
                self['error'] = runresults[-2]['error']
812
 
            except:
 
938
            except Exception:
813
939
                pass
814
940
                
815
 
        elif (self.pgs or self.delphes) and not self['nb_event']:
 
941
        elif (self.pgs or self.delphes) and not self['nb_event'] and \
 
942
             len(runresults) > 1:
816
943
            if runresults[-2]['cross_pythia'] and runresults[-2]['cross']:
817
944
                self['cross'] = runresults[-2]['cross_pythia']
818
945
                self['error'] = runresults[-2]['error_pythia']
825
952
        
826
953
        first = None
827
954
        subresults_html = ''
828
 
        for type in ['parton', 'pythia', 'pgs', 'delphes']:
829
 
            data = getattr(self, type)
 
955
        for ttype in ['parton', 'pythia', 'pgs', 'delphes','reweight','shower']:
 
956
            data = getattr(self, ttype)
830
957
            if not data:
831
958
                continue
832
959
            
833
 
            local_dico = {'type': type, 'run': self['run_name']}
834
 
 
 
960
            local_dico = {'type': ttype, 'run': self['run_name'], 'syst': ''}
 
961
            if 'run_mode' in self.keys():
 
962
                local_dico['run_mode'] = self['run_mode']
 
963
            else:
 
964
                local_dico['run_mode'] = ""
835
965
            if not first:
836
 
                template = sub_part_template_parton
837
 
                first = type
838
 
                if type=='parton' and self['cross_pythia']:
 
966
                if ttype == 'reweight':
 
967
                    template = sub_part_template_reweight
 
968
                else:
 
969
                    template = sub_part_template_parton
 
970
                first = ttype
 
971
                if ttype=='parton' and self['cross_pythia']:
839
972
                    local_dico['cross_span'] = 1
840
973
                    local_dico['cross'] = self['cross']
841
974
                    local_dico['err'] = self['error']
842
975
                    local_dico['nb_event'] = self['nb_event']
 
976
                    if 'syst' in self.parton:
 
977
                        local_dico['syst'] = '<font face=symbol>&#177;</font> <a href="./Events/%(run_name)s/%(tag)s_parton_syscalc.log">systematics</a>' \
 
978
                                             % {'run_name':self['run_name'], 'tag': self['tag']}
843
979
                elif self['cross_pythia']:
844
980
                    if self.parton:
845
981
                        local_dico['cross_span'] = nb_line -1
851
987
                        local_dico['nb_event'] = 0
852
988
                    local_dico['cross'] = self['cross_pythia']
853
989
                    local_dico['err'] = self['error_pythia']
 
990
                    if 'rwt' in self.pythia:
 
991
                        local_dico['syst'] = '<font face=symbol>&#177;</font> <a href="./Events/%(run_name)s/%(tag)s_Pythia_syscalc.log">systematics</a>' \
 
992
                                             % {'run_name':self['run_name'], 'tag': self['tag']}
854
993
                else:
 
994
                    local_dico['type'] += ' %s' % self['run_mode']
855
995
                    local_dico['cross_span'] = nb_line
856
996
                    local_dico['cross'] = self['cross']
857
997
                    local_dico['err'] = self['error']
858
998
                    local_dico['nb_event'] = self['nb_event']
 
999
                    if 'syst' in self.parton:
 
1000
                        local_dico['syst'] = '<font face=symbol>&#177;</font> <a href="./Events/%(run_name)s/%(tag)s_parton_syscalc.log">systematics</a>' \
 
1001
                                             % {'run_name':self['run_name'], 'tag': self['tag']}
859
1002
                    
860
 
            elif type == 'pythia' and self['cross_pythia']:
 
1003
            elif ttype == 'pythia' and self['cross_pythia']:
861
1004
                template = sub_part_template_parton
862
1005
                if self.parton:           
863
1006
                    local_dico['cross_span'] = nb_line - 1
868
1011
                else:
869
1012
                    local_dico['cross_span'] = nb_line
870
1013
                    local_dico['nb_event'] = self['nb_event']
 
1014
                if 'rwt' in self.pythia:
 
1015
                    local_dico['syst'] = '<font face=symbol>&#177;</font> <a href="./Events/%(run_name)s/%(tag)s_Pythia_syscalc.log">systematics</a>' \
 
1016
                                             % {'run_name':self['run_name'], 'tag': self['tag']}
871
1017
                local_dico['cross'] = self['cross_pythia']
872
1018
                local_dico['err'] = self['error_pythia']
 
1019
 
 
1020
            elif ttype == 'shower':
 
1021
                template = sub_part_template_shower
 
1022
                if self.parton:           
 
1023
                    local_dico['cross_span'] = nb_line - 1
 
1024
                else:
 
1025
                    local_dico['cross_span'] = nb_line
873
1026
            else:
874
 
               template = sub_part_template_pgs             
 
1027
                template = sub_part_template_pgs             
875
1028
            
876
1029
            # Fill the links
877
 
            local_dico['links'] = self.get_links(type)
 
1030
            local_dico['links'] = self.get_links(ttype)
878
1031
 
879
1032
            # Fill the actions
880
 
            if type == 'parton':
881
 
                if runresults.web:
882
 
                    local_dico['action'] = """
883
 
<FORM ACTION="http://%(web)s/cgi-bin/RunProcess/handle_runs-pl"  ENCTYPE="multipart/form-data" METHOD="POST">
884
 
<INPUT TYPE=HIDDEN NAME=directory VALUE="%(me_dir)s">
885
 
<INPUT TYPE=HIDDEN NAME=whattodo VALUE="remove_level">
886
 
<INPUT TYPE=HIDDEN NAME=level VALUE="all">
887
 
<INPUT TYPE=HIDDEN NAME=tag VALUE=\"""" + self['tag'] + """\">
888
 
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
889
 
<INPUT TYPE=SUBMIT VALUE="Remove run">
890
 
</FORM>
891
 
                    
892
 
<FORM ACTION="http://%(web)s/cgi-bin/RunProcess/handle_runs-pl"  ENCTYPE="multipart/form-data" METHOD="POST">
893
 
<INPUT TYPE=HIDDEN NAME=directory VALUE="%(me_dir)s">
894
 
<INPUT TYPE=HIDDEN NAME=whattodo VALUE="pythia">
895
 
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
896
 
<INPUT TYPE=SUBMIT VALUE="Run Pythia">
897
 
</FORM>"""
898
 
                else:
899
 
                    local_dico['action'] = self.command_suggestion_html('remove %s parton --tag=%s' \
900
 
                                                                       % (self['run_name'], self['tag']))
901
 
                    local_dico['action'] += self.command_suggestion_html('pythia %s ' % self['run_name'])
902
 
            elif type == 'pythia':
 
1033
            if ttype == 'parton':
 
1034
                if runresults.web:
 
1035
                    local_dico['action'] = """
 
1036
<FORM ACTION="http://%(web)s/cgi-bin/RunProcess/handle_runs-pl"  ENCTYPE="multipart/form-data" METHOD="POST">
 
1037
<INPUT TYPE=HIDDEN NAME=directory VALUE="%(me_dir)s">
 
1038
<INPUT TYPE=HIDDEN NAME=whattodo VALUE="remove_level">
 
1039
<INPUT TYPE=HIDDEN NAME=level VALUE="all">
 
1040
<INPUT TYPE=HIDDEN NAME=tag VALUE=\"""" + self['tag'] + """\">
 
1041
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
 
1042
<INPUT TYPE=SUBMIT VALUE="Remove run">
 
1043
</FORM>
 
1044
                    
 
1045
<FORM ACTION="http://%(web)s/cgi-bin/RunProcess/handle_runs-pl"  ENCTYPE="multipart/form-data" METHOD="POST">
 
1046
<INPUT TYPE=HIDDEN NAME=directory VALUE="%(me_dir)s">
 
1047
<INPUT TYPE=HIDDEN NAME=whattodo VALUE="pythia">
 
1048
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
 
1049
<INPUT TYPE=SUBMIT VALUE="Run Pythia">
 
1050
</FORM>"""
 
1051
                else:
 
1052
                    local_dico['action'] = self.command_suggestion_html('remove %s parton --tag=%s' \
 
1053
                                                                       % (self['run_name'], self['tag']))
 
1054
                    # this the detector simulation and pythia should be available only for madevent
 
1055
                    if self['run_mode'] == 'madevent':
 
1056
                        local_dico['action'] += self.command_suggestion_html('pythia %s ' % self['run_name'])
 
1057
                    else: 
 
1058
                        pass
 
1059
 
 
1060
            elif ttype == 'shower':
 
1061
                if runresults.web:
 
1062
                    local_dico['action'] = """
 
1063
<FORM ACTION="http://%(web)s/cgi-bin/RunProcess/handle_runs-pl"  ENCTYPE="multipart/form-data" METHOD="POST">
 
1064
<INPUT TYPE=HIDDEN NAME=directory VALUE="%(me_dir)s">
 
1065
<INPUT TYPE=HIDDEN NAME=whattodo VALUE="remove_level">
 
1066
<INPUT TYPE=HIDDEN NAME=level VALUE="all">
 
1067
<INPUT TYPE=HIDDEN NAME=tag VALUE=\"""" + self['tag'] + """\">
 
1068
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
 
1069
<INPUT TYPE=SUBMIT VALUE="Remove run">
 
1070
</FORM>
 
1071
                    
 
1072
<FORM ACTION="http://%(web)s/cgi-bin/RunProcess/handle_runs-pl"  ENCTYPE="multipart/form-data" METHOD="POST">
 
1073
<INPUT TYPE=HIDDEN NAME=directory VALUE="%(me_dir)s">
 
1074
<INPUT TYPE=HIDDEN NAME=whattodo VALUE="pythia">
 
1075
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
 
1076
<INPUT TYPE=SUBMIT VALUE="Run Pythia">
 
1077
</FORM>"""
 
1078
                else:
 
1079
                    local_dico['action'] = self.command_suggestion_html('remove %s parton --tag=%s' \
 
1080
                                                                       % (self['run_name'], self['tag']))
 
1081
                    # this the detector simulation and pythia should be available only for madevent
 
1082
                    if self['run_mode'] == 'madevent':
 
1083
                        local_dico['action'] += self.command_suggestion_html('pythia %s ' % self['run_name'])
 
1084
                    else: 
 
1085
                        pass
 
1086
 
 
1087
            elif ttype == 'pythia':
903
1088
                if self['tag'] == runresults.get_last_pythia():
904
1089
                    if runresults.web:
905
1090
                        local_dico['action'] = """
939
1124
<INPUT TYPE=HIDDEN NAME=level VALUE=\"""" + str(type) + """\">
940
1125
<INPUT TYPE=HIDDEN NAME=tag VALUE=\"""" + self['tag'] + """\">
941
1126
<INPUT TYPE=HIDDEN NAME=run VALUE="%(run_name)s">
942
 
<INPUT TYPE=SUBMIT VALUE="Remove """ + str(type) + """\">
 
1127
<INPUT TYPE=SUBMIT VALUE="Remove """ + str(ttype) + """\">
943
1128
</FORM>"""
944
1129
                else:
945
1130
                    local_dico['action'] = self.command_suggestion_html('remove %s %s --tag=%s' %\
946
 
                                                              (self['run_name'], type, self['tag']))
 
1131
                                                              (self['run_name'], ttype, self['tag']))
947
1132
 
948
1133
            # create the text
949
1134
            subresults_html += template % local_dico
982
1167
                           'err': self['error'],
983
1168
                           'nb_event': self['nb_event'] and self['nb_event'] or 'No events yet',
984
1169
                           'links': 'banner only',
985
 
                           'action': action
 
1170
                           'action': action,
 
1171
                           'run_mode': '',
 
1172
                           'syst':''
986
1173
                           }                                
987
1174
                                  
988
1175
        if self.debug is KeyboardInterrupt:
1016
1203
        
1017
1204
        if command.startswith('pythia'):
1018
1205
            button = 'launch pythia'
 
1206
        if command.startswith('shower'):
 
1207
            button = 'shower events'
1019
1208
        elif command.startswith('remove banner'):
1020
1209
            button = 'remove banner'
1021
1210
        elif command.startswith('remove'):
1024
1213
            button = 're-run from the banner'
1025
1214
        else:
1026
1215
            button = 'launch detector simulation'
1027
 
        
1028
 
        header = 'Launch ./bin/madevent in a shell, and run the following command: '
 
1216
        if self['run_mode'] == 'madevent':
 
1217
            header = 'Launch ./bin/madevent in a shell, and run the following command: '
 
1218
        else:
 
1219
            header = 'Launch ./bin/aMCatNLO in a shell, and run the following command: '
 
1220
 
1029
1221
        return "<INPUT TYPE=SUBMIT VALUE='%s' onClick=\"alert('%s')\">" % (button, header + command)
1030
1222
 
1031
1223