Annotated MyMiniAnalysis.tcl
This is the second tcl file in the analysis job.
The command to run the job is:
BetaMiniApp snippet.tcl
Then snippet.tcl passes the job to MyMiniAnalysis.tcl with the command:
sourceFoundFile BetaMiniUser/MyMiniAnalysis.tcl
#------------------------------------------------------------------------------
# $Id: MyMiniAnalysis.tcl,v 1.29 2004/11/19 22:42:08 fnc Exp $
# Sample MyMiniAnalysis.tcl file
# Modified for the Workbook by Sheila Mclachlin
#------------------------------------------------------------------------------
sourceFoundFile is a tcl procedure that sources the argument filename.
The following commands implement some setup, sourcing files
that give instructions on how to error-log, and how to use
Framework configuration variables instead of environment
variables to configure the job.
# always source the error logger early in your main tcl script
sourceFoundFile ErrLogger/ErrLog.tcl
sourceFoundFile FrameScripts/FwkCfgVar.tcl
sourceFoundFile FrameScripts/talkto.tcl
# Disable the use of envvars
set ProdTclOnly true
# set the error logging level to 'warning'. If you encounter a configuration
# error you can get more information using 'trace'
ErrLoggingLevel warning
The next few commands set some Framework configuration variables
(FwkCfgVars). You can change FwkCfgVars from job to job without
having to change BetaMiniApp (i.e., without having to recompile
and relink).
As mentioned in the CM2 section, when
you have a choice between "Kan"-something and "Bdb"-something, you
should choose "Kan" for CM2-Kanga. Bdb is the old data-storage system.
## allowed values of BetaMiniReadPersistence are (currently) "Kan", "Bdb"
##
FwkCfgVar BetaMiniReadPersistence Kan
The most common choice for levelOfDetail is "cache." See the
Event Store section for a description of the different levels of detail.
## allowed (non-expert) values of levelOfDetail are "micro", "cache", "extend"
## or "refit"
##
FwkCfgVar levelOfDetail "cache"
ConfigPatch specifies the data-taking period of the input. Run2 now
encompasses all data taking periods (not just Run 2). In the Quicktour
you use a Monte Carlo (MC) simulated data set.
## allowed values of ConfigPatch are "Run1", "Run2" or "MC". This MUST be set
## consistent ## with your input data type or you will get INCONSISTENT OR
## INCORRECT RESULTS
##
FwkCfgVar ConfigPatch "MC"
hbook is an old format used in the analysis program PAW.
root is the new format used in the analysis program ROOT.
Use ROOT --- it's better.
snippet.tcl can use the "set" command to override any of the
values set in MyMiniAnalysis.tcl. In this case, MyMiniAnalysis.tcl
defines the histFileName to be MyMiniAnalysis.root. However, snippet.tcl
overrides this with the command "set histFileName myHistogram.root".
So you will end up with a root file named "myHistogram.root".
## choose the flavor of ntuple to write (hbook or root) and the file name
##
FwkCfgVar BetaMiniTuple "root"
FwkCfgVar histFileName "MyMiniAnalysis.root"
##
## You can enter input collections two ways: either append them to a list, or
## explicitly enter them in the input module. Do one or the other, BUT NOT
## BOTH.
## If inputList is set before executing btaMini.tcl, that will automatically
## add the collections to the appropriate input module, otherwise make sure you
## talk to the right one.
##
## lappend inputList collection1 collection2 ...
##
The tcl file that you produced with BbkDatasetTcl
is basically just a list of many "lappend inputList" commands. To add
all of the collections in SP-B0B0bar-Run4.tcl to the input list, you
would add the following command here (in MyMiniAnalysis.tcl) or in
snippet.tcl:
source SP-1237-Run4.tcl
## OR THE FOLLOWING (choose the correct one based on persistence)
##
## talkto BdbEventInput {
## talkto KanEventInput {
## input add collection1
## input add collection2
## ...
## }
"talkto KanEventInput" is an in-tcl-file equivalent of the
"mod talk KanEventInput" command that you use in the Quicktour.
## create Everything path and add core sequences to it. btaMiniPhysics is the
## same as btaMini, just appending a few standard list generating modules. For
## reading data with stored composites, you may have a conflict running
## btaMiniPhyscs.tcl
##
## You can also run (most of) the PhysProdSequence, complete with its 3 gamma
## conversion finders, etc. Consider disabling the portion of this sequence
## that you do not need to save yourself some time. The BetaLumiSequence
## and TagProd sequences are left off, as they otherwise cause problems.
##
sourceFoundFile BetaMiniUser/btaMini.tcl
#sourceFoundFile BetaMiniUser/btaMiniPhysics.tcl
#sourceFoundFile BetaMiniUser/btaMiniPhysProdSequence.tcl
# Append QA sequence if requested, disable module otherwise to avoid empty histos
FwkCfgVar MyMiniQA
if [info exists MyMiniQA] {
sourceFoundFile BetaMiniQA/BetaMiniQaSequence.tcl
path append Everything BetaMiniQaSequence
talkto QaMiniBtaCandidates {
startPrint set 0
stopPrint set 3
printFreq set 1
}
path append Everything TagInspector
sourceFoundFile SkimMini/listOfTagBits.tcl
} else {
module disable QaMiniBtaCandidates
}
The main analysis path is called "Everything", and
is defined in btaMini[Whatever].tcl. MyMiniAnalysis is added to
the path, and then the Quicktour's NTrkExample module.
## Add Analysis module
##
path append Everything MyMiniAnalysis
path append Everything NTrkExample
Using a tag filter is kind of like running your own skim:
the tag filter checks the tag variables and rejects events with tags that
you don't want. This works only on AllEventsSkim or its subsets,
since they are tagged. It won't work on AllEvents, since AllEvents
hasn't been tagged.
##
## If your job has a tag-level filter, here is how you should run it
## so as to avoid wasting time reading the mini when the tag filter fails
## Here's a simple example that restricts to just multi-hadron events
## on Kan input
module clone TagFilterByName TagBGFMultiHadron
module talk TagBGFMultiHadron
andList set BGFMultiHadron
assertIfMissing set true
exit
#sequence append BetaMiniReadSequence -a KanEventUpdateTag TagBGFMultiHadron
Of the available example modules, you chose
MyMiniAnalysis. So now you disable the other two.
#
# Turn off some specialty items
#
module disable MyDstarAnalysis
module disable MyK0Analysis
The path list command prints a list of the
modules in the path, in order. This list (and all other runtime messages)
will be output to your terminal.
path list
|