Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaOnlRun.cxx
Go to the documentation of this file.
1//*-- Author : Robert Michaels March 2001
2
4//
5// THaOnlRun :: THaRun
6//
7// Description of an online run using ET system to get data in real time.
8// Inheriting from THaRun, this is essentially a TNamed object with
9// additional support for a run number, filename, CODA file IO,
10// and run statistics.
11//
13
14#include "THaOnlRun.h"
15
16#include "THaEtClient.h"
17#include "TClass.h"
18#include "TError.h"
19#include <stdexcept>
20
21using namespace std;
22
23#if __cplusplus >= 201402L
24# define MKETCLIENT make_unique<Decoder::THaEtClient>()
25#else
26# define MKETCLIENT unique_ptr<Decoder::THaEtClient>(new Decoder::THaEtClient)
27#endif
28
29//______________________________________________________________________________
31{
32 // Default constructor
33
34 // NOW is the correct time
35 TDatime now;
36 SetDate(now);
37 // Use ET client as data source
39}
40
41//______________________________________________________________________________
42THaOnlRun::THaOnlRun( const char* computer, const char* session, Int_t mode) :
43 THaCodaRun(session), fComputer(computer), fSession(session), fMode(mode)
44{
45 // Normal constructor
46
47 // NOW is the correct time
48 TDatime now;
49 SetDate(now);
50
51 // Use ET client as data source
53}
54
55//______________________________________________________________________________
57 THaCodaRun(rhs), fComputer(rhs.fComputer), fSession(rhs.fSession),
58 fMode(rhs.fMode)
59{
60 // Copy constructor
61
62 // NOW is the correct time
63 TDatime now;
64 SetDate(now);
65
67}
68
69//_____________________________________________________________________________
71{
72 // Assignment operator.
73
74 if (this != &rhs) {
76 try {
77 const auto& obj = dynamic_cast<const THaOnlRun&>(rhs);
78 fComputer = obj.fComputer;
79 fSession = obj.fSession;
80 fMode = obj.fMode;
81 }
82 catch( const std::bad_cast& e ) {}
84 }
85 return *this;
86}
87
88
89//______________________________________________________________________________
91{
92 // Open ET connection.
93
94 if (fComputer.IsNull() || fSession.IsNull()) {
95 Error( "Open", "Computer and Session must be set. "
96 "Cannot open ET run." );
97 return -2; // must set computer and session, at least;
98 }
99
100 Int_t st = fCodaData->codaOpen(fComputer, fSession, fMode);
101 st = ReturnCode(st);
102 if( st == READ_OK )
103 fOpened = true;
104 return st;
105}
106
107//______________________________________________________________________________
108Int_t THaOnlRun::OpenConnection( const char* computer, const char* session,
109 Int_t mode )
110{
111 // Set the computer name, session name, and mode, then open the 'file'.
112 // It isn't really a file. It is an ET connection.
113
114 fComputer = computer;
115 fSession = session;
116 fMode = mode;
117 return ReturnCode( Open() );
118}
119
120//______________________________________________________________________________
int Int_t
#define e(i)
Option_t Option_t TPoint TPoint const char mode
#define MKETCLIENT
Definition THaOnlRun.cxx:26
std::unique_ptr< Decoder::THaCodaData > fCodaData
Definition THaCodaRun.h:35
static Int_t ReturnCode(Int_t coda_retcode)
virtual THaCodaRun & operator=(const THaRunBase &)
virtual THaOnlRun & operator=(const THaRunBase &rhs)
Definition THaOnlRun.cxx:70
virtual Int_t Open()
Definition THaOnlRun.cxx:90
TString fComputer
Definition THaOnlRun.h:28
Int_t fMode
Definition THaOnlRun.h:31
TString fSession
Definition THaOnlRun.h:29
virtual Int_t OpenConnection(const char *computer, const char *session, Int_t mode)
Bool_t fOpened
Definition THaRunBase.h:99
virtual void SetDate(const TDatime &date)
virtual void Error(const char *method, const char *msgfmt,...) const
Bool_t IsNull() const
STL namespace.
ClassImp(TPyArg)