RecoControl Class Reference

#include <RecoControl.h>

List of all members.

Public Types

enum  rectype { NONE, GEOM, GEVT }

Public Member Functions

 RecoControl ()
void init (const char *, int)
virtual ~RecoControl ()
void clear ()
rectype nextRecord ()
void reconstruction ()
void setOutputFile (const char *)
void setInputFile (const char *)
void setDstFile (const char *)
void closeAll ()
int eof ()
const char * eventTitle ()
void setPrintStream (std::ostream *o)
void printEvent ()
virtual void giveEventTo (REROOT_Visitor &)
virtual void giveGeomTo (REROOT_Visitor &)
REROOT_Eventcurevent ()
REROOT_Geomcurgeom ()

Private Attributes

const char * _iniFile
const char * _inputFileName
int _nevtot
long _record
REROOT_Event_curevent
REROOT_Geom_curgeom
ADAMO_Shell_ads
std::istream * _inputStream
std::ostream * _outputStream
std::ostream * _tupleFile
std::ostream * pstream

Detailed Description

Definition at line 20 of file RecoControl.h.


Member Enumeration Documentation

Enumerator:
NONE 
GEOM 
GEVT 

Definition at line 25 of file RecoControl.h.

00025 {NONE, GEOM, GEVT};


Constructor & Destructor Documentation

RecoControl::RecoControl (  ) 

Definition at line 10 of file RecoControl.cxx.

00010                          :
00011   _iniFile(0)
00012 , _inputFileName(0)
00013 , _nevtot(0)
00014 , _record(0)
00015 , _curevent(0)
00016 , _curgeom(0)
00017 , _ads(0)
00018 , _inputStream(0)
00019 , _outputStream(0)
00020 , _tupleFile(0)
00021 ,  pstream(&cout)
00022 {}

RecoControl::~RecoControl (  )  [virtual]

Definition at line 24 of file RecoControl.cxx.

References _ads, _curevent, _curgeom, and closeAll().

00025 {
00026     closeAll();
00027     delete _curevent;
00028     delete _curgeom;
00029     delete _ads;
00030 }


Member Function Documentation

void RecoControl::clear (  ) 

Definition at line 81 of file RecoControl.cxx.

00082 {
00083 }

void RecoControl::closeAll (  ) 

Definition at line 59 of file RecoControl.cxx.

References _inputStream, _outputStream, and _tupleFile.

Referenced by ~RecoControl().

00060 {
00061     if ( _inputStream ) {
00062         delete _inputStream;
00063         _inputStream = 0;
00064     }
00065     if ( _outputStream ) {
00066         delete _outputStream;
00067         _outputStream=0;
00068     }
00069     if ( _tupleFile ) {
00070         delete _tupleFile;
00071         _tupleFile=0;
00072     }
00073 }

REROOT_Event* RecoControl::curevent (  )  [inline]

Definition at line 55 of file RecoControl.h.

References _curevent.

Referenced by processSingleFile().

00055 {return _curevent;}

REROOT_Geom* RecoControl::curgeom (  )  [inline]

Definition at line 56 of file RecoControl.h.

References _curgeom.

Referenced by processSingleFile().

00056 {return _curgeom;}

int RecoControl::eof (  ) 

Definition at line 118 of file RecoControl.cxx.

References _inputStream.

00119 { 
00120     return (_inputStream==0)? 0 : _inputStream->eof();
00121 }

const char* RecoControl::eventTitle (  ) 
void RecoControl::giveEventTo ( REROOT_Visitor av  )  [virtual]

Definition at line 140 of file RecoControl.cxx.

References _curevent, and REROOT_Event::accept().

Referenced by processSingleFile().

00141 {
00142       if (_curevent) _curevent->accept(av);
00143 }

void RecoControl::giveGeomTo ( REROOT_Visitor av  )  [virtual]

Definition at line 145 of file RecoControl.cxx.

References _curgeom, and REROOT_Geom::accept().

Referenced by processSingleFile().

00146 {
00147       if (_curgeom) _curgeom->accept(av);
00148 }

void RecoControl::init ( const char *  infile,
int  nevtot 
)

Definition at line 32 of file RecoControl.cxx.

References _ads, _iniFile, and _nevtot.

Referenced by processSingleFile().

00033 {
00034     _iniFile = infile;
00035     _nevtot = nevtot;
00036 
00037     if (!_ads) _ads = new ADAMO_Shell();
00038 }

RecoControl::rectype RecoControl::nextRecord (  ) 

Definition at line 85 of file RecoControl.cxx.

