TFndRun Class Reference

Inheritance diagram for TFndRun:

TFndPreanMan List of all members.

Public Member Functions

 TFndRun (const TString &name="FINUDA_run_processor", const TString &title="The FINUDA run processor")
 ~TFndRun ()
Int_t InitNewRun (TString runtype="ONLM", const Int_t &runnum=-1, const Bool_t &UsedByPrean=kFALSE)
Bool_t IsProcessing ()
Bool_t IsNewRun ()
TFndFeeMapGetFeeMap ()
Int_t CheckMsqlConnection ()
Int_t ConnectToDB ()
Int_t FetchDBinfo (Int_t source, Bool_t verbose=kFALSE)
Int_t DisconnectFromDB ()
Int_t FinishRun (Bool_t last=kFALSE, const Bool_t &UsedByPrean=kFALSE)
void ClearEvent ()
Int_t GetNofProcessedRuns ()
Int_t GetNofProcessedEvents ()
UInt_t GetEvNum_Raw ()
Int_t GetDebug ()
UInt_t GetDebugRawEv ()
void ReadConfigFile (TString ConfFileName="RunConfig.C")
TFndRunConfigurationRunConfiguration ()
void SetDBHost (const TString &dbhost)
TString GetDBHost ()
TString GetDataPath ()
void SetDataPath (const TString &data_path)
TString GetRunType (Int_t &run_type_id)
TString GetRunType ()
Int_t SetRunType (TString runtype)
void SetRunType (Int_t runtype)
UInt_t GetCurOnlineRunNmber ()
Int_t GetRunNumber ()
void SetRunNumber (Int_t run_num)
Int_t GetMaxNumberOfEvents ()
void SetMaxNumberOfEvents (Int_t max_evts)
Int_t GetGebIP ()
void SetGebIP (Int_t geb_ip)
void SetDebugLevel (Int_t level)
void SetDebugRawEv (UInt_t levels)
virtual Int_t GetNextEvent (Bool_t fill_hdt=kTRUE)
virtual UInt_t * GetNextRawEvent (Int_t &exit_value)
Int_t ReadRawEvent (Bool_t using_db=kTRUE)
UInt_t * GetCurrentRawEvent ()
virtual Int_t ReconstructEvent ()
UInt_t GetRunTime ()
void SetRunTime (const UInt_t &rtim)
Int_t Onlflg ()
TFndGtsMonFrameGtsMonFrame ()
TFndTofMonFrameTofMonFrame ()
TFndSilMonFrameSilMonFrame ()
TFndLmdMonFrameLmdMonFrame ()
TFndStbMonFrameStbMonFrame ()
TFndGtsMonGtsMon ()
TFndTofMonTofMon ()
TFndSilMonIsmMon ()
TFndSilMonOsmMon ()
TFndLmdMonLmdMon ()
TFndStbMonStbMon ()
TFndGenInfoGetGenInfo ()
void SetMustFillMonitor (EFndMonDetectors det_id, const Bool_t &val)
void FillMonitors ()
void WriteMonitors (Bool_t close=kFALSE)
void StartMonitors ()
void StartGtsMonitor ()
void StartGtsMonitor (TString *)
void StartTofMonitor (Int_t adc_bins=-1, Float_t adc_min=-1., Float_t adc_max=-1., Int_t tdc_bins=-1, Float_t tdc_min=-1., Float_t tdc_max=-1.)
void StartTofMonitor (TString *)
void StartIsmMonitor ()
void StartOsmMonitor ()
void StartIsmMonitor (TString *)
void StartOsmMonitor (TString *)
void StartLmdMonitor (Int_t adc_bins=-1, Float_t adc_min=-1., Float_t adc_max=-1., Int_t tdc_bins=-1, Float_t tdc_min=-1., Float_t tdc_max=-1.)
void StartLmdMonitor (TString *)
void StartStbMonitor (Int_t tdc_bins=-1, Float_t tdc_min=-1., Float_t tdc_max=-1.)
void StartStbMonitor (TString *)
TFndHdtGetCurrentHdt ()
TFndRdtGetCurrentRdt ()
Int_t StartMonFrame (Int_t det, TString RootFileName=0, TString RootFileName2=0)
TFndMonFrameGetMonFrame (Int_t det)
Int_t DeleteMonFrame (Int_t det)
void SetProcessRec (TFndProcessRec *proc)
TFndProcessRecGetProcessRec ()
Int_t * Zebra_LQ ()
Int_t * Zebra_IQ ()
Float_t * Zebra_Q ()
virtual void OpenLogFile (const TString &fdir, const TString &fnam)
void CloseLogFile ()
void WriteLogFile (const TString &line)
void SetHdt (TFndHdt *hdt)
void SetfProcessing (const Bool_t &flg)
void SetfOnlineFlag (const Int_t &flg)
void SetfRunFileName (const TString &nam)

Static Public Attributes

static TFndHdtfgFinHdt

Protected Types

enum  { k_MinRawFileSize = 1024 }

Protected Member Functions

virtual Long_t OpenRawFile (TString fdir, TString fnam, Bool_t check_only=kFALSE)
 support for log messages
Int_t Init ()
virtual void CheckRawSwapping ()
void CleanEvent ()
virtual Int_t CreateSocketToDAQ (E_Fnd_DaqRaw_Udp_Ports det_port)
virtual Int_t ShutdownSocketToDAQ ()
virtual Int_t CheckSocketToDAQ ()
virtual Int_t RecreateSocketToDAQ (E_Fnd_DaqRaw_Udp_Ports det_port=FIN_DAQ_RAW_UDP_PORT)
virtual UInt_t * GetNextRawEventFromSocket (int &exit_val)
virtual UInt_t * GetNextRawEventFromFile (int &exit_val)

Protected Attributes

Int_t fDebug
UInt_t fDebugRawEv
TFndRunConfigurationfRunConfiguration
TString fDBHost
TFndFeeMapfFeeMap
TString fDataPath
TString fRunType
Int_t fRunTypeID
Int_t fRunNumber
TString fRunFilename
TString fMonHisFilename
Int_t fGebIp
Int_t fOnlineFlag
TString fCurRunType
UInt_t fCurRunNum
Bool_t fIsNewRun
Bool_t fProcessing
Int_t fNumOfProcessedRuns
Int_t fNumOfProcessedEvents
Int_t fMaxNofEvents
Int_t fMaxNofRuns
Int_t fSockLength
sockaddr_in fLocSockAddr
Int_t fUdpSd
sockaddr_in fShrSockAddr
Int_t fShrSockAddr_size
Int_t request_counter
FILE * fRawFile
UInt_t fRawEvent [FIN_RAW_DATA_BUF_SIZE]
 Raw file pointer /////////////////////////////.
UInt_t fRunTime
TFndGenInfofGenInfo
TFndGtsMonFramefGtsMonFrame
TFndTofMonFramefTofMonFrame
TFndSilMonFramefSilMonFrame
TFndLmdMonFramefLmdMonFrame
TFndStbMonFramefStbMonFrame
Bool_t fMustFillMonitor [D_STB+1]
TFndGtsMonfGtsMon
TFndTofMonfTofMon
TFndSilMonfIsmMon
TFndSilMonfOsmMon
TFndLmdMonfLmdMon
TFndStbMonfStbMon
TFndRdtfFinRdt
TFndHdtfFinHdt
TFndProcessRecfProcessRec
ofstream * fCurLogFile

Detailed Description

Definition at line 53 of file TFndRun.h.


Member Enumeration Documentation

anonymous enum [protected]

Enumerator:
k_MinRawFileSize 

Definition at line 55 of file TFndRun.h.

00055 { k_MinRawFileSize = 1024 }; // minimum file size requested (bytes)


Member Function Documentation

UInt_t * TFndRun::GetNextRawEventFromSocket ( int &  exit_val  )  [protected, virtual]

--- CHECKS added (Feb 2007)

Reimplemented in TFndPreanMan.

Definition at line 582 of file TFndRun.cxx.

References CheckRawSwapping(), CheckSocketToDAQ(), fDebug, fRawEvent, fShrSockAddr, fShrSockAddr_size, fUdpSd, and request_counter.

Referenced by GetNextRawEvent().

00582                                                        {
00583   // get the next raw-event (from socket)
00584   // send the request
00585   // NOTE:
00586   //   A loop of requests is required, unless you are sure
00587   //   that the server is already running and witing for client requests
00588   //    "ioctl" is used to know if the request has been received by the server
00589   //
00590   // tested with simulated DAQ rate in the range [0.3 - 200] ev/s
00591   //
00592   // exit_val value: 
00593   //                0: ok
00594   //               -2: must re-create socket
00595   
00596   bzero(fRawEvent,sizeof(fRawEvent));
00597   //   char request_buf[100];
00598   //   sprintf(request_buf,"send me an event");
00599 
00600   Int_t request_buf=1;
00601   
00602   Int_t n_max_requests = 50; // after 50 requests recreate socket (was 10)
00603   
00604   int n_trials = 0;
00605   while(1){
00606     n_trials++; if(n_trials> n_max_requests){
00607       exit_val = -2;
00608       return 0;
00609     }
00610     request_counter++;
00611     //Info("GetNextRawEventFromSocket","sending request to the server (%d)",request_counter);
00612     //int send_err = sendto(fUdpSd,(char*)request_buf ,sizeof(request_buf) ,0 ,(struct sockaddr *) &fShrSockAddr,fShrSockAddr_size);
00613     int send_err = sendto(fUdpSd,(char*)&request_buf ,sizeof(Int_t) ,0 ,(struct sockaddr *) &fShrSockAddr,fShrSockAddr_size);    
00614     if(send_err==-1){
00615       Error("GetNextRawEventFromSocket","send-request operation failed!");
00616       sleep(1);
00617       continue;
00618     }
00619 
00620     int check_result=CheckSocketToDAQ(); // wait for answer
00621     // cout << "check_result: " << check_result << endl;
00622     if(check_result) break;
00623     else Info("GetNextRawEventFromSocket","...server not ready: trying again");
00624   }
00625   // the data fRawEvent is sent from the server to the "sockaddr_in" who sent the request (so it is used to receive)
00626   Int_t nread = recvfrom(fUdpSd ,(char*)fRawEvent ,sizeof(fRawEvent) ,0 ,(struct sockaddr*)&fShrSockAddr , (socklen_t *) &fShrSockAddr_size);
00627 
00628   if(fDebug > 0) printf("UDP fRawEvent received from server: nread = %d; event = \"%x\".\n",nread,fRawEvent);
00629 
00631   if(nread == -1){
00632     Error("GetNextRawEventFromSocket","nread = -1");
00633     exit_val = -2;
00634     return 0;
00635   }
00636   else if(nread == 0){
00637     Error("GetNextRawEventFromSocket","connection closed by GEB");
00638     exit_val = -2;
00639     return 0;
00640   }
00641 
00642   Int_t u_length = nread / sizeof(fRawEvent[0]);
00643   if( u_length >= sizeof(fRawEvent) ){
00644     Warning("GetNextRawEventFromSocket","received buffer size greater than local buf-size");
00645     exit_val = -2;
00646     return 0;
00647   }
00648   if( u_length != fRawEvent[0] ){
00649     Warning("GetNextRawEventFromSocket","received buffer size different from event size");    
00650     exit_val = -2;
00651     return 0;
00652   }
00653 
00654   if(fDebug > 0) if(u_length == fRawEvent[0]) Info("GetNextRawEventFromSocket","received event OK");
00655   // --- CHECKS completed
00656 
00657   if(fDebug > 1){
00658     for(unsigned int j=0; j<5; j++){
00659       if(fRawEvent[j] != 0) cout << "fRawEvent[" << j << "] = " << fRawEvent[j] << endl;
00660     }
00661   }
00662   else if(fDebug > 2){
00663     unsigned int len_test = fRawEvent[0];
00664     for(unsigned int j=0; j<len_test; j++){
00665       if(fRawEvent[j] != 0) cout << "fRawEvent[" << j << "] = " << fRawEvent[j] << endl;
00666     }
00667   }
00669  
00670   CheckRawSwapping();
00671 
00672   exit_val = 0;
00673   return fRawEvent;  
00674 }


The documentation for this class was generated from the following files:
Generated on Tue Oct 16 15:40:51 2007 by  doxygen 1.5.2