Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
centrality
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pwg-c2f
analysis
centrality
Commits
16438831
Commit
16438831
authored
6 years ago
by
Evgeny Kashirin
Browse files
Options
Downloads
Patches
Plain Diff
Create 1D Getter builder
parent
2ce6a4f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#2328
failed
6 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Getter.cpp
+29
-0
29 additions, 0 deletions
src/Getter.cpp
src/Getter.h
+49
-45
49 additions, 45 deletions
src/Getter.h
with
78 additions
and
45 deletions
src/Getter.cpp
+
29
−
0
View file @
16438831
...
@@ -47,4 +47,33 @@ float Getter::GetCentrality(float xvalue, float yvalue) const
...
@@ -47,4 +47,33 @@ float Getter::GetCentrality(float xvalue, float yvalue) const
return
-
1.
;
return
-
1.
;
}
}
Getter
*
Getter
::
Create1DGetter
(
std
::
vector
<
double
>
borders
)
{
typedef
decltype
(
ranges_
)
::
value_type
Floating_t
;
size_t
n_borders
=
borders
.
size
();
assert
(
n_borders
>
2
);
Floating_t
range_max
=
100.
f
;
Floating_t
range_min
=
0.
f
;
Floating_t
range_step
=
(
range_max
-
range_min
)
/
(
n_borders
-
1
);
decltype
(
ranges_
)
ranges
(
n_borders
);
for
(
int
i
=
0
;
i
<
n_borders
;
++
i
)
{
auto
rr
=
range_min
+
range_step
*
i
;
ranges
[
i
]
=
rr
;
std
::
cout
<<
rr
<<
"%: "
<<
borders
[
i
]
<<
std
::
endl
;
}
TAxis
ax_borders
(
static_cast
<
Int_t
>
(
n_borders
-
1
),
&
(
borders
[
0
]));
auto
getter
=
new
Getter
;
getter
->
ranges_
=
std
::
move
(
ranges
);
getter
->
borders_
=
ax_borders
;
getter
->
isinitialized_
=
true
;
return
getter
;
}
}
}
This diff is collapsed.
Click to expand it.
src/Getter.h
+
49
−
45
View file @
16438831
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#ifndef CENTRALITY_GETTER_H
#ifndef CENTRALITY_GETTER_H
#define CENTRALITY_GETTER_H
#define CENTRALITY_GETTER_H
#include
<assert.h>
#include
"vector"
#include
"vector"
#include
"array"
#include
"array"
...
@@ -16,53 +17,56 @@
...
@@ -16,53 +17,56 @@
#include
"TRandom.h"
#include
"TRandom.h"
namespace
Centrality
{
namespace
Centrality
{
class
Getter
:
public
TObject
{
class
Getter
:
public
TObject
{
public:
public:
Getter
(){}
Getter
()
=
default
;
float
GetCentrality
(
float
value
)
const
;
float
GetCentrality
(
float
value
)
const
;
float
GetCentrality
(
float
xvalue
,
float
yvalue
)
const
;
float
GetCentrality
(
float
xvalue
,
float
yvalue
)
const
;
void
SetBorders
(
const
std
::
vector
<
double
>
&
borders
)
void
SetBorders
(
const
std
::
vector
<
double
>
&
borders
)
{
{
borders_
=
TAxis
(
borders
.
size
()
-
1
,
&
(
borders
[
0
]));
borders_
=
TAxis
(
borders
.
size
()
-
1
,
&
(
borders
[
0
])
);
isinitialized_
=
true
;
isinitialized_
=
true
;
}
}
const
TAxis
&
GetBorders
()
const
{
return
borders_
;
};
const
TAxis
&
GetBorders
()
const
{
return
borders_
;
};
const
std
::
vector
<
float
>
&
GetRanges
()
const
{
return
ranges_
;
};
const
std
::
vector
<
float
>&
GetRanges
()
const
{
return
ranges_
;
};
void
SetRanges
(
const
std
::
vector
<
float
>
&
ranges
)
{
ranges_
=
ranges
;
}
void
SetRanges
(
const
std
::
vector
<
float
>
&
ranges
)
{
ranges_
=
ranges
;
}
void
IsSpectator
(
bool
is
=
true
)
{
isspectator_
=
is
;
}
void
IsSpectator
(
bool
is
=
true
)
{
isspectator_
=
is
;
}
void
AddBorder2D
(
const
std
::
array
<
float
,
2
>
&
border2D
)
{
void
AddBorder2D
(
const
std
::
array
<
float
,
2
>
&
border2D
)
borders2d_
.
push_back
(
border2D
);
{
if
(
!
isinitialized2D_
)
isinitialized2D_
=
true
;
borders2d_
.
push_back
(
border2D
);
}
if
(
!
isinitialized2D_
)
isinitialized2D_
=
true
;
}
const
std
::
vector
<
std
::
array
<
float
,
2
>>
&
GetBorders2D
()
const
{
return
borders2d_
;
};
const
std
::
vector
<
std
::
array
<
float
,
2
>>&
GetBorders2D
()
const
{
return
borders2d_
;
};
void
SetMax
(
float
x
,
float
y
)
{
xmax_
=
x
;
void
SetMax
(
float
x
,
float
y
)
{
xmax_
=
x
;
ymax_
=
y
;
}
ymax_
=
y
;
}
private
:
static
Getter
*
Create1DGetter
(
std
::
vector
<
double
>
borders
);
TAxis
borders_
;
std
::
vector
<
std
::
array
<
float
,
2
>>
borders2d_
{};
private
:
std
::
vector
<
float
>
ranges_
{};
TAxis
borders_
;
float
xmax_
{
1.
};
std
::
vector
<
std
::
array
<
float
,
2
>>
borders2d_
{};
float
ymax_
{
1.
};
std
::
vector
<
float
>
ranges_
{};
bool
isspectator_
{
false
};
float
xmax_
{
1.
};
bool
isinitialized_
{
false
};
float
ymax_
{
1.
};
bool
isinitialized2D_
{
false
};
bool
isspectator_
{
false
};
ClassDef
(
Getter
,
2
);
bool
isinitialized_
{
false
};
bool
isinitialized2D_
{
false
};
ClassDef
(
Getter
,
2
);
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment