*** INSTRUCTIONS FOR TEST RUNNING Find_Jpsi_Ks *** Juan Pablo Negret, July 28, 2001 More details on the package at http://www-d0.fnal.gov/~bruce1/Find_Jpsi_Ks.doc More details on learning to run D0 code at http://www-d0.fnal.gov/~schellma/d0cpp/ Currently the package is set to use the MC sample (1000 events) listed in d0mino:/prj_root/786/mub_3/RunIIB/kinyip/jpsiks_mu_reco_OLD.list If you do not change RCP parameters, the program will run with the default values. -------------------------------------------------------------- 1. SETTING UP THE PACKAGE AND COMPILING Start by opening a shell on your account (username) at d0mino: d0mino:username > setup n32 d0mino:username > setup D0RunII t01.XX.00 // Replace XX with a valid version number for a test release. d0mino:username > setup d0cvs d0mino:username > setenv SCRATCH /scratch/7/username // Use your scratch areas, unless you have access to other areas. d0mino:username > newrel -t t01.XX.00 testjkXX // This creates in your home area a set of subdirectories under testjkXX // (this name is just an example) and fills them up with a bunch of files // and links to others in SCRATCH. This is done only once for release XX. Next you cd to testjkXX: d0mino:testjkXX > addpkg -h find_jpsi_ks // To add this package. This is done only once for release XX. The RCP files // for the package are in testjkXX/find_jpsi_ks/rcp, including ReadEvent.rcp, // where you control the InputFile and the number of events to read, as well as // Find_Tracks_xy_test.rcp, Find_Tracks_xyz_test.rcp, Find_Track_Pairs_test.rcp // and Get_Errors.rcp, which control the parameters for the filters. d0mino:testjkXX > gmake all // This will compile everything. Need to do first time for release XX. // Later on, you can do "gmake find_jpsi_ks.all" to recompile the package only. 2. INTERACTIVE RUNNING If you want to run interactively, you do the following. At present, it takes around 2.5 seconds per event. d0mino:testjkXX > d0setwa // To set the d0 working area. Now you cd to testjkXX/find_jpsi_ks/test: ********************* Note by B.H.: See notes by B.H. and W.T. at the end of these instructions. ********************* d0mino:test > Find_Jpsi_Ks -rcp ../rcp/runFind_Jpsi_Ks.rcp // This starts the run, and the program will show some messages on the screen. // The number of messages depend on the level of "verbose" in the rcp files. At the end of the run, the program will produce the results in the following file: testjkXX/find_jpsi_ks/test/find_jpsi_ks.hbook or testjkXX/find_jpsi_ks/test/find_jpsi_ks.rtpl depending on rcp parameters Presently, it is producing ntuples for Npairs, MassPiPi, NtrkXY, TXYpT, NtrkXYZ and TXYZpT. 3. RUNNING IN BATCH MODE If you prefer sending a batch job, do the following instead: d0mino:testjkXX > d0setwa // To set the d0 working area. Now you cd to testjkXX/find_jpsi_ks/test: d0mino:test > bsub Find_Jpsi_Ks -rcp ../rcp/runFind_Jpsi_Ks.rcp At the end of the run, you will get an email with a copy of the messages that you would have seen on the screen for the interactive run, and the program will produce the results in the following file: testjkXX/find_jpsi_ks/test/find_jpsi_ks.hbook Presently, it is producing ntuples for Npairs, MassPiPi, NtrkXY, TXYpT, NtrkXYZ and TXYZpT. To avoid a long email you can do this: d0mino:test > bsub -o /path/log.txt Find_Jpsi_Ks -rcp ../rcp/runFind_Jpsi_Ks.rcp to send the output to log.txt. 4. INTERACTIVE RUNNING WITH THE TOTALVIEW DEBUGGER If you want to run interactively with the Totalview debugger, after finishing compiling (gmake), open a second shell with X windows capabilities enabled. d0mino:username > ssh d0tvs // With this, you login into the d0tvs node, a mirror of d0mino, just for // running the Totalview debugger. d0tvs: username > setup n32 d0tvs: username > setup D0RunII t01.XX.00 d0tvs:username > setup totalview d0tvs:testjkXX > d0setwa d0tvs:test > totalview Find_Jpsi_Ks Here Totalview will pop up a small window (the main Totalview window), and a second larger window (the Find_Jpsi_Ks window). CTRL-? gives help on Totalview. Select the Find_Jpsi_Ks window and type the letter a (for "argument"). In the new window that pops up, write: -rcp ../rcp/runFind_Jpsi_Ks.rcp and click OK. Next, type the letter f (for "function"), in the new window type: processEvent and click OK. Next type the letter g (for "go"), to start the run. At the end of the run, to exit Totalview, exit from the small Totalview window. Find_Jpsi_Ks will produce the results in the following file (as before): testjkXX/find_jpsi_ks/test/find_jpsi_ks.hbook ***** Notes by B.H.: *d0setwa must be run in the top directory created by 'addpkg'. *To find what the latest test release is look in http://www-d0.fnal.gov/d0dist/dist/releases or look at ls /d0dist/dist/releases on d0mino.fnal.gov. Click on the release you are interested in and you will find all packages. *In Juan Pablo's instructions 'testjkXX' is the directory created with the addpkg command. 'find_jpsi_ks' is the package name (it could have been 'd0reco' or 'reco_analyze' or whatever). 'Find_Jpsi_Ks' is the executable. *To find out what packages were used in a particular release of, say, 'reco_analyze' look at the command string Packages = "geo read ntplmgr ... " in http:///www-d0.fnal.gov/d0dist/dist ---> releases ---> t01.55.00 for example ---> reco_analyze ---> rcp ---> runRecoAnalyze.rcp In that rcp you will find commands that look like: RCP read = Here D0recoReadEvent.rcp is the rcp used by the package 'd0reco'. *Edit the rcp parameters in the files in testjkXX/find_jpsi_ks/rcp/. Recommended starting rcp's for finding Ks are listed below. *In testjkXX/find_jpsi_ks/rcp/ReadEvent.rcp and edit line string InputFile="listfile:/prj_root/786/mub_3/RunIIB/kinyip/jpsiks_mu_reco_OLD.list" to whatever list of files you will use. *To run with data or MonteCarlo files from SAM first get the files from SAM using instructions by Tom Diehl (http://www-d0.fnal.gov/~bruce1/get_file_from_sam.txt, also listed at the end of this document), then make a file with the list of files (one file per line, no commas) and then edit ReadEvent.rcp to point to this list of files. To select sam events of interest create your sam dataset choosing from the MetaFile names. *To see what variables are available, do, as an example, the following: http://www-d0.fnal.gov/d0dist/dist/packages/ ---> muo_analyze ---> the release you are interested in ---> doc ---> Contents_of_Muo_Analyze_Results ---> Muonid Many many thanks are due to Ariel Schwartzman for providing some of these tips! ************* Note by W.T.: If the executable is not found by your run command try this: In testjkXX/find_jpsi_ks/test (to force picking up correct executable): ln -s ../../bin/IRIX6-KCC_4_0/Find_Jpsi_Ks Find_Jpsi_Ks ************* ******************************************* Recommended initial rcp parameters for Ks: //////////////////////////////////////////////////////////////////////////// // // File: Find_Tracks_xy.rcp // // Purpose: RCP file for the Find_Tracks_xy class. // // Created: // // Revised: // //////////////////////////////////////////////////////////////////////////// //These are //'nbins_search' = Number of bins to search (left and right) in layer 4A, // For J/psi from (x, y) = (0, 0) choose nbins_search = 9*Bmag/pTmin. //'pTmin' = Minimum pion momenta to search (in GeV/c), //'mcs' = Number of standard deviations for Multiple Coulomb Scattering //'dlmin' = Minimum number of millimeters to search (left and right) in axial layers. //'minHitsA' = Minimum required number of clusters in axial layers (>=5, <=8) //'dmin' : Accept only xy tracks with distance from (x, y) = (0, 0) between 'dmin' and 'dmax'. //'dmax' //'clean_LTrackFound_xy', if 1 'clean_tracks_xy' is run to remove "repeated //'TrackFound_xy's. //'verbose' = 0 no output // = 1 only error messages // = 2 plus output of get_errors // = 3 plus output of find_track_pairs // = 4 plus output of find_tracks_xyz // = 5 plus output of find_tracks_xy // = 6 plus in's and out's of functions // = 7 to 10 plus more details // > 10 for testing purposes only int nbins_search = 150 float pTmin = 0.3 float mcs = 2.5 float dlmin = 0.3 int minHitsA = 7 float dmin = 5.0 float dmax = 300.0 int clean_LTrackFound_xy = 1 int verbose = 5 //////////////////////////////////////////////////////////////////////////// // // File: Find_Tracks_xyz.rcp // // Purpose: RCP file for the Find_Tracks_xyz class. // // Created: // // Revised: // //////////////////////////////////////////////////////////////////////////// //These are //'dzmin' = Minimum distance for match in z. //'minHitsA' = Minimum required number of clusters in axial layers (>=5, <=8) //'minHitsS' = Minimum required number of clusters in stereo layers (>=4, <=8) //'minHits' = Minimum required number of clusters in all layers (>=minHitsA+4, <=16) //'clean_LTrackFound_xyz', if 1 'clean_tracks_xyz' is run to remove "repeated //'TrackFound_xyz's. //'verbose' = 0 no output // = 1 only error messages // = 2 plus output of get_errors // = 3 plus output of find_track_pairs // = 4 plus output of find_tracks_xyz // = 5 plus output of find_tracks_xy // = 6 plus in's and out's of functions // = 7 to 10 plus more details // > 10 for testing purposes only float dzmin = 15.0 int minHitsA = 7 int minHitsS = 7 int minHits = 14 int clean_LTrackFound_xyz = 1 int verbose = 5 //////////////////////////////////////////////////////////////////////////// // // File: Find_Tracks_Pairs.rcp // // Purpose: RCP file for the Find_Tracks_Pairs class. // // Created: // // Revised: // //////////////////////////////////////////////////////////////////////////// //These are //'dzmin' = Minimum distance for match in z. //'minHits' = Minimum required number of clusters in stereo layers (>=minHitsA+4, <=16) //'bmin' = Minimum impact parameter of Ks in transverse plane (mm). //'bmax' = Maximum impact parameter of Ks in transverse plane (mm). //'opposite_charge' = 1 to require opposite charge tracks. //'mmin' = Minimum invariant mass of DecayPair [GeV/c^2]. //'mmax' = Maximum invariant mass of DecayPair [GeV/c^c]. //'clean_LDecayPair', if 1 'clean_pair' is run to remove "repeated" DecayPair's. //'verbose' = 0 no output // = 1 only error messages // = 2 plus output of get_errors // = 3 plus output of find_track_pairs // = 4 plus output of find_tracks_xyz // = 5 plus output of find_tracks_xy // = 6 plus in's and out's of functions // = 7 to 10 plus more details // > 10 for testing purposes only float dzmin = 30.0 int minHits = 12 float bmin = 7.0 float bmax = 240.0 int opposite_charge = 1 float mmin = -1. float mmax = 1000.0 int clean_LDecayPair = 1 int verbose = 5 ************************************** Tom Diehl's instructions to make a list of SAM files: How to Get a File from SAM This is an example of how to get Run 119216 off of SAM. 1) I think you have to be a registered SAM user. These instructions don't cover that procedure, yet. a) GOTO http://d0db.fnal.gov/sam_project_editor/DatasetEditor.html Fill in some fields: i) Definition Name: 119216 ! This is the name of your new SAM project ! Use no spaces. ii) Work Group: dzero ! You might use any of a bunch of these ! I am using this for now. iii) Username: "your_username" ! Well, you. iv) Decription: ! type something descriptive b) Make a query to see if the run exists Fill in some fields under "Operator Dimension": i) highlight Run_Number ! If you want to search run number fields ii) Constraint: 119216 ! To find run numbers with field 119216 iii) hit: Translate Constraints button ! Look in field below to see if it finds ! your run. c) Define the SAM Project i) hit: Save button. 2) 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. This is file /www-d0/room3/WWW/docs/Run2Physics/docs/howto/get_file_from_sam.txt. Tom Diehl 4/25/01. Special thanks to Wyatt Merritt for help. ******************* And this is the contents of 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