Skip to content
Snippets Groups Projects
Commit 7ec28898 authored by Ewelina Maria Lobodzinska's avatar Ewelina Maria Lobodzinska Committed by Graeme Stewart
Browse files

EvgenOTFTopUpSvc added (EvgenProdTools-00-02-13)

        * implement   EvgenOTFTopUpSvc from Zach
        * tagging EvgenProdTools-00-02-13
parent 16a4b1af
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EVGENPRODTOOLS_EVGENOTFTOPUPSVC_H
#define EVGENPRODTOOLS_EVGENOTFTOPUPSVC_H
#include "AthenaBaseComps/AthService.h"
#include "EvgenProdTools/IEvgenOTFTopUpSvc.h"
#include <string>
/// @brief Service to hold some information for topping up
/// algorithms that are running on the fly. It's a bit tricky,
/// but this is mostly just a service for holding some numbers...
///
class EvgenOTFTopUpSvc : public AthService , public IEvgenOTFTopUpSvc {
public:
// Constructor and destructor
EvgenOTFTopUpSvc(const std::string& name, ISvcLocator* pSvcLocator);
~EvgenOTFTopUpSvc() {;} //!< Nothing to delete...
// Standard sequence functions - don't actually need an excecute
// Could use init() as a chance to run OTF for the first time,
// but that applied to the OTF algorithm, not this service
StatusCode finalize();
// Getters
virtual long getNPerFile() const { return m_nPerFile; }
virtual long getNUsedSoFar() const { return m_nUsedSoFar; }
virtual double getEfficiency() const { return m_efficiency; }
virtual bool getNewFileFlag() const { return m_newFileFlag; }
// Setters - first for Pythia/Herwig to call when they use up events
virtual void usedEvents() { ++m_nUsedSoFar; }
virtual void usedEvents( const int n ) { m_nUsedSoFar+=n; }
// New file created by the OTF generator algorithm
virtual void newFile( std::string& s ) { ++m_nIterations; m_newFileFlag=true; m_newFileName=s; m_nUsedSoFar=0; }
// New file grabbed by the showering generator
virtual const std::string& getFile() { m_newFileFlag=false; return m_newFileName; }
static const InterfaceID& interfaceID() { return IID_IEvgenOTFTopUpSvc; }
StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
private:
bool m_execDuringInit; //!< Execute OTF during initialization? (Set in JO)
long m_nPerFile; //!< Number of events per LHE file (Set in JO)
long m_nUsedSoFar; //!< Number of events used so far by Pythia/Herwig (counter)
double m_efficiency; //!< Rough efficiency in Pythia/Herwig (Set in JO)
bool m_newFileFlag; //!< Just produced a new file with the OTF generator
std::string m_newFileName; //!< Name of the new OTF generated file
long m_nTotal; //!< Book-keeping: total number of generated events
long m_nIterations; //!< Book-keeping: total number of OTF iterations
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EVGENPRODTOOLS_IEVGENOTFTOPUPSVC_H
#define EVGENPRODTOOLS_IEVGENOTFTOPUPSVC_H
#include "GaudiKernel/IInterface.h"
#include <string>
/// @brief IService to hold some information for topping up
/// algorithms that are running on the fly. It's a bit tricky,
/// but this is mostly just a service for holding some numbers...
///
static const InterfaceID IID_IEvgenOTFTopUpSvc("IEvgenOTFTopUpSvc", 1 , 0);
class IEvgenOTFTopUpSvc : virtual public IInterface {
public:
// Getters
virtual long getNPerFile() const = 0;
virtual long getNUsedSoFar() const = 0;
virtual double getEfficiency() const = 0;
virtual bool getNewFileFlag() const = 0;
// Setters - first for Pythia/Herwig to call when they use up events
virtual void usedEvents() = 0;
virtual void usedEvents( const int ) = 0;
// New file created by the OTF generator algorithm
virtual void newFile( std::string& ) = 0;
// New file grabbed by the showering generator
virtual const std::string& getFile() = 0;
static const InterfaceID& interfaceID() { return IID_IEvgenOTFTopUpSvc; };
};
#endif
......@@ -8,6 +8,7 @@ use AtlasHepMC AtlasHepMC-* External
use AtlasROOT AtlasROOT-* External
use GeneratorModules GeneratorModules-* Generators
use TruthHelper TruthHelper-* Generators/GenAnalysisTools
use AthenaBaseComps AthenaBaseComps-* Control
private
use AthenaKernel AthenaKernel-* Control
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "EvgenProdTools/EvgenOTFTopUpSvc.h"
EvgenOTFTopUpSvc::EvgenOTFTopUpSvc(const std::string& name, ISvcLocator* pSvcLocator)
: AthService(name, pSvcLocator)
{
declareProperty("Efficiency", m_efficiency=0.9, "Estimate of Pythia/Herwig matching efficiency and filter efficiency");
declareProperty("ExecDuringInit", m_execDuringInit=false, "Execute OTF algorithm during intialize");
declareProperty("NPerFile", m_nPerFile=long(5000./0.9), "Number of events to make per file with OTF algorithm");
declareProperty("NewFileName", m_newFileName="events.lhe", "Please that the new OTF events went");
}
StatusCode EvgenOTFTopUpSvc::finalize() {
ATH_MSG_INFO("Total on the fly generated events: " << m_nTotal << " over " << m_nIterations << " iterations.");
return StatusCode::SUCCESS;
}
/** Query the interfaces - this is copied and pasted :( */
StatusCode EvgenOTFTopUpSvc::queryInterface(const InterfaceID& riid, void** ppvInterface){
if ( IID_IEvgenOTFTopUpSvc == riid )
*ppvInterface = (IEvgenOTFTopUpSvc*)this;
else {
// Interface is not directly available: try out a base class
return Service::queryInterface(riid, ppvInterface);
}
addRef();
return StatusCode::SUCCESS;
}
......@@ -4,16 +4,19 @@
#include "EvgenProdTools/CountHepMC.h"
#include "EvgenProdTools/FixHepMC.h"
#include "EvgenProdTools/TestHepMC.h"
#include "EvgenProdTools/EvgenOTFTopUpSvc.h"
DECLARE_ALGORITHM_FACTORY(CopyEventWeight)
DECLARE_ALGORITHM_FACTORY(CountHepMC)
DECLARE_ALGORITHM_FACTORY(FixHepMC)
DECLARE_ALGORITHM_FACTORY(TestHepMC)
DECLARE_SERVICE_FACTORY(EvgenOTFTopUpSvc)
DECLARE_FACTORY_ENTRIES( EvgenProdTools ) {
DECLARE_ALGORITHM( ExpressionGenFilter );
DECLARE_ALGORITHM( ExpressionGenFilter )
DECLARE_ALGORITHM(CopyEventWeight)
DECLARE_ALGORITHM(CountHepMC)
DECLARE_ALGORITHM(FixHepMC)
DECLARE_ALGORITHM(TestHepMC)
DECLARE_SERVICE(EvgenOTFTopUpSvc)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment