00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "Stl3Util/gl3/gl3Event.h"
00015 #include "Stl3Util/gl3/gl3Algorithm.h"
00016
00017 #include "Stl3Util/base/St_l3_Coordinate_Transformer.h"
00018
00019 #include "Stl3Util/foreign/RC_Config.h"
00020
00021 #include <stdio.h>
00022 #include <math.h>
00023 #include <list>
00024 #include <vector>
00025
00026 #ifndef GL3CONDUCTOR
00027 #define GL3CONDUCTOR
00028
00029 #define NTOKENS 4096
00030
00031 typedef gl3Algorithm* pGl3Algorithm ;
00032
00033 class gl3EventDecision {
00034 public:
00035 short accept ;
00036 short build ;
00037 int status[4];
00038 gl3EventDecision ( ):accept(0),build(0)
00039 {
00040 for(int i = 0 ; i < 4 ; i++ )
00041 status[i] = 0 ;
00042 } ;
00043 };
00044
00045
00046 class gl3HistoContainer {
00047 public:
00048 int nBytes;
00049 int nHistos;
00050 int runNumber ;
00051 int buffer;
00052 };
00053
00054 class gl3Conductor {
00055
00056
00057 public:
00058 short maxEvents ;
00059 short maxAlgorithms ;
00060 short communicationsFlag ;
00061 int nEvents ;
00062 int nAlgorithms ;
00063 int maxTokens ;
00064 int runNumber ;
00065 pGl3Algorithm* algorithm ;
00066 int* tokenIndex ;
00067
00068
00069
00070
00071
00072 short hitProcessing ;
00073
00074
00075
00076 int maxSectorNForTrackMerging ;
00077
00078 public:
00079 gl3Conductor (void ) ;
00080 ~gl3Conductor ( ) ;
00081
00082
00083 int configure (L3_CFG *cfg);
00084 int add ( gl3Algorithm* algorithm ) ;
00085
00086
00087 int fillSummary(int token, struct L3_summary*, struct L3_SUMD *);
00088 int collectSummary(int token);
00089 int fillTracks(int token);
00090
00091 void clearAlgorithms();
00092 int checkHistoRequest() ;
00093 int init ( ) ;
00094
00095 int processEvent(EventDescriptor *desc, L3_P* l3data,
00096 TrgSumData* = NULL, RawTrgDet* = NULL);
00097
00098
00099
00100
00101 gl3Event* getEvent ( int token ) ;
00102 int releaseToken ( int token ) ;
00103 int resetHistos ( ) ;
00104 int runStart ( int _runNumber ) ;
00105 int runEnd ( ) ;
00106 int end ( ) ;
00107
00108
00109 void setBField ( float bField ) ;
00110 void setHitProcessing ( int hitPro ) ;
00111 void setMaxSectorNForTrackMerging ( int _trackMerging ) ;
00112 int setup ( St_l3_Coordinate_Transformer* _trans,
00113 int maxEvents=1, int maxAlgorithm=10 ) ;
00114 int setCommunications ( ) ;
00115 int writeHistos ( int maxBytes, char *buffer ) ;
00116
00117 private:
00118 int getFreeEventIndex();
00119 int getTokenIndex(int);
00120
00121 gl3Event* event ;
00122 L3_summary* summary;
00123 L3_SUMD* summaryData;
00124
00125 int nReco;
00126
00127
00128
00129 list<gl3Histo *> histoList ;
00130 gl3Histo* l3Rates;
00131
00132
00133 int socketFd, remoteSocket ;
00134 int gl3Port ;
00135
00136
00137 void resetTimer();
00138 void timingMark();
00139
00140 void allocateTimingHistos();
00141 void fillTimingHistos();
00142
00143 void printTiming();
00144
00145 int lastTimeEntry;
00146 vector<unsigned long> cpuTimes, realTimes;
00147 vector<gl3Histo*> timingHistos;
00148
00149 double ccPerMs;
00150 };
00151 #endif