Skip to content

Commit 11f37a7

Browse files
committed
Merge pull request cms-sw#2664 from gartung/statics-DataFormats-ParticleFlowReco
Thread Safety DataFormats/ParticleFlowReco -- Change depthCor* static members to static std::atomic
2 parents 16689f9 + d2e975b commit 11f37a7

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

DataFormats/ParticleFlowReco/interface/PFCluster.h

+20-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
#include <iostream>
1515
#include <vector>
16-
16+
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
17+
#include <atomic>
18+
#endif
1719

1820

1921
class PFClusterAlgo;
@@ -141,7 +143,22 @@ namespace reco {
141143

142144
/// cluster position: rho, eta, phi (transient)
143145
REPPoint posrep_;
144-
146+
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
147+
/// \todo move to PFClusterTools
148+
static std::atomic<int> depthCorMode_;
149+
150+
/// \todo move to PFClusterTools
151+
static std::atomic<double> depthCorA_;
152+
153+
/// \todo move to PFClusterTools
154+
static std::atomic<double> depthCorB_ ;
155+
156+
/// \todo move to PFClusterTools
157+
static std::atomic<double> depthCorAp_;
158+
159+
/// \todo move to PFClusterTools
160+
static std::atomic<double> depthCorBp_;
161+
#else
145162

146163
/// \todo move to PFClusterTools
147164
static int depthCorMode_;
@@ -157,6 +174,7 @@ namespace reco {
157174

158175
/// \todo move to PFClusterTools
159176
static double depthCorBp_;
177+
#endif
160178

161179
static const math::XYZPoint dummyVtx_;
162180

DataFormats/ParticleFlowReco/src/PFCluster.cc

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@
44
using namespace std;
55
using namespace reco;
66

7-
7+
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
8+
std::atomic<int> PFCluster::depthCorMode_{0};
9+
std::atomic<double> PFCluster::depthCorA_{0.89};
10+
std::atomic<double> PFCluster::depthCorB_{7.3};
11+
std::atomic<double> PFCluster::depthCorAp_{0.89};
12+
std::atomic<double> PFCluster::depthCorBp_{4.0};
13+
#else
814
int PFCluster::depthCorMode_ = 0;
915
double PFCluster::depthCorA_ = 0.89;
1016
double PFCluster::depthCorB_ = 7.3;
1117
double PFCluster::depthCorAp_ = 0.89;
1218
double PFCluster::depthCorBp_ = 4.0;
19+
#endif
20+
1321

1422
const math::XYZPoint PFCluster::dummyVtx_(0,0,0);
1523

0 commit comments

Comments
 (0)