-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.cc
57 lines (51 loc) · 1.57 KB
/
example.cc
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
/*
################################################################################
# File: example.cc
# Description: LAGO example on how to include and use LAGO ANNA main classes
# Author: Hernán Asorey
# Email: asoreyh@gmail.com
# Date: 2012
#
# Copyright: [2012] [The LAGO Collaboration]
# License: BSD-3-Clause
# See the LICENSE file in the project root for full license information.
################################################################################
*/
#define _FILE_OFFSET_BITS 64
#include "lago_defs.h"
#include "lago_data.h"
#include "lago_file.h"
using namespace std;
#define MAXPULSEPERSEC 1000000
// This is just an example to use LAGO libraries
int main (int argc, char **argv) {
if (argc < 2) {
cerr << "Error: data file is needed. Please check." << endl;
cerr << endl;
cerr << "Usage: " << argv[0] << " <file>" << endl;
return 1;
}
LagoFile Input;
int NbPulses=0;
LagoGeneric Data;
LagoEvent *Pulse;
Pulse=(LagoEvent*)malloc(MAXPULSEPERSEC*sizeof(LagoEvent));
for (int i=0;i<MAXPULSEPERSEC;i++)
Pulse[i].Init();
Input.Open(argv[1]);
//
// File reading and processing
//
cerr << "Reading file" << endl;
while(NbPulses!=-1) {
NbPulses=Input.ReadOneSecond(&Data,Pulse,MAXPULSEPERSEC);
cout << Data.second << " " << Data.pressure << " " << Data.temperature << " " << NbPulses << endl;
/*
* So, Data have one second of pulses, here we should our analysis
* say, looking for excesses for grb analysis, something like this:
* if (NbPulses>0)
* TreatSecond(&Data,Pulse,NbPulses);
*/
}
return 0;
}