14 removed + 1 modified, total 15 files
lcio/examples/cpp/lcioframe
diff -u -r1.1 -r1.2
--- README 31 Oct 2003 13:25:09 -0000 1.1
+++ README 28 Mar 2007 16:15:42 -0000 1.2
@@ -9,68 +9,7 @@
# Frank Gaede, 2003/16/09
#########################################################################################
-Requirements:
-
- - currently Linux/gcc only
- - Root installation
-
-Building the program:
-
- - set environment, e.g. with env.sh modified to
- your system :
-
- #
- # set the environment for the lcioframe example
- # modify the $ROOTSYS as needed
- #
-
- export ROOTSYS=/products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3
- export PATH=${ROOTSYS}/bin:${PATH}
- export LD_LIBRARY_PATH=${ROOTSYS}/lib:${LD_LIBRARY_PATH}
-
- - type:
- gmake
-
-
-Running the program:
-
- lcioframe myFile.slcio [lcioframe.steer]
- myFile.slcio : LCIO input file
- lcioframe.steer : steering file with module names
-
-
-Files:
-
-user defined analysis modules - use as example to create your own modules:
- MCParticleHistograms.cc
- MCParticleHistograms.h
- CalorimeterHitHistograms.cc
- CalorimeterHitHistograms.h
-inherit from:
- LCIOModule.cc
- LCIOModule.h
-
-a class for global constants/steering variables
- LCIOFrameSteer.cc
- LCIOFrameSteer.h
-
-instance of root file shared by modules:
- MyRootFile.cc
- MyRootFile.h
-
-the main program (no changes needed to run other modules)
- lcioframe.cc
-
-
-auxilliary files:
-
- GNUmakefile
- README
- env.sh
- lcioframe.steer
-
-
-
+ lcioframe is obsolete - please use the marlin (http://ilcsoft.desy.de/marlin)
lcio/examples/cpp/lcioframe
diff -N CalorimeterHitHistograms.cc
--- CalorimeterHitHistograms.cc 11 Nov 2003 18:27:03 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,140 +0,0 @@
-#include "CalorimeterHitHistograms.h"
-#include "LCIOFrameSteer.h"
-
-#include "EVENT/LCIO.h"
-#include "EVENT/LCCollection.h"
-#include "EVENT/SimCalorimeterHit.h"
-#include "EVENT/CalorimeterHit.h"
-#include "IMPL/LCFlagImpl.h"
-#include "MyRootFile.h"
-
-#include <sstream>
-
-//------- need one global instance of this module ----------------------------
-CalorimeterHitHistograms calorimeterHitHistograms("CalorimeterHitHistograms") ;
-//-----------------------------------------------------------------------------
-
-
-CalorimeterHitHistograms::CalorimeterHitHistograms(const char* moduleName)
- : LCIOModule(moduleName ),
- hfile(0),
- firstEventInRun( true ) {
-
-}
-
-CalorimeterHitHistograms::~CalorimeterHitHistograms(){
- if(hfile)
- hfile->Write() ;
-}
-
-void CalorimeterHitHistograms::processEvent( LCEvent * evt ) {
-
- // as we look at arbitrary files we don't know the names of
- // the collections with calorimeterhits
- // thus we loop over all collections and create subfolder with collection names
-
- typedef const std::vector< std::string > StringVec ;
- typedef std::vector< const std::string* > StringPVec ;
- StringVec* strVec = evt->getCollectionNames() ;
- StringPVec calCols ;
-
- if(firstEventInRun){
-
- for( StringVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
-
- LCCollection* col = evt->getCollection( *name ) ;
-
- if( col->getTypeName() == LCIO::SIMCALORIMETERHIT ||
- col->getTypeName() == LCIO::CALORIMETERHIT ){
-
- calCols.push_back( &(*name) ) ;
-
- // make a subfolder and create histograms for every collection
- runDir->mkdir( name->c_str() ) ;
- runDir->cd( name->c_str() ) ;
-
- hEhit = new TH1F("hEhit"," hit energy",500,0.,.001);
- hEhit->SetBit(TH1::kCanRebin) ;
-
- hElong = new TH1F("hElong"," hit energy longitudenal",100,0.,10.);
- hElong->SetBit(TH1::kCanRebin) ;
-
- hEradial = new TH1F("hEradial"," hit energy radial",50,0.,10);
- hEradial->SetBit(TH1::kCanRebin) ;
-
- }
- }
- firstEventInRun = false ;
- }
- // now loop over cal collections
-
- for( StringPVec::const_iterator name = calCols.begin() ; name != calCols.end() ; name++){
-
- LCCollection* col = evt->getCollection( **name ) ;
-
- int nHits = col->getNumberOfElements() ;
-
- if( col->getTypeName() == LCIO::SIMCALORIMETERHIT ){
- for( int i=0 ; i< nHits ; i++ ){
-
- SimCalorimeterHit* hit = dynamic_cast<SimCalorimeterHit*>( col->getElementAt( i ) ) ;
- hEhit->Fill( hit->getEnergy() ) ;
-
- LCFlagImpl flag( col->getFlag() ) ;
- if( flag.bitSet( LCIO::CHBIT_LONG )){ // postion stored
-
- hElong->Fill( hit->getPosition()[2] , hit->getEnergy() ) ;
- float radius = sqrt( hit->getPosition()[0]*hit->getPosition()[0]
- +hit->getPosition()[1]*hit->getPosition()[1] ) ;
- hEradial->Fill( radius , hit->getEnergy() ) ;
-
- }
- }
-
- }else{ // real data calorimeter hit
-
- for( int i=0 ; i< nHits ; i++ ){
- CalorimeterHit* hit = dynamic_cast<CalorimeterHit*>( col->getElementAt( i ) ) ;
- hEhit->Fill( hit->getEnergy() ) ;
-
- LCFlagImpl flag( col->getFlag() ) ;
- if( flag.bitSet( LCIO::CHBIT_LONG )){ // postion stored
-
- hElong->Fill( hit->getPosition()[2] , hit->getEnergy() ) ;
- float radius = sqrt( hit->getPosition()[0]*hit->getPosition()[0]
- +hit->getPosition()[1]*hit->getPosition()[1] ) ;
- hEradial->Fill( radius , hit->getEnergy() ) ;
- }
- }
- }
- } // cal collections
-}
-
-
-void CalorimeterHitHistograms::processRunHeader( LCRunHeader* run) {
-
- firstEventInRun = true ;
-
- // create a folder this run - if it doesn't exist yet
- stringstream runFolder ;
- runFolder << "run_" << run->getRunNumber() << ends ;
-
- runDir = dynamic_cast<TDirectory*>( hfile->Get( runFolder.str().c_str() ) ) ;
-
- if( runDir == 0 )
- runDir = hfile->mkdir( runFolder.str().c_str() );
- runDir->cd() ;
-}
-
-void CalorimeterHitHistograms::initModule() {
-
- // open / reopen the root file
-
- std::stringstream rootFileName ;
- rootFileName << LCIOFrameSteer::baseFileName << ".root" << std::ends ;
-
- hfile = MyRootFile::getInstance( rootFileName.str().c_str() ) ;
-
-}
-
-
lcio/examples/cpp/lcioframe
diff -N CalorimeterHitHistograms.h
--- CalorimeterHitHistograms.h 31 Oct 2003 13:25:08 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-#ifndef CalorimeterHitHistograms_h
-#define CalorimeterHitHistograms_h
-
-#include "TFile.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TDirectory.h"
-
-#include "LCIOModule.h"
-
-#include <cstdlib>
-#include <iostream>
-
-using namespace std ;
-using namespace lcio ;
-
-
-/** Minimodule that creates some root histograms from all SimCalorimeterHit and
- * CalorimeterHit (real data) collections in an LCIO file.
- */
-class CalorimeterHitHistograms : public LCIOModule {
-
-public:
-
- CalorimeterHitHistograms(const char* moduleName) ;
- ~CalorimeterHitHistograms() ;
-
- void processEvent( LCEvent * evt ) ;
- void processRunHeader( LCRunHeader* run) ;
- void initModule() ;
-
-private:
- TFile* hfile ; // the root file
-
- // create a directory for every run
- TDirectory * runDir ;
-
- // some histograms
- TH1F* hEhit ; // hit energy
- TH1F* hElong ; // longitudenal energy distribution
- TH1F* hEradial ; // radial energy distribution
- TH2F* hhitmap ; // energy distribution in x,y
-
- bool firstEventInRun ;
-};
-
-
-#endif
lcio/examples/cpp/lcioframe
diff -N GNUmakefile
--- GNUmakefile 31 Oct 2003 13:25:08 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,64 +0,0 @@
-ObjSuf = o
-SrcSuf = cc
-ExeSuf =
-DllSuf = so
-OutPutOpt = -o
-
-ROOTCFLAGS := $(shell root-config --cflags)
-ROOTLIBS := $(shell root-config --libs)
-ROOTGLIBS := $(shell root-config --glibs)
-
-# Linux with egcs, gcc 2.9x, gcc 3.x (>= RedHat 5.2)
-CXX = g++
-CXXFLAGS = -g -O -Wall -fPIC
-LD = g++
-LDFLAGS = -O
-SOFLAGS = -shared
-
-CXXFLAGS += $(ROOTCFLAGS)
-LIBS = $(ROOTLIBS) $(SYSLIBS)
-GLIBS = $(ROOTGLIBS) $(SYSLIBS)
-
-#------ LCIO includes and libs -------------------------
-CXXFLAGS += -I$(LCIO)/src/cpp/include
-LIBS += -L$(LCIO)/lib -llcio -L$(LCIO)/sio/lib -lsio -lz
-#--------------------------------------------------------
-
-#------------------------------------------------------------------------------
-#objects := $(patsubst %.cc,%.o,$(wildcard *.cc))
-
-HSIMPLEO = $(patsubst %.$(SrcSuf),%.$(ObjSuf),$(wildcard *.$(SrcSuf)))
-
-
-#HSIMPLEO = MyAnalysis.$(ObjSuf) hcalpptana.$(ObjSuf)
-#HSIMPLES = MyAnalysis.$(SrcSuf) hcalpptana.$(SrcSuf)
-
-HSIMPLE = lcioframe$(ExeSuf)
-OBJS = $(HSIMPLEO)
-PROGRAMS = $(HSIMPLE)
-
-#------------------------------------------------------------------------------
-
-.SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)
-
-all: $(PROGRAMS)
-
-$(HSIMPLE): $(HSIMPLEO)
- $(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
- @echo "$@ done"
-
-
-clean:
- @rm -f $(OBJS) core
-
-distclean: clean
- @rm -f $(PROGRAMS) $(EVENTSO) $(EVENTLIB) *Dict.* *.def *.exp \
- *.root *.ps *.so .def so_locations
- @rm -rf cxx_repository
-
-.SUFFIXES: .$(SrcSuf)
-
-###
-
-.$(SrcSuf).$(ObjSuf):
- $(CXX) $(CXXFLAGS) -c $<
lcio/examples/cpp/lcioframe
diff -N LCIOFrameSteer.cc
--- LCIOFrameSteer.cc 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
-#include "LCIOFrameSteer.h"
-
-
-
-std::string LCIOFrameSteer::baseFileName ;
lcio/examples/cpp/lcioframe
diff -N LCIOFrameSteer.h
--- LCIOFrameSteer.h 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-#ifndef LCIOFrameSteer_h
-#define LCIOFrameSteer_h 1
-
-#include <string>
-
-/** Some global constants available throughout all modules - extend as needed.
- */
-
-class LCIOFrameSteer{
-
- public:
-
- // base file name - used for LCIO input and root outputfile
- static std::string baseFileName ;
-
-};
-
-#endif
lcio/examples/cpp/lcioframe
diff -N LCIOModule.cc
--- LCIOModule.cc 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
-#include "LCIOModule.h"
-
-using namespace lcio ;
-
-
-LCIOModuleMap* LCIOModuleMap::_map = 0 ;
-
-LCIOModuleMap* LCIOModuleMap::getInstance(){
- if( !_map )
- _map = new LCIOModuleMap ;
- return _map ;
-}
-
-
-LCIOModule::LCIOModule(const char* moduleName){
-
- //register module in map
- (* LCIOModuleMap::getInstance() )[ moduleName ] = this ;
-}
-
-LCIOModule::LCIOModule(){}
-
-LCIOModule::~LCIOModule() {}
-
-
-void LCIOModule::initModule() {
- // nothing to be done here
-}
lcio/examples/cpp/lcioframe
diff -N LCIOModule.h
--- LCIOModule.h 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-#ifndef LCIOModule_h
-#define LCIOModule_h 1
-
-#include "lcio.h"
-
-#include "IO/LCRunListener.h"
-#include "IO/LCEventListener.h"
-#include "IO/LCReader.h"
-#include "EVENT/LCEvent.h"
-#include "EVENT/LCRunHeader.h"
-
-#include <map>
-
-using namespace std ;
-using namespace lcio ;
-
-class LCIOModule ;
-class LCIOModuleMap ;
-
-typedef std::map< std::string , LCIOModule* > ModuleMap ;
-
-/** Base class for modules for analyzing LCIO files.
- * Provides (empty) default implementations of member functions.
- * Inherit from this class and create one global instance
- * of your module.
- */
-class LCIOModule : public LCRunListener, public LCEventListener{
-
-private:
-
- LCIOModule() ;
-
-public:
-
-
- /* Only constructor - specify a unique name for your module.
- * Do not allocate any resources in the constructor but use
- * initModule() instead.
- */
- LCIOModule(const char* moduleName) ;
-
- virtual ~LCIOModule() ;
-
-
- // the LCRunListener and LceventListener interfaces default implementations
- // overwrite in your module as needed (typically the processRunHeader/Event methods)
- virtual void processEvent( LCEvent * evt ) { /*no_op*/ ;}
- virtual void processRunHeader( LCRunHeader* run) { /*no_op*/; }
-
- virtual void modifyEvent( LCEvent * evt ) { /*no_op*/ ;}
- virtual void modifyRunHeader( LCRunHeader* run) { /*no_op*/; }
-
-
- virtual void initModule() ;
-
-};
-
-class LCIOModuleMap : public ModuleMap{
-
-public:
- // returns the map of all modules
- static LCIOModuleMap* getInstance() ;
-
-protected:
- // static map of all known modules
- static LCIOModuleMap* _map ;
-} ;
-
-#endif
lcio/examples/cpp/lcioframe
diff -N MCParticleHistograms.cc
--- MCParticleHistograms.cc 7 Nov 2003 18:33:00 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,115 +0,0 @@
-#include "MCParticleHistograms.h"
-#include "LCIOFrameSteer.h"
-
-#include "EVENT/LCIO.h"
-#include "EVENT/LCCollection.h"
-#include "EVENT/MCParticle.h"
-#include "IMPL/LCFlagImpl.h"
-
-#include "MyRootFile.h"
-
-#include <sstream>
-
-//------- need one global instance of this module ----------------
-MCParticleHistograms mcParticleHistograms("MCParticleHistograms") ;
-//-----------------------------------------------------------------
-
-
-MCParticleHistograms::MCParticleHistograms(const char* moduleName)
- : LCIOModule(moduleName ),
- hfile(0),
- firstEventInRun( true ) {
-}
-
-MCParticleHistograms::~MCParticleHistograms(){
-
- if(hfile)
- hfile->Write() ;
-
-}
-
-void MCParticleHistograms::processEvent( LCEvent * evt ) {
-
- // as we look at arbitrary files we don't know the names of
- // the collections with calorimeterhits
- // thus we loop over all collections and create subfolder with collection names
-
- typedef const std::vector< std::string > StringVec ;
- StringVec* strVec = evt->getCollectionNames() ;
-
- for( StringVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
-
- LCCollection* col = evt->getCollection( *name ) ;
-
- if( col->getTypeName() == LCIO::MCPARTICLE ){
-
- if(firstEventInRun){
-
- // make a subfolder and create histograms for every collection
- runDir->mkdir( name->c_str() ) ;
- runDir->cd( name->c_str() ) ;
-
-
- hEMother = new TH1F("hEMother","energy of mother particles",100,0.,10.);
- hEMother->SetBit(TH1::kCanRebin) ;
-
- hTypeMother = new TH1F("hTypeMother"," type of mother particles",4000,-2000.,2000.);
- hTypeMother->SetBit(TH1::kCanRebin) ;
-
- hEstable = new TH1F("hEstable","energy of stable particles",100,0.,10.);
- hEstable->SetBit(TH1::kCanRebin) ;
-
- hTypestable = new TH1F("hTypestable"," type of stable particles",4000,-2000.,2000.);
- hTypestable->SetBit(TH1::kCanRebin) ;
-
-
- firstEventInRun = false ;
- }
-
- int nHits = col->getNumberOfElements() ;
-
- for( int i=0 ; i< nHits ; i++ ){
-
- MCParticle* particle = dynamic_cast<MCParticle*>( col->getElementAt( i ) ) ;
-
- if( particle->getNumberOfParents() == 0 ){ // mother
- hEMother->Fill( particle->getEnergy() ) ;
- hTypeMother->Fill( particle->getPDG() ) ;
- }
- if( particle->getNumberOfDaughters() == 0 ){ // 'stable'
- hEstable->Fill( particle->getEnergy() ) ;
- hTypestable->Fill( particle->getPDG() ) ;
- }
- }
- }
- } // loop over collections
-}
-
-void MCParticleHistograms::processRunHeader( LCRunHeader* run) {
-
- firstEventInRun = true ;
-
- // create a folder this run - if it doesn't exist yet
- stringstream runFolder ;
- runFolder << "run_" << run->getRunNumber() << ends ;
-
- runDir = dynamic_cast<TDirectory*>( hfile->Get( runFolder.str().c_str() ) ) ;
-
- if( runDir == 0 )
- runDir = hfile->mkdir( runFolder.str().c_str() );
- runDir->cd() ;
-
-}
-
-void MCParticleHistograms::initModule() {
-
- // open / reopen the root file
-
- std::stringstream rootFileName ;
- rootFileName << LCIOFrameSteer::baseFileName << ".root" << std::ends ;
-
- hfile = MyRootFile::getInstance( rootFileName.str().c_str() ) ;
-
-}
-
-
lcio/examples/cpp/lcioframe
diff -N MCParticleHistograms.h
--- MCParticleHistograms.h 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-#ifndef MCParticleHistograms_h
-#define MCParticleHistograms_h
-
-//#include "lcio.h"
-
-
-#include "TFile.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TDirectory.h"
-
-#include "LCIOModule.h"
-
-#include <cstdlib>
-#include <iostream>
-
-using namespace std ;
-using namespace lcio ;
-
-/** Minimodule that creates some root histograms from the MCParticle collection
- * in an LCIO file.
- */
-
-class MCParticleHistograms : public LCIOModule {
-
-public:
-
- MCParticleHistograms(const char* moduleName) ;
- ~MCParticleHistograms() ;
-
- void processEvent( LCEvent * evt ) ;
- void processRunHeader( LCRunHeader* run) ;
- void initModule() ;
-
-private:
- TFile* hfile ; // the root file
-
- // create a directory for every run
- TDirectory * runDir ;
-
- // some histograms
- TH1F* hEMother ; // energy of mother particles
- TH1F* hTypeMother ; // type of mother particles
- TH1F* hEstable ; // energy of stable particles
- TH1F* hTypestable ; // type of stable particles
-
- bool firstEventInRun ;
-};
-
-
-#endif
lcio/examples/cpp/lcioframe
diff -N MyRootFile.cc
--- MyRootFile.cc 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-#include "MyRootFile.h"
-
-MyRootFile* MyRootFile::_hfile = 0 ;
-
-
-MyRootFile::MyRootFile(const char* name,const char* mode,const char *title) :
- TFile( name , mode, title )
-{
-}
-
-MyRootFile::~MyRootFile() {
-
- if( _hfile )
- _hfile->Close() ;
-}
-
-MyRootFile* MyRootFile::getInstance(const char* name){
-
- if( !_hfile )
- _hfile = new MyRootFile( name ,
- "RECREATE","Root file with example histograms from arbitrary LCIO file") ;
-
- return _hfile ;
-}
lcio/examples/cpp/lcioframe
diff -N MyRootFile.h
--- MyRootFile.h 31 Oct 2003 13:25:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-#ifndef MyRootFile_h
-#define MyRootFile_h
-
-#include "TFile.h"
-
-/** Singleton for one instance of a root file used by all modules.
- */
-class MyRootFile: public TFile{
-
- private:
- MyRootFile() ;
-
-
- MyRootFile(const char* name,const char* mode,const char *title) ;
-
-public:
-
- ~MyRootFile() ;
-
- /** Returns the current root file is it exists - the first call to this
- * function determines the name of the file !
- */
- static MyRootFile* getInstance(const char* FileName ) ;
-
- //private:
- static MyRootFile* _hfile ; // the root file
-};
-
-
-#endif
lcio/examples/cpp/lcioframe
diff -N env.sh
--- env.sh 31 Oct 2003 13:25:10 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-#
-# set the environment for the lcioframe example
-# modify the $ROOTSYS as needed
-#
-
-export ROOTSYS=/products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3
-export PATH=${ROOTSYS}/bin:${PATH}
-export LD_LIBRARY_PATH=${ROOTSYS}/lib:${LD_LIBRARY_PATH}
-
-
lcio/examples/cpp/lcioframe
diff -N lcioframe.cc
--- lcioframe.cc 31 Oct 2003 13:25:10 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,119 +0,0 @@
-#include "lcio.h"
-#include "LCIOModule.h"
-#include "CalorimeterHitHistograms.h"
-#include "IO/LCReader.h"
-
-#include "LCIOFrameSteer.h"
-#include <sstream>
-#include <fstream>
-#include <string>
-
-using namespace std ;
-using namespace lcio ;
-
-
-typedef std::vector<const char*> StringVec ;
-
-void registerModule(const char* moduleName, LCReader* lcReader) ;
-int readNextValidLine( std::string& str , istream& stream) ;
-
-
-/** Example of a mini framework that can be used to ananlyse LCIO data files
- * with root. The main program is independent of root and can be used with other
- * analysis tools as well. All you need to do is to write your own subclasses
- * of LCModule.
- */
-int main(int argc, char** argv ){
-
- const char* steeringFileName = "lcioframe.steer" ;
-
-
- // read file name from command line
- if( argc > 1 ) {
-
- string filename( argv[1] ) ;
- if( filename.substr( filename.length() - strlen(".slcio") , strlen(".slcio") ) !=
- ".slcio") {
-
- LCIOFrameSteer::baseFileName = filename ;
-
- } else {
-
- LCIOFrameSteer::baseFileName = filename.substr(0 , filename.length() - strlen(".slcio") ) ;
- }
-
- } else {
- cout << " usage: lcioframe lciofile [lcioframe.steer]" << endl
- << " lciofile: filename " << endl
- << " [lcioframe.steer] optional steering file name - default is lcioframe.steer"
- << endl ;
- exit(1) ;
- }
-
- if( argc > 2 ){
- steeringFileName = argv[2] ;
- }
-
- stringstream fileName ;
- fileName << LCIOFrameSteer::baseFileName << ".slcio" << ends ;
-
- // create lcio reader
- LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
-
- lcReader->open( fileName.str() ) ;
-
- // open steering file with module names
-
- ifstream inFile( steeringFileName ) ;
- if( ! inFile ){
- std::cout << " Couldn't open steering file: " << steeringFileName << std::endl ;
- exit(1) ;
- }
- string moduleName ;
- // try{
- while( readNextValidLine(moduleName, inFile) ){
-
- registerModule( moduleName.c_str() , lcReader ) ;
-
- }
-
- lcReader->readStream() ;
- lcReader->close() ;
-
- return 0 ;
-
-}
-
-void registerModule(const char* moduleName, LCReader* lcReader){
-
- LCIOModule*lcioModule = (* LCIOModuleMap::getInstance() )[ moduleName ] ;
- if( lcioModule ) {
- lcioModule->initModule() ;
- lcReader->registerLCRunListener( lcioModule ) ;
- lcReader->registerLCEventListener( lcioModule ) ;
- cout << " registering module : " << moduleName << endl ;
- } else{
- cout << "WARNING: no instance of module: " << moduleName << " found ! " << endl ;
- }
-
-}
-
-/** Small helper method that reads the next line from stdin (cin)
- * that is not empty or starts with a '#'
- */
-int readNextValidLine( std::string& str , istream& stream){
-
-// static ifstream inFile("modules.steer") ;
-
-// if( ! inFile )
-// throw new lcio::Exception(" Couldn't open steering file: lcioframe.steer" ) ;
-
- while( ! stream.eof() ) {
-
- getline( stream , str ) ;
-
- if( str.length() != 0 && str[0] != '#' )
- return str.length() ;
- }
- return 0 ;
-}
lcio/examples/cpp/lcioframe
diff -N lcioframe.steer
--- lcioframe.steer 31 Oct 2003 13:25:10 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-
-############################################
-#
-# modules to be run with lcioframe
-#
-############################################
-
-# MC truth
-MCParticleHistograms
-
-
-# calorimeter hits (real and sim)
-CalorimeterHitHistograms
-
CVSspam 0.2.8