Skip to content

Commit

Permalink
Merge pull request #3012 from VinInn/MagFieldInlined
Browse files Browse the repository at this point in the history
Reco -- make nominalValue() inlined
  • Loading branch information
ktf committed Mar 29, 2014
2 parents cceeb18 + 1c80ad7 commit 19ba3ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 4 additions & 1 deletion MagneticField/Engine/interface/MagneticField.h
Expand Up @@ -53,7 +53,10 @@ class MagneticField
}

/// The nominal field value for this map in kGauss
int nominalValue() const;
int nominalValue() const {
if(kSet==nominalValueCompiuted.load()) return theNominalValue;
return computeNominalValue();
}

private:
//nominal field value
Expand Down
9 changes: 1 addition & 8 deletions MagneticField/Engine/src/MagneticField.cc
Expand Up @@ -20,14 +20,7 @@ MagneticField::MagneticField(const MagneticField& orig) : nominalValueCompiuted(
MagneticField::~MagneticField(){}

int MagneticField::computeNominalValue() const {
return int((inTesla(GlobalPoint(0.f,0.f,0.f))).z() * 10.f + 0.5f);
}

int MagneticField::nominalValue() const {
if(kSet==nominalValueCompiuted.load()) return theNominalValue;

//need to make one
int tmp = computeNominalValue();
int tmp = int((inTesla(GlobalPoint(0.f,0.f,0.f))).z() * 10.f + 0.5f);

//Try to cache
char expected = kUnset;
Expand Down

0 comments on commit 19ba3ad

Please sign in to comment.