1 | |
2 | |
3 | |
4 | |
5 | #include "hddm_merge_files.h" |
6 | |
7 | #include <HDDM/hddm_r.hpp> |
8 | using namespace hddm_r; |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | void Process_r(unsigned int &NEvents, unsigned int &NEvents_read) |
15 | { |
16 | |
17 | std::cout << " output file: " << OUTFILENAME << std::endl; |
18 | std::ofstream ofs(OUTFILENAME); |
19 | if (! ofs.is_open()) { |
| |
20 | std::cout << " Error opening output file \"" << OUTFILENAME |
21 | << "\"!" << std::endl; |
22 | exit(-1); |
23 | } |
24 | hddm_r::ostream *ostr = new hddm_r::ostream(ofs); |
25 | if (HDDM_USE_COMPRESSION) { |
| 2 | | Assuming 'HDDM_USE_COMPRESSION' is 0 | |
|
| |
26 | std::cout << " Enabling bz2 compression of output HDDM file stream" |
27 | << std::endl; |
28 | ostr->setCompression(hddm_r::k_bz2_compression); |
29 | } |
30 | else { |
31 | std::cout << " HDDM compression disabled" << std::endl; |
32 | } |
33 | if (HDDM_USE_INTEGRITY_CHECKS) { |
| 4 | | Assuming 'HDDM_USE_INTEGRITY_CHECKS' is 0 | |
|
| |
34 | std::cout << " Enabling CRC data integrity check in output HDDM" |
35 | " file stream" << std::endl; |
36 | ostr->setIntegrityChecks(hddm_r::k_crc32_integrity); |
37 | } |
38 | else { |
39 | std::cout << " HDDM integrity checks disabled" << std::endl; |
40 | } |
41 | |
42 | |
43 | time_t last_time = time(NULL__null); |
44 | for (unsigned int i=0; i<INFILENAMES.size(); i++) { |
| 6 | | Loop condition is true. Entering loop body | |
|
| 9 | | Potential leak of memory pointed to by 'istr' |
|
45 | std::cout << " input file: " << INFILENAMES[i] << std::endl; |
46 | |
47 | |
48 | std::ifstream ifs(INFILENAMES[i]); |
49 | |
50 | |
51 | hddm_r::istream *istr = new hddm_r::istream(ifs); |
| |
52 | |
53 | |
54 | while (ifs.good()) { |
| 8 | | Loop condition is false. Execution continues on line 220 | |
|
55 | HDDM xrec; |
56 | *istr >> xrec; |
57 | NEvents_read++; |
58 | |
59 | *ostr << xrec; |
60 | NEvents++; |
61 | |
62 | |
63 | time_t now = time(NULL__null); |
64 | if (now != last_time) { |
65 | std::cout << " " << NEvents_read << " events read (" |
66 | << NEvents << " event written) \r"; |
67 | std::cout.flush(); |
68 | last_time = now; |
69 | } |
70 | if (QUIT) |
71 | break; |
72 | } |
73 | } |
74 | } |