Extended JTerm Pre-Workshop Exercises - First Set - 15 Oct 2009

Introduction

The purpose of the pre-workshop exercises is for prospective workshop attendees to become familiar with the basic software tools required to perform physics analysis at CMS. Please run and complete these exercises and post the results in the online form provided.The exercises are standalone. A large amount of additional information about these exercises is available in the twikis that we reference. Please remember that twikis evolve but aim to provide the best information at any time.

To perform the first set of exercises an LPC account is required.

How to obtain an LPC computer account

  • cmslpc account
    • Exercises will be performed on cmslpc.fnal.gov cluster.


When logging in to cmslpc from a windows machine, the following links might be helpful:

Exercise 1 - Cut and Paste

Login to cmslpc.fnal.gov

To verify if cut and paste from one window to another works, cut and paste the following and then hit return

~cplager/runThisCommand.py "asdf;klasdjf;kakjsdf;akjf;aksdljf;a"\
"sldjfqewradsfafaw4efaefawefzdxffasdfw4ffawefawe4fawasdffadsfef"
The response should be your username followed by alphabets unique to your username, for example like this:
success: malik znyvx 
QUESTION - Post this unique alphanumeric characters.

If you only run the command without any cut and paste, like the following:

somebody@cmslpc11> ~cplager/runThisCommand.py
you should get
Error: You must provide the secret key
If you paste incorrectly, you should get
Error: You didn't paste the correct input string
If you run it from a wrong computer ( not cmslpc, say from your laptop locally), you should get
bash: ~cplager/runThisCommand.py: No such file or directory
OR
Unknown user: cplager.

Exercise 2 - Simple Edit Exercise

This is to test and make sure that the user can edit files on cmslpc.

Log into cmslpc, run this command:

cp ~cplager/editThisCommand.py . 

Then open editThisCommand.py in your editor and edit the 11th line adding a # (hash character) to the front of the line. So the lines should start of looking like this:

# Please comment the line below out by adding a '#' to the front of
# the line.
raise RuntimeError, "You need to comment out this line with a #"

and be changed to:

# Please comment the line below out by adding a '#' to the front of
# the line.
#raise RuntimeError, "You need to comment out this line with a #"

Save the file and run the command:

user@cmslpc12> ./editThisCommand.py

If this is successful, you will see this

cplager@cmslpc12> ./editThisCommand.py
success:  cplager 0x1851DCBA

Paste the bottom line into the window.

If you did not successfully edit the file, you'll see an error message such as this:

cplager@cmslpc12> ./editThisCommand.py
Traceback (most recent call last):
  File "./editThisCommand.py", line 11, in ?
    raise RuntimeError, "You need to comment out this line with a #"
RuntimeError: You need to comment out this line with a #

Exercise 3 - Setup a release area CMSSW_3_3_0

source /uscmst1/prod/sw/cms/cshrc uaf 
cmscvsroot CMSSW
mkdir YOURWORKINGAREA
cd YOURWORKINGAREA
scram p CMSSW CMSSW_3_3_0
cd CMSSW_3_3_0/src
cmsenv

Run the following command:

 echo $CMSSW_BASE
QUESTION - Paste the output of the above command

Exercise 4 - Find data in DBS ( Database Bookkeeping Service)

Go to the url DBS discovery and in the menu driven interface, choose the info from the pull down menu, so that your choices look like this:

DBS_snapshot.png

then click on "Find" and after few seconds it brings another page. On this page there are two data sets. Look for the one that says: /RelValTTbar/CMSSW_3_1_4-STARTUP31X_V2-v1/GEN-SIM-RECO.

QUESTIONS - What is the size of this data? Click on "plain" to see the number of files it contains? Is this data at FNAL?

The files it contains should look like this

       '/store/relval/CMSSW_3_1_4/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V2-v1/0006/AC0641BB-73B1-DE11-A138-001D09F291D2.root',
       ...................................................

More information about on accessing data in DBS can be found in WorkBookDataSamples

Exercise 5 - Use some EDM ( Event Data Model framework) standalone utilities - edmDumpEventContent, edmProvDump, edmEventSize

