SAM INSTRUCTIONS THAT WORK FOR ME --------------------------------- 0. setup sam 1. Choose a list of files: sam translate constraints --dim="data_tier root-tuple and file_name %all%p11% and create_date > 05/01/2002 and create_date < 05/03/2002" Other data_tier: reconstructed raw Note: % is a wild card. Caution: File sizes in KBytes! 2. Define a dataset with these files: sam define dataset --group=dzero --defname=bh030702 --dim="data_tier root-tuple and file_name %all%p11% and create_date > 05/01/2002 and create_date < 05/03/2002" Note: bh030702 is the name given to the dataset in this example. 3. Copy files of dataset "bh030702" to your disk: From D0mino: ! Or whatever a) cp /www-d0/room3/WWW/docs/Run2Physics/wz/docs/howto/get_file.py . ! You only have to do this once eevr. b) edit get_file.py i) Change the project_definition to the one above ii) Change the field "/prj_root/808/mtst_1/group_datafiles/" to the directory in which you want your file to land. c) setup sam d) sam run project get_file.py ! That's all folks. ******************* And this is the contents of get_file.py: import os, sys, time ############################################################################ # project_definition = "bh250705" 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/naia-clued0/bruce1/2MU_skim_dataset259972/' % filename) return ****************************************************** And this is the contents of the obsolete get_file.py: #!/usr/bin/env python # # This file sets up and runs a SAM project. # import os, sys, string, time, signal from re import * from globals import * import run_project ############################################################################ # # Set the following variables to appropriate values # Consult database for valid choices sam_station = "central-analysis" # Consult Database for valid choices project_definition = "119216" # A particular snapshot version, last or new snapshot_version = 'new' # Consult database for valid choices appname = "test" version = "1" group = "dzero" # The maximum number of files to get from sam max_file_amt = 160 # for additional debug info use "--verbose" ##verbosity = "--verbose" verbosity = "" # Give up on all exceptions give_up = 1 def file_ready(filename): # Replace this python subroutine with whatever you want to do # to process the file that was retrieved. # Your program will only be called in the event of # a successful delivery. # print 'Transferring file: ' print filename print ' to commissioning disk 808.' os.system('ls -l %s'%filename) os.system('cp %s /prj_root/808/mtst_1/group_datafiles/. '%filename) #time.sleep(10) return *************************************************