Creating and Using Framework/AC++ Modules
- If you do not do this in your login: source ~cdfsoft/cdf2.cshrc
- setup cdfsoft2
- This example will take up about 9000 blocks of disk space so if you
do not have that much space in your home area, go to your scratch area:
cd /spool/<your_name>
- newrel -t 1.8.0 testrel
- cd testrel
- newpkg MyExample
- cd MyExample
- cp $EXAMPLES_DIR/HistExample.cc MyModule.cc
- cp $EXAMPLES_DIR/HistExample.hh MyModule.hh
- cp $EXAMPLES_DIR/AppUserBuild_template.cc MyExample_test.cc
- chmod 775 * this will allow you to edit them.
- Edit the MyModule* files. Inside MyModule.cc, and
MyExample_test.cc replace
#include "Examples/HistExample.hh"
with
#include "MyExample/MyModule.hh"
- inside MyExample_test.cc change the line:
aModule = new HistExample( "hist", "Histogramming example" );
to
aModule = new MyModule( "MyModule1", "My example module" );
This file has the same purpose as the build_job output file in the old
system. Changing the first line to the second says that in this
test job create an instance of MyModule called MyModule1 not the
HistModule. The first argument is the name to use on the AC++ command
line and the second will be used as the discription field.
- inside MyModule.hh and MyModule.cc, change all occurrences of
HistExample to MyModule
- Now make any functional changes to MyExample.cc that you wish.
Suggestions from the class syllabus may be too ambitious but we can help
if you are really interested:
- Add cuts to candidate muons and/or tracks
- Implement a "distance of closest approach" cut
- Extend to electron or meson candidates, other decays
In order to do this you should:
- Identify banks needed, $BANKS_DIR/Banks/*.hh
- Create classes for them if needed (this is the hard part)
An easier excersize would be to use the already existing classes in
the example in different ways.
- Look at $BANKS_DIR/Banks/CMUO_Bank.hh to see what other named
accessors could be used.
- Add histograms of other interesting quantaties.
In any case even if you don't make any changes you should at least
make it write something new to cout so that you know that your module
is actually run and not the HistMoudle.
- cd .. Go back to the top level of the release, (testrel).
This is where the make command should always run from.
- gmake
- run the executable from the top level of the release, invoke it with
whatever name you choose for the
BINS target in your GNUmakefile. It will be MyExample_test if you did
not edit the make file. The binary can be run from the
testrel directory without a path specification and it is also easier
for the debuggers to find sources if you launch them from this
directory.
- cp $EXAMPLES_DIR/run_ac++hist_ex.tcl run.tcl tcl files
can be used the way uic files were used in the old system. If you are on
cdfsga you can use the run.tcl file without changing the input file name
because the data file it uses is in the standard validation area. However
you should edit it and change hist to MyModule1 so that
your module will be run in the SamplePath instead. For more
available commands see the beginning chapters of
this document. Although it is very old the commands have not changed.
Much work on the user interface is needed and it will be improved
this fall.
Notes on Using ddd
Because of the way I/O is directed within ddd, I have found that it is easiest
to use the run.tcl file you created in the last step above.
Start up ddd with the command ddd bin/IRIX6/exename & Set breakes in
the source window with the right mouse button. The file pull-down menu allows you to
set breaks in other sources. To start debugging go to the Program pull-down menu
and select Run..., type run.tcl under the box that says Run with Arguments
hit (cr) and you will see the contents of standard out go to the commands
window when it stops with a gdb prompt you can start debugging. You can use
the gdb command line interface but I prefer to use the gui on the source window
since I don't want to memorize those commands. It's pretty obvious what the
step/next and continue buttons do but if you want to print something you have to
errase the word main then type in the name of the thing you want to print
or display and then hit the appropriate button. Remeber that if the variable that
you have is a pointer and you type in the pointer name by itself it will just echo
an address. What you are probably more interested in is the contents of the thing
it is pointing to. In order to see this with the debugger type *pointer_name then
hit print or display.
Internet Address: sexton@fnal.gov
Office Phone: 840-4974