00001 #ifndef BESVISALG_H_
00002 #define BESVISALG_H_
00003
00004
00005 #include "GaudiKernel/Algorithm.h"
00006 #include "GaudiKernel/MsgStream.h"
00007 #include "GaudiKernel/AlgFactory.h"
00008 #include "GaudiKernel/ISvcLocator.h"
00009 #include "GaudiKernel/SmartDataPtr.h"
00010 #include "GaudiKernel/IDataProviderSvc.h"
00011 #include "GaudiKernel/PropertyMgr.h"
00012 #include "GaudiKernel/Tokenizer.h"
00013 #include "GaudiKernel/IRegistry.h"
00014 #include "GaudiKernel/IAlgManager.h"
00015 #include "GaudiKernel/IConversionSvc.h"
00016 #include "GaudiKernel/IDataManagerSvc.h"
00017 #include "GaudiKernel/IPersistencySvc.h"
00018 #include "GaudiKernel/IOpaqueAddress.h"
00019 #include "GaudiKernel/IDataStoreAgent.h"
00020 #include "GaudiKernel/strcasecmp.h"
00021 #include "GaudiKernel/DataObject.h"
00022 #include "GaudiKernel/DataStoreItem.h"
00023
00024
00025
00026 #include <stdio.h>
00027 #include <unistd.h>
00028 #include <stdlib.h>
00029 #include <sys/types.h>
00030 #include <sys/ipc.h>
00031 #include <sys/sem.h>
00032 #include <wait.h>
00033
00034
00035 #include <TObject.h>
00036 #include <TList.h>
00037 #include <TRootEmbeddedCanvas.h>
00038 #include <TTimer.h>
00039 #include <TApplication.h>
00040 #include <TInterpreter.h>
00041 #include <TBranch.h>
00042 #include <TFile.h>
00043 #include <TTree.h>
00044 #include <TSystem.h>
00045 #include <TGeoManager.h>
00046 #include <TGButton.h>
00047 #include <TGMenu.h>
00048 #include <TGLayout.h>
00049 #include <TGStatusBar.h>
00050 #include <TGFileDialog.h>
00051 #include <TGNumberEntry.h>
00052 #include <TGMsgBox.h>
00053 #include <TGProgressBar.h>
00054 #include <TGTab.h>
00055 #include <TGSplitter.h>
00056 #include <TGCanvas.h>
00057 #include <TSystem.h>
00058 #include <TGListTree.h>
00059 #include <TGLabel.h>
00060 #include <TGButtonGroup.h>
00061 #include <TGTextEntry.h>
00062 #include <TGTextBuffer.h>
00063 #include <TG3DLine.h>
00064 #include <TGSlider.h>
00065 #include <TCanvas.h>
00066 #include <TView.h>
00067 #include <TGeometry.h>
00068 #include <TASImage.h>
00069 #include <TColor.h>
00070
00071
00072
00073
00074 #include <TVirtualGeoPainter.h>
00075 #include <TRootHelpDialog.h>
00076
00078
00079 #include "RootEventData/TRecTrackEvent.h"
00080 #include "RootEventData/TDigiEvent.h"
00081 #include "RootCnvSvc/commonData.h"
00082 #include "RootCnvSvc/RootInterface.h"
00083 #include "RootCnvSvc/RootCnvSvc.h"
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #include "EventModel/EventModel.h"
00101 #include "EventModel/Event.h"
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 #include "ReconEvent/ReconEvent.h"
00113 #include "MdcRecEvent/RecMdcTrack.h"
00114 #include "MdcRecEvent/RecMdcKalTrack.h"
00115 #include "MdcRecEvent/RecMdcDedx.h"
00116 #include "TofRecEvent/RecTofTrack.h"
00117 #include "EmcRecEventModel/RecEmcShower.h"
00118 #include "MucRecEvent/RecMucTrack.h"
00119 #include "RootEventData/TDisTrack.h"
00120
00121 #include "CLHEP/Matrix/Vector.h"
00122 #include "CLHEP/Matrix/SymMatrix.h"
00123 #include "CLHEP/Vector/ThreeVector.h"
00124
00125
00126 #include <vector>
00127 #include <iostream>
00128 #include <cmath>
00129 #include <cstdlib>
00130 #include <map>
00131
00132 using namespace std;
00133 using namespace Event;
00134 using CLHEP::Hep3Vector;
00135 using CLHEP::HepSymMatrix;
00136
00137
00138 #define BUFFER "./buffer"
00139
00140 union semun{
00141 int val;
00142 struct semid_ds *buf;
00143 ushort *array;
00144 };
00145
00146 enum {FREE_SPACE, OUTPUT_STORE};
00147
00149 class TList;
00150 class TObject;
00151 class TRootEmbeddedCanvas;
00152 class TApplication;
00153 class TInterpreter;
00154 class TFile;
00155 class TTimer;
00156 class TBranch;
00157 class TTree;
00158 class TGPopupMenu;
00159 class TGStatusBar;
00160 class TGHorizontal3DLine;
00161 class TGLayoutHints;
00162 class TGMenuBar;
00163 class TGNumberEntry;
00164 class TGNumberFormat;
00165 class TGLabel;
00166 class TGHButtonGroup;
00167 class TGRadioButton;
00168 class TGCheckButton;
00169 class TGTextButton;
00170 class TGTextBuffer;
00171 class TGTextEntry;
00172 class TGHProgressBar;
00173 class TGButton;
00174 class TGPictureButton;
00175 class TGFileInfo;
00176 class TGFileDialog;
00177 class TGMsgBox;
00178 class TGGroupFrame;
00179 class TGTab;
00180 class TGVSplitter;
00181 class TGCanvas;
00182 class TGListTree;
00183 class TGListTreeItem;
00184 class TGHSlider;
00185 class TGVSlider;
00186 class TCanvas;
00187 class TView;
00188 class TGListTreeItem;
00189
00190
00191 class BesVisAlg:public Algorithm {
00192 public:
00193 BesVisAlg (const std::string& name, ISvcLocator* pSvcLocator);
00194 ~BesVisAlg();
00195 StatusCode initialize();
00196 StatusCode execute();
00197 StatusCode finalize();
00198
00199 private:
00200
00201 static int counter;
00202 std::vector<std::string> testVec;
00203 std::string f_rootOutputFile;
00204 std::string f_geoInputFile;
00205
00206 pid_t c_pid;
00207 pid_t m_pid;
00208 ushort start_val[2];
00209 int sem_value_F, sem_value_O;
00210 int semid;
00211 struct semid_ds sem_buf;
00212 union semun arg;
00213 struct sembuf acquire, release;
00214
00215
00216 IDataManagerSvc *m_pDataManager;
00217 IDataProviderSvc *m_pDataProvider;
00218 IConversionSvc *m_pConversionSvc;
00219 IDataStoreAgent *m_pAgent;
00220 DataStoreItem *m_currentItem;
00221 RootInterface *m_pRootInterface;
00222 RootCnvSvc *m_cnvSvc;
00223
00224 typedef std::vector<DataStoreItem*> Items;
00225 typedef std::vector<std::string> ItemNames;
00226
00227 Items m_itemList;
00228
00229 TDisTrack *recdis;
00230 TRecMdcTrack *recTrack1;
00231 TRecMucTrack *muctrk;
00232 TRecTofTrack *tofTrack;
00233 TRecMdcHit *mdchit;
00234 TRecEmcShower *emcshower;
00235
00236 int m_mode;
00237
00238 StatusCode producer(int p_sleep);
00239 bool hasRead();
00240 StatusCode hasWrite();
00241 void addItem(Items& itms, const std::string& descriptor);
00242 void clearItems(Items& items);
00243 DataStoreItem* findItem(const std::string& path);
00244 StatusCode collectObjects();
00245 StatusCode getSvc();
00246 StatusCode finishSvc();
00247 StatusCode write2file();
00248 };
00249
00250
00251 #endif
00252