Skip to content

Commit

Permalink
Fixed thread-safety issues with PixelToFEDAssociateFromAscii
Browse files Browse the repository at this point in the history
Changed the class statics to be member data. This avoids potential
thread-safety issues. The additional minor changes were to support
this change or to make mainentance easier. The exact functionality
of this class was unchanged.
  • Loading branch information
Dr15Jones committed Mar 7, 2014
1 parent 29c3d3b commit 3bfcf5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ class PixelToFEDAssociateFromAscii : public PixelToFEDAssociate {
PixelToFEDAssociateFromAscii(const std::string & fileName);

/// FED id for module
virtual int operator()(const PixelModuleName &) const;
virtual int operator()(const PixelModuleName &) const override;

/// version
virtual std::string version() const;
virtual std::string version() const override;


/// FED id to which barrel modul (identified by name) should be assigned
virtual int operator()(const PixelBarrelName &) const;
int operator()(const PixelBarrelName &) const;

/// FED id to which endcape modul (identified by name) should be assigned
virtual int operator()(const PixelEndcapName &) const;
int operator()(const PixelEndcapName &) const;

private:
/// initialisatin (read file)
Expand All @@ -53,16 +53,16 @@ class PixelToFEDAssociateFromAscii : public PixelToFEDAssociate {

typedef std::vector< std::pair< int, std::vector<Bdu> > > BarrelConnections;
typedef std::vector< std::pair< int, std::vector<Edu> > > EndcapConnections;
static BarrelConnections theBarrel;
static EndcapConnections theEndcap;
BarrelConnections theBarrel;
EndcapConnections theEndcap;

private:

std::string theVersion;

/// initialisation (read input file)
void send (std::pair< int, std::vector<Bdu> > & ,
std::pair< int, std::vector<Edu> > & ) const;
std::pair< int, std::vector<Edu> > & ) ;
Bdu getBdu( std::string ) const;
Edu getEdu( std::string ) const;
Range readRange( const std::string &) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
using namespace std;


PixelToFEDAssociateFromAscii::BarrelConnections PixelToFEDAssociateFromAscii::theBarrel
= PixelToFEDAssociateFromAscii::BarrelConnections();
PixelToFEDAssociateFromAscii::EndcapConnections PixelToFEDAssociateFromAscii::theEndcap
= PixelToFEDAssociateFromAscii::EndcapConnections();


PixelToFEDAssociateFromAscii::PixelToFEDAssociateFromAscii(const string & fn) {
init(fn);
}
Expand Down Expand Up @@ -169,7 +163,7 @@ void PixelToFEDAssociateFromAscii::init(const string & cfg_name)
}

void PixelToFEDAssociateFromAscii::send(
pair<int,vector<Bdu> > & b, pair<int,vector<Edu> > & e) const
pair<int,vector<Bdu> > & b, pair<int,vector<Edu> > & e)
{
if (b.second.size() > 0) theBarrel.push_back(b);
if (e.second.size() > 0) theEndcap.push_back(e);
Expand Down

0 comments on commit 3bfcf5e

Please sign in to comment.