Skip to content

Commit

Permalink
Migrate to New Random Service Interface
Browse files Browse the repository at this point in the history
Migrate ElectronEnergyCalibrator to use the
new interface of the random number generator
service designed to work with the multithreaded
Framework.
  • Loading branch information
wddgit committed Mar 6, 2014
1 parent 29c3d3b commit 41614bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ using std::ifstream;
using std::istringstream;
using std::cout;

namespace edm {
class StreamID;
}

struct correctionValues
{
double nRunMin;
Expand Down Expand Up @@ -68,7 +72,7 @@ class ElectronEnergyCalibrator
init();
}

void calibrate(SimpleElectron &electron);
void calibrate(SimpleElectron &electron, edm::StreamID const&);
void correctLinearity(SimpleElectron &electron);

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void CalibratedElectronProducer::produce( edm::Event & event, const edm::EventSe
// energy calibration for ecalDriven electrons
if ( ele.core()->ecalDrivenSeed() || correctionsType==2 || combinationType==3 )
{
theEnCorrector->calibrate(mySimpleElectron);
theEnCorrector->calibrate(mySimpleElectron, event.streamID());

// E-p combination

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void CalibratedPatElectronProducer::produce( edm::Event & event, const edm::Even
// energy calibration for ecalDriven electrons
if ( ele->core()->ecalDrivenSeed() || correctionsType==2 || combinationType==3 )
{
theEnCorrector->calibrate(mySimpleElectron);
theEnCorrector->calibrate(mySimpleElectron, event.streamID());

// E-p combination

Expand Down
6 changes: 3 additions & 3 deletions EgammaAnalysis/ElectronTools/src/ElectronEnergyCalibrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ double ElectronEnergyCalibrator::stringToDouble(const string &str)
return val;
}

void ElectronEnergyCalibrator::calibrate(SimpleElectron &electron)
void ElectronEnergyCalibrator::calibrate(SimpleElectron &electron, edm::StreamID const& streamID)
{
double scale = 1.0;
double dsigMC=0.;
Expand Down Expand Up @@ -299,7 +299,7 @@ void ElectronEnergyCalibrator::calibrate(SimpleElectron &electron)
}
} else
{
CLHEP::RandFlat flatRandom(rng->getEngine());
CLHEP::RandFlat flatRandom(rng->getEngine(streamID));
double rn = flatRandom.fire();
if ( rn > lumiRatio_ )
{
Expand Down Expand Up @@ -411,7 +411,7 @@ void ElectronEnergyCalibrator::calibrate(SimpleElectron &electron)

if ( isMC_ )
{
CLHEP::RandGaussQ gaussDistribution(rng->getEngine(), 1.,dsigMC);
CLHEP::RandGaussQ gaussDistribution(rng->getEngine(streamID), 1.,dsigMC);
corrMC = gaussDistribution.fire();
if ( verbose_ )
{
Expand Down

0 comments on commit 41614bf

Please sign in to comment.