Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VKSort
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
AUSA
Oliskir
VKSort
Commits
31c69533
Commit
31c69533
authored
7 years ago
by
Oliver Kirsebom
Browse files
Options
Downloads
Patches
Plain Diff
sort executable
parent
1475f930
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
CMakeLists.txt
+8
-0
8 additions, 0 deletions
CMakeLists.txt
include/vklib/VKRawReader.h
+1
-0
1 addition, 0 deletions
include/vklib/VKRawReader.h
sort.cpp
+80
-0
80 additions, 0 deletions
sort.cpp
source/VKRawReader.cpp
+7
-1
7 additions, 1 deletion
source/VKRawReader.cpp
with
97 additions
and
1 deletion
.gitignore
+
1
−
0
View file @
31c69533
...
...
@@ -11,6 +11,7 @@ cotire/*
# Custom
vktest
vksort
*.pdf
*.png
...
...
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
8
−
0
View file @
31c69533
...
...
@@ -19,6 +19,8 @@ file(GLOB_RECURSE SOURCE "source/*.cpp")
add_library
(
vklib
${
HEADERS
}
${
SOURCE
}
${
GIT_FILE
}
)
add_executable
(
vksort sort.cpp
${
HEADERS
}
${
SOURCE
}
)
############################################
## Dependencies ##
...
...
@@ -47,6 +49,7 @@ message (STATUS ${ROOT_INCLUDE_DIR})
# Add libraries to target
target_link_libraries
(
vklib
${
LIBRARIES
}
)
target_link_libraries
(
vksort vklib
${
LIBRARIES
}
)
#########################################
...
...
@@ -79,3 +82,8 @@ INSTALL(TARGETS vklib
)
install
(
DIRECTORY include/vklib DESTINATION include
)
INSTALL
(
TARGETS vksort
RUNTIME DESTINATION bin
)
This diff is collapsed.
Click to expand it.
include/vklib/VKRawReader.h
+
1
−
0
View file @
31c69533
...
...
@@ -66,6 +66,7 @@ namespace VEIKONKONE {
std
::
unique_ptr
<
std
::
ifstream
>
file
;
bool
_eof
;
std
::
string
input
;
bool
first
;
};
}
#endif //VK_RAW_READER_H
This diff is collapsed.
Click to expand it.
sort.cpp
0 → 100644
+
80
−
0
View file @
31c69533
#include
"vklib/VKSorter.h"
#include
"vklib/VKRawReader.h"
#include
<ausa/util/memory>
#include
<string>
#include
<iostream>
#include
<memory>
#include
<TSystem.h>
#include
<TSystemDirectory.h>
using
namespace
std
;
using
namespace
VEIKONKONE
;
string
datadir
=
"/home/oliskir/Desktop/f20/data/"
;
void
findFiles
(
int
run
,
vector
<
string
>&
input
);
// syntax: ./vksort <Run> [Window]
int
main
(
int
argc
,
char
*
argv
[]
){
// run number
int
run
=
atoi
(
argv
[
1
]);
// coincidence window
double
window
=
30
;
if
(
argc
==
3
)
window
=
atof
(
argv
[
2
]);
vector
<
string
>
input
;
findFiles
(
run
,
input
);
vector
<
shared_ptr
<
VKRawReader
>>
readers
;
for
(
auto
&
i
:
input
)
{
auto
r
=
make_shared
<
VKRawReader
>
(
i
);
readers
.
emplace_back
(
move
(
r
));
}
string
output
=
Form
(
"%ssorted/new/s%04d_000.root"
,
datadir
.
data
(),
run
);
auto
sorter
=
make_unique
<
VKSorter
>
(
readers
,
output
,
window
);
// SIGNAL energy calibration
double
a0
=
30.0
,
a1
=
1.252
,
a2
=
0
;
sorter
->
setCalibration
(
0
,
a0
,
a1
,
a2
);
sorter
->
run
();
return
0
;
}
void
findFiles
(
int
run
,
vector
<
string
>&
input
)
{
TString
path
=
datadir
+
"raw/"
;
TSystemDirectory
dir
(
path
,
path
);
TList
*
files
=
dir
.
GetListOfFiles
();
if
(
files
)
{
TSystemFile
*
file
;
TString
fname
;
TIter
next
(
files
);
while
((
file
=
(
TSystemFile
*
)
next
()))
{
fname
=
file
->
GetName
();
if
(
!
file
->
IsDirectory
())
{
if
(
fname
.
EndsWith
(
Form
(
"%04d_ch000.txt"
,
run
)))
{
input
.
push_back
(
fname
.
Data
());
}
else
if
(
fname
.
EndsWith
(
Form
(
"%04d_ch001.txt"
,
run
)))
{
input
.
push_back
(
fname
.
Data
());
}
else
if
(
fname
.
EndsWith
(
Form
(
"%04d_ch002.txt"
,
run
)))
{
input
.
push_back
(
fname
.
Data
());
}
}
}
}
for
(
auto
&
i
:
input
)
i
=
datadir
+
"raw/"
+
i
;
}
This diff is collapsed.
Click to expand it.
source/VKRawReader.cpp
+
7
−
1
View file @
31c69533
...
...
@@ -11,7 +11,8 @@ using namespace VEIKONKONE;
VKRawReader
::
VKRawReader
(
string
input
)
:
input
(
input
)
:
input
(
input
),
first
(
true
)
{
reset
();
}
...
...
@@ -69,4 +70,9 @@ void VKRawReader::reset()
file
=
make_unique
<
ifstream
>
(
input
.
c_str
());
if
(
!
file
->
good
())
throw
invalid_argument
(
"Unable to find input file "
+
input
);
if
(
first
)
{
cout
<<
"Reading from: "
<<
input
<<
endl
;
first
=
false
;
}
}
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