-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40133 from Dr15Jones/reviveModulesInsideMixing
Revived being able to run modules inside a mixing module
- Loading branch information
Showing
21 changed files
with
343 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef IOMC_RandomEngine_cloneEngine_h | ||
#define IOMC_RandomEngine_cloneEngine_h | ||
// -*- C++ -*- | ||
// | ||
// Package: IOMC/RandomEngine | ||
// Class : cloneEngine | ||
// | ||
/**\function cloneEngine cloneEngine.h "IOMC/RandomEngine/interface/cloneEngine.h" | ||
Description: Function used to clone a random number engine | ||
Usage: | ||
<usage> | ||
*/ | ||
// | ||
// Original Author: Christopher Jones | ||
// Created: Fri, 02 Dec 2022 19:32:10 GMT | ||
// | ||
#include <memory> | ||
|
||
namespace CLHEP { | ||
class HepRandomEngine; | ||
} | ||
|
||
namespace edm { | ||
std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(CLHEP::HepRandomEngine const&); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<use name="FWCore/ServiceRegistry"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="IOMC/RandomEngine"/> | ||
<library file="Module.cc" name="IOMCRandomEnginePlugins"> | ||
<library file="*.cc" name="IOMCRandomEnginePlugins"> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...omEngine/src/RandomEngineStateProducer.cc → ...gine/plugins/RandomEngineStateProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
IOMC/RandomEngine/src/RandomFilter.cc → IOMC/RandomEngine/plugins/RandomFilter.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: IOMC/RandomEngine | ||
// Class : cloneEngine | ||
// | ||
// Implementation: | ||
// [Notes on implementation] | ||
// | ||
// Original Author: Christopher Jones | ||
// Created: Fri, 02 Dec 2022 19:34:37 GMT | ||
// | ||
|
||
// system include files | ||
|
||
// user include files | ||
#include "IOMC/RandomEngine/interface/cloneEngine.h" | ||
#include "IOMC/RandomEngine/interface/TRandomAdaptor.h" | ||
|
||
#include "FWCore/Utilities/interface/EDMException.h" | ||
|
||
#include "CLHEP/Random/engineIDulong.h" | ||
#include "CLHEP/Random/JamesRandom.h" | ||
#include "CLHEP/Random/RanecuEngine.h" | ||
#include "CLHEP/Random/MixMaxRng.h" | ||
|
||
namespace edm { | ||
std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(CLHEP::HepRandomEngine const& existingEngine) { | ||
std::vector<unsigned long> stateL = existingEngine.put(); | ||
long seedL = existingEngine.getSeed(); | ||
std::unique_ptr<CLHEP::HepRandomEngine> newEngine; | ||
if (stateL[0] == CLHEP::engineIDulong<CLHEP::HepJamesRandom>()) { | ||
newEngine = std::make_unique<CLHEP::HepJamesRandom>(seedL); | ||
} else if (stateL[0] == CLHEP::engineIDulong<CLHEP::RanecuEngine>()) { | ||
newEngine = std::make_unique<CLHEP::RanecuEngine>(); | ||
} else if (stateL[0] == CLHEP::engineIDulong<CLHEP::MixMaxRng>()) { | ||
newEngine = std::make_unique<CLHEP::MixMaxRng>(seedL); | ||
} else if (stateL[0] == CLHEP::engineIDulong<TRandomAdaptor>()) { | ||
newEngine = std::make_unique<TRandomAdaptor>(seedL); | ||
} else { | ||
// Sanity check, it should not be possible for this to happen. | ||
throw Exception(errors::Unknown) << "The RandomNumberGeneratorService is trying to clone unknown engine type\n"; | ||
} | ||
newEngine->get(stateL); | ||
return newEngine; | ||
} | ||
}; // namespace edm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.