LCSim
LCSim is the analysis and reconstruction framework in the
SiD software package.
Installation
Requirements
Installing from Scratch
Check out the project from CVS:
export CVSROOT=:pserver:anonymous@cvs.freehep.org:/cvs/lcd
cvs login (just hit enter when prompted for password)
cvs co lcsim
Build it with maven:
cd lcsim
mvn -DskipTests=true clean install
Preinstalled Version on AFS
You can find a pre-installed version on the CERN-LCD AFS space.
/afs/cern.ch/eng/clic/software/lcsim/
Creating a Driver
A driver is something which is executed by LCSim. While LCSim is looping over an event sample it calls the existing driver(s) and allows them to access the information stored in the LCIO event. Digitization, reconstruction and analysis code is written in the form of drivers. A tutorial on how to write an LCSim driver can be found
here.
Running LCSim
Using an XML Steering file
The easiest way to run LCSim is to use an xml steering file. In the steering file you have to define the input LCIO file, which drivers to load including their parameters and various other options. A detailed description can be found
here
.
Once the xml file is set up go to the
target directory in your LCSim installation directory and type
java -jar lcsim-<version>-bin.jar <steering.xml>
This example shows structure of an LCSim steering XML file:
<lcsim xmlns:lcsim="http://www.lcsim.org/schemas/lcsim/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
<inputFiles>
<fileUrl />
<file />
<fileSet>
<file />
</fileSet>
<fileList />
<fileUrlList />
</inputFiles>
<control>
<dryRun>true</dryRun>
<logFile>/path/to/mylog.txt</logFile>
<cacheDirectory>/path/to/mycache/</cacheDirectory>
<skipEvents>1</skipEvents>
<numberOfEvents>1000</numberOfEvents>
<verbose>true</verbose>
<printDriverStatistics>true</printDriverStatistics>
<printSystemProperties>true</printSystemProperties>
<printUserClassPath>true</printUserClassPath>
<printDriversDetailed>true</printDriversDetailed>
</control>
<classpath>
<jarUrl />
<jar />
<directory />
</classpath>
<define>
<anExampleVariable>1234</anExampleVarible>
</define>
<execute>
<driver name="ExampleDriver" />
</execute>
<drivers>
<driver name="ExampleDriver" type="org.lcsim.example.ExampleDriver">
<exampleParam>1234</exampleParam>
<exampleArrayParam>1 2 3 4</exampleParam>
<exampleArray2DParam>1 2 3 4; 5 6 7 8</exampleArray2DParam>
</driver>
</drivers>
</lcsim>

Since Mai 2010 it is mandatory to include the lcsim schema location into the steering xml. LCSim will check and produce an error if it is not set. So write
<lcsim xmlns:lcsim="http://www.lcsim.org/schemas/lcsim/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
instead of just
<lcsim>
at the beginning of your file.
On the Grid using ILCDIRAC
For ILCDIRAC an xml steering file is required (see above). The actual job submission is done with a python script.
from ILCDIRAC.Interfaces.API.DiracILC import DiracILC
from ILCDIRAC.Interfaces.API.ILCJob import ILCJob
dirac = DiracILC ( True , "repository.cfg" )
job = ILCJob ( )
job.setLCSIM ( "1.14-SNAPSHOT" ,
xmlfile="test.lcsim" ,
aliasproperties="alias.properties" ,
inputslcio="input.slcio" )
job.setInputSandbox ( [ 'lib', 'input.slcio' ] )
job.setOutputSandbox ( [ "*.log", "*.xml", "*.lcsim" ] )
job.setOutputData ( "" )
job.setCPUTime( 5000 )
job.setSystemConfig ( 'x86_64-slc5-gcc43-opt' )
job.setName ( "LCSIM Test" )
dirac.submit ( job )
Inside JAS3
It is possible to run and even write your own drivers in
JAS3. AIDA plots which are filled by the driver can be viewed immediately. It is recommended to write the driver outside of JAS3 because it offers just a plain text editor without syntax highlighting.
A detailed tutorial can be found
here
.
- open an lcio file in JAS3 including the data you want to analyze (File->Open File)
- open the java file containing the driver in JAS3 (File->Open File)
- compile the java file (File->Compile) and load it (File->Load)
- run the analysis (alt+G)
- you can also edit the java file in your favorite editor simultaniously. Jas3 will notice that the file has changed. You just need to compile it again but you don't have to load it again.
- rewind (alt+R) and run the analysis again (alt+G)
Writing a Full Main Loop
You can also write your own java programm which has to open the input LCIO file, load the drivers and execute the event loop.
import java.io.File;
import org.lcsim.util.loop.LCSimLoop;
public class TestMainLoop {
public static void main(String[] args) throws Exception {
LCSimLoop loop = new LCSimLoop();
MyDriver myDriver = new MyDriver();
loop.add( myDriver );
String fileName = "/path/to/input/file.slcio";
File inputFile = new File(fileName);
loop.setLCIORecordSource(inputFile);
loop.loop(-1);
loop.dispose();
}
}
Setting the Detector / Conditions Database
When running LCSim it will automatically retrieve the detector definition, including calibration files like sampling fractions, etc. This feature requires that the detector is available at
http://www.lcsim.org/detectors
(and that the server is online). If you want to use a different detector you have to set its location in the
alias.properties file. The default location for the alias file is
~/.lcsim/
.
myDetectorName : detectorName
detectorName : /path/to/detector/directory
detectorName2 : http://www.example.com/my/detector.zip

LCSim will not work when it can not find the detector description, even if you actually do not need any of the information.

When using your own detector it has to include at least a text file called
detector.properties with the line:
name: detectorName
.
FAQ