References _ads, _curevent, _curgeom, _iniFile, REROOT_Event::fill_objects_from_GAF(), REROOT_Geom::fill_objects_from_GAF(), GEOM, ADAMO_Shell::gettab(), GEVT, NONE, ADAMO_Shell::read(), REROOT_Event::Set_curevent(), and REROOT_Geom::Set_curgeom().

Referenced by processSingleFile().

00086 {
00087 
00088 // Get next ADAMO record from input file.
00089    if (_ads->read(_iniFile))
00090         return NONE;
00091 
00092 // Construct new current Event object from new GAF record.
00093    if (!strncmp((_ads->gettab((GAFKEY_DEF *) 0,1))->Type,"GEVT",4)) {
00094 //      cout << "RecoControl::nextEvent: Accept GEVT record" << "\n";
00095         delete _curevent;
00096         _curevent = new REROOT_Event;
00097         _curevent->fill_objects_from_GAF(_ads);
00098         REROOT_Event::Set_curevent(_curevent);
00099         return GEVT;
00100    }
00101 
00102 // Construct new current Geom object from new GAF record.
00103  else if (!strncmp((_ads->gettab((GAFKEY_DEF *) 0,1))->Type,"GEOM",4)) {
00104 //      cout << "RecoControl::nextEvent: Accept GEOM record" << "\n";
00105         delete _curgeom;
00106         _curgeom = new REROOT_Geom;
00107         _curgeom->fill_objects_from_GAF(_ads);
00108         REROOT_Geom::Set_curgeom(_curgeom);
00109         return GEOM;
00110    }
00111    else {
00112         cout << "RecoControl::nextEvent: Skip unknown record" << "\n";
00113         return NONE;
00114    }
00115    return NONE;
00116 }

void RecoControl::printEvent (  ) 

Definition at line 135 of file RecoControl.cxx.

00136 {
00137 //  if (_curevent) _curevent->printEvent(*pstream);
00138 }

void RecoControl::reconstruction (  ) 

Definition at line 130 of file RecoControl.cxx.

Referenced by processSingleFile().

00131 {
00132 }

void RecoControl::setDstFile ( const char *  fileName  ) 

Definition at line 75 of file RecoControl.cxx.

References _tupleFile.

00076 {
00077     if ( strcmp(fileName, "cout")==0 ) _tupleFile = &cout;
00078     else _tupleFile = new std::ofstream(fileName);
00079 }

void RecoControl::setInputFile ( const char *  fileName  ) 

Definition at line 46 of file RecoControl.cxx.

References _inputFileName, _inputStream, and _record.

00047 {
00048     if ( _inputStream ) delete _inputStream;
00049     _inputFileName = fileName;
00050     _inputStream = new std::ifstream(fileName);
00051     _record = 0;
00052     if ( ! _inputStream ) {
00053 // gmi  WARNING("Cant read from file");
00054         delete _inputStream;
00055         _inputStream = 0;
00056     }
00057 }

void RecoControl::setOutputFile ( const char *  fileName  ) 

Definition at line 40 of file RecoControl.cxx.

References _outputStream.

00041 {
00042     if ( _outputStream ) delete _outputStream;
00043     _outputStream = new std::ofstream(fileName);
00044 }

void RecoControl::setPrintStream ( std::ostream *  o  )  [inline]

Definition at line 49 of file RecoControl.h.

References pstream.

00049 {pstream = o;}


Member Data Documentation

Definition at line 70 of file RecoControl.h.

Referenced by init(), nextRecord(), and ~RecoControl().

Definition at line 66 of file RecoControl.h.

Referenced by curevent(), giveEventTo(), nextRecord(), and ~RecoControl().

Definition at line 67 of file RecoControl.h.

Referenced by curgeom(), giveGeomTo(), nextRecord(), and ~RecoControl().

const char* RecoControl::_iniFile [private]

Definition at line 60 of file RecoControl.h.

Referenced by init(), and nextRecord().

const char* RecoControl::_inputFileName [private]

Definition at line 61 of file RecoControl.h.

Referenced by setInputFile().

std::istream* RecoControl::_inputStream [private]

Definition at line 73 of file RecoControl.h.

Referenced by closeAll(), eof(), and setInputFile().

int RecoControl::_nevtot [private]

Definition at line 62 of file RecoControl.h.

Referenced by init().

std::ostream* RecoControl::_outputStream [private]

Definition at line 74 of file RecoControl.h.

Referenced by closeAll(), and setOutputFile().

long RecoControl::_record [private]

Definition at line 63 of file RecoControl.h.

Referenced by setInputFile().

std::ostream* RecoControl::_tupleFile [private]

Definition at line 75 of file RecoControl.h.

Referenced by closeAll(), and setDstFile().

std::ostream* RecoControl::pstream [private]

Definition at line 76 of file RecoControl.h.

Referenced by setPrintStream().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1