Ejemplo n.º 1
0
 def make_animated_gif(self, list_for_animated_gif, name_animated_gif, delay=100, loop=True):
       #import lib.util.MiscTools as misctools
       try:
           delay = int(delay)
       except ValueError:
           raise ValueError, "Delay must be an integer."
       
       loop_string = ""
       if loop:
           loop_string = " -loop 0"
           
       self.log.info('Creating animated gif: {0}'.format(name_animated_gif))    
       misctools.processCmd("convert -delay {2} {0}{3} {1} ".format(" ".join("%s"%(one_gif) for one_gif in list_for_animated_gif), name_animated_gif, delay, loop_string))    
       self.doCopyToWebDir(name_animated_gif)
Ejemplo n.º 2
0
    def process(self, do_cmd=""):
        self.do_cmd = do_cmd
        self.setup_POI_related_stuff()

        import lib.util.MiscTools as misc
        #print self.__dict__
        self.fs_expanded = self.fs
        if self.fs.lower() == "4l":
            self.fs_expanded = "4e,4#mu,2e2#mu"
        os.environ['PLOT_TAG'] = "Asimov data %(poi_name_value_plot)s | Discrim. %(discriminant)s | L=%(lumi)s fb^{-1} @ %(sqrts_plot)s TeV | Fin. state = %(fs_expanded)s" %self.__dict__

        cmd = {}
        cmd['createCards']    = "rm -r cards_%(append_name_base)s; python makeDCsandWSs.py -b -i SM_inputs_8TeV_CJLST -a %(append_name_base)s -t %(templatedir)s --terms %(termNames)s %(additional_options)s" %self.__dict__
        cmd['combCards']      = "rm -rf hzz4l_4lS_%(sqrts_dc)s_ALT.txt; combineCards.py hzz4l_4muS_%(sqrts_dc)s_ALT.txt hzz4l_4eS_%(sqrts_dc)s_ALT.txt hzz4l_2e2muS_%(sqrts_dc)s_ALT.txt> hzz4l_4lS_%(sqrts_dc)s_ALT.txt" %self.__dict__
        cmd['t2w'] 		= "text2workspace.py hzz4l_%(fs)sS_%(sqrts_dc)s_ALT.txt -m 126 -P %(poi_physics_model)s %(poi_ranges_string_t2w)s  --PO muFloating -o combine.ws.%(fs)s.%(version)s.root" %self.__dict__
        cmd['gen'] 		= "combine -M GenerateOnly combine.ws.%(fs)s.%(version)s.root -m 126 -t -1 --expectSignal=1 --saveToys --setPhysicsModelParameters %(poi_name_value)s,cmshzz4l_lumi=%(lumi)s -S 0" %self.__dict__
        cmd['addasimov'] 	= "root -b -l -q %(create_cards_dir)s/addToyDataset.C\(\\\"combine.ws.%(fs)s.%(version)s.root\\\",\\\"higgsCombineTest.GenerateOnly.mH126.123456.root\\\",\\\"toy_asimov\\\",\\\"workspaceWithAsimov_%(poi_name_value_filename)s_lumi_%(lumi)s.root\\\"\)" %self.__dict__
        cmd['fit'] 		= "combine -M MultiDimFit workspaceWithAsimov_%(poi_name_value_filename)s_lumi_%(lumi)s.root --algo=grid --points %(poi_n_points)s  -m 126 -n .asimov.%(fs)s.%(poi_name_value_filename)s.lumi_%(lumi_zfill)s -D toys/toy_asimov -S 0 --setPhysicsModelParameters cmshzz4l_lumi=%(lumi)s --setPhysicsModelParameterRanges %(poi_ranges_string_fit)s" %self.__dict__
        cmd['plot'] 	       = "root -l -b -q %(create_cards_dir)s/plotLimit.C\(\\\"higgsCombine.asimov.%(fs)s.%(poi_name_value_filename)s.lumi_%(lumi_zfill)s.MultiDimFit.mH126.root\\\",\\\"%(pois)s\\\",\\\"environ PLOT_TAG\\\" \)" %self.__dict__
        
        if "createCards" in do_cmd:
            print "--------------------------------------------------------"
            print "Cards for Lumi=%(lumi)s and tag=%(append_name_base)s terms=%(termNames)s template=%(templatedir)s discriminant=%(discriminant)s additional_options=%(additional_options)s" %self.__dict__
            misc.processCmd(cmd['createCards'])
            print "--------------------------------------------------------"
        if "combCards" in do_cmd: misc.processCmd(cmd['combCards']) 
        if "t2w" in do_cmd: misc.processCmd(cmd['t2w']) 
        if "gen" in do_cmd: misc.processCmd(cmd['gen']) 
        if "addasimov" in do_cmd: misc.processCmd(cmd['addasimov']) 
        if "fit" in do_cmd: misc.processCmd(cmd['fit']) 
        if "plot" in do_cmd: 
            misc.processCmd(cmd['plot']) 
            import lib.util.MiscTools as misc
            misc.make_sure_path_exists(self.www_dir)
            shutil.copy("/afs/cern.ch/user/r/roko/www/html/index.php",self.www_dir)
            for self.x in ['AxisK3K1', 'AxisArctanGamK3K1', 'AxisArctanK3K1', 'AxisFa3', 'AxisK2K1']:
                #print "cp higgsCombine.asimov.{fs}.{poi_name_value}.MultiDimFit.mH126.root*png {www_dir}/exp.{fs}.{poi_name_value_filename}.mH126.{x}.png".format(**self.__dict__)
                #shutil.copy("higgsCombine.asimov.{fs}.{poi_name_value_filename}.lumi_{lumi_zfill}.MultiDimFit.mH126.root.{x}.png".format(**self.__dict__), \
                            #"{www_dir}/exp.{fs}.{poi_name_value_filename}.mH126.{x}.{lumi_zfill}ifb.png".format(**self.__dict__))
                file_2_copy = "higgsCombine.asimov.{fs}.{poi_name_value_filename}.lumi_{lumi_zfill}.MultiDimFit.mH126.root.{x}.png".format(**self.__dict__)            
                if os.path.exists(file_2_copy):
                    shutil.copy(file_2_copy,"{www_dir}/exp.{fs}.{poi_name_value_filename}.mH126.{x}.{lumi_zfill}ifb.png".format(**self.__dict__))
            print "{www_dir}/?match=exp.{fs}.{poi_name_value_filename}.mH126.*.png".format(**self.__dict__).replace("/afs/cern.ch/user/r/roko/www/html/","https://roko.web.cern.ch/roko/")