Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
epics_main.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// epics_main.C -- to find EPICS data and
3// do something with them.
4//
5#include <iostream>
6#include <cstdlib>
7#include "THaCodaFile.h"
8#include "CodaDecoder.h"
9#include "TString.h"
10
11using namespace std;
12using namespace Decoder;
13
14int main(int argc, char* argv[])
15{
16 if (argc < 2) {
17 cout << "You made a mistake... \n" << endl;
18 cout << "Usage: epicsd filename" << endl;
19 cout << " where 'filename' is the CODA file"<<endl;
20 cout << "\n... exiting." << endl;
21 exit(1);
22 }
23 TString filename = argv[1];
24 THaCodaFile datafile;
25 if (datafile.codaOpen(filename) != CODA_OK) {
26 cout << "ERROR: Cannot open CODA data" << endl;
27 cout << "Perhaps you mistyped it" << endl;
28 cout << "... exiting." << endl;
29 exit(2);
30 }
31
32 auto *evdata = new CodaDecoder();
33 evdata->SetCodaVersion(datafile.getCodaVersion());
34
35 // Loop over a finite number of events
36
37 int NUMEVT=1000000;
38 for (int i=0; i<NUMEVT; i++) {
39
40 int status = datafile.codaRead();
41
42 if ( status != CODA_OK ) {
43 if ( status == EOF) {
44 cout << "This is end of file !" << endl;
45 cout << "... exiting " << endl;
46 break;
47 } else {
48 cout << hex << "ERROR: codaRread status = " << status << endl;
49 exit(status);
50 }
51 }
52
53 status = evdata->LoadEvent( datafile.getEvBuffer() );
54
55 if( status != CodaDecoder::HED_OK && status != CodaDecoder::HED_WARN ) {
56 cerr << "ERROR " << status << " while decoding event " << i
57 << ". Exiting." << endl;
58 exit(status);
59 }
60
61 if(evdata->IsEpicsEvent()) {
62
63 cout << "Event " << i << " EPICS data --> "<<endl;
64//FIXME: needs update for Podd 1.6+
65 cout << "Not implemented in this example program" << endl;
66#if 0
67 cout << "hac_bcm_average "<<
68 evdata->GetEpicsData("hac_bcm_average")<<endl;
69 cout << "IPM1H04A.XPOS "<<
70 evdata->GetEpicsData("IPM1H04A.XPOS")<<endl;
71 cout << "IPM1H04A.YPOS "<<
72 evdata->GetEpicsData("IPM1H04A.YPOS")<<endl;
73#endif
74 }
75
76 } // end of event loop
77
78 datafile.codaClose();
79 return 0;
80}
81
82
83
84
85
86
87
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
#define CODA_OK
Definition THaCodaData.h:28
UInt_t * getEvBuffer()
Definition THaCodaData.h:76
virtual Int_t getCodaVersion()
virtual Int_t codaOpen(const char *filename, Int_t mode=1)
virtual Int_t codaClose()
virtual Int_t codaRead()
int main()
STL namespace.