-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslowdaq.cc
More file actions
68 lines (61 loc) · 1.84 KB
/
slowdaq.cc
File metadata and controls
68 lines (61 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <string>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include "driver.hh"
#include "sdaq.hh"
#include "sevent.hh"
#include "srootdriver.hh"
#include <TCanvas.h>
using namespace std;
//
// MAIN program
//
int main(int argc, char **argv)
{
// switches
int c = 0;
string DriverFilename;
// parse switches
while((c = getopt(argc,argv,"i:")) != -1)
{
switch(c) {
case 'i': // name of driver
DriverFilename = optarg;
break;
default:
exit(-1);
}
}
// driver for the daq processing..... provided from the python script
cout << "slowdaq:: driver file = " << DriverFilename << endl;
bool slowOn = true;
driver* myDriver = new driver(DriverFilename, slowOn);
// TApplication is needed to plot a canvas with an event
// create an instance of the daq datatype: controls all the binary file handling
sdaq myDaq(myDriver);
// root management
srootdriver myRoot(myDriver);
ULong64_t new_stime;
// loop over the events
int totalnumberofevents = myDriver->getNEvent();
slowevent *sev;
int totalslowevents = myDaq.GetSlowFileSize();
cout << "slowdaq:: Found " << totalslowevents << " slow events" << endl;
ULong64_t old_stime = 0;
for (int iSlowEv = 0; iSlowEv < totalslowevents; iSlowEv++){
if(iSlowEv%10000 == 0) cout << " processed "<<iSlowEv<<" slow events"<<endl;
sev = myDaq.readSlowEvent();
new_stime = myRoot.SlowFill(sev, old_stime);
old_stime = new_stime;
// delete sev;
}
//cout << "I am done processing slow events!!!! " << endl;
//delete theApp;
// write run parameters to file
//myRoot.writeParameters(myDriver);
myRoot.Close();
delete myDriver;
return 0;
}