-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdump.cc
More file actions
59 lines (53 loc) · 1.52 KB
/
dump.cc
File metadata and controls
59 lines (53 loc) · 1.52 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
/*
################################################################################
# File: dump.cc
# Description: LAGO dump of pulses, mainly intended to debug and develop classes
# Author: Hernán Asorey
# Email: [email protected]
# 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]);
Input.SetForce(1);
//
// File reading and processing
//
double rt=0., ft=0., tt=0.;
cerr << "Reading file" << endl;
while(NbPulses!=-1) {
NbPulses=Input.ReadOneSecond(&Data,Pulse,MAXPULSEPERSEC);
for (int i=0; i<NbPulses; i++) {
rt = Pulse[i].GetRiseTime(2);
ft = Pulse[i].GetFallTime(2);
tt = Pulse[i].GetFullTime(2);
if (rt>0 && ft>0)
cout << rt << " " << ft << " " << tt << endl;
}
}
return 0;
}