Commit 02af379f authored by Catrin Bernius's avatar Catrin Bernius Committed by Graeme Stewart
Browse files

removed chain counter check for physics menu (TrigConfStorage-03-00-72)

	* removed chain counter check for physics menu
	* TrigConfStorage-03-00-72

2015-01-13 Catrin Bernius
	* Increasing counter range of physics menu to 8095 (ATR-9818)
	* TrigConfStorage-03-00-71

2015-01-13 Catrin Bernius
	* Increased size of CTP items to 512 in consistency check
	* TrigConfStorage-03-00-70

2014-12-15 Yu Nakahama
	* Increased mBGDescBlobSize to 512 (ATR-9101)
	* TrigConfStorage-03-00-69

2014-11-27 Joerg Stelzer
	* Update isolation loading for EM/TAU thresholds
	* Add L1Topo menu comparison
	* TrigConfStorage-03-00-68

...
(Long ChangeLog diff - truncated)
parent 73003401
......@@ -7,7 +7,7 @@
#include "TrigConfStorage/StorageMgr.h"
#include "TrigConfStorage/ILoader.h"
#include "RelationalAccess/ISession.h"
#include "RelationalAccess/ISessionProxy.h"
#include "TrigConfBase/TrigConfMessaging.h"
namespace TrigConf {
......@@ -24,9 +24,9 @@ namespace TrigConf {
*
* @param session reference to the database session
*/
explicit DBLoader( StorageMgr& sm, coral::ISession& session );
explicit DBLoader( StorageMgr& sm, coral::ISessionProxy& session );
explicit DBLoader( const std::string& name, StorageMgr& sm, coral::ISession& session );
explicit DBLoader( const std::string& name, StorageMgr& sm, coral::ISessionProxy& session );
/**@brief destructor*/
virtual ~DBLoader(){};
......@@ -35,6 +35,7 @@ namespace TrigConf {
//std::ostream & msg() { return m_storageMgr.msg(); }
virtual void setLevel(MSGTC::Level lvl);
virtual MSGTC::Level outputLevel() const { return msg().level(); }
/** @brief start session if not already active */
......@@ -54,6 +55,9 @@ namespace TrigConf {
virtual int verbose() const { return m_verbose; }
virtual void setVerbose(int v) { m_verbose=v; }
bool isRun1() const { return ! isRun2(); }
bool isRun2() const;
private:
int m_verbose;
......@@ -64,9 +68,12 @@ namespace TrigConf {
protected:
StorageMgr& m_storageMgr; ///< reference to the storage manager
coral::ISession& m_session; ///< CORAL interface to database session
coral::ISessionProxy& m_session; ///< CORAL interface to database session
bool m_sessionOwner; ///< remember if the loader started the session in the first place
static unsigned int s_triggerDBSchemaVersion; ///< the version of the TriggerDB schema
static unsigned int s_run; ///< database schema for run s_run
static unsigned int s_ctpVersion;
static unsigned int s_l1Version;
private:
void loadSchemaVersion();
......
......@@ -31,6 +31,7 @@ namespace TrigConf {
// setting log level
virtual void setLevel(MSGTC::Level lvl) = 0;
virtual MSGTC::Level outputLevel() const = 0;
virtual int verbose() const = 0;
......
......@@ -8,11 +8,16 @@
#include "TrigConfStorage/ILoader.h"
namespace TXC{
class L1TopoMenu;
}
namespace TrigConf {
class ThresholdConfig;
class CTPConfig;
class Muctpi;
class L1TopoConfig;
/**
* @brief Interface for loaders of the LVL1 trigger configuration
......@@ -55,6 +60,16 @@ namespace TrigConf {
*/
virtual bool load(Muctpi& muctpi) = 0;
/**
* @brief Load the LVL1 topo hardware configuration from the
* configuration source
*
* @param l1topomenu reference to the L1Topo object to be filled
*
* @returns @c true if the loading was successful, @c false otherwise
*/
virtual bool load(TXC::L1TopoMenu& l1topo) = 0;
};
}
......
......@@ -11,74 +11,111 @@
#include <memory>
#include "RelationalAccess/IRelationalService.h"
#include "RelationalAccess/IRelationalDomain.h"
#include "RelationalAccess/ISession.h"
#include "RelationalAccess/IConnection.h"
#include "TrigConfBase/TrigConfMessaging.h"
namespace TrigConf
{
namespace coral {
class ISessionProxy;
}
namespace TrigConf {
/**@brief Manager of the database session
*
* it uses CORAL to connect to the different DB technologies
*/
class SessionMgr
{
public:
/**@brief constructor
*
* @param cs connection string
* @param user user name, if not specified the XML authentication will be used
* @param password password string (only used in connection with a user name)
* @param o output stream for all messages
*/
SessionMgr( const std::string& cs, const std::string& user = "",const std::string& password = "", std::ostream & o = std::cout);
/**@brief constructor
*
* @param type Server technology
* @param server Server name
* @param name Database name, or schema name, or, if server and type are not specified, alias name for lookup
* @param user user name, if not specified the XML authentication will be used
* @param password password string (only used in connection with a user name)
* @param o output stream for all messages
*/
SessionMgr( const std::string& type, const std::string& server,
const std::string& name, const std::string& user ,
const std::string& password , std::ostream & o = std::cout);
/**@brief destructor*/
~SessionMgr();
/**@brief close open sessions*/
void closeSession();
/**@brief Manager of the database session
*
* it uses CORAL to connect to the different DB technologies
*/
class SessionMgr : public TrigConfMessaging
{
public:
/**@brief constructor */
SessionMgr();
// /**@brief constructor
// *
// * @param cs connection string
// * @param user user name, if not specified the XML authentication will be used
// * @param password password string (only used in connection with a user name)
// * @param o output stream for all messages
// */
// SessionMgr( const std::string& cs,
// const std::string& user = "",
// const std::string& password = "");
// /**@brief constructor
// *
// * @param type Server technology
// * @param server Server name
// * @param name Database name, or schema name, or, if server and type are not specified, alias name for lookup
// * @param user user name, if not specified the XML authentication will be used
// * @param password password string (only used in connection with a user name)
// * @param o output stream for all messages
// */
// SessionMgr( const std::string& type,
// const std::string& server,
// const std::string& name,
// const std::string& user,
// const std::string& password);
/**@brief destructor*/
~SessionMgr();
/**@brief close open sessions*/
void closeSession();
/**@brief instantiates the session*/
coral::ISession& createSession(int retrialPeriod=30, int retrialTimeout=300, int connectionTimeout=5);
/**@brief SQL -> C++ type conversion mapping for Oracle database to match MySQL*/
void setTypeConversionRules();
const std::string& connection() const { return m_cs; }
void setUseFrontier(bool useFrontier);
bool useFrontier() const { return m_useFrontier; }
private:
/**@brief SQL -> C++ type conversion interface to CORAL*/
void setCppTypeForSqlType(const std::string& cpp_type,
const std::string& sql_type);
coral::ISession * m_session; ///< the coral database session
coral::IConnection * m_connection; ///< the coral connection
std::string m_cs; ///< connection string
std::string m_dbtype; ///< db type
std::string m_dbserver; ///< db server
std::string m_dbname; ///< db name
std::string m_user; ///< user name
std::string m_password; ///< password
bool m_useFrontier; ///< uses frontier instead of oracle
std::ostream & m_ostream; ///< output stream
};
/**@brief instantiates the session*/
coral::ISessionProxy& createSession();
// coral::ISession& createSessionOld(int retrialPeriod=30, int retrialTimeout=300, int connectionTimeout=5);
/**@brief SQL -> C++ type conversion mapping for Oracle database to match MySQL*/
void setTypeConversionRules();
// setters
void setConnectionString(const std::string & connStr) { m_connectionString = connStr; }
void setUseFrontier(bool useFrontier) { m_useFrontier = useFrontier; }
void setRetrialPeriod(int retrialPeriod) { m_retrialPeriod = retrialPeriod; }
void setRetrialTimeout(int retrialTimeout) { m_retrialTimeout = retrialTimeout; }
void setConnectionTimeout(int connectionTimeout) { m_connectionTimeout = connectionTimeout; }
void setDbType(const std::string & s);
void setDbServer(const std::string & s);
void setDbName(const std::string & s);
void setDbUser(const std::string & s);
void setDbPassword(const std::string & s);
// accessors
const std::string& connection() const { return m_connectionString; }
bool useFrontier() const { return m_useFrontier; }
int retrialPeriod() const { return m_retrialPeriod; }
int retrialTimeout() const { return m_retrialTimeout; }
int connectionTimeout() const { return m_connectionTimeout; }
const std::string & dbType() const { return m_dbtype; }
const std::string & dbServer() const { return m_dbserver; }
const std::string & dbName() const { return m_dbname; }
const std::string & dbUser() const { return m_user; }
const std::string & dbPassword() const { return m_password; }
private:
void buildConnectionString();
/**@brief SQL -> C++ type conversion interface to CORAL*/
void setCppTypeForSqlType(const std::string& cpp_type,
const std::string& sql_type);
coral::ISessionProxy * m_sessionproxy { nullptr }; ///< the coral database session
std::string m_connectionString { "" }; ///< connection string
std::string m_dbtype { "" }; ///< db type
std::string m_dbserver { "" }; ///< db server
std::string m_dbname { "" }; ///< db name
std::string m_user { "" }; ///< user name
std::string m_password { "" }; ///< password
bool m_useFrontier { false }; ///< uses frontier instead of oracle
int m_retrialPeriod {0};
int m_retrialTimeout {0};
int m_connectionTimeout {0};
};
}
#endif
......@@ -173,6 +173,7 @@ namespace TrigConf {
static FolderDefinition HltConfigKeysFolderDefinition();
static FolderDefinition HltPrescalesFolderDefinition();
static FolderDefinition HltPrescaleKeyFolderDefinition();
static FolderDefinition Lvl1MonMapFolderSpecification();
static cool::RecordSpecification createLvl1MenuFolderSpecification(); ///< defines the folder structure for the LVL1 menu
......
......@@ -38,7 +38,7 @@ namespace TrigConf {
void setPtree(const value_type* data) { m_data = data; }
virtual void setLevel(MSGTC::Level lvl);
MSGTC::Level outputLevel() const;
MSGTC::Level outputLevel() const { return msg().level(); }
virtual int verbose() const { return m_verbose; }
virtual void setVerbose(int v) { m_verbose=v; }
......
......@@ -22,6 +22,7 @@ use TrigConfL1Data TrigConfL1Data-* Trigger/TrigConfiguration
use TrigConfHLTData TrigConfHLTData-* Trigger/TrigConfiguration
private
use L1CommonCore L1CommonCore-* Trigger/TrigT1
use TrigConfJobOptData TrigConfJobOptData-* Trigger/TrigConfiguration
use L1TopoConfig L1TopoConfig-* Trigger/TrigT1/L1Topo
end_private
......@@ -45,9 +46,10 @@ apply_pattern detcommon_ignores
#
apply_pattern detcommon_header_installer
macro_append Boost_linkopts " $(Boost_linkopts_regex) "
macro_append Boost_linkopts " -lboost_unit_test_framework-$(Boost_compiler_version)-mt-$(Boost_file_version) "
private
macro_append TrigConfStorage_linkopts " $(Boost_linkopts_regex) \
-lboost_unit_test_framework-$(Boost_compiler_version)-mt-$(Boost_debug)$(Boost_file_version) "
#============================================================================
# Build applications
......
......@@ -19,18 +19,21 @@ class CompareHLTXML(CompareMenuXML):
'STREAMTAG_LIST' : 'single',
'TRIGGERTYPE_LIST' : 'single',
'CHAIN' : 'chain_name',
'BLAH' : 'single',
'GROUP' : 'name',
'SIGNATURE' : 'signature_counter',
'TRIGGERELEMENT' : 'te_name',
'TRIGGERTYPE' : 'bit',
'STREAMTAG' : 'stream',
'SEQUENCE' : 'output',
'PRESCALES' : 'single',
}
# elements that need to print information about the parent when printed
self.needParentInfo = ['GROUP', 'GROUP_LIST', 'TRIGGERTYPE', 'TRIGGERTYPE_LIST']
self.exclFromCmpList = []
self.ignoreAttr = {}
# elements for which the information is stored as #PCDATA content
self.checkText = []
......@@ -38,8 +41,8 @@ class CompareHLTXML(CompareMenuXML):
# depending on the the environment exclude elements from the comparison
if self.exlusionset=='default':
self.exclFromCmpList = []
self.ignoreAttr = {}
self.exclFromCmpList = ['PRESCALES']
self.ignoreAttr = {'CHAIN' : ['EBstep', 'rerun_prescale','pass_through']}
elif self.exlusionset=='cool':
# these things are not stored in COOL
......
......@@ -17,13 +17,12 @@ class CompareL1XML(CompareMenuXML):
'BunchGroup' : 'internalNumber',
'Bunch' : 'bunchNumber',
'CaloInfo' : 'single',
'Isolation' : 'single',
'Parametrization' : 'single',
'MinimumTOBPt' : 'single',
'METSignificance' : 'single',
'JetWeight' : 'num',
'Deadtime' : 'single',
'TriggerCounter' : 'single',
'MuctpiInfo' : 'single',
'high_pt' : 'single',
'low_pt' : 'single',
'max_cand' : 'single',
'PrescaledClock' : 'single',
'Random' : 'single',
'Cable' : 'single',
......@@ -37,21 +36,23 @@ class CompareL1XML(CompareMenuXML):
'TriggerThresholdValue' : 'name',
'TriggerCounterList' : 'single',
'Prescale' : 'ctpid',
'PrioritySet' : 'single',
'Priority' : 'ctpid',
'NOT' : 'single',
'OR' : 'single',
'AND' : 'single',
}
self.needParentInfo = ['NOT', 'OR', 'AND', 'InternalTrigger','Bunch']
self.checkText = ['Prescale']
self.ignoreAttr = {}
self.needParentInfo = []
self.checkText = []
# configure comparison
self.exclFromCmpList = []
if self.exlusionset=='default':
self.exclFromCmpList = ['BunchGroupSet','CaloInfo', 'Deadtime', 'MuctpiInfo', 'PrescaledClock', 'Random', 'Cable']
self.ignoreAttr = {}
self.ignoreAttr['TriggerItem'] = ['definition']
self.ignoreAttr['TriggerThreshold'] = ['id','version']
elif self.exlusionset=='cool':
# these things are not stored in COOL
......
#!/usr/bin/env python
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
import sys
from TrigConfStorage.CompareMenuXML import CompareMenuXML
class CompareL1TopoXML(CompareMenuXML):
def __init__(self, files, **args):
super(CompareL1TopoXML,self).__init__(**args)
self.uniqID = {
'TOPO_MENU' : 'single',
'OutputList' : 'single',
'OutputList.Output' : 'algname',
'TopoConfig' : 'single',
'SortAlgo' : 'algoId',
'DecisionAlgo' : 'algoId',
'Fixed' : 'single',
'Variable' : 'single',
'Generic' : 'name',
'Input' : 'single',
'Fixed.Output' : 'single',
'Bit' : 'single',
'Parameter' : 'pos',
}
self.needParentInfo = []
self.checkText = []
# configure comparison
self.exclFromCmpList = []
self.ignoreAttr = {}
if self.exlusionset=='default':
pass
elif self.exlusionset=='cool':
# these things are not stored in COOL
self.exclFromCmpList = ['Deadtime','MuctpiInfo','Random','PrescaledClock','Cable','PrioritySet', 'TriggerCounterList']
self.ignoreAttr['LVL1Config'] = ['id', 'name', 'version']
self.ignoreAttr['PrescaleSet'] = ['name', 'version']
self.ignoreAttr['Prescale'] = ['n', 'm', 'd', 'N', 'M', 'D']
self.ignoreAttr['TriggerMenu'] = ['name']
self.ignoreAttr['TriggerItem'] = ['id', 'trigger_type', 'definition', 'comment']
self.ignoreAttr['TriggerThreshold'] = ['id', 'bitnum']
self.ignoreAttr['TriggerThresholdValue'] = ['version']
self.ignoreAttr['BunchGroupSet'] = ['version', 'name']
self.ignoreAttr['BunchGroup'] = ['version']
self.ignoreAttr['CaloInfo'] = ['name', 'version', 'global_scale']
elif self.exlusionset=='rtt':
# these things are not stored in COOL
self.exclFromCmpList = ['BunchGroupSet', 'CaloInfo', 'MuctpiInfo', 'PrescaledClock', 'Random', 'Cable', 'TriggerCounterList']
self.ignoreAttr['TriggerItem'] = ['id', 'definition']
self.ignoreAttr['TriggerThreshold'] = ['id', 'active']
self.ignoreAttr['TriggerThresholdValue'] = ['version']
self.ignoreAttr['PrioritySet'] = ['version']
self.ignoreAttr['LVL1Config'] = ['version']
elif self.exlusionset=='tt':
# these things change when uploading with the TT and downloading with 2XMLApp
self.exclFromCmpList = ['BunchGroupSet', 'PrioritySet']
self.ignoreAttr['LVL1Config'] = ['id']
self.ignoreAttr['CaloInfo'] = ['version']
self.ignoreAttr['Deadtime'] = ['version']
self.ignoreAttr['MuctpiInfo'] = ['version']
self.ignoreAttr['TriggerItem'] = ['definition', 'trigger_type']
self.ignoreAttr['PrescaledClock'] = ['version']
else:
print >>self, "Don't know about comparison environment %s. Should be nothing, 'cool' or 'rtt'" % self.exlusionset
sys.exit(0)
self.doc1 = self.parseFile(files[0])
self.doc2 = self.parseFile(files[1])
def diff(self):
equal = super(CompareL1TopoXML,self).diff(self.doc1, self.doc2)
print >> self, "L1 topo menus are%s equal" % ('' if equal else ' not')
return ""
......@@ -55,13 +55,15 @@ class CompareMenuXML(object):
def diff(self, doc1, doc2):
return self.comp(doc1, doc2)
return self.comp(doc1, doc2, "")
def comp(self, node1, node2):
def comp(self, node1, node2, context):
if self.isOneMissing(node1, node2): return False
self.context = context + "." + node1.nodeName
equal = True
if self.verboseLevel>0:
print >> self, "compare %s with %s" % (node1.nodeName,node2.nodeName)
......@@ -81,32 +83,44 @@ class CompareMenuXML(object):
pairedElems = self.orderChildren(node1.childNodes, node2.childNodes, childrenType)
for (l,r) in pairedElems:
equal &= self.comp(l,r)
equal &= self.comp( l, r, self.context )
return equal
def cmpNode(self,node1,node2,reqUniq=False):
def cmpNode(self, node1, node2, reqUniq=False):
res = cmp(node1.nodeName,node2.nodeName)
if res!=0: return res
if node1.nodeType==minidom.Node.TEXT_NODE:
return cmp(node1.data,node2.data)
if not node1.nodeName in self.uniqID:
print >>self, "Don't know how to compare two items of type %s , will abort" % node1.nodeName
# will check for comparison rule (the field to be used) in uniqID
compField = None
lookfor = self.context + "." + node1.nodeName
for k,f in self.uniqID.items():
if lookfor.endswith(k):
compField = f
break
if not compField:
print >>self, "Don't know how to compare two items of type %s in context %s, will abort" % ( node1.nodeName, self.context )
sys.exit(0)
key = self.uniqID[node1.nodeName]
if key=='single': return 0
val1 = node1.attributes[key].value
val2 = node2.attributes[key].value
if compField=='single': return 0
val1 = node1.attributes[compField].value
val2 = node2.attributes[compField].value
if val1<val2: return -1
if val1>val2: return 1
if reqUniq:
raise RuntimeError, "Two equal nodes %s found with %s = %s" % (node1.nodeName, key, val1)
raise RuntimeError, "Two equal nodes %s found with %s = %s" % (node1.nodeName, compField, val1)
else:
return 0
def isOneMissing(self, node1, node2):
if not (node1 and node2):
......
......@@ -75,6 +75,8 @@ class TriggerCoolUtil:
connection = 'COOLONL_TRIGGER/COMP200'
elif dbconn=="OFLP":
connection = 'COOLONL_TRIGGER/OFLP200'
elif dbconn=="CONDBR2":
connection = 'COOLONL_TRIGGER/CONDBR2'
elif m:
dbname=m.group(1).upper()
connection = "sqlite://;schema=%s;dbname=%s;" % (dbconn,dbname)
......
......@@ -6,9 +6,6 @@ import user, sys
from optparse import OptionParser
from xml.dom import expatbuilder
from TrigConfStorage.CompL1Menu import CompareL1XML
from TrigConfStorage.CompHLTMenu import CompareHLTXML
from TrigConfStorage.CompSetup import CompareSetupXML
def getFileLvl(filename):
......@@ -17,6 +14,8 @@ def getFileLvl(filename):
buff = fp.read().replace('&','&amp;')
doc = builder.parseString(buff)
for x in doc.childNodes:
if x.nodeName == u'TOPO_MENU':
return 'L1Topo'
if x.nodeName == u'LVL1Config':
return 'L1'
if x.nodeName == u'HLT_MENU':
......@@ -66,11 +65,17 @@ if __name__ == '__main__':
print " Second file:",filetype[1]
sys.exit(0)