User Tools

Site Tools


en:prog:root

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:prog:root [2010/03/05 18:44] (current)
Line 1: Line 1:
 +==== How I compile root program with gcc ====
 +
 + gcc `root-config --libs` `root-config --cflags`
 +
 +
 +
 +
 +
 +==== How I run root form an editor (e.g. vim) ====
 +
 + * I've written the following script
 +
 +
 +
 + #​!/​bin/​bash
 + # first look whether there is a terminal with root running
 + pid=$(ps -Ao ''​%p %a''​ |grep terminal|grep root|awk '​{print $1}')
 + if [ -n ''​$pid''​ ]; then kill $pid; fi
 + # now run new terminal and root inside
 + gnome-terminal --disable-factory --geometry 130x50 --window-with-profile=root --hide-menubar -x root -l $1++&
 +
 +
 +
 +It opens new terminal window and inside runs root which starts compiling source passed in $1. The first part looks for an existing ''​root''​ terminal window and closes it. Thus, after multiple script exucutions, there is just one ''​root''​ terminal window.
 +
 + * This script can be used in your favourite editor. In vim I use it through Ctrl-F9 hot key, it is achieved by following line in ''​.vimrc''​
 +
 + map <​C-F9>​ :​wa<​cr>:​!runroot %<​cr><​cr>​
 +
 +That '':​wa''​ save all documents first.
 +
 +
 +
 +
 +
 +==== Scram output colorized ====
 +
 +See [[en:​linux:​scripts:​sc|the script]].
 +
 +
 +
 +==== A great debugging tool ====
 +
 +Tired of endless debugging? Try [[http://​valgrind.org/​|Valgrind]]!
 +
 +
 +
 +
 +
 +
 +==== Event dump - show structure of an event ====
 +
 +  module dump = EventContentAnalyzer {}
 +
 +or
 +
 +  process.dump = cms.EDAnalyzer("​EventContentAnalyzer"​)
 +
 +Or use binary ''​edmDumpEventContent''​.
 +
 +
 +
 +==== Show steps/​progress of processing ====
 +
 +  service = Tracer {}
 +or
 +  process.Tracer = cms.Service("​Tracer"​
 +  )
 +in the new format (note the name ''​Tracer''​ is obligatory).
 +
 +==== A missing symbol ? ====
 +
 +The following script can find where it comes from.
 +<​code>​
 +#!/bin/bash
 +
 +if [ -z "​$1"​ ]
 +then
 + echo "​USAGE:​ cmssw_findsymbol <symbol to find>"​
 + exit 1
 +fi
 +
 +for file in  $CMSSW_BASE/​lib/​$SCRAM_ARCH/​*.so
 +do
 + output=`nm -C $file|grep -l "​$1"​`
 + if [ -n "​$output"​ ]
 + then
 + echo ${file##*/}
 + fi
 +done
 +</​code>​
 +
  
en/prog/root.txt · Last modified: 2010/03/05 18:44 (external edit)