At this point just learn how to execute some of them as they are very useful throughout your physics analysis beyond the workshop. The details can be found on WorkBookEdmUtilities. These together with CMSSW and CMS LXR Cross Referencer can help you understand the CMS code.
  • Use edmDumpEventContent to see what class names etc. to use in order to access the objects in the RECO data file you located above
    • To do this do
       edmDumpEventContent dcap:///pnfs/cms/WAX/11/store/relval/CMSSW_3_1_4/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V2-v1/0006/AC0641BB-73B1-DE11-A138-001D09F291D2.root > EdmDumpEventContent.txt 
    • Note how /pnfs/cms/WAX/11/ has been prefixed to the file name. Adding this gives you the physical location of the file at Fermilab.
    • Cut and Paste EdmDumpEventContent.txt in the form.
  • Use edmProvDump to see what modules were run, CMSSW version etc. used when the RECO file was made. To use it do
    • To do this do
       edmProvDump    dcap:///pnfs/cms/WAX/11/store/relval/CMSSW_3_1_4/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V2-v1/0006/AC0641BB-73B1-DE11-A138-001D09F291D2.root > EdmProvDump.txt 
    • Cut and Paste EdmProvDump.txt in the form.
  • You can use edmEventSize to know the size of different branches in your data file. The details are here SWGuideEdmEventSize
    • To do this do
      edmEventSize -v dcap:///pnfs/cms/WAX/11/store/relval/CMSSW_3_1_4/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V2-v1/0006/AC0641BB-73B1-DE11-A138-001D09F291D2.root > EdmEventSize.txt 
    • Cut and Paste EdmEventSize.txt in the form.

Exercise 6 - Make a PATtuple where PAT means Physics Analysis ToolKit

What is a PATuple and all about it can be found at SWGuidePAT and the latest PAT tutorial.

Using the WorkBookPATSimpleExample in Module 1 of PAT tutorial, we will plot the Pt distribution of the PAT muons. Note that we will use the datafile ( which is a RECO file) that you found above in the DBS instead of the default data file used in Module 1 ( you can dig out the default file later) but for now we will simply make a PAT tuple called simplePAT.root.

Make sure at this point your are in the directory YOURWORKINGAREA/CMSSW_3_1_4/src To complete this exercise follow these steps: 1. Open your favorite editor and cut paste the contents of the file simplePAT_cfg.py. Save this file as simplePAT_cfg.py. 2. Now run the following command

cmsRun simplePAT_cfg.py
While this command is executed you will see an output like this. 3. Now open the root file you just created. Note that this file is created in the YOURWORKINGAREA/CMSSW_3_1_4/src directory where you should always be for this tutorial. To open the root file do:
 root -l simplePAT.root
On root prompt type root [1] gStyle->SetOptStat(111111); and then TBrowser b; like this
root [1] gStyle->SetOptStat(111111);
root [1] TBrowser b;
This opens a window that looks like this:

root1.png

On this window click on ROOT Files on the left menu and now the window looks like this:

root2.png

Click simplePAT.root, then on Events, then on patMuons_cleanLayer1Muons__PAT and then on patMuons_cleanLayer1Muons__PAT.obj. You should now see a window that looks like this:

root6.png

Scroll way down ( not too fast) and click on pt(). You should now see PAT Muon Pt distribution.
QUESTION - What is the mean value of the muon pt()?

Get Grid Certificate and CMS VO registration

Use the following link for this: Get Your Grid Certificate and CMSVO

Get CERN account

* Use the following link for CMS CERN account: CMS CERN account

    • CERN acount is needed to login in to any elearning web-site ( later used in the final tutorial), to get a file from afs area or any future need you may have beyond the tutorial.
    • To keep the information flow going for CERN account, please ask your team leader do the necessary "signing" after the online form has been treated by the secretariat.

AFTER the above you are ready for the exercises below We assume that you are familiar with basic unix commands like ls, ls -altrh, cp etc. and can edit a file using any of the editors like pico, emacs, nedit etc.

Exercise 7 - Fireworks - CMS Event Display

Fireworks is CMS' graphical tool to display events for physics. Fireworks is intended to be run locally at your deskstop ( using the recipe at WorkBookFireworks download the 31X distribution locally on your laptop). We have a made file called EJTermDataForEventDisplay.root from the RECO file that you have been working so far. Your task is to find out how many tracks are present in the event number 8550 which is the last event in this file EJTermDataForEventDisplay.root. To do this exercise follow any of the following method:

METHOD 1 ( Run Fireworks from your /YOURWORKINGAREA/CMSSW_3_1_4/src). This method is intended just for this exercise otherwise it is very slow and will choke up cmslpc if all user start event display simulatneously.

Form your /YOURWORKINGAREA/CMSSW_3_1_4/src execute the following command

cmsShow /afs/cern.ch/cms/sdt/web/validation/physicstools/EJTermDataForEventDisplay.root

METHOD 2

cd cmsShow31
./cmsShow https://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/validation/physicstools/EJTermDataForEventDisplay.root

You can also download the data file locally by doing

  • For LINUX
wget https://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/validation/physicstools/EJTermDataForEventDisplay.root
  • For MAC
curl https://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/validation/physicstools/EJTermDataForEventDisplay.root  >  EJTermDataForEventDisplay.root  

and then view the event display by doing

cd cmsShow31
./cmsShow EJTermDataForEventDisplay.root

Now the event display should start. You may UNCEHCK all the objects in the summary view on the left EXCEPT tracks. You should see the following type of graphics ( with just green tracks)

Event5300.png

Once you have this display, you will swift through different events one by one.

To do the exercise do the following steps:

  1. Write event number 8550 where you see event displayed as 8501, press enter
  2. Now you should see the tracks displayed for event 8550. Not all the tracks are displayed though.
  3. Click on the little arrow button on the left of the Tracks in the summary view
  4. This will pull a display of all the tracks, showing pt, eta, phi etc., like this:
  5. Menu.png
  6. Scroll down and see how many tracks this event has.
  7. QUESTION - What are the number of tracks in this event 8550?
  8. You can of course play with other buttons and menu.

To do this do

 cmsShow dcap:///pnfs/cms/WAX/11/store/relval/CMSSW_3_1_4/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V2-v1/0006/AC0641BB-73B1-DE11-A138-001D09F291D2.root

Exercise 8 - Grid/Crab exercises ( A valid Grid Certificate and CMS VORMS membership is a pre-requisite for this) - to be completed by ERIC VAANDERING

  • a. Exercise on having a grid certificate
  • b. Getting a /store/user area from your assigned Tier2
  • c. Running a Grid Job

Exercise 9 - Run EDAnalyzer to make your PATtuple

If you want to manipulate, analyze, draw histograms etc. from the data in the PATtuple, you need can do it using EDAnalyzer or in FWLite. More on these can be found on WorkBookWriteFrameworkModule and FWLiteExecutable. While EDAnalyzer needs full framwork to run, FWLite can be run on your laptop by downloading the appropriate FWLite distribution.

In the /YOURWORKINGAREA/CMSSW_3_1_4/src directory cut and paste the following commands ( you can select all and paste all together and commands will be executed sequentially)

cvs co -r patTutorial_sept09_module1 PhysicsTools/PatExamples/src  
cvs co -r patTutorial_sept09_module1 PhysicsTools/PatExamples/interface  
cvs co -r patTutorial_sept09_module1 PhysicsTools/PatExamples/BuildFile  
cvs co -r patTutorial_sept09_module1 PhysicsTools/PatExamples/plugins/BuildFile  
cvs co -r patTutorial_sept09_module1 PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc  
cvs co -r patTutorial_sept09_module1 PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py

To run, you need to compile the code by doing the following

scram b 

Now you open the file (using your favourite editor), like this

pico  PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py
and change the input file to "simplePAT.root you created in Exercise 4. This is done like below in the config file analyzePatBasics_cfg.py

process.source = cms.Source("PoolSource",
  fileNames = cms.untracked.vstring(
    'file:simplePAT.root'
  )
)

To run the code do ( assuming you are still in the src directory)

cmsRun PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py
After the config file runs, you should see a file called analyzePatBasics.root . Browse through different histograms.
QUESTIONS - How many histograms are there? Which histogram is empty?

Exercise 10 - FWLite exercises

