The DIRAC Offline User Guide
Daniel Drijard and Michel Hansroul
<CERN>
Valery Yazkov
<DUBNA>
April 2000
Table of Contents
Introduction
Table of Contents
This guide describes the structure of the offline DIRAC reconstruction
program (called Ariane) and the instuctions to build an executable module.
The user interface to the program is also fully documented.
As this is a document in constant evolution,
the user is welcomed to send comments and suggestions;
please Email at
michel.hansroul@cern.ch.
The latest version can be obtained from the DIRAC Web page
http://www.cern.ch/DIRAC/.
Programming language, libraries and tools
Table of Contents
The FORTRAN language is used for almost all of the present code, with
the exception of a few C functions used for reading and writing data records.
Except for a few instructions (e.g. cycle, exit ...) the code is written
in the FORTRAN 77 language in order to guarantee
the portability to various platforms. In addition, the usage of the CERN
library code maintenance package PATCHY requires a limitation of the line
lengths to 72 characters only (this restriction is no longer valid for the
latest version of PATCHY but remains for certain compilers).
The program uses various utilities and packages of the CERN library,
such as FFREAD, HBOOK, HEPDB, ZEBRA. These are usually available for a large
variety of platforms.
Presently, the code maintenance is done with the PATCHY system
(version 5) which is available in the CERN library. As PATCHY was
not implemented on MacIntosh, a version of PATCHY
with a reduced set of functionalities has been written by D.Drijard for
that machine. However, the standard version of PATCHY has by now (April 2000)
also been implemented on Macs as well as most of the CERN library.
Code present status and location
Table of Contents
The program has been developped and implemented on the UNIX, LINUX and the
Mac OS systems.
The functionalities provided are the following:
-
geometry and calibration data decoding
-
data records reading from disk
-
storing of data blocks
-
decoding and storing of decoded data blocks
-
track reconstruction
-
encoding of data and writing of output records
-
display of detectors, data and reconstructed tracks (package
provided by Jean-Louis Narjoux)
It is expected that the groups in charge of the detectors will provide
the appropriate code to be inserted in the program.
The source code (in the form of a "car" file for PATCHY), the
libraries, the executable module, test events and scripts are located in
the following directory on the CERN AFS system:
/afs/cern.ch/user/d/diracoff/public/offline/ariane
An explanation of the various sub-directories and their contents is
given in the file
AREADME
which the user is invited to consult for the
latest information. Below follows a brief summary of the directories
structure:
"ariane" directory
-
AREADME: text file with latest informations
-
info: directory where
ModificationsLog
is a simple text file
summarizing the history of modifications of the ariane program
-
data: directory containing the desciption of the setup geometry
in the file "detector.data"
-
dev: directory of development code tree
- car: ".car" files for Patchy
- demo: files for a test example
- exe: executable modules for AIX and HPUX systems
- lib: libraries for AIX and HPUX systems
- src: FORTRAN sources for AIX and HPUX systems
-
pro: directory of production code tree with a structure similar to "dev"
-
old: directory of obsolete source code (archive)
-
events: directory of some events samples files
-
scripts: directory of "build" scripts files
For the MacIntosh version, contact
Daniel.Drijard@cern.ch.
Program structure
Table of Contents
As required by the PATCHY maintenance tool, the code is stored in what
is called a PAM or CAR file, from which PATCHY will extract the C or FORTRAN
code to be compiled and linked with appropriate libraries. The extraction
of the code follows instructions contained in a CRADLE file to be provided
by the user, an example of which being included in the "buildlib" script
described in a later section.
REMARK: For users familiar with CMZ (interactive code maintenance
system), the CAR file can also be read by CMZ, thus providing the CMZ tools
to perform various tasks as needed.
The CAR file is divided into "PATCHES", each containing a set of "DECKS"
which themselves consist of subroutines or functions. The patches
CDES, CDEDATABASE and TRCDES are special and consist of KEEP sequences whose contents are the
common blocks or parameters definitions; these sequences are referred to
in the subroutines or functions whenever needed. In addition, one can define
flags which may be used to select pieces of code specific to different
platforms.
A full description of the functionalities of PATCHY can be obtained
from the CERN library; however, later in this guide, examples of usage
of PATCHY will be given for the convenience of users not wanting to invest
much time in getting familiar with the PATCHY system.
General code organisation
Table of Contents
The following patches are presently defined in the CAR file:
-
HISTORY: brief comments on program versions.
-
*Ariane: pilot craddle
-
CDES: common blocks and parameter declarations in KEEP
sequences
-
CDEDATABASE: common blocks and parameter declarations in KEEP
sequences for the HEPDB database reading and decoding
-
TRCDES: common blocks and parameter declarations in KEEP
sequences for DECODING and DCTRACKING
-
Header: defines KEEP sequence Allkeeps containing all
sequences from the patch CDES
-
Header1Mac: defines MacIntosh KEEP sequence Allkeeps containing all
sequences from the patch CDES
-
Header2Mac: defines MacIntosh Include file
-
Header3Mac: defines special directives for MacIntosh only
-
DiracMain: contains code of batch and interactive main programs
-
USERCODE: default (EMPTY) user routine UserAction
-
INIT: initialisation routines
-
GENERAL: steering routines
-
DECODING: code for event blocks decoding
-
INOUT: input-output routines
-
PRINTING: various printing routines
-
TITLES: set of routines for detector descriptions
-
TITLESGETDB: set of routines for HEPDB DB decoding
-
TITLESTOOLSDB: set of routines for HEPDB DB reading
-
TITLESPRINT: routines for titles printing
-
UTIL: routines of general use
-
UTILUX: utilities specific to unix systems
-
UTILMAC: utilities specific to MacIntosh systems
-
MONTECARLO: treatment of Montecarlo events
-
EVENTCOPY: some dummy routine for event copying job
-
DCTRACKING: Drift Chambers track reconstruction code
-
PROCESSING: analysis code
-
CUTILS: C routines of general use (byte swapping,DAQ pool)
-
TITLESDATA: detector geometry,calibration and contstants file
The usage of the selection flags will be explained in the examples in a
later section. They are:
-
INTERACTIVE : selects interactive code
-
DEBUG: selects special additional debug code
-
UNIX : selects standard Unix code
-
AIX : selects Aix unix system specific code
-
HPUX : selects HP-UX unix system specific code
-
PCLINUX : selects PC Linux system specific code
-
ALPHA : selects Alpha OSF1 system specific code
-
MacMPW : selects MacIntosh specific code
-
POOL : selects DAQ POOL specific code
-
TYPE : selects strong typing of variables with the
"IMPLICIT NONE" statement inserted in each routine
Main job phases
Table of Contents
The principal tasks, identified by a "job phase level", performed by
the program are outlined below:
-
Job initialisation: job phase level 1
-
Event loop
-
Fetch an event
-
Get the event input buffer: job phase level 2
-
Get the event blocks pointers: job phase level 3
-
Read the event Titles: job phase level 5
-
Decode the general blocks: job phase level 4
-
Decode the event blocks: job phase level 6
-
Process the event: job phase level 7
-
Put event in output buffer: job phase level 8
-
actions at end of event: job phase level 9
-
Job termination: job phase level 10
-
Job Run start: job phase level 11
-
Job Run end: job phase level 12
The number of presently predefined job phase levels (variable 'LevelJob'
in the code) is expected to increase in the future as new processors will
be included in the program.
The tasks to be performed are steered within the main program, called
'DiracB' and 'DiracI' for the batch and interactive versions, respectively.
A simplified listing of 'DiracB' is given below.
Program DiracB
c
c------------- Initialisation ---------------
call InitPhase(JobInitialisation)
call DateAndTime
call Initialisation
call InitPackages
call ffset
call InitFFKeys
call ffgo
call SetupJob
call UserAction
call SetupPrint
c----- begin Event loop ---------------------
call InitPhase(jobInputReading)
call FetchEvent
call UserAction
c------------- Event decoding ---------------
call InitPhase(jobBlocksDecoding)
call DecodeAll
call GetMeasFromData
call FilterAllMeas
call UserAction
c------------- Event processing ---------------
call InitPhase(jobEventProcessing)
call Processing
call UserAction
c------------- Event output ---------------
call InitPhase(jobOutputWriting)
call PutEvent
call UserAction
c------------- Event wrap up actions ---------------
call InitPhase(jobEventEnding)
call FillHistograms
call EventPrint (LevelJob)
call UserAction
c----- finish Event loop ---------------------------
c------------- End of operations ---------------
call InitPhase(JobTerminating)
call UserAction
call EndOfJob
END
Initialisation
Table of Contents
The main program successively calls a series of subroutines as indicated
in the following flow chart:
-
DateAndTime: gets starting date and time of job
-
Initialisation: preset variables
-
InitBlocksList: defines event blocks identifiers
-
TitlesNeeded: defines titles names and numbers
-
InitPackages: calls FFREAD init routines
-
ffinit: init of FFREAD
-
ffget: defines logical unit of directives input file
-
ffset: defines length of directives keywords
-
ffuset: declares external routine for FFREAD
-
InitFFKeys: defines preset directives keywords
-
ffkey: utility to define directives keywords
-
InitFFKeysDC: defines Drift Chambers directives keywords
-
UserFFKeys: defines additional user directives keywords
-
ffgo: action routine to read FFread directives
-
SetupJob: sets job conditions according to directives
-
hlimit: init of HBOOK package
-
BookHistograms: booking of histograms
-
UserAction: user routine
-
SetupPrint: prints job conditions
Event loop
Table of Contents
The event loop flow chart is shown below for the successive phases of
actions:
-
FetchEvent: steers the event reading Input level 2
-
ResetEvent: resets variables, counters and flags at event start
-
GetEvent: controls the event buffer input
-
GetRecord: fills new input record buffer
-
GetNextFile: opens next input file
-
GetRecordDisk: reads one record from disk
-
GetRecordPool: reads one record from DAQ pool
-
DebugIt: is this event to be debugged?
-
EventPrint: debug print
-
EventBlow: sets up the event blocks pointers level 3
-
StatPerRun: called if end of run
-
NewRun: called if start of run
-
EventPrint:debug print
-
GetTitles;Event Titles reading level 5
-
NewTitle: updates geometry according to run number
-
InitReconst: initialises detector planes positions
-
ReClGeomDC: calculates geometry constants for DC tracking
-
UserAction
-
DecodeGen:decoding of general blocks level 4
-
DecodeRun:decoding of Run block
-
DecodeInitDEDX:DEDX decoding initialisation
-
DecodeInitHodHor:HodHor decoding initialisation
-
DecodeInitHodVer:HodVer decoding initialisation
-
DecodeInitCherenkov:herenkov decoding initialisation
-
DecodeInitPreShower:PreShower decoding initialisation
-
DecodeInitMuon:Muon decoding initialisation
-
DecodeInitScFi:ScFi decoding initialisation
-
EventPrint:debug print
-
InSelection: is this event to be further processed?
-
UserAction
Event blocks decoding level 6
-
DecodeAll: steers the event blocks decoding
-
DecodeDeDx: DeDx block decoding
-
DecodeSciFi: Scintillation Fibers block
-
DecodeHodVer: vertical hodoscope
-
DecodeHodHor: horizontal hodoscope
-
DecodeMuon: muon chambers
-
DecodePreShow: pre showers
-
DecodeCherenkov: cherenkovs
-
DecodeDC: drift chambers
-
GetMeasFromData: fills variables of common Measurements¾
-
EventPrint:debug print
-
UserAction
Event processing level 7
-
Processing: for the time being only DC track
reconstruction is provided
-
ProcessingDC: DC tracking taking into account data from
Horizontal and Vertical hodoscopes
-
TrWirDC: finding tracks from hit wires only
-
FndTrxDC: finding tracks from drift times
-
UserAction
Event output level 8
-
PutEvent: steering of event output
-
OutSelection: is this event selected for output?
-
EventMerge: merge new additional data blocks
-
PutRecord:
-
PutNextFile: open new output file
PutRecordDisk: writes buffer record on disk
-
PutRecordTape: writes buffer record on tape
-
EventPrint: debug print
-
UserAction
Event ending level 9
-
FillHistograms: fills histograms
-
EventPrint: prints event summary
-
UserAction
-
FinishRun: prints statistics if end of run
Job Termination
Table of Contents
-
EndOfJob: level 10
-
PutRecord: flush the remaining output record
-
FileStatus: prints output file status
-
StatFinal: prints final statistics
-
PrintHistograms: writes out histograms
List of subroutines
Table of Contents
Here follows the list of decks for each patch in the CAR file:
-
Patch DiracMain
-
DiracB: batch steering program
-
DiracI: interactive steering program
-
Patch USERTEST
-
UserAction: temporary example of user interaction at various levels
-
Patch USERCODE
-
UserAction: user interaction at various levels
-
Patch INIT
-
DiracFFread: special actions when reading FFKEYS starting with
the character "*"
-
InitBlocksList: defines blocks identifiers
-
InitFFKeys: defines predefined directives keywords
-
Initialisation: general presetting of variables
-
InitPackages: initialises Cern library packages FFREAD and HBOOK
-
SetupJob: sets job conditions according to directives
-
UserFFKeys: user routine to define additional directives keywords
-
Patch GENERAL
-
BookHistograms: defines requested histograms (EMPTY)
-
DebugIt: decides if debug printing is requested
-
EndOfJob: wrap up at end
-
FillHistograms: filling of histograms
-
FinishRun: end of run statistics
-
HistSummary: index and summary of requested histograms
-
InitJobPhase: initialisation of a job phase
-
InSelection: decides if event is to be processed
-
NewRun: resets variables for a new run
-
OutSelection: decides if event is to be stored for output
-
PrintHistograms: prints histograms (EMPTY)
-
Processing: steering of reconstruction (EMPTY)
-
ResetEvent: variables and flags resetting at event start
-
Patch DECODING
click here for a full description
-
DecodeInitDEDX: init of DEDX decoding
-
DecodeInitHodHor:init of HodHor decoding
-
DecodeInitHodVer: init of HodVer decoding
-
DecodeInitCherenkov: init of Cherenkov decoding
-
DecodeInitPreShower: init of PreShower decoding
-
DecodeInitMuon: init of Muon decoding
-
DecodeInitScFi: init of ScFi decoding
-
Patch INOUT
-
EventBlow: gets all the event blocks pointers and sizes
-
EventCopy: copy event buffer to output buffer
-
EventMerge: merges/collects blocks to to construct output event
-
FetchEvent: steers the reading and unpacking of an event
-
GetEvent: get next event buffer
-
GetNextFile: opens next events input file
-
GetRecord: controls the reading of the next input record
-
GetRecordDisk: reads one record from input file on disk
-
GetRecordPool:reads one record from input file or DAQ pool
-
NewRun:prepares the next run of events
-
PutEvent: steers the storing of an event and writing of a record
-
PutNextFile: opens next output file
-
PutRecord: controls the writing of an output record
-
PutRecordDisk:writes one record on output file on disk
-
PutRecordTape: writes one record on output file on tape
-
Patch PRINTING
-
EventDump: similar to EventPrint
-
EventDump2: prints decoding results
-
EventPrint: debug printing at various job phases
-
RunBlockPrint: debug printing of Run Block information
-
SetupPrint: prints job conditions at initialisation
-
ShowBlocksInfo: prints data blocks identifiers
-
ShowDataWords: prints data blocks contents
-
StatFinal: prints final job statistics
-
StatPerFile: controls the printing of a file statistics
-
StatPerRun: prints run statistics
-
Patch TITLES
-
BlowTitles
-
GetTitles
-
InitReconst
-
NewTitle
-
RefFramesDefine
-
RefFramesSet1
-
RefFramesSet2
-
RefFrameSshow
-
TitlesDump
-
TitlesGetAxes
-
TitlesGetCherenkov
-
TitlesGetDC
-
TitlesGetDeDx
-
TitlesGetHodHor
-
TitlesGetHodVer
-
TitlesGetMSGC
-
TitlesGetMuon
-
TitlesGetPreShower
-
TitlesGetSciFi
-
TitlesGetTarget
-
TitlesNeeded
-
Patch UTIL
-
CleanString: removes leading and/or trailing blanks from a
string of characters
-
DateAndTime: gets date and time
-
DateTimeToString: transforms date and time to a string of
characters
-
FastRead: unformatted FORTRAN read
-
FastWrite: unformatted FORTRAN write
-
GetNextLine:
-
GetOK: logical function
-
GetSubString: character function
-
Ivadd: addition of 2 integer arrays
-
Lower: character function returning argument in lower case
-
ReadVal: prompting for interactive input
-
RotVectorTo: 3-D vector rotation
-
RotVectorFrom: 3-D vector rotation
-
Upper:character function returning argument in upper case
-
Patch UTILHP
-
FileStatus: prints informations on an opened file
-
GetFileName: prompts for interactive input of a file name
-
Patch CUtils
-
byteswap: C routine to invert bytes in an input array
-
byteswapc: C routine to invert bytes in an input array
and copy the result into an output array
-
initpool: initialisation of I.Manuilov¹s DAQ pool library
-
getburst: interface to pool routine "initspill"
-
getevts: interface to pool routine "getevents"
-
Patch MONTECARLO
-
BufferToCoreMC
-
CoreToBufferMC
-
ShowEventMC
-
Patch TitlesData
This patch contains the "Detector.Data" file defining
the detector geometry, some calibration data and
various other constants needed by the decoding and
reconstruction procedures.
List of common blocks
Table of Contents
The description of the common blocks can be found in the following links:
In patch CDES
click here
In patch TRCDES
click here
User interface
Table of Contents
The user has the possiblity to interact with the program through a set
of directives controlling the job conditions and by means of a user routine
which is called at each predefined job phase.
Job directives with FFREAD package
Table of Contents
FFREAD provides a facility for input of format free data. It is a
tool suitable to transmit or modify variables at run time without recompilation.
The variables to be set by FFREAD must reside in common blocks and to
each variable or set of variables (for arrays) the system associates a
key, its location, its length and type. All this being defined at initialisation
time, the directives are read by FFREAD which sets or modifies the variables
in memory accordingly.
A full description of FFREAD can be consulted at
http://consult.cern.ch/writeups/ffread/ffread.html.
-
Predefined job directives
The definitions of keys and associated variabkes
are done in the routine InitFFKeys through successive calls to the routine
FFKEY provided by FFREAD.
The number of significant characters of the keys has been set to 12,
but a directive's keyword can consist of more characters, the excess being
ignored by FFREAD. Data items on the directives should be separated by
blanks and characters not being of the expected type for the current key are considered
as comments. A line starting with one or several blanks is treated as a
continuation line.
The keys starting with "*" (see list below) can be repeated in order
to set several variables of the same type but not part of an array. For
example, the "*eventfilein 'Filename'" directive may appear as many times
as the number of input events files to be read: in addition, these files will be read in
the order in which they appear in the directives.
Below is the present list of directives
divided into a compulsory and an optional groups:
Compulsory directives
-
eventselection i1 i2 i3
requests processing of events from i1 to i2 by step of i3; it
is to be noted that i1, i2 are not event numbers as stored in raw
data, but corespond to internal counters in the program.
-
*RunEventRanges i1 i2 i3 i4
this is an alternative to the "eventselection" directive; it
requests processing of events from i2 to i3 by step of i4 for the run
number i1; this directive is to be provided for each desired run number.
WARNING: the events range (i2 to i3) concerns internal event numbers
as they are stored in the raw data and NOT the independent counter within
the program.
If this directive is used, the "eventselection" directive should NOT be
set.
This directive is to be provided for each desired run up to
a maximum of 100 runs.
-
*geometryfile 'Filename'
where Filename = geometry file path name
-
*eventfilein 'Filename'
where Filename = input file full path name
This directive is to be provided for each desired input file up to
a maximum of 100 files
-
END
this line must be the last one and is required to stop the reading
by FFREAD (the keyword "STOP" is also understood as "END")
Optional directives
-
List
instructs FFREAD to print all directives
-
maxwordsoutput i1
where i1 = maximum number of words of output records
-
eventoutput i1
where i1 = maximum number of output events to be written
-
*eventfileout 'Filename'
where Filename = output file full path name
-
printselection i1 i2 i3 i4
requests debug printing of events from i1 to i2 by step i3
and debug level i4 (from 1 to 4)
-
phasetoprint i=ilevel j=jlevel ... n=nlevel
by default, the debug level is set for all job phases to the
value set in the "printselection" directive.
The present directive allows a redefinition of a debug level
for the specified job phases "i", "j" ..."n" to be set to the values
"ilevel", "jlevel" ..."nlevel", respectively. In addition, setting a level to
a negative integer suppresses the printing of the corresponding phase
-
phasetoexecute i=iexe j=jexe ... n=nexe
The present directive allows a selection of
the specified job phases "i", "j" ..."n" to be executed or not by setting
"iexe", "jexe" ..."nexe" to 1 or 0, respectively.
This is an easy way of speeding up some jobs not requiring all phases
to be executed.
By default, all phases are executed.
-
inputmedium 'name'
input file comes from medium "name" where name can have the
values DISK (default) or POOL; name HAS to be put between quotes as shown
-
outputmedium 'name'
output file will be put on medium "name" .
-
DumpInRecords i1 i2 i3 i4
requests dump of i4 words starting at word i3 for input records
from i1 to i2
-
DumpOutRecords i1 i2 i3 i4
requests dump of i4 words starting at word i3 for output records
from i1 to i2
-
eventDisplay i1 i2
allows the display of events from i1 to i2 (interactive mode only)
-
*Switches i j k l
sets the general purpose switches i, j, k, l to true;
for example, if i=5, j=2, k=20 and l=12, the logical variables
switch(2), switch(5), switch(12) and switch(20) are set true.
These switches are available to the user for his/her specialised
code, as none of the switches are used by the standard program.
-
*histoSelection i j k l
sets the histograms selection flags i, j, k, l to 1;
for example, if i=5, j=2, k=15 and l=12, the variables
jobHistOptions(2), jobHistOptions(5), jobHistOptions(12)
and jobHistOptions(15) are set 1. By default, they are initialised to 0.
Up to 10 options can be set on
one directive and a second directive should be provided if more are
needed.
The present maximum number of options is 15 in total .
-
saveHistos L1 L2 L3
where L1, L2 and L3 are set to t (=true) or f (=false)
If true ,L1 instructs the program to save all histograms on a
direct access file named "ariane.hbook" suitable for subsequent analysis by
by using the CERN library utility PAW. (default is "false")
If true ,L2 instructs the program to print an index and summary of
of all requested histograms.(default is "false")
If true ,L3 instructs the program to print all requested
histograms.(default is "false")
-
RequestHisto L
where L is set to t (=true) or f (=false).
This instructs the program to initialise HBOOK for user histograms
even if no standard histograms have been selected through the
³*histoselection² directive.
-
GlobalStatistics Logical
where Logical = ON/OFF to turn printing of global statistics
on or off. When "OFF" is selected, the statistics is provided for each run.
-
acceptBlocks L1 L2 ... Ln
L1, L2 ... Ln can be set to t (=true) or f (=false) for each of the
data blocks types to be decoded or not on input (default is "t" for all
blocks)
-
neededBlocks L1 L2 ... Ln
L1, L2 ... Ln can be set to t (=true) or f (=false) for each of the
data blocks types needed for further processing (default is "f" for all
blocks)
-
newBlocks L1 L2 ... Ln
L1, L2 ... Ln can be set to t (=true) or f (=false) for each of the
new data blocks types created during processing (default is "f" for all
blocks)
-
outputBlocks L1 L2 ... Ln
L1, L2 ... Ln can be set to t (=true) or f (=false) for each of the
data blocks types to be written or not on output (default is "t" for all
blocks)
-
CopyInToOut Logical
where Logical = ON/OFF to turn the copy flag on or off. This
option causes the program to skip the normal flow of output and replaces it
by a simple straight copy of the input event buffer to the output buffer.
In order not to waste time in the operation, some processing routines should
be disabled, for example by turning on the EVENTCOPY patch when building
the specialised main program to be used for building the copy job.
-
Example
LIST
maxwordsoutput 8192 max number of words for an output record
eventoutput 2000 max number of events to write on output file
c eventselection 0 10 1 first last step
*RunEventRanges 69 0 50 1
*RunEventRanges 70 0 50 1
printselection 1 5 1 4 first last step debuglevel
c debug levels modified for phases 4,1,3
phasetoprint 4=3 1=-1 3=1
c phases 5,6,7,8 will not be executed
phasetoexecute 5=0 6=0 7=0 8=0
c The above directive can also be written as:
c "phasetoexecute 5=0 0 0 0" as the variables set are consecutive in memory
c or "phasetoexecute 5=4*0" using the repetition factor "4"
*histoselection 1 2
saveHistos F T T
inputmedium 'DISK' actually not needed as this is the default
outputmedium 'TAPE' default is DISK
acceptblocks 25*t all blocks accepted (this is the default)
neededBlocks 25*f actually not needed as this is the default
c The next line sets blocks 24 and 25 to "ON" ,meaning that they will be
c created during the job, the others remaining as found on input file
newblocks 24=t t
c
outputBlocks 25*t actually not needed as this is the default
c
streaminput actually not needed as this is the default
StreamOutput actually not needed as this is the default
c
*geometryfile
'/afs/cern.ch/user/d/diracww/public/offline/ariane/data/detector.data'
c
*eventfilein
'/afs/cern.ch/exp/dirac/events4/69.run'
*eventfilein
'/afs/cern.ch/exp/dirac/events4/70.run'
c
*eventfileout
'/afs/cern.ch/user/d/diracww/public/offline/ariane/events/6970.e1toe50'
c
GlobalStatistics on
DumpInRecords 2 2 1 1000 first last firstword lastword
DumpOutRecords 1 2 1 1000
END
User subroutines
Table of Contents
The interaction of the user with the flow of tasks performed by the
program has been implemented by means of a subroutine called "UserAction".
This routine is normally empty, but when needed the user has the possibility
of writing, for the job levels desired, his own special code as is outlined
in the next section.
-
The UserAction subroutine
subroutine UserAction
c
c the Allkeeps sequence contains all the other sequences
+SEQ,Allkeeps
c...local variables
c_______________________________
c...USER routine
c
c....................at end of initialisation
if (LevelJob.eq.JobStarting) then
c....................at end of getting blocks
elseif (LevelJob.eq.JobBlocksPointing) then
c....................at end of GENERAL blocks decoding
elseif (LevelJob.eq.JobGenDecoding) then
c....................at end of Titles Reading
elseif (LevelJob.eq.JobTitlesReading) then
c....................at end of decoding
elseif (LevelJob.eq.JobBlocksDecoding) then
c....................at end of event processing
elseif (LevelJob.eq.JobEventProcessing) then
c....................at end of event outputting
elseif (LevelJob.eq.JobOutputWriting) then
c....................at end of event
elseif (LevelJob.eq.JobEventEnding) then
c....................at end of Job
elseif (LevelJob.eq.JobTerminating) then
endif
END
Example
Debug printing
Table of Contents
Input and output files
Table of Contents
Data formats
A FILE is made of RECORDS that are made of EVENTS,
which in turn are made of BLOCKS. The following gives an explicit
definition of these entities.
In a disk file, all bits are contiguous, without hardware record
markers in between, as would be the case for standard binary FORTRAN files.
The records mentioned here are only software concepts that are written/read
by C-routines (or FORTRAN on Macintosh).
The order of bytes in a word is the same as that (network byte order) used on the
HP, RS6000(AIX) and Mac machines.
However, other machines having a different byte order in a computer word
such as PC(Linux) and Alpha machines, require byte swapping
in order to write/read those data, this operation being taken care of
by the program.
On tape, a hardware structure is superimposed, but we need not worry about
it provided we properly use the stageout/stagein commands.
A record has a variable length and holds many events but no event
is split across successive records.
An event consists of different blocks , starting with
an Offset-block followed by a "general" Event-block and
one or several data blocks.
Each block starts with a packed word that holds its
size and type (identifier).
A graphical representation of an event is stored in the
postscript file
event_format.ps
A run is defined as a collection of events starting by a record with
a single event that has a Run-block.
A PS burst (1,2 or maybe 3 in a supercycle of 14.4 seconds
or so) is sandwiched between a Start-Of-Burst and an
End-Of-Burst block.
On raw-data (on-line) there are further constraints:
- a run may be formally split into sub-runs over many files, each of which
limited to about 300 Mbytes, the labels of the files carrying the part
number
- the first record of a run (and sub-runs) contains a single event
with only a Run-block
- a Tuning-block, when present, occurs alone in an event
and alone in a record (as a Run-block) and it may appear at any time during
a run
- every burst is fully contained in a record
- there is only one burst per record.
On processed-data files these restrictions are removed.
The word "event" is unfortunately used with three different meanings.
In the previous paragraph, it means an element of record (a set of blocks)
and an other meaning is in the special block
called EVENT-block. To avoid the confusion this block is called 'General'
in Ariane. The third meaning, the most natural one, is that of a set of
measurements representing an interaction. Again to avoid confusion Ariane
uses (in principle) DataEvt in this case.
Words quoted here are 32-bit long. When relevant, packing is defined
as [a/b] for two 16-bit and [a/b/c/d] for four 8-bit components. For
example the word [Version/Size] means that "Version" is in the 16 most
significant bits and "Size" in the 16 least significant ones.
Size means the number of words, in 32-bit units, following this word,
i.e. it does not include itself in the count.
- RECORD
-
- Size (number of words following)
- Event-1
- Event-2
- ...
- Event-last
- EVENT
-
- Header [Version/Size]
- Block-1
- Block-2
- ...
- Block-last
- Delimiter { = 'FFFFFFFF'x }
- BLOCK
-
- Header [Size/Type]
- Word-1
- Word-2
- ...
- Word-last
- OFFSET-block
-
- Header [Size/Type]
- [Type/Offset in event]-1
- [Type/Offset in event]-2
- ...
- [Type/Offset in event]-last
- general EVENT-block
-
- Header [Size/Type]
- Run number
- Trigger bit-pattern
- Event-number in run
- [Event-number in burst/Burst number]
Date and time of burst {approximate}:
- [Day/Month/Year-1997/Hour]
- [Minutes/Seconds/0/0]
- Live time (in µsec)
- Gamma monitor
- Relative time since beginning of burst (in µsec)
- Date and time in Unix conventions (seconds since 1/1/1970 at 2:00 AM)
- Parameter set and suppression flag packed
The Trigger bit-pattern (in the Event-block) describes the trigger:
- the highest order bit is 0 for normal data events, and 1 for Monte-Carlo
events.
- the next 15 bits are reserved for the DAQ logics
- each of the 16 lowest order bits corresponds to a trigger so that
an event corresponding to multiple triggers will have multiple bits set
(such as pi+pi- and K+K-).
The detailed contents of the other blocks are described elsewhere.
Numbering of blocks (Type)
- 100 .. 199 General purpose
- 100 Offset
- 101 Event Information
- 102 Run block : the graphical description of this block can be found
here.
This block contains sub-blocks called:
Run Status,
Detector list,
Fera list
- 103 Start Of Burst
- 104 End Of Burst
- 105 Monitor
- 106 Tuning
- 107 Memory
- 199 Offline
- 200 .... 299 MSGC
- 201 MSGC-1
- 202 MSGC-2
- 203 MSGC-3
- 300 .... 399 SciFi
- 400 .... 499 dEdX
- 500 .... 599 Drift Chambers
- 500 DC-0
- 501 DC-1
- 502 DC-2
- 600 .... 699 Vertical Hodoscopes
- 700 .... 799 Horizontal Hodoscopes
- 800 .... 699 Cherenkov
- 900 .... 999 Pre-Shower
- 1000 .. 1099 Muon Counter
- 1100 .. 1199 DUMMY (now TDC of DNA)
- 2000 .. 2099 Processed data
- 2100 .. 2199 Monte Carlo
Apart from the General purpose blocks, 100 values are reserved for the
type of each block in order to allow future variations of the format if
needed.
In case a severe event selection is applied during off-line analysis,
some bursts may be left empty, and possibly some runs empty. We will
have to keep the relevant information, such as the integrated live-time,
but it would be space consuming to keep all Run-block, Start-Of-Burst
and End-Of-Burst blocks. Instead we might have to create a special
Summary-block.
Scripts for building an executable module
Table of Contents
The scripts listed below are for the UNIX system and should be adapted
for other systems. They have been tested for the following
platforms(systems): HP-UX, AIX, Alpha(OSF1), Linux.
1.Installation of the offline "Ariane" software
In order to install the "Ariane" program, the user should follow
the steps below:
First, set up a directory structure similar to the structure implemented
on the DIRAC AFS account in the directory:
"/afs/cern.ch/user/d/diracww/public/offline/"
The directory structure is represented as follows:
- offline
- ariane top directory
- dev development directory
- car contains "arianeXXX.car" file
where "XXX" is the latest version number being worked on
- demo job directory (from which to launch the program)
with "FFreadInput" file and
detector geometry file corresponding to version "XXX"
- exe contains executable module
- lib contains "ariane.a" and "graf.a" libraries
(graf.a library not yet available)
- src contains FORTRAN and C source code
- pro production directory
- car contains "arianeYYY.car" file
where "YYY" is the production (stable) version number
- demo job directory (from which to launch the program)
with "FFreadInput" file and
detector geometry file corresponding to version "YYY"
- exe contains executable module
- lib contains "ariane.a" and "graf.a" libraries
(graf.a library not yet available)
- src contains FORTRAN and C source code
- scripts contains the scripts "buildlib", "buildmain",
"buildexe" , "buildgraf" and "extractDetector"
This directory should be included in the search "PATH" variable unless the
user prefers to put these scripts into an other directory already in his
search path.
Then, follow the steps below:
- transfer a copy of the latest arianeXXX.car file into the relevant
(dev or pro) "car" directory.
- transfer a copy of the latest script files into a directory
of your choice.
- modify the script files so that they will access
the user defined directories; in each script, only 1 line needs
to be modified, namely the line defining the variable "wdir" where the
the "/afs/.../offline" part of the path to the "ariane" directory should
be redefined.
- execute the "buildlib" and "buildmain" scripts
(see examples in next sections). If the graphics utilities are desired,
the "buildgraf" scripts should also be executed.
- execute the "buildexe" script (see example below).
- from the "demo" directory execute the "extractDetector"
script which will create the "detector geometry" file needed for
the execution of the program (aee example below).
Create and/or modify (or copy from the example in the DIRAC ariane
directory on AFS mentioned above) the FFREAD instructions file
"FFreadInput" and a link to the executable module.
The detailed description and usage of the installation scripts is
explained in the following sections. In addition, each script contains
a summary of its functionalities and options which can be displayed on
line by typing a command such as "buildlib -h" and similarly for the
other scripts.
2. Build the library
click here for the listing
For example, on the AIX system, the command "buildlib -nd ariane113"
will produce the
library "ariane113.a" in the directory lib/aix
obtained from the compilation of all subroutines
contained in the directory src/aix/ariane113.fdir.
2. Build the graphics library
click here for the listing
For example, on the AIX system, the command "buildgraf -n graf"
will produce the
library "graf.a" in the directory lib/aix
obtained from the compilation of all subroutines
contained in the directory src/aix/graf.fdir.
3. Build the main program
click here for the listing
For example, the command "buildmain -nd ariane113" will produce the
object file diracb.o ("b" for batch) in the directory exe/aix.
The interactive version including the graphics functionalities could be
obtained with the command "buildmain -nig ariane113" which will
produce the object file diraci.o ('i' for interactive) in the directory
exe/aix.
4. Link and Build the executable module
click here for the listing
For example, the command "buildexe -n ariane113" will create the
executable module "ariane113.exe" in the directory exe/aix using the
(batch) main program, the library created in the previous commands
and the CERN library.
Similarly, tje command "buildexe -nig ariane113" creates the
executable module "ariane113.exe" in the directory exe/aix using the
(interactive) main program, the ariane and graf libraries created
previously and the CERN library, including graphics.
5. Extract the detector geometry
click here for the listing
For example, the command
"extractDetector -n ariane113 det113" will create the
file "det113.dat" in the directory from which the above command
is launched.
Job example
Table of Contents
The directory
"/afs/cern.ch/user/d/diracww/public/offline/ariane/dev/demo" contains an
example of input directives in the file "FFreadInput", the link "aixgo113"
to the executable module and the output text file "aix113out" produced
when the command "aixgo113 > aix113out" is typed on the terminal keyboard.
The directory
"/afs/cern.ch/user/d/diracww/public/offline/ariane/events"
contains a test sample of events from run 450 in the file
"450.e1to500" which can be transferred as appropriate.
Appendices
Table of Contents
-
Coordinates systems
click here
-
Detector File format
click here
- Monte Carlo block format
click here
- Detector Data File
click here
- Some semantic considerations
click here