Commit f540517b authored by Elmar Ritsch's avatar Elmar Ritsch Committed by Graeme Stewart
Browse files

provide all BarcodeServices configurations through ConfGetter methods + add...

provide all BarcodeServices configurations through ConfGetter methods + add MC15 BarcodeService configuration (ATLASSIM-1658) (BarcodeServices-00-01-00)

	* provide all BarcodeServices configurations through ConfGetter methods
	* add MC15 BarcodeService configuration (ATLASSIM-1658)
	* Tagging as BarcodeServices-00-01-00

2014-09-19  Marcin Nowak  <Marcin.Nowak@cern.ch>
	* Root\LinkDef.h: added "+" to #pragma link C++
	* cmt\requirements: removed unnecessary explicit -lCint
	* Tagging as BarcodeServices-00-00-17
parent 2776f63e
......@@ -90,13 +90,16 @@ namespace Barcode {
/** barcode information used for GenVertices */
VertexBarcode m_firstVertex;
VertexBarcode m_vertexIncrement;
VertexBarcode m_curVertex;
VertexBarcode m_currentVertex;
/** barcode information used for secondary GenParticles */
ParticleBarcode m_firstSecondary;
ParticleBarcode m_secondaryIncrement;
ParticleBarcode m_curParticle;
ParticleBarcode m_currentSecondary;
/** barcode offset for each regeneration of updated particles */
ParticleBarcode m_particleRegenerationIncrement;
/** throw error messages if a possible overflow is detected */
bool m_doUnderOverflowChecks;
......
......@@ -17,8 +17,8 @@
#pragma link off all functions;
#pragma link C++ namespace Barcode;
#pragma link C++ class Barcode::BitCalculator;
#pragma link C++ class Barcode::TruthDressRoom;
#pragma link C++ class Barcode::BitCalculator+;
#pragma link C++ class Barcode::TruthDressRoom+;
#endif
......
......@@ -35,7 +35,9 @@ library BarcodeServices *.cxx components/*.cxx
macro_append BarcodeServices_dependencies " BarcodeServicesLib"
apply_pattern component_library
apply_pattern declare_joboptions files="*.py"
apply_pattern declare_python_modules files="*.py"
private
macro_append BarcodeServicesLib_use_linkopts " -L$(ROOTSYS)/lib -lCore -lCint"
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
"""
BarcodeServices configurations
Elmar Ritsch, 23/10/2014
"""
from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,\
getService,getServiceClone,getAlgorithm,getAlgorithmClone
from AthenaCommon.Constants import * # FATAL,ERROR etc.
from AthenaCommon.SystemOfUnits import *
from AthenaCommon.DetFlags import DetFlags
def getMC15BarcodeSvc(name="Barcode_MC15BarcodeSvc", **kwargs):
kwargs.setdefault("FirstVertexBarcode" , -1000001 )
kwargs.setdefault("VertexIncrement" , -1 )
kwargs.setdefault("FirstSecondaryBarcode" , 1000001 )
kwargs.setdefault("SecondaryIncrement" , 1 )
kwargs.setdefault("ParticleRegenerationIncrement" , 10000000 )
kwargs.setdefault("DoUnderAndOverflowChecks" , True )
kwargs.setdefault("EncodePhysicsProcessInVertexBC", False )
#
from BarcodeServices.BarcodeServicesConf import Barcode__GenericBarcodeSvc
return Barcode__GenericBarcodeSvc(name, **kwargs)
def getMC12BarcodeSvc(name="Barcode_MC12BarcodeSvc", **kwargs):
kwargs.setdefault("FirstVertexBarcode" , -200001)
kwargs.setdefault("VertexIncrement" , -1)
kwargs.setdefault("FirstSecondaryBarcode" , 200001)
kwargs.setdefault("SecondaryIncrement" , 1)
kwargs.setdefault("ParticleGenerationIncrement" , 1000000)
#
from BarcodeServices.BarcodeServicesConf import Barcode__LegacyBarcodeSvc
return Barcode__LegacyBarcodeSvc(name, **kwargs)
def getPhysicsProcessBarcodeSvc(name="Barcode_PhysicsProcessBarcodeSvc", **kwargs):
kwargs.setdefault("EncodePhysicsProcessInVertexBC", False )
kwargs.setdefault("FirstVertexBarcode" , -200000 )
kwargs.setdefault("VertexIncrement" , -1000000)
kwargs.setdefault("FirstSecondaryBarcode" , 200001 )
kwargs.setdefault("SecondaryIncrement" , 1 )
kwargs.setdefault("EncodePhysicsProcessInVertexBC", True )
#
getMC15BarcodeSvc(name, **kwargs)
def getGlobalBarcodeSvc(name="Barcode_GlobalBarcodeSvc", **kwargs):
kwargs.setdefault("FirstVertexBarcode" , -200000 );
kwargs.setdefault("VertexIncrement" , -1000000 );
kwargs.setdefault("FirstSecondaryBarcode" , 200001 );
kwargs.setdefault("SecondaryIncrement" , 1 );
kwargs.setdefault("DoUnderAndOverflowChecks" , True );
kwargs.setdefault("EncodePhysicsProcessInVertexBC", True );
#
from BarcodeServices.BarcodeServicesConf import Barcode__GlobalBarcodeSvc
return Barcode__GlobalBarcodeSvc(name, **kwargs)
def getValidationBarcodeSvc(name="Barcode_ValidationBarcodeSvc", **kwargs):
kwargs.setdefault("FirstVertexBarcode" , -200001)
kwargs.setdefault("VertexIncrement" , -1)
kwargs.setdefault("FirstSecondaryBarcode" , 200001)
kwargs.setdefault("SecondaryIncrement" , 1)
kwargs.setdefault("ParticleGenerationIncrement" , 1000000)
kwargs.setdefault("DoUnderAndOverflowChecks" , True)
#
from BarcodeServices.BarcodeServicesConf import Barcode__ValidationBarcodeSvc
return Barcode__ValidationBarcodeSvc(name, **kwargs)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
"""
Configuration database for BarcodeServices
Elmar Ritsch, 23/10/2014
"""
from AthenaCommon.CfgGetter import addTool, addToolClone, addService, addAlgorithm, \
addTypesToExcludeIfDefaultValue, addNamesToExcludeIfDefaultValue, addFullNamesToExcludeIfDefaultValue, \
addPropertiesToExcludeIfDefault, \
addTypesToSkipIfNotAvailable, addNamesToSkipIfNotAvailable, addFullNamesToSkipIfNotAvailable, \
addTypesOnlyToSkip
from AthenaCommon.Constants import * # FATAL,ERROR etc.
import AthenaCommon.SystemOfUnits as Units
# Common tools, services and algorithms used by jobs:
addService("BarcodeServices.BarcodeServicesConfig.getMC12BarcodeSvc" , "Barcode_MC12BarcodeSvc" )
addService("BarcodeServices.BarcodeServicesConfig.getMC15BarcodeSvc" , "Barcode_MC15BarcodeSvc" )
addService("BarcodeServices.BarcodeServicesConfig.getPhysicsProcessBarcodeSvc", "Barcode_PhysicsProcessBarcodeSvc")
addService("BarcodeServices.BarcodeServicesConfig.getGlobalBarcodeService" , "Barcode_GlobalBarcodeService" )
addService("BarcodeServices.BarcodeServicesConfig.getLegacyBarcodeService" , "Barcode_LegacyBarcodeService" )
addService("BarcodeServices.BarcodeServicesConfig.getValidationBarcodeSvc" , "Barcode_ValidationBarcodeSvc" )
......@@ -15,22 +15,24 @@
Barcode::GenericBarcodeSvc::GenericBarcodeSvc(const std::string& name,ISvcLocator* svc) :
AthService(name,svc),
m_incidentSvc("IncidentSvc", name),
m_firstVertex(-200000),
m_vertexIncrement(-1000000),
m_curVertex(m_firstVertex),
m_firstSecondary(200001),
m_firstVertex(-1000001),
m_vertexIncrement(-1),
m_currentVertex(-1),
m_firstSecondary(1000001),
m_secondaryIncrement(1),
m_curParticle(m_firstSecondary),
m_currentSecondary(1),
m_particleRegenerationIncrement(10000000),
m_doUnderOverflowChecks(true),
m_encodePhysicsProcess(true)
m_encodePhysicsProcess(false)
{
// python properties
declareProperty("FirstVertexBarcode" , m_firstVertex=-200000 );
declareProperty("VertexIncrement" , m_vertexIncrement=-1000000 );
declareProperty("FirstSecondaryBarcode" , m_firstSecondary=200001 );
declareProperty("SecondaryIncrement" , m_secondaryIncrement=1 );
declareProperty("DoUnderAndOverflowChecks" , m_doUnderOverflowChecks=true );
declareProperty("EncodePhysicsProcessInVertexBC", m_encodePhysicsProcess=true );
declareProperty("FirstVertexBarcode" , m_firstVertex=-1000001 );
declareProperty("VertexIncrement" , m_vertexIncrement=-1 );
declareProperty("FirstSecondaryBarcode" , m_firstSecondary=1000001 );
declareProperty("SecondaryIncrement" , m_secondaryIncrement=1 );
declareProperty("ParticleRegenerationIncrement" , m_particleRegenerationIncrement=10000000);
declareProperty("DoUnderAndOverflowChecks" , m_doUnderOverflowChecks=true );
declareProperty("EncodePhysicsProcessInVertexBC", m_encodePhysicsProcess=false );
}
......@@ -60,22 +62,24 @@ StatusCode Barcode::GenericBarcodeSvc::initialize()
Barcode::VertexBarcode Barcode::GenericBarcodeSvc::newVertex( Barcode::ParticleBarcode /* parent */,
Barcode::PhysicsProcessCode process ) {
// update the internal vertex BC counter
m_curVertex += m_vertexIncrement;
m_currentVertex += m_vertexIncrement;
// the barcode that will be returned
Barcode::VertexBarcode newBC = m_curVertex;
Barcode::VertexBarcode newBC = m_currentVertex;
// if enabled, put the physics process code into the vertex barcode
if (m_encodePhysicsProcess)
if (m_encodePhysicsProcess) {
newBC = newBC - process;
// an example vertex BC would be (8th vtx, process #1234): -8201234
}
// a naive underflog checking based on the fact that vertex
// barcodes should never be positive
if ( m_doUnderOverflowChecks && ( newBC > 0))
if ( m_doUnderOverflowChecks && ( newBC > 0)) {
ATH_MSG_ERROR("LegacyBarcodeSvc::newVertex(...)"
<< " will return a vertex barcode greater than 0: "
<< m_curVertex << ". Possibly Integer Underflow?");
<< " will return a vertex barcode greater than 0: '"
<< m_currentVertex << "'. Possibly Integer Underflow?");
}
return newBC;
}
......@@ -86,16 +90,18 @@ Barcode::VertexBarcode Barcode::GenericBarcodeSvc::newVertex( Barcode::ParticleB
the secondary */
Barcode::ParticleBarcode Barcode::GenericBarcodeSvc::newSecondary( Barcode::ParticleBarcode /* parentBC */,
Barcode::PhysicsProcessCode /* process */) {
m_curParticle += m_secondaryIncrement;
m_currentSecondary += m_secondaryIncrement;
// a naive overflow checking based on the fact that particle
// barcodes should never be negative
if ( m_doUnderOverflowChecks && (m_curParticle < 0))
if ( m_doUnderOverflowChecks && (m_currentSecondary < 0)) {
ATH_MSG_ERROR("LegacyBarcodeSvc::newSecondary(...)"
<< " will return a particle barcode of less than 0: "
<< m_curParticle << ". Possibly Integer Overflow?");
<< " will return a particle barcode of less than 0: '"
<< m_currentSecondary << "'. Reset to zero.");
m_currentSecondary = Barcode::fUndefinedBarcode;
}
return m_curParticle;
return m_currentSecondary;
}
......@@ -110,10 +116,20 @@ Barcode::ParticleBarcode Barcode::GenericBarcodeSvc::sharedChildBarcode( Barcode
/** Update the given barcode (e.g. after an interaction) */
Barcode::ParticleBarcode Barcode::GenericBarcodeSvc::incrementBarcode( Barcode::ParticleBarcode /* old */,
Barcode::ParticleBarcode Barcode::GenericBarcodeSvc::incrementBarcode( Barcode::ParticleBarcode old,
Barcode::PhysicsProcessCode /* process */) {
m_curParticle += m_secondaryIncrement;
return ( m_curParticle);
Barcode::ParticleBarcode newBC = old + m_particleRegenerationIncrement;
// a naive overflow checking based on the fact that particle
// barcodes should never be negative
if ( m_doUnderOverflowChecks && (newBC < 0)) {
ATH_MSG_ERROR("LegacyBarcodeSvc::incrementBarcode('" << old << "')"
<< " will return a particle barcode of less than 0: '"
<< newBC << "'. Reset to zero.");
newBC = Barcode::fUndefinedBarcode;
}
return newBC;
}
......@@ -129,8 +145,8 @@ void Barcode::GenericBarcodeSvc::registerLargestGenEvtVtxBC( Barcode::VertexBarc
void Barcode::GenericBarcodeSvc::handle(const Incident& inc) {
if ( inc.type() == IncidentType::BeginEvent ) {
ATH_MSG_VERBOSE("'BeginEvent' incident caught. Resetting Vertex and Particle barcode counters.");
m_curParticle = m_firstSecondary - m_secondaryIncrement;
m_curVertex = m_firstVertex - m_vertexIncrement;
m_currentVertex = m_firstVertex - m_vertexIncrement;
m_currentSecondary = m_firstSecondary - m_secondaryIncrement;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment