This is the cut-and-paste version of Gordon's software tutorial (using 4.1.5 instead of 3.8.7):

source /vols/cms/grid/setup.sh
scram list CMSSW
(for 32 bit releases: export SCRAM_ARCH=slc5_ia32_gcc434)
find release you need here:
https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookWhichRelease
scram project CMSSW CMSSW_4_1_5
cd CMSSW_4_1_5
cmsenv
(only ever use src directory)

cd src/
mkdir -p Tutorial/Exercise
cd Tutorial/Exercise
mkdir src
mkdir test
mkdir python
mkdir interface

cp /home/hep/gfball/tutorial/BuildFile .

cd test
cp /home/hep/gfball/tutorial/config_cfg.py .
voms-proxy-init -voms cms

[edit config_cfg to add GoodVertex filter]

in CMSSW_4_1_5/src/Tutorial/Exercise/test:
run the (framework) code: cmsRun config_cfg.py

to look up CMS code: cmslxr
CMS CVS

now replace the GoodVertexFilter with our own setting with the equivalent standard setting using 'DPGAnalysis.Skims.goodvertexSkim_cff' (new config file) and check it still runs.

Find at least two muons in an event: The Filter
Copy the analysis code skeleton to the appropriate places:
cd src [this is now: CMSSW_4_1_5/src/Tutorial/Exercise/src/]

cp /home/hep/gfball/tutorial/Filter.cc TwoMuonFilter.cc
cd ../interface
cp /home/hep/gfball/tutorial/Filter.h TwoMuonFilter.h

Use edmFileUtil to list the branches in one of the data files [data file name take from from config_cfg.py]:
edmFileUtil -P /store/data/Run2010B/Mu/RECO/N
ov4ReReco_v1/0001/F447BC06-38EC-DF11-ACBD-485B39800B8A.root | grep -i muon
This is probably the right bit:
Branch 270 of Events tree: recoMuons_muons__RECO. Total size = 105261
In CMS speak, recoMuons is the class, muons the collection ('the producer') and RECO the process.

There seems to be nothing about compiling the code in the tutorial, I guess that came appeared in the lectures.
After a bit of digging, this seems to work:
in CMSSW_4_1_5 (it seems to work in lower dirs as well, but at some point it gets confused):
scram build -c (do only once)
scram b
or scram b -v (for degugging)
(now what's the equivalent of gmake clean ? 'scram b clean' apparently. And should I be using scramv1 ? No, cause they are identical. Do I show my age here ?)
After adding a bunch of header files, the code snippet now compiles, lets try cmsRun again - it works:
Begin processing the 5000th record. Run 148862, Event 129672331, LumiSection 80 at 13-May-2011 14:30:34.033 BST
Hello
5
13-May-2011 14:30:34 BST Closed file dcap://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/data/Run2010B/Mu/RECO/Nov4ReReco_v1/0001/F447BC06-38EC-DF11-ACBD-485B39800B8A.root
For reference, here is TwoMuonFilter.h, TwoMuonFilter.cc and config_cfg.py (updated to include the TwoMuonFilter) at this stage.

Adding a new particle to the event
in CMSSW_4_1_5/src/Tutorial/Exercise/src
cp /home/hep/gfball/tutorial/Producer.cc ParentProducer.cc
cp /home/hep/gfball/tutorial/Producer.h ../interface/ParentProducer.h
Edit them to add a new LeafCandidate.
Here is the result: ParentProducer.h, ParentProducer.cc, config_cfg.py
(Note that you need to specify in the contructor what you are about to produce.)

Analyse the event and make a few histograms
in CMSSW_4_1_5/src/Tutorial/Exercise/src
cp /home/hep/gfball/tutorial/Analyser.cc ParentAnalyser.cc
cp /home/hep/gfball/tutorial/Analyser.h ../interface/ParentAnalyser.h
Edit to add some histograms (the magic of TFileService): the output file is added in the cfg file, not the code.
Here is the analysis code: config_cfg.py, ParentAnalyser.h, ParentAnalyser.cc
cmsRun Exercise/test/config_cfg.py > whole_chain.log 2>&1
Haven't dealt with ROOT in a while:
root exercise.root
root [1] .ls
TFile** exercise.root
TFile* exercise.root
KEY: TDirectoryFile parentAnalyser;1 parentAnalyser
root [2] parentAnalyser->cd()
root [3] .ls
TDirectoryFile* parentAnalyser parentAnalyser
KEY: TH1F hMass;1 #mu-#mu opposite-sign mass
hMass->Draw()
Here is the result. I've found a J/psi :-)

I am basically done, but while I am at it, I am just going to finish the tutorial.

Detour: Parameters
To define a set of parameters (as opposed to hardcoding them), CMS uses python (goes in CMSSW_4_1_5/src/Tutorial/Exercise/python). Here is the file (parentProducer_cff.py).
Next do 'scram b' again, this makes parentProducer_cff.pyc.
Then edit ParentProducer.cc to pick up the parameters from the config file and edit config_cfg.py to load the default configuration.

CMS Dataset Bookkeeping System (DBS)
Find you data here. For this example analysis we are using '/Mu/Run2010B-Nov4ReReco_v1/RECO'. After getting the results (click 'Search'), click on 'cff' in "LFNs: cff, py, plain", for a cut-and-pastable list to add file to the config file.

CRAB ("CMS Remote Analysis Builder")
CMS internal CRAB webpage.
*After* setting up the cms software area etc do:
source /vols/cms/grid/CRAB/current/crab.sh copy crab config skeleton from Gordon's area:
in Tutorial/Exercise/test/
cp /home/hep/gfball/tutorial/ crab.cfg .
Edit to taste (note comments in the file where it has gone wrong).
crab -create -submit
crab -status
The results will be stored in /pnfs/hep.ph.ic.ac.uk/data/cms/store/user/dbauer/tutorial2011/ on gfe02.

Some relevant header Files:
LeafCandidate
Muon