GRID ENVIROMENT SETUP ===================== Setup local Environment and prepare user analysis code. How to use your certificate with grid-proxy-init. ----> mkdir .globus ----> cd .globus Copy the above PKCS#12 cert.p12 file to the computer where you will run grid-proxy-init. ----> openssl pkcs12 -in cert.p12 -clcerts -nokeys -out $HOME/.globus/usercert.pem Enter Import Password and then ----> openssl pkcs12 -in cert.p12 -nocerts -out $HOME/.globus/userkey.pem Type ls ---- one must have three files 1223.p12*, usercert.pem, userkey.pem Type the following to see ur certifcate ----> openssl x509 -in usercert.pem -noout -text | less Make sure that userkey.pem has valid permissions --600 -rw-r--r-- 1 wajid zh 3146 Mar 24 14:30 cert.p12 -rw-r--r-- 1 wajid zh 2192 Mar 24 14:30 usercert.pem -rw-r--r-- 1 wajid zh 1900 Mar 24 14:31 userkey.pem Change the permissions to ----> chmod 600 userkey.pem -rw-r--r-- 1 wajid zh 3146 Mar 24 14:30 cert.p12 -rw-r--r-- 1 wajid zh 2192 Mar 24 14:30 usercert.pem -rw------- 1 wajid zh 1900 Mar 24 14:31 userkey.pem In order to submit jobs to the Grid, you must have an access to a LCG User Interface (LCG UI). It will allow you to access WLCG-affiliated resources in a fully transparent way.LXPLUS users can get an LCG UI via AFS by: -----> source /afs/cern.ch/cms/LCG/LCG-2/UI/cms_ui_env.csh then ----> mkdir Tutorial cd Tutorial cmsrel CMSSW_2_2_3 cd CMSSW_2_2_3/src/ cmsenv Then source from any directory the following: ----> source /afs/cern.ch/cms/ccs/wm/scripts/Crab/crab.csh Check your certificate either from HOME or from working directroy voms-proxy-init -debug -verify voms-proxy-init --voms cms:/cms/dcms --valid 192:00 ----> grid-proxy-init -debug -verify ----> grid-proxy-init -valid 190:00 Get a long certificate. If it expires jobs will abort. This one lasts for 190 hours. Are you a member of the CMS VO? To see if this is the case,you can execute this command. ----> voms-proxy-init -voms cms If you get an error, chances are that you did not register to the CMS VO, or your registration expired. In this case, please follow the instructions in: http://cmsdoc.cern.ch/cms/aprom/www/top/CMS_VO.html ----> voms-proxy-info -all This checks how long the proxy is valid. ----> Make sure that the path where the output is stored has the permissions. You should also make sure that your area (the whole path) has the right permissions. The last directory of the path has to be available to group write with the rfchmod 775 command, while the other directories of the path need just to be available to owner/all read and execute with the rfchmod 755. For example, if is needed to copy to: user_remote_dir=/user/w/wajid/Crab/abc A few common ones are: ----> crab -create/multicrab -create (Create all jobs. No submission!) ----> crab -create -cfg MyCrab.cfg/multicrab -create -cfg MyCrab.cfg // create all job specifying a custom cfg file: default is crab.cfg ----> crab -submit all -continue crab_0_date_time (Where crab_0_date_time is the ui_working_dir) multicrab -submit ----> crab -status // Check the status of all jobs multicrab -status ----> crab -getoutput // Get back the output of all jobs multicrab -get As said before, you might want to create all tasks but the submit just one of them: in this case, you would do like that (using the above multicrab.cfg) ----> multicrab -create ----> crab -submit -c Wmunu ----> crab -status -c Wmunu ----> crab -report -c INTEGRATED LUMI =============== To find the Total Lumi correcponding to Lumisection in JSON.txt ----> lumiCalc.py -i /res/lumiSummary.json overview ----> lumiCalc.py -i /afs/cern.ch/user/w/wajid/scratch0/wajid/JetAnalysis/CMSSW_4_2_8/src/RecoJets/JetAnalyzers/test/CRAB/RealData/res/lumiSummary.json overview To list the JSON files ----> ls -la /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/ ----> ls -la /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/8TeV/PileUp/ Total lumi using lumiCalc2.py ----> lumiCalc2.py recorded -i /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Reprocessing/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt -hltpath HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v2 -b stable -norm pp7TeV Total lumi using pixelLumiCalc.py ----> pixelLumiCalc.py recorded -i /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Reprocessing/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt --hltpath "HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v2" --nowarning ----> pixelLumiCalc.py lumibyls -i /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Reprocessing/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt --hltpath "HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v2" -o YourOutput.csv PILEUP DISTRIBUTION =================== ----> pileupCalc.py -i /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Reprocessing/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt --inputLumiJSON pileup_JSON_2011_4_2_validation.txt --calcMode observed --minBiasXsec 69400 --maxPileupBin 50 --numPileupBins 50 MyDataPileupHistogram.root SRM-COMMANDS ============ At NCP from lxplus "quots" are important sometimes ----> srmmkdir "srm://pcncp22.ncp.edu.pk:8446/srm/managerv2?SFN=/dpm/ncp.edu.pk/user/w/wajid/ABC/" ----> srmls "srm://pcncp22.ncp.edu.pk:8446/srm/managerv2?SFN=/dpm/ncp.edu.pk/user/w/wajid" At INFB ----> srmmkdir srm://t2-srm-02.lnl.infn.it:8443/srm/managerv2?SFN=/pnfs/lnl.infn.it/data/cms/store/user/wajid The suggested full command line for lcg-cp is ----> lcg-cp -b -D srmv2 -v -n 1 Another is ----> srmcp -2 At Castor ----> srmmkdir srm://srm-cms.cern.ch:8443/srm/managerv2?SFN=/castor/cern.ch/user/w/wajid/ srm://t2-srm-02.lnl.infn.it:8443/srm/managerv2?SFN=/pnfs/lnl.infn.it/data/cms/store/user/wajid srm://dcache-se-cms.desy.de:8443/srm/managerv2?SFN=/pnfs/desy.de/cms/tier2/store/user/wajid From SRM to SRM ----> lcg-cp --verbose --defaultsetype srmv2 srm://srm01.ncg.ingrid.pt:8443/srm/managerv2?SFN=/cms/store/user/psilva/TTbarl_2l_R0/TTbarl_2l_R0/f6861c6a9bc70f101716d7a56695db32/TTbar_Tauola_7TeV_cfi_py_GEN_FASTSIM_HLT_PU_13_1_jvN.root srm://dcache-se-cms.desy.de:8443/srm/managerv2?SFN=/pnfs/desy.de/cms/tier2/store/user/wajid/TTbar_Tauola_7TeV_cfi_py_GEN_FASTSIM_HLT_PU_13_1_jvN.root From SRM to Local Machine ----> lcg-cp --verbose --defaultsetype srmv2 srm://dcache-se-cms.desy.de:8443/srm/managerv2?SFN=/pnfs/desy.de/cms/tier2/store/user/wajid/TTbar_Tauola_7TeV_cfi_py_GEN_FASTSIM_HLT_PU_13_1_jvN.root file:///storage/9/wajid/TTbar_Tauola_7TeV_cfi_py_GEN_FASTSIM_HLT_PU_13_1_jvN.root CASTOR COMMANDS =============== we have to do: ----> rfchmod 755 /castor/cern.ch/user/w/wajid ----> rfchmod 755 /castor/cern.ch/user/w/wajid/Crab ----> rfchmod 775 /castor/cern.ch/user/w/wajid/Crab/abc How to Access files from castor: ----> TFile *f = TFile::Open ("rfio:/castor/cern.ch/user/w/wajid/Reco.root") To copy from one shell to another shell or to copy from lxplus to desktop ----> scp wajid@lxplus.cern.ch:~/scratch0/wajid/CMSSW_2_2_6/src/Demo/DemoTrackAnalyzer/test/chains.C To copy from desktop to LXPLUS ----> scp ~/Desktop/crab_Enviroment wajid@lxplus.cern.ch:~/ To create a directory in CASTOR ----> rfmkdir /castor/cern.ch/cms/store/user/wajid/Test To view list of files in CASTOR ----> nsls -l /castor/cern.ch/cms/store/user/wajid/Test To Delete files saved at CASTOR ----> nsrm -r /castor/cern.ch/cms/store/user/wajid/Test To Delete a directory from castor ----> nsrm -rf /castor/cern.ch/cms/store/user/wajid/Test/Analysis To rename a file on CASTOR ----> rfrename /castor/cern.ch/cms/store/user/wajid/Test/t_channel_n_1.root /castor/cern.ch/cms/store/user/wajid/Test/t_channel_2.root To copy ----> xrdcp root://eoscms//eos/cms/store/data/Run2011B/Jet/AOD/PromptReco-v1/000/175/832/B65748C8-35DD-E011-ADB9-0030486780E6.root /tmp/wajid/ ----> To get PFN cmsPfn /store/data/Run2011B/Jet/RECO/PromptReco-v1/000/175/832/98556DED-BCDB-E011-839C-003048F024DC.root To See data already at CERN Tier 0 ----> nsls /castor/cern.ch/cms/store/mc To list data already produced with CMSSW versions ----> nsls /castor/cern.ch/cms/store/relval/ To copy data from CASTOR to Local Machine Copy data from CASTOR to /tmp/wajid/ directory i.e /castor/cern.ch/cms/store/relval/ ----> rfcp /castor/cern.ch/cms/store/user/wajid/Test/t_channel_1.root /tmp/wajid Then copy from /tmp/wajid to local Machine ----> scp -pv wajid@lxplus204.cern.ch:/tmp/wajid/t_channel_1.root /scratch/w/wajid/t_channel_1.root To copy all the directories to local machine ----> scp -r wajid@lxplus304.cern.ch:/tmp/wajid/* . To view the packeges available in the CVS ----> ls /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_2_10/src DIRECT COPY LCG =============== ----> T1/T2/T3 Site path Castor srm://srm-cms.cern.ch:8443/srm/managerv2?SFN=/castor/cern.ch/user/b/bommelmeier/ T0_CH_CERN srm://srm-cms.cern.ch:8443/srm/managerv2?SFN=/castor/cern.ch/cms T1_DE_FZK srm://cmssrm-fzk.gridka.de:8443/srm/managerv2\?SFN=/pnfs/gridka.de/cms T1_ES_PIC srm://srmcms.pic.es:8443/pnfs/pic.es/data/cms T1_FR_IN2P3 srm://ccsrm.in2p3.fr:8443/pnfs/in2p3.fr/data/cms/data T1_IT_CNAF srm://storm-fe-cms.cr.cnaf.infn.it:8444/srm/managerv2?SFN=/cms T1_TW_ASGC srm://srm2.grid.sinica.edu.tw:8443/srm/managerv2?SFN=/castor/grid.sinica.edu.tw/d0t1/cms T1_UK_RAL srm://srm-cms.gridpp.rl.ac.uk:8443/srm/managerv2?SFN=/castor/ads.rl.ac.uk/prod/cms T1_US_FNAL srm://cmssrm.fnal.gov:8443//11 T2_AT_Vienna srm://hephyse.oeaw.ac.at:8446/srm/managerv2?SFN=/dpm/oeaw.ac.at/home/cms T2_CN_Beijing srm://srm.ihep.ac.cn:8443/srm/managerv2?SFN=/pnfs/ihep.ac.cn/data/cms T2_DE_DESY srm://dcache-se-cms.desy.de:8443/srm/managerv2?SFN=/pnfs/desy.de/cms/tier2 dcap://dcache-ses-cms.desy.de:22125/pnfs/desy.de/cms/tier2 T2_DE_RWTH srm://grid-srm.physik.rwth-aachen.de:8443/srm/managerv2\?SFN=/pnfs/physik.rwth-aachen.de/cms T2_EE_Estonia srm://ganymede.hep.kbfi.ee:8888/srm/v2/server?SFN=/hdfs/cms T2_ES_CIEMAT srm://srm.ciemat.es:8443/srm/managerv2?SFN=/pnfs/ciemat.es/data/cms/prod T2_ES_IFCA srm://storm.ifca.es:8444/srm/managerv2?SFN=/cms T2_IT_Legnaro srm://t2-srm-02.lnl.infn.it:8443/srm/managerv2?SFN=/pnfs/lnl.infn.it/data/cms T2_UK_London_IC srm://gfe02.hep.ph.ic.ac.uk:8443/srm/managerv2\?SFN=/pnfs/hep.ph.ic.ac.uk/data/cms T2_US_Caltech srm://cit-se.ultralight.org:8443/srm/v2/server?SFN=/mnt/hadoop T2_US_Nebraska srm://dcache07.unl.edu:8443/srm/v2/server?SFN=/mnt/hadoop/user/uscms01/pnfs/unl.edu/data4/cms T2_US_Wisconsin srm://cmssrm.hep.wisc.edu:8443/srm/v2/server?SFN=/hdfs T3_US_FNALLPC srm://cmsdca2.fnal.gov:8443/srm/managerv2\?SFN=/pnfs/cms First search for the data at DAS (https://cmsweb.cern.ch/das/).e.g ----> /T_TuneZ2_t-channel_7TeV-powheg-tauola/Summer11-PU_S4_START42_V11-v1/AODSIM Find the site on which is hosted e.g. click on "Block". A list will be displayed. Now click on "Files". Choose any file on T2 let say T2_DE_DESY. copy the site address from above list and copy the file at your desired location ----> lcg-cp -b -D srmv2 -v -n 1 "srm://dcache-se-cms.desy.de:8443/srm/managerv2?SFN=/pnfs/desy.de/cms/tier2/store/mc/Summer11/T_TuneZ2_t-channel_7TeV-powheg-tauola/AODSIM/PU_S4_START42_V11-v1/0000/FE4EF257-A3AB-E011-9698-00304867915A.root" "file://storage/9/wajid/FE4EF257-A3AB-E011-9698-00304867915A.root" INTEGRATED LUMI =============== ----> mkdir Lumi cd Lumi cmsrel CMSSW_4_2_8 cd CMSSW_4_2_8/src cmsenv cvs co -r RecoLuminosity/LumiDB V03-03-12 cd RecoLuminosity/LumiDB/scripts scramv1 b To find out how much luminosity was analysed with ----> lumiCalc2.py recorded -i /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Reprocessing/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt -hltpath HLT_IsoMu17_v5 -b stable -norm pp7TeV DAS(Data Aggregation System) COMMAND LINE TOOL ============================================== Down load the DAS client ----> curl -k https://cmsweb.cern.ch/das/cli > das_client.py Or Download it from ----> https://cmsweb.cern.ch/das/cli Change permissions to ----> chmod a+x das_client.py Search the DataSet ----> ./das_client.py --query="dataset=/SingleMu/Run2011B-PromptReco-v1/AOD | grep dataset.name" --format=plain ----> ./das_client.py --query="dataset=/SingleMu/Run2011B-PromptReco-v1/* | grep dataset.name" --format=plain ----> ./das_client.py --query="dataset=/Jet/Run2011B-PromptReco-v1/RECO* | grep dataset.name" --format=plain ----> ./das_client.py --query="dataset=/Jet/Run2011B-PromptReco-v1/AOD* | grep dataset.name" --format=plain To copy single Event from a Data Set ----> edmPickEvents.py "/Photon/Run2011B-PromptReco-v1/AOD" 176163:41:69046624 -/Photon/Run2011B-PromptReco-v1/AOD = is the dataset you want to pick events from -176163:41:69046624 is one event you want to pick. The syntax is Run:Lumi:Event (Run1:Lumi1:Event1, Run2:Lumi2:Event2) ----> edmCopyPickMerge outputFile=pickevents.root eventsToProcess=176163:69046624 inputFiles=/store/data/Run2011B/Photon/AOD/PromptReco-v1/000/176/163/24DD7EC1-FCDE-E011-AE6E-001D09F23A20.root COPY ONE REAL DATA EVENT ======================== ----> edmPickEvents.py "/Photon/Run2011B-PromptReco-v1/AOD" 176163:41:69046624 --crab ----> crab -create -cfg pickevents_crab.config ----> crab -submit To copy more than one desired events put them in text file,events.txt is a text file that contains = 176163:41:69046624 = ( and others if desired,but one by line ) ----> edmPickEvents.py "/Photon/Run2011B-PromptReco-v1/AOD" events.txt --crab BATCH LXPLUS ============ To submit a job on Batch Lxplus, copy the following lines to a batchjobs.csh then make the shell executable #!/bin/csh cd /afs/cern.ch/user/w/wajid/scratch0/wajid/Trigger/CMSSW_3_6_1/src/Analysis/TopTriggerStartup/test #eval `scramv1 runtime -csh ` cmsenv #cd - cmsRun /afs/cern.ch/user/w/wajid/scratch0/wajid/Trigger/CMSSW_3_6_1/src/Analysis/TopTriggerStartup/test/runTrigAna_cfg.py rfcp /afs/cern.ch/user/w/wajid/scratch0/wajid/Trigger/CMSSW_3_6_1/src/Analysis/TopTriggerStartup/test/Trigger_histos.root /castor/cern.ch/user/w/wajid/Trigger_histos.root To Make your script executable ----> chmod +x batchjobs.csh ----> chmod 744 batchjobs.csh To submit a job on Batch Lxplus ----> bsub -q -8nh batchjobs.csh (8nh = 8 hours , 2nh = 2 hours, 1nh = 1 hours, 1nd = One day, 1nw = One Week ) To check the status of job on lxplus ----> bjobs CMSSW ===== If You have renamed this project area "/expdata/w/wajid/Single_Top/CMSSW_3_5_7" from "/pc/scratch/w/wajid/Single_Top/CMSSW_3_5_7 ----> scram b ProjectRename ----> scram b distclean ----> scram b vclean ----> scram b clean ----> scram b Add a package from the cms repository with required Tag ----> addpkg PhysicsTools/Utilities [tag] To List which Pakages are there ----> showtags -r To log the output from a cmsRun command to a file ----> cmsRun SingleTopSkim_MC.py > & runLog.log & Using cmsDriver ---> cmsDriver.py PythiaH190ZZ4mu_cfi.py -s GEN:ProductionFilterSequence--conditions FrontierConditions_GlobalTag,MC_31X_V5::All --datatier 'GEN-SIM-RAW' --eventcontent RAWSIM -n 1000 --no_exec ----> edmDumpEventContent /castor/cern.ch/cms/store/user/wajid/Test/t_channel_2.root | grep gen This command will only get caloJet label ----> edmDumpEventContent --all --regex caloJet /data/wajid/EDM_CMSSW336_TTbar.root> edmDumpEventContent.txt To find the version of the data sample ----> edmProvDump /data/wajid/EDM_CMSSW336_TTbar.root > edmProvDump.txt To check the number of events an EDM.root file contains and size of event ----> edmEventSize -v /data/wajid/EDM_CMSSW336_TTbar.root > EdmEventSize.txt To list files in present directory ----> du -sh* (du=disk usage, s=summary,h=human readiable) To Compile C++ code in Linux Terminal ----> g++ wajid.C This will produce a an executable file called a.out which can then be run by typing ----> ./a.out If you want executable to be named then write it as fallows ----> g++ -o wajid_out wajid.C PYTHIA ====== To Download Pythia8130 ----> wget http://home.thep.lu.se/~torbjorn/pythia8/pythia8135.tgz To Unzip and expand it with ----> tar -xvfz pythia8135.tgz Enable shared Library installation of pythia ----> ./configure --enable-shared To set the enviorment Variables execute the following command(it takes atleat 3 min) in pythia8135/ ----> make ----> A file with any other name Single.cc must be included in "Makefile" before it can be compiled. To run a pythia8315 program ----> cd /pythia8135/examples "then" make main01 (without .cc extension). To run the executable produecd in the last step ----> ./make main01.exeOA INSTALLING HepMC ================ ----> mkdir hepmc Move to it. ----> cd /hepmc Downd load the HepMC tar file from ----> wget http://lcgapp.cern.ch/project/simu/HepMC/download Unzing and expand it with ----> tar -xzf HepMC-2.06.03.tar.gz Create two new subdirectories ----> mkdir build install Move to /build ----> cd build Compile HepMC ----> make Run the tests ----> make check To install every thing in the specified directory ----> make install HepMC INTERFACE TO PYTHIA ========================= Now move to main /pythia8135 and remove the currently compiled version ----> make clean Now reconfigure it with the option of shared-library creation turn on ----> ./configure --enable-shared Configure it with HepMC interface, now it should take the HepMC Interface ----> ./configure --enable-shared --with-hepmc=/root/hepmc/install --with-hepmcversion=2.06.03 Now recompile the /pythia8135, now with HepMC Interface ----> make (it with take 3-5 min) Move to /examples subdirectory & source the shell. ----> source config.sh You can now also use the main32.cc and main31.cc examples to produce HepMC event files ----> make main32 After you have produced the executable you can run it with ----> ./main32.exe main32.cmnd hepmcfile > main32.out ROOT COMMANDS ============= To execute a script of Root commands 'logon.C' when you start a Root interactive session, you require a file .rootrc. In this .rootrc file, you need the line Rint.Logon: [FULL PATH OF FILE]/logon.C OR Load User-Defined Functions into Memory Automatically Want to do .L myfunction.cc automatically when Root starts. One way is to add the line gROOT->ProcessLine(".L [PATH_NAME]/myfunction.cc"); to the root logon file (see above). Remember, the PATH_NAME must be in the Root macro path (see above). So need to edit the .rootrc file. ROOT INSTALLATION ================= To download the ROOT tar file from source. ----> wget ftp://root.cern.ch/root/root_v5.26.00.source.tar.gz To untar this tar.gz ----> tar -xvf root_v5.26.00.source.tar.gz Configure ROOT with pythia8 ----> ./configure --enable-pythia8 --with-pythia8-incdir=$PYTHIA8/include --with-pythia8-libdir=$PYTHIA8/lib Build ROOT with ----> make To make the executable from all the shells, Add the following lines to it. ----> vi ~/.bash_profile ROOTSYS=/root/root export ROOTSYS PATH=$PATH:$HOME/bin:$ROOTSYS/bin LD_LIBRARAY_PATH=$ROOTSYS/lib:$LD_LIBRARAY_PATH export LD_LIBRARAY_PATH export PATH Make sure that you source the .bash_profile for the changes to take effect. ----> source ~/.bash_profile or ----> . .~/.bash_profile To check the paths. ----> echo $PATH ----> echo $LD_LIBRARAY_PATH USING ROOT ========== Assuming you have a standard installation of ROOT: the basic command is: ----> g++ `root-config --cflags --libs` abc.cc -o abc Compiling programs which include ROOT and RooFit classes: ----> g++ `root-config --cflags --libs` -L $ROOTSYS/lib -lRooFit -lHtml -lMinuit abc.cxx -o abc To use root for drawing different functions ----> TF1 *f1 = new TF1("f1","sin(x)",0,10); ----> f1->Draw(); ----> f1->DrawDerivative(); ----> f1->DrawIntegral(); Drawing two plots on one canvas. ----> TF1 *f1 = new TF1("f1","cos(x)",0,10); ----> TF1 *f2 = new TF1("f1","sin(x)",0,10); ----> f1->Draw(); ----> f2->Draw("same"); ----> SetLineColor(8) ----> f2->Draw("same"); Using Root for analysis ----> TFile f("wajid_1.root"); To Draw a particular Histogram ----> h_W_trans_Mass.Draw(); To Fit a Histrogram ----> h1->Fit("gaus"); ----> h1->Fit("gaus","R", "P",-2., 2.); // where "R" indicates to fit only in a range, given in the last two arguments and "P" is an option indicating to plot markers instead of histograms To Test the Goodness of fit ----> h61->Fit("gaus") ----> h61->GetFunction("gaus")->GetChisquare() ----> h61->GetFunction("gaus")->GetNDF() To Create a tree. ----> TFile *f1 = new TFile("wajid_1.root"); To see what a file contains. ----> f1->ls(); ----> TTree *mytree =(TTree*)f1->Get("muon pt"); You can print the tree to show its structure. ----> mytree->Print(); ----> TTree *mytree =(TTree*)f1->Get("et_elect"); To Draw the selected histogram. ----> mytree->Draw(); To view EDM data file in root ----> TTree *T = (TTree *)f.Get("Events"); To Print ----> T->Print(); NORMALIZING HISTOGRAMS ====================== ----> Double_t scale = 1/h1->Integral(); ----> h1->Scale(scale); ----> h1->Draw(); If you want to normalize your histogram per entry per unite of x-axis then ----> Double_t scale = 1/h1->GetXaxis()->GetBinWidth(1)/h1->GetIntegral(); ----> h1->Scale(scale); To find the data at pcncp 22. First creat grid enviromnet and valid proxy ----> setenv DPM_HOST pcncp22.ncp.edu.pk ----> setenv DPNS_HOST pcncp22.ncp.edu.pk Then set the dpm qurry configuration ----> dpm-qryconf To list the directories at pcncp22,23 ----> dpns-ls /dpm/ncp.edu.pk/home/cms LINUX ===== ----> screen -S name To list screen sessions ----> screen -ls/-list To deteach and reattach a screen session ----> screen -d -R session_name To kill a sssion ----> screen -X -S name kill To Get the speed of internet link. ----> curl -o /dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip ----> wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip ----> CHMOD is used to change permissions of a file. PERMISSION COMMAND U G W rwx rwx rwx chmod 777 filename rwx rwx r-x chmod 775 filename rwx r-x r-x chmod 755 filename rw- rw- r-- chmod 664 filename rw- r-- r-- chmod 644 filename U = User, G = Group, W = World r = Readable,w = writable, x = executable, - = no permission VIM EDITOR ========== Replacing Text in a file Replace the first occurrence of the word foo with bar on line number 452. ----> :452s/foo/bar/ Replace every occurrence of the word foo with bar on current line. ----> :s/foo/bar/g Replace every occurrence of the word foo with bar in the whole file. ----> :%s/foo/bar/g The same as above, but ignore the case of the pattern you want to substitute. This replaces foo, FOO, Foo, and so on. ----> :%s/foo/bar/gi ----> :%s/foo/bar/gc Confirm every substitution. ----> :%s/foo/bar/c For each line on the file, replace the first occurrence of foo with bar and confirm every substitution. ----> Turn on the spell check :set spell or :set nospell ----> Turn on the dictionary :set spell spelllang=en_us :setlocal spell spelllang=en_us ----> use ]s and [s. The ]s command will move the cursor to the next misspelled word, the [s command will move the cursor back ----> use z= and Vim will suggest a list of alternatives Adding a word to the current dictionary ----> ----> Use Ctrl+V to select whole line ----> Use VISUAL mode to select line and key to indent it or to remove indentation ----> Use Ctrl+T to indent and Ctrl+D to deindent To grep something from a file and count it ----> grep "no secb" new4.txt | wc -l To use | tee command ----> cmsRun kita_l1_cfg.py | tee new4.txt To check the system architecture ----> uname -a To extract a page from pdf file using pdftk ----> pdftk A=thesis.pdf cat A37-37 output 37.pdf To combine files using a pdftk ----> pdftk *.pdf cat output combined.pdf To view JPEG files in Linux ----> display abc.jpg To convert ps file to pdf ----> ps2pdf abc.ps abc.jpg To mount a USB or external Hard Derive to a computer ----> mkdir /mnt/usb ----> mount /dev/sda1 /mnt/usb To copy a subdirectory from a host ----> wget -r -N -nH -nd -np -R "index.html*" -P root http://www.pp.rhul.ac.uk/~cowan/stat/root/ To install catdoc and catppt ----> yum install catdoc catppt To get the IP of computer ----> ifconfig To restart the network service or reconfigure it ----> service network restart To check the ping time out ----> traceroute www.yahoo.com or ping www.yahoo.com To install Flash player rpm ----> rpm -ivh flash-plugin-10.1.102.65-release.i386.rpm To find the path on which the executable is installed ----> which root To suspend jobs and then to retrive those jobs ----> Press Ctrl+C to retreive type "fg" To list the actrive processes ----> top or ps or ps aux = all extended To redirect the stderr & stdout channels with terminations even after logout ----> nohup source CopyRootFilesFromCastor.csh > & test.log & (nohup=no hang up) To Make your file executable ----> chmod +x To Make "tar" file. ----> tar -cvf wajid.tar wajid_1.root wajid_2.root wajid_3.root To deconver "tar" file ----> tar -zxvf wajid.tar To make a Global link of an executable ----> ln -s /usr/local/Adobe/AcroBat7.0/bin/acroread acroread ----> To copy few lines from a text file to a new file line 4->89 sed -n '4,89 p' synco1 > synco2 ----> To have the live number in a VIM editor :set number ----> Use Unix command "sort" sort filename CMS DBS Query Tool-for csh shell ================================ ----> setenv CVSROOT :pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories/CMSSW ----> setenv CVS_RSH ssh ----> cvs -d `echo $CVSROOT | awk -F@ '{print $1":98passwd\@"$2}'` login ----> cvs co -r HEAD DBS/Clients/Python ----> cd DBS/Clients/Python ----> source setup.csh To search the data with wild cards ----> dbs search --query="find dataset where dataset like *Singletop*" To find the number of events in given data set ----> dbs search --query="find sum(file.numevents) where dataset=/SingleTop_tChannel-madgraph/Spring10-START3X_V26_S09-v1/GEN-SIM-RECO" USEFUL LINKS ============ ----> http://cms-project-physics.web.cern.ch/cms-project-physics/physics-home.htm ----> https://twiki.cern.ch/twiki/bin/view/Main/LxplusProblem To find the most current good luminosity section files in JSON format ----> https://cms-service-dqm.web.cern.ch/cms-service-dqm/CAF/certification/ To Download Lumi Mask File ----> wget --no-check-certificate https://cms-service-dqm.web.cern.ch/cms-service-dqm/CAF/certification/Collisions10/7TeV/Reprocessing/Cert_136033-149442_7TeV_Nov4ReReco_Collisions10_JSON.txt /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions12/8TeV/Reprocessing/Cert_190456-208686_8TeV_22Jan2013ReReco_Collisions12_JSON.txt POWHEG ======= ----> export LD_LIBRARY_PATH=/portal/ekpcms5/home/wajid/pdfstudy/LHAPDF/lhapdf-5.8.8/lhapdf/lib/:$LD_LIBRARY_PATH ----> export LHAPATH=/portal/ekpcms5/home/wajid/pdfstudy/LHAPDF/lhapdf-5.8.8/lhapdf/share/lhapdf/PDFsets ----> ldd pwhg_main linux-vdso.so.1 => (0x00007fffa5d98000) libLHAPDF.so.0 => /portal/ekpcms5/home/wajid/pdfstudy/LHAPDF/lhapdf-5.8.8/lhapdf/lib/libLHAPDF.so.0 (0x00002b0c620a2000) libgfortran.so.3 => /wlcg/sw/cms/experimental/slc5_amd64_gcc434/external/gcc/4.3.4-cms/lib64/libgfortran.so.3 (0x00002b0cdbb20000) libm.so.6 => /lib64/libm.so.6 (0x000000344e000000) libgcc_s.so.1 => /wlcg/sw/cms/experimental/slc5_amd64_gcc434/external/gcc/4.3.4-cms/lib64/libgcc_s.so.1 (0x00002b0cdbc17000) libc.so.6 => /lib64/libc.so.6 (0x000000344dc00000) libstdc++.so.6 => /wlcg/sw/cms/experimental/slc5_amd64_gcc434/external/gcc/4.3.4-cms/lib64/libstdc++.so.6 (0x00002b0cdbc2e000) /lib64/ld-linux-x86-64.so.2 (0x000000344d800000) GIT Guide ========= ----> mkdir git_testing ----> cd git_testing ----> git init ----> touch GIT-FAQ ----> git add GIT-FAQ ----> git commit -m "first commit" Create a GIT directory from the prompt ----> curl -u 'wajidalikhan' https://api.github.com/user/repos -d '{"name":"Hello"}' ----> git remote add origin git@github.com:wajidalikhan/Hello.git ----> git remote -v ----> git push -u origin master MAC Guide ========= Check the MAC ports version installed ----> port version Update the macports ----> sudo port -v selfupdate ----> sudo port install python_select ----> port search python # Search for version you are looking for ----> sudo port install python27 ----> sudo port select --set python python27 ----> sudo port installed ----> port contents py27-numpy Install ROOT via mac ports ----> sudo port install root5 To list the packages available in macports for installation ----> port list Move cursor to the end ----> cmd+down arrow Move cursor to the begin ----> cmd+right-arrow To move coursor on by one word forword/backword ----> alt+right/left arrow Ubunto Guide ============ To update the apt-get ----> sudo apt-get update To upgrade ----> sudo apt-get upgrade To search if the packages is available in repository ----> apt-cache search tex-maker