Go through the twiki - FWLiteExecutable

AFTER completing the exercises on the twiki:
Open the root file myZPeakModified.root and draw the modified Z-peak as follows:

root -l myZPeakModified.root
root [0] Zmass->Draw();

QUESTION - Report the mean of the MODIFIED Z Mass.

Questions/Problems/Suggestion - mailto: malik@fnalNOSPAMPLEASE.gov , Phone - 630-840-6441

-- SudhirMalik - 2009-10-06

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatext CondorJob_samplePAT r1 manage 0.6 K 2009-10-09 - 03:49 SudhirMalik  
PNGpng DBS.png r1 manage 69.3 K 2009-10-13 - 05:20 SudhirMalik  
PNGpng DBS_snapshot.png r1 manage 51.2 K 2009-10-13 - 05:20 SudhirMalik  
Texttxt EdmDumpEventContent.txt r1 manage 31.3 K 2009-10-13 - 06:02 SudhirMalik  
Texttxt EdmEventSize.txt r1 manage 19.2 K 2009-10-13 - 06:04 SudhirMalik  
Texttxt EdmProvDump.txt r1 manage 643.2 K 2009-10-13 - 06:03 SudhirMalik  
PNGpng Event5300.png r1 manage 194.4 K 2009-10-09 - 03:54 SudhirMalik  
PDFpdf GridTaskMonitoring.pdf r1 manage 119.5 K 2009-10-09 - 03:53 SudhirMalik  
PNGpng Menu.png r1 manage 22.9 K 2009-10-09 - 03:54 SudhirMalik  
PNGpng MuonMultDist.png r1 manage 22.5 K 2009-10-07 - 22:54 SudhirMalik  
PNGpng Muon_pt.png r1 manage 22.4 K 2009-10-13 - 06:26 SudhirMalik  
PNGpng Tracks.png r1 manage 74.0 K 2009-10-09 - 03:53 SudhirMalik  
Texttxt condorjob.txt r1 manage 0.8 K 2009-10-09 - 07:58 SudhirMalik  
Unknown file formatcfg crab.cfg r1 manage 0.6 K 2009-10-09 - 03:49 SudhirMalik  
PNGpng root1.png r1 manage 17.0 K 2009-10-09 - 06:03 SudhirMalik  
PNGpng root2.png r1 manage 18.4 K 2009-10-09 - 06:03 SudhirMalik  
PNGpng root3.png r1 manage 21.1 K 2009-10-09 - 06:04 SudhirMalik  
PNGpng root4.png r1 manage 23.5 K 2009-10-09 - 06:04 SudhirMalik  
PNGpng root5.png r1 manage 26.8 K 2009-10-09 - 06:04 SudhirMalik  
PNGpng root6.png r1 manage 33.9 K 2009-10-09 - 06:04 SudhirMalik  
PNGpng root7.png r1 manage 21.3 K 2009-10-09 - 06:05 SudhirMalik  
Unknown file formatcsh simplePAT.csh r1 manage 0.3 K 2009-10-09 - 03:50 SudhirMalik  
Texttxt simplePAT.csh.txt r1 manage 0.3 K 2009-10-09 - 07:42 SudhirMalik  
Unknown file formatlog simplePAT.log r1 manage 29.9 K 2009-10-13 - 07:56 SudhirMalik  
Unknown file formatlog simplePAT314.log r1 manage 29.9 K 2009-10-13 - 08:01 SudhirMalik  
Texttxt simplePAT314_cfg.py.txt r1 manage 0.6 K 2009-10-13 - 08:57 SudhirMalik  
Unknown file formatcondorlog simplePAT_313451.condorlog r1 manage 1.0 K 2009-10-09 - 03:48 SudhirMalik  
Unknown file formatstdout simplePAT_313451.stdout r1 manage 0.1 K 2009-10-09 - 03:49 SudhirMalik  
Texttxt simplePAT_cfg.py.txt r1 manage 0.5 K 2009-10-13 - 06:32 SudhirMalik  
Edit | Attach | Watch | Print version | History: r24 | r22 < r21 < r20 < r19 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r20 - 2009-10-16 - SudhirMalik
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback