For the most recent version of these instructions, click here.

Instructions for the Muon CSC Example

CMSSW_1_5_0

Michael Schmitt / Northwestern University
schmittm@lotus.phys.northwestern.edu
Last modified: Fri Jun 29 15:39:06 CDT 2007

Overview

These instructions show you how to compile and run a CMSSW program which will take a raw input data file (typically in root format), and produce muon segments, as follows:
  1. read in the raw data events and unpack the EMU detectors
  2. create all the DIGI's
  3. find 2D local space-points, called "recHits"
  4. find "segments," ie, short portions of muon tracks
  5. make a standard set of plots which show selected distributions of these objects
This program also fills some "user" histograms and prints out the contents of the basic objects. The histograms are written out to a root file and they might be used for MTCC shifts. Some plotting routines are available in a subdirectory "/results."
Selected examples are available on my MTCC web page.

To work at the LPC:

LPC only:
kinit -n [userid]
xhost + cmslpc.fnal.gov
ssh -t cmslpc.fnal.gov

Fundamentals

source /afs/fnal.gov/files/code/cms/setup/cshrc uaf  [LPC only]
setenv SCRAM_ARCH `scramv1 arch`

Install Code & Compile it (29-June-2007)

First, create an area and declare CMSSW project.
mkdir ~/DEV
cd ~/DEV
scramv1 project CMSSW CMSSW_1_5_0
cd CMSSW_1_5_0/src
project CMSSW
at the LPC only:
cmscvsroot CMSSW
cvs login
[98passwd]

Next, check out the necessary packages:

cvs co -r CMSSW_1_5_0 RecoLocalMuon/CSCRecHit
(From time to time, other packages may be required, such as DataFormats/CSCDigi, EventFilter/CSCRawToDigi and CondFormats/CSCObjects.)

Get copies of the "private" routines that Michael wrote as a starting point. (Notice the periods at the end!)
These routines are meant to be for your analysis. You can get an idea of how to hook your own routines into the CMSSW framework: aside from the routines you need to list them in the BuildFile file. Without that, the routines will not be "known" to CMSSW.

cd RecoLocalMuon/CSCRecHit/test/
cp -v ~schmittm/public/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test/myRoutines.cc .
cp -v ~schmittm/public/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test/myRoutines.h .
cp -v ~schmittm/public/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test/myHistograms.h .
cp -v ~schmittm/public/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test/BuildFile .
cp -v ~schmittm/public/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test/mtccproc.cfg .

I have copied the current version of all these files to ~schmittm/public/ on lxplus. The tar file ALL_THESE_FILES.tar.gz contains all the files in that area including the /results subdirectory.


Compile the code.

cd ~/DEV/CMSSW_1_5_0/src
eval `scramv1 runtime -csh`
scramv1 b
This will take several minutes.
 
Sometimes there will be an error that indicates a missing symbol (basically, getStrips from the strip DIGI):
@@@@ Checking shared library for missing symbols: 
tmp/slc3_ia32_gcc323/src/RecoLocalMuon/CSCRecHit/test/libCSCRecHitReader.so: undefined symbols
  _ZNK12CSCStripDigi8getStripEv
        needed by tmp/slc3_ia32_gcc323/src/RecoLocalMuon/CSCRecHit/test/libCSCRecHitReader.so
If that occurs, then try scramv1 b a second (or even third) time.

Running

In order to run the CMSSW executable, try this:
cd ~/DEV/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test
eval `scramv1 runtime -csh`
cmsRun mtccproc.cfg
The program may "sit" there for a while before showing anything on the screen. This is normal.
If you see an error:
  ConvertFile::ConvertFile() File file:./mtcc.root was not found.
then you need to make a soft link to a real file -- see below.

If the job runs successfully, then you should see something like this:

PoolSource
45081

TimeReport> Time report complete in 153.512 seconds
 Time Summary: 
 Min: 0.00099802
 Max: 1.24392
 Avg: 0.00340525

%MSG-i FwkJob:  PostModule 21-Jun-2007 21:01:42 CDT Run: 4318 Event: 90348

Storage parameters: adaptor: true Stats:true Buffering:false Caching:0,0
Storage statistics: file/close=1/1/0MB/0.021001ms/0.021001ms/0.021001ms; 
ETC ETC

monHists: Write
monHists: Write
monHists: Write
monHists: Write
monHists: Write
monHists: Write
monHists: Write
monHists: Write
monHistsGlobal: Write
%MSG-i FwkJob:  PostModule 21-Jun-2007 21:01:43 CDT Run: 4318 Event: 90348


%MSG-i FwkJob:  PostModule 21-Jun-2007 21:01:43 CDT Run: 4318 Event: 90348

The configuration file is mtccproc.cfg and it looks like this:

process TEST = {

  source = PoolSource {
       untracked vstring fileNames = {
        "file:./mtcc.root"
       }
  }

  untracked PSet maxEvents = {untracked int32 input = 1000}

# Specify the output file for the reconstructed events.
  module out = PoolOutputModule {
    untracked string fileName ="eventsOutput.root"
  }

# These are some useful utilities.
  service = Timing { }
  service = SimpleMemoryCheck { }

# specify the data unpacker, which makes the digis
  module cscunpacker = CSCDCCUnpacker {
    untracked bool Debug = false
    untracked bool PrintEventNumber = true
    FileInPath theMappingFile = "CondFormats/CSCObjects/data/csc_slice_test_map.txt"
    untracked bool UseExaminer = true
    untracked uint32 ErrorMask = 0xDFCFEFFF 
    untracked uint32 ExaminerMask = 0x7FB7BF6
    InputTag InputObjects = source
    untracked bool UnpackStatusDigis = false
    untracked bool isMTCCData = false
  }

# These are some geometry modules needed for recHits and segments
# (I'm not sure what to do about the magnetic field.)
  include "Geometry/MuonCommonData/data/muonIdealGeometryXML.cfi"
  include "Geometry/CSCGeometry/data/cscGeometry.cfi"
# include "MagneticField/Engine/data/volumeBasedMagneticField.cfi"

  es_module = MuonNumberingInitialization { }


# Specify the recHit reconstruction routine.
# The first file sets default paramters.
  include "RecoLocalMuon/CSCRecHit/data/csc2DRecHits.cfi"

# Specify the segment reconstruction routine.
  include "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmSK.cfi"
  include "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmTC.cfi"
  module segmentproducer = CSCSegmentProducer {
    InputTag inputObjects = csc2DRecHits
# Name of RecHitProducer producer module(s)...
    string CSCRecHit2DProducer = "csc2DRecHits"
# Choice of the building algo: 1 SK, 2 TC...
    int32 algo_type = 1  
    VPSet algo_psets = {
       {using CSCSegAlgoSK}, {using CSCSegAlgoTC}
    }
  }

# Finally, specify my user analysis package !
module mine = myRoutines{
    untracked bool writeAsciiFiles = false
    untracked string rootFileName = 'monHists.root' 
}

# Here is the path of modules for the analysis of a single event:
path p = {cscunpacker, csc2DRecHits, segmentproducer, mine}

# Specify the output:
#	endpath e = {out}

}

As you can see,


Output Histograms

The routines myRoutines and myHistograms create collections of histograms some of which may be useful for monitoring the MTCC data. All of these histograms are written to the file specified in mtccproc.cfg. (This file can get large due to a number of 2D histograms. You may want to specify a file name in your /tmp area.)

You can make formatted plot from these histograms using the routines stored in

~schmittm/public/CMSSW_1_5_0/src/RecoLocalMuon/CSCRecHit/test/results
I will post instructions for those plotting macros after they have been cleaned up and organized a bit better.

Data Files

There are example MTCC data files you can use:

You should make soft links to the files you want to analyze as explained above. You can use the soft link in the mtccproc.cfg file.

In order to get these files yourself, or to get other files, you need to use CASTOR which is a general file-storage system at CERN. At Fermilab there is a different system.

In order to find what files are available, try something like:

nsls -l /castor/cern.ch/cms/emuslice/globaldaq/
The latest MTCC data are written to
/castor/cern.ch/cms/MTCC/data/0000NNNN/A/
where NNNN is the run number.
To copy a file to your own disk, use
rfcp /castor/cern.ch/cms/MTCC/data/0000NNNN/A/(file name) (location)
Note that this can take a long time...

At the LPC, some files have been put on a public disk: /uscmst1b_scratch/lpc1/lpcmuon/MTCC/ and /uscmst1b_scratch/lpc1/lpcmuon/stoyan/. See the LPC cosmic data web page for more information.

The following may still need updating:

Ingo Bloch says that the right way to specify a file on dCache in the configuration file is like this:

"dcache:/pnfs/cms/WAX/7/PHEDEX2/MTCC/data/00002274/A/mtcc.00002274.A.testStorageManager_0.0.root"
(notice there is no file: specification in front). For reading the so-called intermediate streamer files, which have the .dat extension, you cannot use dcache. In this case you need to copy your desired file to your /tmp area like this:
dccp /pnfs/cms/WAX/7/PHEDEX2/MTCC/data/00002426/A/mtcc.00002426.A.testStorageManager_0.0.dat (your file)
and then specify (your file). Note that you can read only one of these files at a time, and they typically contan 10k events.

Something similar can be done at CERN. For example, Oana Boeriu sent this recommendation:

"rfio:/castor.cern.ch/cms/MTCC/data/00002274/A/mtcc.00002274.A.testStorageManager_0.0.root"
Again, this does not work with the intermediate streamer files.