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

Instructions for the Muon CSC Example

CMSSW_0_8_0_pre2

Michael Schmitt / Northwestern University
Last modified: Sun Aug 13 09:49:41 CDT 2006

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
I have provided some crude analysis / debugging routines as well, to help you get started with your own analysis.

At Northwestern, to work at the LPC:

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

Fundamentals

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

Install Code & Compile it (7-July-2006)

First, create an area and declare CMSSW project.
mkdir ~/DEV
cd ~/DEV
scramv1 project CMSSW CMSSW_0_8_0_pre2
cd CMSSW_0_8_0_pre2/src
project CMSSW
at the LPC only:
cmscvsroot CMSSW
cvs login
[98passwd]
Next, check out the necessary packages:
cvs co -r CMSSW_0_8_0_pre2 EventFilter/CSCRawToDigi
cvs co -r CMSSW_0_8_0_pre2 DataFormats/CSCDigi
cvs co -r CMSSW_0_8_0_pre2 CondFormats/CSCObjects
cvs co -r CMSSW_0_8_0_pre2 IORawData/CSCCommissioning
cvs co -r CMSSW_0_8_0_pre2 RecoLocalMuon/CSCRecHit
cvs co -r CMSSW_0_8_0_pre2 RecoLocalMuon/CSCSegment
(Note that you do not necessarily need all of these packages. These are the main ones that are relevant for the CSC's, though most of the time you will only need the last two RecoLocalMuon code sets. This all takes a lot of disk space so you might want to leave some of these out, once you know what you are doing.)

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/DEV12/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test/myRecHitReader.cc .
cp -v ~schmittm/DEV12/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test/myRecHitReader.h .
cp -v ~schmittm/DEV12/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test/mySegmentReader.cc .
cp -v ~schmittm/DEV12/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test/mySegmentReader.h .
cp -v ~schmittm/DEV12/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test/BuildFile .

Notice!
For some reason the protection and permissions for these five files is not correctly set. I have asked for help from the CERN helpdesk. Meanwhile, you can copy all five files from:
/tmp/schmittm/SHARE/
on lxplus014. This is a temporary solution, of course.
The same applies for the configuration file mtccproc.cfg.

Get a copy of the configuration file if you don't have one already.
This file controls the way the program runs and you will certainly modify it frequently.

cp -v ~schmittm/DEV12/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test/mtccproc.cfg .

Fetch some mapping files (or else make a link).

cp -v ../../../EventFilter/CSCRawToDigi/test/csc_slice_test_map.txt .


Compile the code.

cd ~/DEV/CMSSW_0_8_0_pre2/src
eval `scramv1 runtime -csh`
scramv1 b


Running

In order to run the CMSSW executable, try this:
cd ~/DEV/CMSSW_0_8_0_pre2/src/RecoLocalMuon/CSCRecHit/test

eval `scramv1 runtime -csh`

cmsRun --parameter-set mtccproc.cfg
(One can use "-p" instead of "--parameter-set".)

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

process TEST = {
       source = PoolSource {
                untracked vstring fileNames = {"file:./mtcc.root"}
                untracked int32 maxEvents = 5
                 untracked uint32 debugVebosity = 10
                 untracked bool   debugFlag     = false
                }

        module cscunpacker = CSCDCCUnpacker {
                                untracked bool Debug = false
                                untracked bool PrintEventNumber = false
                                untracked string theMappingFile = "csc_slice_test_map.txt" 
                                untracked bool UseExaminer = true
                             } 

        service = Timing { }
  
        service = SimpleMemoryCheck { }

        module out = PoolOutputModule {
                untracked string fileName ="digi.root"
        }
         
        module anal = DigiAnalyzer {}

        include "Geometry/MuonCommonData/data/muonIdealGeometryXML.cfi"
        include "Geometry/CSCGeometry/data/cscGeometry.cfi"

        # include "MagneticField/Engine/data/volumeBasedMagneticField.cfi"

        include "RecoLocalMuon/CSCRecHit/data/CSCRecHit2DProducer.cfi"
        module rechitproducer = CSCRecHit2DProducer{
             string CSCStripDigiProducer = "cscunpacker"
             string CSCWireDigiProducer  = "cscunpacker"
             int32 no_of_chamber_types = 9
             vstring algo_types = { 
                                    "CSCRecHit2DFromStripsAndWires",
                                    "CSCRecHit2DFromORedStrips"
                                   }
             VPSet algo_psets = {
                                    {using common_params}, 
                                    {using common_params} 
                                }
             vint32 algo_per_chamber_type = { 2, 1, 1, 1, 1, 1, 1, 1, 1 }
             untracked bool debug = true
        }

        module myrechitreader = myRecHitReader{
                # Switch on/off the verbosity and turn on/off histogram production
                untracked bool debug = true
                # Label to retrieve SimHits from the event
                # untracked string simHitLabel = 'SimG4Object'
                # Tim's code outputs "r" instead of SimG4Object...
                untracked string simHitLabel = 'r'
                # Label to retrieve RecHits from the event
                untracked string recHitLabel = 'rechitproducer'
                # Name of the root file which will contain the output histograms
                untracked string rootFileName = "cscrechitplots.root"
                # Maximum distance between simhit and recohit
                untracked double maxRechitDistance = 9999.
                # Maximum number of reco hits per layer of any given chamber
                untracked int32 maxRechitPerLayer = 1
                # Maximum number of sim hits per layer of any given chamber
                untracked int32 maxSimhitPerLayer = 1
                # WhichEndcap:  0 = both,  1 = +Z,  2 = -Z
                untracked int32 WhichEndCap = 0
        }


        include "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmSK.cfi"
        include "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmTC.cfi"

        module segmentproducer = CSCSegmentProducer {
                # Name of RecHitProducer producer module(s)...
                string CSCRecHit2DProducer = "rechitproducer"
                # Choice of the building algo: 1 SK, 2 TC...
                int32 algo_type = 1  
                # std::vector
                VPSet algo_psets = {
                        {using CSCSegAlgoSK}, {using CSCSegAlgoTC}
                }
        }

        module mysegmentreader = mySegmentReader{
        }

        path p = {cscunpacker, anal, rechitproducer, myrechitreader, segmentproducer, mysegmentreader}
        endpath e = {out}
}

You can download the file itself: here

As you can see,

It should be obvious how to change the options.


You may get a bunch of errors about
     Limitation: Can't instantiate precompiled template
and things like that. Apparently this is a known problem and does not matter for what we want to do right now.


Data Files

I have example MTCC data files you can use:

It is not obvious how long the files will remain in these temporary areas.

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.

In order to find what files are available, try:

nsls -l /castor/cern.ch/cms/emuslice/globaldaq/
and to copy a file to your own disk, use
rfcp /castor/cern.ch/cms/emuslice/globaldaq/   
Note that this can take several minutes.