Skip to main content

Posts

Showing posts from 2010

Buffering and flush

When you send output to a stream, it does not necessarily get printed immediately. Rather, it may wait in a buffer until some unspecified event, e.g. buffer full enough, reading from input, or exit from program. The details may vary. Buffering makes it faster to print a large amount of output, particularly if you are producing the output bit-by-bit (e.g. one character at a time). However, it is a nuisance for output used in debugging (e.g. a statement that informs you that step 3 of your algorithm has been finished). Forcing all buffered output to actually be printed is known as "flushing" the stream. A flush can be forced by calling the flush function associated with each output stream, inserting the magic variable flush into the stream, or inserting endl. cout << flush; cout.flush(); cout << endl;

copy root files from SAM to a local directory

copy the following file and name it xxx.py. $ vi get_sam_ww.py import os, sys, time ############################################################################ # project_definition = "singletop_recovery_p20mu_201002271038" sam_station        = os.environ['SAM_STATION'] snapshot_version   = 'new' appname            = 'generic' version            = "1" group              = "dzero" max_file_amt       = 1000 ##verbosity          = "--verbose" verbosity           = "" # Give up on all exceptions give_up            = 1 def file_ready(filename):     now = time.strftime( '%H:%M:%S', time.localtime(time.time()) )     print("<%s> MY PROJECT: working on a file named >%s<" % (now,filename))     # Modify the destination below to copy the files somewhere     os.system('cp %s /work/landshark-clued0/weigang/TriggerStudy/MU/SAM_WW_copy' % filename)     return run

How to recover a SAM project

How to find a SAM_PROJECT name for a job: $ vi /work/landshark-clued0/weigang/Winter2010/check_data.log "Reading /prj_root/2671/top_write/weigang/SingleTop2010Summer2009Extended/RunIIa/data/p17_CC_Data_PreTag_0_20091231120843-2953530.d0cabsrv1.fnal.gov/cafe.out Number of processed events: 38749635 Reading /prj_root/2671/top_write/weigang/SingleTop2010Summer2009Extended/RunIIa/data/p17_CC_Data_PreTag_0_20091231120843-2953564.d0cabsrv1.fnal.gov/cafe.out Number of processed events: 39353873 Processed[expected] events: 39353873[39381649] BAD" look for any job name that belongs to a BAD project. then, $ find /d0mino/weigang -name "*2953564*" $ vi /d0mino/weigang/p17_CC_Data_PreTag_0.o2953564 "SAM_PROJECT    = weigang_13105_20091231120843" Liang showed how to do it easier way: $ cat  /d0mino/weigang/*.o3447239 | grep SAM_PROJECT SAM_PROJECT    = weigang_4789_20100227000742 ($ setup sam) $ sam generate strict recovery project --project=weigang_13