00001 00002 // 00003 // Implementation of class AlephIoManager 00004 // 00005 // Author : G. Dissertori , 02.11.98 00006 // 00008 00009 #include <stdlib.h> 00010 #include <iostream> 00011 #include <fstream> 00012 #include <string> 00013 #include "AlephIoManager.h" 00014 00015 extern ofstream fout; 00016 00017 // 00018 // set the global instance variable 00019 // 00020 AlephManager* AlephIoManager::_theAlephIoManager=0; 00021 00022 // 00023 // the instance function of the Singleton 00024 // 00025 AlephManager* AlephIoManager::TheAlephIoManager() 00026 { 00027 // check out which manager has to be produced 00028 if (_theAlephIoManager == 0) 00029 { 00030 // here also the cards reader is created and starts its constructor 00031 _theAlephIoManager = new AlephIoManager; 00032 } 00033 return _theAlephIoManager; 00034 } 00035 00036 00037 // 00038 // the constructor 00039 // 00040 AlephIoManager::AlephIoManager() 00041 { 00042 // call the constructor of the base class 00043 AlephManagerSetup("IoManager"); 00044 } 00045 00046 00047 // 00048 // the destructor 00049 // 00050 AlephIoManager::~AlephIoManager() 00051 { 00052 AlephManagerShutDown(); 00053 } 00054 00055 // 00056 // the initialization step 00057 // 00058 AlephRC AlephIoManager::initialize() 00059 { 00060 00061 // say something 00062 fout << " AlephIoManager : initializing .... " << endl; 00063 00064 // initialize the members 00065 int mode; 00066 if ((strrchr(_theCardsReader.getHist().c_str(),'.') == NULL)||(strcmp(strrchr(_theCardsReader.getHist().c_str(),'.'),".root"))) mode = 2; 00067 else mode = 1; 00068 _theNtupleWriter.Initialize(&_theCardsReader, mode); 00069 00070 // set the status 00071 setStatus(INITIALIZED); 00072 00073 return AlephOK; 00074 } 00075 00076 00077 // 00078 // the running step 00079 // 00080 AlephRC AlephIoManager::run() 00081 { 00082 00083 // say something 00084 fout << " AlephIoManager : running .... " << endl; 00085 00086 00087 // set the status 00088 setStatus(RUNNING); 00089 00090 return AlephOK; 00091 } 00092 00093 00094 // 00095 // the termination step 00096 // 00097 AlephRC AlephIoManager::terminate() 00098 { 00099 00100 // say something 00101 fout << " AlephIoManager : terminating .... " << endl; 00102 00103 // terminate the members 00104 _theNtupleWriter.Terminate(); 00105 00106 // set the status 00107 setStatus(TERMINATED); 00108 00109 return AlephOK; 00110 } 00111 00112 // return the pointer to the cards reader 00113 AlephCardsReader& AlephIoManager::theCardsReader() 00114 { 00115 return _theCardsReader; 00116 } 00117 00118 // return the pointer to the ntuple writer 00119 AlephNtupleWriter& AlephIoManager::theNtupleWriter() 00120 { 00121 return _theNtupleWriter; 00122 } 00123