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
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
np
nptool
Commits
b97b5484
Commit
b97b5484
authored
4 years ago
by
Adrien Matta
Browse files
Options
Downloads
Patches
Plain Diff
* fixing seg fault with analysis of analysis FDC
parent
1eabb90b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPLib/TrackReconstruction/NPDCReconstructionMT.cxx
+18
-9
18 additions, 9 deletions
NPLib/TrackReconstruction/NPDCReconstructionMT.cxx
NPLib/TrackReconstruction/NPDCReconstructionMT.h
+1
-6
1 addition, 6 deletions
NPLib/TrackReconstruction/NPDCReconstructionMT.h
with
19 additions
and
15 deletions
NPLib/TrackReconstruction/NPDCReconstructionMT.cxx
+
18
−
9
View file @
b97b5484
...
@@ -18,7 +18,11 @@
...
@@ -18,7 +18,11 @@
*****************************************************************************/
*****************************************************************************/
#include
"NPDCReconstructionMT.h"
#include
"NPDCReconstructionMT.h"
// ROOT
#include
"Math/Factory.h"
#include
"Math/Factory.h"
#include
"Math/Minimizer.h"
#include
"Math/Functor.h"
#include
"TError.h"
#include
"TError.h"
#include
"TGraph.h"
#include
"TGraph.h"
#include
"TVector3.h"
#include
"TVector3.h"
...
@@ -29,6 +33,9 @@ using namespace NPL;
...
@@ -29,6 +33,9 @@ using namespace NPL;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
DCReconstructionMT
::
DCReconstructionMT
(
unsigned
int
number_thread
){
DCReconstructionMT
::
DCReconstructionMT
(
unsigned
int
number_thread
){
m_nbr_thread
=
number_thread
;
m_nbr_thread
=
number_thread
;
// force loading of the minimizer plugin ahead
ROOT
::
Math
::
Minimizer
*
mini
=
ROOT
::
Math
::
Factory
::
CreateMinimizer
(
"Minuit2"
,
"Migrad"
);
delete
mini
;
}
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
DCReconstructionMT
::~
DCReconstructionMT
(){
DCReconstructionMT
::~
DCReconstructionMT
(){
...
@@ -190,10 +197,8 @@ void NPL::DCReconstructionMT::InitThreadPool(){
...
@@ -190,10 +197,8 @@ void NPL::DCReconstructionMT::InitThreadPool(){
m_Ready
.
clear
();
m_Ready
.
clear
();
m_Ready
.
resize
(
m_nbr_thread
,
false
);
m_Ready
.
resize
(
m_nbr_thread
,
false
);
for
(
unsigned
int
i
=
0
;
i
<
m_nbr_thread
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
m_nbr_thread
;
i
++
)
{
//Create the minimiser (deleted by the thread)
ROOT
::
Math
::
Minimizer
*
mini
=
ROOT
::
Math
::
Factory
::
CreateMinimizer
(
"Minuit2"
,
"Migrad"
);
// Register minimiser for futur deletion
// Register minimiser for futur deletion
m_ThreadPool
.
push_back
(
std
::
thread
(
&
NPL
::
DCReconstructionMT
::
StartThread
,
this
,
mini
,
i
)
);
m_ThreadPool
.
push_back
(
std
::
thread
(
&
NPL
::
DCReconstructionMT
::
StartThread
,
this
,
i
)
);
}
}
m_stop
=
false
;
m_stop
=
false
;
for
(
auto
&
th
:
m_ThreadPool
){
for
(
auto
&
th
:
m_ThreadPool
){
...
@@ -201,17 +206,21 @@ void NPL::DCReconstructionMT::InitThreadPool(){
...
@@ -201,17 +206,21 @@ void NPL::DCReconstructionMT::InitThreadPool(){
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
void
DCReconstructionMT
::
StartThread
(
ROOT
::
Math
::
Minimizer
*
mini
,
unsigned
int
id
){
void
DCReconstructionMT
::
StartThread
(
unsigned
int
id
){
// Let the main thread start
// usefull variable
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
));
double
ai
,
bi
;
unsigned
int
uid
;
const
double
*
xs
;
// create the functor
// create the functor
// each threads needs its own or the minisation is not thread safe
// each threads needs its own or the minisation is not thread safe
ROOT
::
Math
::
Functor
*
func
=
new
ROOT
::
Math
::
Functor
(
this
,
&
NPL
::
DCReconstructionMT
::
SumD
,
3
);
ROOT
::
Math
::
Functor
*
func
=
new
ROOT
::
Math
::
Functor
(
this
,
&
NPL
::
DCReconstructionMT
::
SumD
,
3
);
//Create the minimiser (deleted by the thread)
ROOT
::
Math
::
Minimizer
*
mini
=
ROOT
::
Math
::
Factory
::
CreateMinimizer
(
"Minuit2"
,
"Migrad"
);
mini
->
SetFunction
(
*
func
);
mini
->
SetFunction
(
*
func
);
mini
->
SetPrintLevel
(
0
);
mini
->
SetPrintLevel
(
0
);
double
ai
,
bi
;
unsigned
int
uid
;
// Let the main thread start
const
double
*
xs
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
))
;
while
(
true
){
while
(
true
){
// Do the job if possible
// Do the job if possible
if
(
m_Ready
[
id
]){
if
(
m_Ready
[
id
]){
...
...
This diff is collapsed.
Click to expand it.
NPLib/TrackReconstruction/NPDCReconstructionMT.h
+
1
−
6
View file @
b97b5484
...
@@ -40,10 +40,6 @@
...
@@ -40,10 +40,6 @@
#include
<map>
#include
<map>
#include
<vector>
#include
<vector>
#include
<thread>
#include
<thread>
// ROOT
#include
"Math/Minimizer.h"
#include
"Math/Functor.h"
class
TVector3
;
class
TVector3
;
class
TGraph
;
class
TGraph
;
namespace
NPL
{
namespace
NPL
{
...
@@ -97,7 +93,6 @@ namespace NPL{
...
@@ -97,7 +93,6 @@ namespace NPL{
long
double
av
,
bv
,
au
,
bu
;
long
double
av
,
bv
,
au
,
bu
;
double
xM
,
yM
;
double
xM
,
yM
;
private
:
// Thread Pool defined if C++11 is available
private
:
// Thread Pool defined if C++11 is available
unsigned
int
m_nbr_thread
;
unsigned
int
m_nbr_thread
;
std
::
vector
<
std
::
thread
>
m_ThreadPool
;
std
::
vector
<
std
::
thread
>
m_ThreadPool
;
...
@@ -107,7 +102,7 @@ namespace NPL{
...
@@ -107,7 +102,7 @@ namespace NPL{
public
:
// Init the Thread Pool
public
:
// Init the Thread Pool
void
InitThreadPool
();
void
InitThreadPool
();
void
StartThread
(
ROOT
::
Math
::
Minimizer
*
,
unsigned
int
);
void
StartThread
(
unsigned
int
);
void
StopThread
();
void
StopThread
();
bool
IsDone
();
bool
IsDone
();
...
...
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