~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/various/systematics.py

more options for systematics

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
                 only_beam=False,
60
60
                 ion_scaling=True,
61
61
                 weight_format=None,
 
62
                 weight_info=None,
62
63
                 ):
63
64
 
64
65
        # INPUT/OUTPUT FILE
68
69
            self.input = input_file
69
70
        self.output_path = output_file
70
71
        self.weight_format = weight_format
 
72
        self.weight_info_format = weight_info
71
73
        if output_file != None:
72
74
            if isinstance(output_file, str):
73
75
                if output_file == input_file:
398
400
        #print "normalisation is ", norm
399
401
        #print "nb_event is ", nb_event
400
402
    
401
 
        misc.sprint(len(all_cross))
402
403
        max_scale, min_scale = 0,sys.maxint
403
404
        max_alps, min_alps = 0, sys.maxint
404
405
        max_dyn, min_dyn = 0,sys.maxint
616
617
                tag += 'PDF="%s" ' % pdf.lhapdfID
617
618
            
618
619
            wgt_name = self.get_wgt_name(mur, muf, alps, dyn, pdf, cid)
 
620
            tag = self.get_wgt_tag(mur, muf, alps, dyn, pdf, cid)
 
621
            info = self.get_wgt_info(mur, muf, alps, dyn, pdf, cid)
619
622
            text +='<weight id="%s" %s> %s </weight>\n' % (wgt_name, tag, info)
620
623
            cid+=1
621
624
        
671
674
        else:
672
675
            wgt_name = cid
673
676
        return wgt_name
 
677
    
 
678
    def get_wgt_info(self, mur, muf, alps, dyn, pdf, cid=0):
 
679
        
 
680
        if self.weight_info_format:            
 
681
            info =  self.weight_info_format[0] % {'mur': mur, 'muf':muf, 'alps': alps, 'pdf':pdf.lhapdfID, 'dyn':dyn, 'id': cid, 's':' ', 'n':'\n'}
 
682
        else:
 
683
            info = '',''
 
684
            if mur!=1.:
 
685
                info += 'MUR=%s ' % mur
 
686
            if muf!=1.:
 
687
                info += 'MUF=%s ' % muf 
 
688
            if alps!=1.:
 
689
                info += 'alpsfact=%s ' % alps
 
690
            if dyn!=-1.:
 
691
                info += 'dyn_scale_choice=%s ' % {1:'sum pt', 2:'HT',3:'HT/2',4:'sqrts'}[dyn]                             
 
692
            if pdf != self.orig_pdf:
 
693
                info += 'PDF=%s MemberID=%s' % (pdf.lhapdfID-pdf.memberID, pdf.memberID)
 
694
 
 
695
        return info
 
696
 
 
697
    def get_wgt_tag (self, mur, muf, alps, dyn, pdf, cid=0):
 
698
            tags = []
 
699
            tags.append('MUR="%s" ' % mur)
 
700
            tags.append('MUF="%s" ' % muf)
 
701
            if alps!=1.:
 
702
                tags.append('ALPSFACT="%s" ' % alps)
 
703
            if dyn!=-1.:
 
704
                tags.append('DYN_SCALE="%s" ' % dyn)
 
705
            tags.append('PDF="%s" ' % pdf.lhapdfID)
 
706
            return " ".join(tags)
 
707
     
674
708
 
675
709
    def get_id(self):
676
710