OSU-CMS Tips and Tricks

Work To Do

Working on FNAL

In order to set up the CMSSW environment and CRAB environment on FNAL, the following commands need to be run:

#!/bin/csh                                                                                                                                                                                                                                   
source /uscmst1/prod/grid/gLite_SL5.csh

cd /uscms/home/jbrinson/CMSSW_4_2_5/src


eval `scram runtime -csh`

kserver_init jbrinson@CERN.CH # could use kserver_init                                                                                                                                                                                       
source /uscmst1/prod/grid/CRAB/crab.csh
voms-proxy-init -voms cms

It's useful to put all of them into a shell script that you can run upon login.

Useful Root Commands

The following series of commands will copy a histogram from one root file into another
root [0] TFile *_file0 = TFile::Open("file0.root","UPDATE") #file that you wish to edit
root [1] TFile *_file1 = TFile::Open("file1.root") #file that you want to copy from
root [2] TH1D* h
root [3] _file1->GetObject("nameOfHistogram",h)
root [4] TH1D*hNew = (TH1D*)h->Clone("nameOfHistogram")
root [5] _file0->Write("hNew")

Useful Linux Commands

ls -l targetdir | wc -l

This will tell you how many files are located in a certain directory

ls -1 directory_name
List only the file names in a directory in column form (useful for copying and pasting datasets into config files)

ln -s <destination> <linkname>

Creates a symlink

du -h file_name

Gives size of file in megabytes.

/home/jbrinson> chmod -R g-w *
Designates the permissions in your home directory as read only.

DAS

To search for a specific file in a dataset when you have the corresponding run and lumi:

file dataset=/WJetsToLNu_TuneZ2Star_8TeV-madgraph-tarball/Summer12_DR53X-PU_S10_START53_V7A-v2/GEN-SIM-RECO run=1 lumi=314675

Xrootd

To open a file located anywhere when you are outside US:

root -l root://xrootd.ba.infn.it//store/mc/Summer12_DR53X/WJetsToLNu_TuneZ2Star_8TeV-madgraph-tarball/GEN-SIM-RECO/PU_S10_START53_V7A-v2/0000/00026999-98ED-E111-8657-001E67398390.root

To open a file located anywhere when you are in US:

root -l root://xrootd.unl.edu//store/mc/Summer12_DR53X/WJetsToLNu_TuneZ2Star_8TeV-madgraph-tarball/GEN-SIM-RECO/PU_S10_START53_V7A-v2/0000/00026999-98ED-E111-8657-001E67398390.root

Some other useful info about xrootd can be found here.

CRAB

The following twiki pages related to CRAB are very helpful:

https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookCRABTutorial

https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideCrab

To extract the usercert.pem and userkey.pem files from your grid certificate follow the instructions here: https://twiki.cern.ch/twiki/bin/view/Main/CRABPrerequisitesGRIDCredentials

Basics of Running Crab

To create a crab job:
crab -create -cfg config_file_name.cfg

To submit a crab job:

crab -submit -c <directory name>

To check on the status of your crab job:

crab -status -c <directory name>

CRAB Error Codes

* 50664: Job terminated for using too much wall clock time - Solution: Set the max_wall_clock_time in your .cfg file
[GRID]
max_wall_clock_time = 600 # That's 10 hours

FNAL

If you're running CRAB for the first time on FNAL and are using a tcsh shell reference this page to see how to convert the CMSSW environment from bash to tcsh: https://twiki.cern.ch/twiki/bin/viewauth/CMS/CRABonLPCCAF

If a dataset is only hosted on FNAL, change the scheduler in the crab config file to condor. Then the jobs will submit successfully.

If you get the following error when submitting CRAB jobs on FNAL:

crab: Your config file in not valid python

Type cmsenv and try again.

Staging out to Purdue and copying over files

In crab.cfg file:

[USER]
storage_element         = T2_US_Purdue
storage_path            = /srm/managerv2?SFN=/cms
user_remote_dir         = BN_MET_Run2012C-22Jan2013-v1_AOD
storage_port            = 8444
thresholdLevel          = 50

To access the files at Purdue:

voms-proxy-init -voms cms

srmls "srm://srm-dcache.rcac.purdue.edu:8443/srm/managerv2?SFN=/mnt/hadoop/store/user/jbrinson"

Setting up UserCode area and Committing to CVS

The following website presents a step by step guide to setting up your UserCode area and committing code for the first time: https://twiki.cern.ch/twiki/bin/view/Main/HowToUserCode

To commit a file to a directory that you have checked out from the repository.

cd directory_you_wish_to_edit

cvs update -A

cvs add file_name

cvs commit file_name

cmsRun Errors

The following webpage is a great place to start when getting fatal exceptions while trying to do cmsRun: https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookTroubleShooting

Phyiscs Analysis Summary (PAS) and Analysis Note (AN) How To's

Instructions for retrieving and building the template are located here:

https://twiki.cern.ch/twiki/bin/view/CMS/Internal/TdrProcessing

In the sections of the above twiki page, replace commands with [papers|notes] to just notes for the PAS and AN i.e.

svn update -N [papers|notes]
becomes
svn update -N notes
You will find that working on lxplus is often best (tdr is less finnicky over there)
ssh jbrinson@lxplus.cern.ch

To committ changes that you have made:

cd /myDir/notes/XXX-YY-YYY

svn add directory/*.file_extenstion

svn commit -m "Comment i.e. 1st Draft" 

-- JessicaBrinson - 07-Jan-2012

Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r16 - 2014-04-09 - JessicaBrinson
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback