Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
np
nptool
Commits
a70ab3e3
Commit
a70ab3e3
authored
10 years ago
by
adrien-matta
Browse files
Options
Downloads
Patches
Plain Diff
* Fixing npanalysis
parent
f2dd4d32
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NPLib/Utility/npanalysis.cxx
+38
-6
38 additions, 6 deletions
NPLib/Utility/npanalysis.cxx
with
38 additions
and
6 deletions
NPLib/Utility/npanalysis.cxx
+
38
−
6
View file @
a70ab3e3
...
@@ -8,7 +8,9 @@
...
@@ -8,7 +8,9 @@
// STL
// STL
#include
<iostream>
#include
<iostream>
#include
<dlfcn.h>
#include
<stdio.h>
#include
<dlfcn.h>
#include
<stdlib.h>
#ifndef SHARED_LIB_EXTENSION_GLOB
#ifndef SHARED_LIB_EXTENSION_GLOB
#define SHARED_LIB_EXTENSION_GLOB
#define SHARED_LIB_EXTENSION_GLOB
...
@@ -25,10 +27,12 @@ std::string SHARED_LIB_EXTENSION = ".dylib";
...
@@ -25,10 +27,12 @@ std::string SHARED_LIB_EXTENSION = ".dylib";
#endif
#endif
#endif
#endif
void
ProgressDisplay
(
clock_t
&
,
clock_t
&
,
unsigned
int
&
,
unsigned
int
&
,
int
&
);
int
main
(
int
argc
,
char
**
argv
){
int
main
(
int
argc
,
char
**
argv
){
// command line parsing
// command line parsing
NPOptionManager
*
myOptionManager
=
NPOptionManager
::
getInstance
(
argc
,
argv
);
NPOptionManager
*
myOptionManager
=
NPOptionManager
::
getInstance
(
argc
,
argv
);
// if input files are not given, use those from TAsciiFile
// if input files are not given, use those from TAsciiFile
if
(
myOptionManager
->
IsDefault
(
"DetectorConfiguration"
))
{
if
(
myOptionManager
->
IsDefault
(
"DetectorConfiguration"
))
{
string
name
=
RootInput
::
getInstance
()
->
DumpAsciiFile
(
"DetectorConfiguration"
);
string
name
=
RootInput
::
getInstance
()
->
DumpAsciiFile
(
"DetectorConfiguration"
);
...
@@ -42,7 +46,7 @@ int main(int argc , char** argv){
...
@@ -42,7 +46,7 @@ int main(int argc , char** argv){
// Instantiate RootOutput
// Instantiate RootOutput
RootOutput
::
getInstance
(
"Analysis/"
+
OutputfileName
,
"ResultTree"
);
RootOutput
::
getInstance
(
"Analysis/"
+
OutputfileName
,
"ResultTree"
);
TTree
*
tree
=
RootOutput
::
getInstance
()
->
GetTree
();
TTree
*
tree
=
RootOutput
::
getInstance
()
->
GetTree
();
// Instantiate the detector using a file
// Instantiate the detector using a file
NPA
::
DetectorManager
*
myDetector
=
new
DetectorManager
();
NPA
::
DetectorManager
*
myDetector
=
new
DetectorManager
();
myDetector
->
ReadConfigurationFile
(
detectorfileName
);
myDetector
->
ReadConfigurationFile
(
detectorfileName
);
...
@@ -66,9 +70,14 @@ int main(int argc , char** argv){
...
@@ -66,9 +70,14 @@ int main(int argc , char** argv){
nentries
=
myOptionManager
->
GetNumberOfEntryToAnalyse
()
;
nentries
=
myOptionManager
->
GetNumberOfEntryToAnalyse
()
;
std
::
cout
<<
" Number of Event to be treated : "
<<
nentries
<<
std
::
endl
;
std
::
cout
<<
" Number of Event to be treated : "
<<
nentries
<<
std
::
endl
;
clock_t
begin
=
clock
();
clock_t
end
=
begin
;
unsigned
int
treated
=
0
;
unsigned
int
inter
=
0
;
if
(
UserAnalysis
==
NULL
){
if
(
UserAnalysis
==
NULL
){
for
(
int
i
=
0
;
i
<
nentries
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
nentries
;
i
++
)
{
ProgressDisplay
(
begin
,
end
,
treated
,
inter
,
nentries
);
// Get the raw Data
// Get the raw Data
Chain
->
GetEntry
(
i
);
Chain
->
GetEntry
(
i
);
// Clear previous Event
// Clear previous Event
...
@@ -81,7 +90,8 @@ int main(int argc , char** argv){
...
@@ -81,7 +90,8 @@ int main(int argc , char** argv){
}
}
else
{
else
{
for
(
int
i
=
0
;
i
<
nentries
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
nentries
;
i
++
)
{
ProgressDisplay
(
begin
,
end
,
treated
,
inter
,
nentries
);
// Get the raw Data
// Get the raw Data
Chain
->
GetEntry
(
i
);
Chain
->
GetEntry
(
i
);
// Clear previous Event
// Clear previous Event
...
@@ -95,7 +105,29 @@ int main(int argc , char** argv){
...
@@ -95,7 +105,29 @@ int main(int argc , char** argv){
}
}
UserAnalysis
->
End
();
UserAnalysis
->
End
();
}
}
ProgressDisplay
(
begin
,
end
,
treated
,
inter
,
nentries
);
RootOutput
::
getInstance
()
->
Destroy
();
RootOutput
::
getInstance
()
->
Destroy
();
return
0
;
return
0
;
}
}
////////////////////////////////////////////////////////////////////////////////
void
ProgressDisplay
(
clock_t
&
begin
,
clock_t
&
end
,
unsigned
int
&
treated
,
unsigned
int
&
inter
,
int
&
total
){
end
=
clock
();
if
((
end
-
begin
)
/
CLOCKS_PER_SEC
>
CLOCKS_PER_SEC
||
treated
>=
total
){
long
double
elapsed
=
(
long
double
)
(
end
-
begin
)
/
CLOCKS_PER_SEC
;
double
event_rate
=
inter
/
elapsed
;
double
percent
=
100
*
treated
/
total
;
double
remain
=
(
total
-
treated
)
/
event_rate
;
if
(
treated
!=
total
)
printf
(
"
\r
\033
[1;31m ******* Progress: %.1f | Rate: %.1f evt/s | Remain: %.1fs *******
\033
[0m"
,
percent
,
event_rate
,
remain
);
else
printf
(
"
\r
\033
[1;32m ******* Progress: %.1f | Rate: %.1f evt/s | Remain: %.1fs *******
\033
[0m"
,
percent
,
event_rate
,
remain
);
fflush
(
stdout
);
begin
=
clock
()
;
inter
=
0
;
}
treated
++
;
inter
++
;
}
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