-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathres.cpp
142 lines (129 loc) · 6.25 KB
/
res.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "res.h"
res::res(): _count(0)
{
}
res::res(const res& r): _count(r.GetCount())
{
_arr.clear();
for (int i = 0; i < r.GetCount(); ++i)
_arr.push_back(r.GetEvent(i));
}
res::res(const long long count): _count(count)
{
_arr.resize(count);
}
long long res::GetCount() const
{
return _count;
}
event res::GetEvent(const int index) const
{
if (index < _count)
return _arr[index];
return event();
}
void res::AddEvent(const event e)
{
_arr.push_back(e);
++_count;
}
void res::SetCount(const long long count)
{
_count = count;
_arr.resize(_count);
}
void res::SetEvent(const int index, const event e)
{
if (index >= _count)
return;
_arr[index] = e;
}
void res::PrintData(const equipment e, bool print_empty, bool print_full_data, int min_count_l, int min_count_d, int min_count_p) const
{
long long count_events = 0;
int ind_k, ind_l, ind_d, ind_p;
std::cout << "res data" << std::endl;
for (long long i = 0; i < GetCount(); ++i)
{
if (print_empty ||
(GetEvent(i).GetFlag() &&
(min_count_l <= GetEvent(i).GetCountOfLayers()) &&
(min_count_d <= GetEvent(i).GetCountOfDetectors()) &&
(min_count_p <= GetEvent(i).GetCountOfPixels())
) )
{
if ((int)GetEvent(i).GetArr().size() > 1)
++count_events;
if (print_full_data)
{
ind_k = GetEvent(i).GetKitIndex();
std::cout << "\t" << "event " << i <<
std::setw(12) << std::setfill(' ') <<
":\t\t\t\tphi\t\ttet\t\tx\t\ty\t\tz\t\t" <<
GetEvent(i).GetFlag() << std::endl;
std::cout << "\t" << "muon" <<
":\t\t\t\t\t" <<
std::setw(12) << std::setfill(' ') <<
GetEvent(i).GetMuon().GetPhi() << "\t" <<
std::setw(12) << std::setfill(' ') <<
GetEvent(i).GetMuon().GetTet() << "\t" <<
std::setw(12) << std::setfill(' ') <<
GetEvent(i).GetMuon().GetCoor().GetX() << "\t" <<
std::setw(12) << std::setfill(' ') <<
GetEvent(i).GetMuon().GetCoor().GetY() << "\t" <<
std::setw(12) << std::setfill(' ') <<
GetEvent(i).GetMuon().GetCoor().GetZ() << "\t" <<
std::endl;
std::cout << "\t" << "kit " << ind_k << ":\t\t\t\t\t\t\t\t\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetCoor().GetX() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetCoor().GetY() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetCoor().GetZ() << "\t" <<
std::endl;
for (int j = 0; j < (int)GetEvent(i).GetArr().size(); ++j)
{
ind_l = GetEvent(i).GetArr()[j].first;
std::cout << "\t\t" << "layer " <<
GetEvent(i).GetArr()[j].first << ":\t\t\t\t\t\t\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetCoor().GetX() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetCoor().GetY() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetCoor().GetZ() << "\t" <<
std::endl;
for (int k = 0; k < (int)GetEvent(i).GetArr()[j].second.size(); ++k)
{
ind_d = GetEvent(i).GetArr()[j].second[k].first;
std::cout << "\t\t\t" << "detector " <<
GetEvent(i).GetArr()[j].second[k].first << ":\t\t\t\t\t\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetDetector(ind_d).GetCoor().GetX() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetDetector(ind_d).GetCoor().GetY() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetDetector(ind_d).GetCoor().GetZ() << "\t" <<
std::endl;
for (int l = 0; l < (int)GetEvent(i).GetArr()[j].second[k].second.size(); ++l)
{
ind_p = GetEvent(i).GetArr()[j].second[k].second[l];
std::cout << "\t\t\t\t" << "pixel " <<
GetEvent(i).GetArr()[j].second[k].second[l] << ":\t\t\t\t\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetDetector(ind_d).GetPixel(ind_p).GetCoor().GetX() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetDetector(ind_d).GetPixel(ind_p).GetCoor().GetY() << "\t" <<
std::setw(12) << std::setfill(' ') <<
e.GetKit(ind_k).GetLayer(ind_l).GetDetector(ind_d).GetPixel(ind_p).GetCoor().GetZ() << "\t" <<
std::endl;
}
}
}
std::cout << "---------------------------------------------------------------------------------------------------------------------------------" << std::endl;
}
}
}
std::cout << "Count of necessary events: " << count_events << std::endl;
}