Commit 188d3ee4 authored by Joerg Stelzer's avatar Joerg Stelzer Committed by Graeme Stewart
Browse files

Fix loading of thresholds from run1 TriggerDB (TrigConfStorage-03-01-18)

	* Fix loading of thresholds from run1 TriggerDB
	* TrigConfStorage-03-01-18

2016-03-17 Joerg Stelzer
	* Removed use of deprecated L1 setPrescale method
	* TrigConfStorage-03-01-17

2016-02-10 Joerg Stelzer
	* Improved printout
	* TrigConfStorage-03-01-15/6

2016-02-01 Elisabetta Pianori
	* Add a check for lengthf of TE (ATR-13262)
	* TrigConfStorage-03-01-14
parent 09b917de
################################################################################
# Package: TrigConfStorage
################################################################################
# Declare the package name:
atlas_subdir( TrigConfStorage )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Trigger/TrigConfiguration/TrigConfBase
Trigger/TrigConfiguration/TrigConfHLTData
Trigger/TrigConfiguration/TrigConfL1Data
PRIVATE
Trigger/TrigConfiguration/TrigConfJobOptData
Trigger/TrigT1/L1Topo/L1TopoConfig )
# External dependencies:
find_package( Boost COMPONENTS filesystem thread system )
find_package( COOL COMPONENTS CoolKernel CoolApplication )
find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
find_package( tdaq-common )
# tag NEEDS_CORAL_BASE was not recognized in automatic conversion in cmt2cmake
# Component(s) in the package:
atlas_add_library( TrigConfStorage
src/*.cxx
PUBLIC_HEADERS TrigConfStorage
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} TrigConfBase TrigConfHLTData TrigConfL1Data
PRIVATE_LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} TrigConfJobOptData L1TopoConfig )
atlas_add_executable( TrigConf2COOLApp
src/test/2COOLApp.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} TrigConfBase TrigConfHLTData TrigConfL1Data TrigConfJobOptData L1TopoConfig TrigConfStorage )
atlas_add_executable( TrigConfConsistencyChecker
src/test/ConsistencyChecker.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} TrigConfBase TrigConfHLTData TrigConfL1Data TrigConfJobOptData L1TopoConfig TrigConfStorage )
atlas_add_executable( TrigConfReadWrite
src/test/ReadWrite.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} TrigConfBase TrigConfHLTData TrigConfL1Data TrigConfJobOptData L1TopoConfig TrigConfStorage )
atlas_add_executable( TrigConfCoolFix
src/test/CoolFix.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} TrigConfBase TrigConfHLTData TrigConfL1Data TrigConfJobOptData L1TopoConfig TrigConfStorage )
atlas_add_executable( TrigConfTestTriggerDBCoolMix
src/test/TestTriggerDBCoolMix.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} TrigConfBase TrigConfHLTData TrigConfL1Data TrigConfJobOptData L1TopoConfig TrigConfStorage )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_scripts( scripts/*.py )
......@@ -61,7 +61,6 @@ apply_pattern trigconf_application name=ReadWrite
apply_pattern trigconf_application name=CoolFix
apply_pattern trigconf_application name=TestTriggerDBCoolMix
#============================================================================
# Reflection
#============================================================================
......
......@@ -198,7 +198,7 @@ bool TrigConf::CTPConfigLoader::load(CTPConfig& ctpcTarget) {
m.setId(menuid);
m.setSuperMasterTableId(ctpcTarget.superMasterTableId());
if ( !mldr.load( m ) ) {
TRG_MSG_ERROR("loading Menu " << m.id());
TRG_MSG_ERROR("failed loading Menu " << m.id());
throw std::runtime_error( "CTPConfigLoader: ERROR loading Menu" );
}
if(isRun1()) {
......
......@@ -174,6 +174,38 @@ private:
std::string m_offending;
};
///////////////////////// Max lenght of TRIGGER ELEMENTS name /////////////////////////
class TENameLengthTest : public TrigConfTest {
public:
TENameLengthTest()
: TrigConfTest("TENameLength", "Max length of TE name must be less than 100 characters"),
m_offending("")
{}
virtual void execute(const Exc_t&) {
if ( ! m_hlt ) return;
unsigned int _maxTElength = 100;
for(const TrigConf::HLTSequence* seq : m_hlt->getHLTSequenceList()) {
const std::string& tename = seq->outputTE()->name();
if (tename.length() > _maxTElength )
m_offending += tename + ", ";
}
if(m_offending.size()!=0)
m_error = " Following Trigger elements are too long [more than 100 characters long]: " + m_offending;
}
private:
std::string m_offending;
};
/////////////// CHECK WHETHER ALL SIGNATURES IN A GROUP ARE CONNECTED BY COMMON TEs //////////////////
////// ALL OUTPUT TEs OF A SIGNATURE ARE THE FINAL TE OF THE CHAIN OR THE INPTUT OF ANOTHER SIGNATURE ///
////// CHECK ALSO CHANGE OF MULTIPLICITY BETWEEN SIGNATURES
......@@ -1704,6 +1736,7 @@ ConfigurationCheck::ConfigurationCheck(TrigConf::CTPConfig* ctp, TrigConf::HLTFr
m_tests.push_back(new CTPCountersUnique());
m_tests.push_back(new ChainsNamingConventionTest());
m_tests.push_back(new TENamingConventionTest());
m_tests.push_back(new TENameLengthTest());
m_tests.push_back(new ChainsNamingUniqueTest());
m_tests.push_back(new ChainsCountersUniqueTest());
m_tests.push_back(new ChainsCounterRangeTest());
......
......@@ -203,6 +203,12 @@ TrigConf::HLTFrameLoader::GetConnectedPSKs(unsigned int smk) {
commitSession();
stringstream ss;
for(int psk : connected_psks)
ss << psk << ", ";
TRG_MSG_INFO( "To SMK " << smk << " connected HLT prescale keys are " << ss.str() );
return connected_psks;
}
......@@ -35,8 +35,8 @@ bool TrigConf::L1TopoMenuLoader::load( TXC::L1TopoMenu& tcaTarget ) {
startSession();
loadTopoAlgos(tcaTarget);
commitSession();
if(msg().level() <= TrigConf::MSGTC::INFO)
tcaTarget.print();
if(msg().level() < TrigConf::MSGTC::INFO)
tcaTarget.print();
} catch( const std::exception& e ) {
TRG_MSG_ERROR("L1TopoMenuLoader::load >> Standard C++ exception: " << e.what());
} catch( ... ) {
......
......@@ -66,7 +66,7 @@ TrigConf::MenuLoader::load( Menu& menu ) {
void
TrigConf::MenuLoader::loadItems(TrigConf::Menu& menu) {
TRG_MSG_INFO("Loading items");
TRG_MSG_INFO("Loading CTP Items");
// to later load internal triggers
TriggerThresholdLoader& ttldr = dynamic_cast<TriggerThresholdLoader&>( (dynamic_cast<StorageMgr&>(m_storageMgr))
......@@ -389,7 +389,7 @@ TrigConf::MenuLoader::loadMonitoring(TrigConf::Menu& menu) {
***************************************/
void
TrigConf::MenuLoader::loadThresholds(TrigConf::Menu& menu) {
TRG_MSG_INFO("Loading thresholds");
TRG_MSG_INFO("Loading L1 trigger thresholds");
ThresholdConfigLoader* thrldr = new ThresholdConfigLoader(m_storageMgr, m_session);
thrldr->setLevel(outputLevel());
......@@ -518,13 +518,10 @@ TrigConf::MenuLoader::loadPIT(TrigConf::Menu& menu) {
ntips++;
TRG_MSG_DEBUG("TIP " << tip->tipNumber() << " --> " << tt->name());
}
TRG_MSG_DEBUG("Loaded " << npits << " PITs and " << ntips << " TIPs");
TRG_MSG_DEBUG("Menu has " << menu.pitVector().size() << " PITs and " << menu.tipVector().size() << " TIPs");
TRG_MSG_INFO("Loaded " << npits << " PITs and " << ntips << " TIPs");
TRG_MSG_INFO("Menu has " << menu.pitVector().size() << " PITs and " << menu.tipVector().size() << " TIPs");
}
......@@ -535,6 +532,8 @@ TrigConf::MenuLoader::createTipFromDirectThresholds(TrigConf::Menu& menu) {
// this is only needed as long as the TIPs from the direct input are not in the database
unsigned int ntips(0);
for(TriggerThreshold * thr : menu.thresholdConfig().getThresholdVector() ) {
if(thr->ttype()==L1DataDef::TOPO || thr->ttype()==L1DataDef::ALFA) {
......@@ -560,9 +559,14 @@ TrigConf::MenuLoader::createTipFromDirectThresholds(TrigConf::Menu& menu) {
menu.addTip(tip);
TRG_MSG_DEBUG("TIP from direct input thresholds " << tip->tipNumber() << " --> " << thr->name());
ntips++;
}
}
TRG_MSG_INFO( "Number of TIPs from direct input thresholds " << ntips );
}
......@@ -611,8 +615,8 @@ TrigConf::MenuLoader::loadMenuAttributes(TrigConf::Menu& menu) {
coral::ICursor& cursor = q->execute();
if ( ! cursor.next() ) {
msg() << "MenuLoader: ERROR No trigger menu in SMK " << menu.smk() << endl;
throw runtime_error( "MenuLoader: ERROR trigger menu not available" );
TRG_MSG_ERROR("No trigger menu in SMK " << menu.smk());
throw runtime_error( "MenuLoader: ERROR trigger menu not available" );
}
// fill the object with data
......
......@@ -18,7 +18,7 @@
#include "CTPfragment/CTPdataformatVersion.h"
#include "TrigConfL1Data/L1PSNumber.h"
#include "./PrescaleSetLoader.h"
#include "./DBHelper.h"
......@@ -76,7 +76,8 @@ TrigConf::PrescaleSetLoader::load( PrescaleSet& prescaleSet ) {
for (unsigned int ctpid=0; ctpid < ctpformat.getMaxTrigItems(); ++ctpid) {
int64_t val = row["L1PS_VAL" + boost::lexical_cast<string,unsigned int>(ctpid+1)].data<int64_t>();
if(isRun1()) {
prescaleSet.setPrescale(ctpid,val);
float prescale = L1PSNumber(val).getFloatPrescale();
prescaleSet.setPrescale( ctpid, prescale );
} else {
prescaleSet.setCut(ctpid,val);
}
......
......@@ -44,7 +44,8 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
const unsigned int schema_version_with_zb_fields = 9;
TRG_MSG_VERBOSE("Loading ThresholdConfig object attached to Lvl1 master ID " << thrConfig.lvl1MasterTableId());
TRG_MSG_DEBUG("Loading ThresholdConfig object attached to Lvl1 master ID " << thrConfig.lvl1MasterTableId());
TRG_MSG_DEBUG("Current number of thresholds: " << thrConfig.size());
long caloinfoid = 0;
......@@ -73,7 +74,7 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
coral::ICursor& cursor0 = query0->execute();
if ( ! cursor0.next() ) {
msg() << "ThresholdConfigLoader >> No such Master_Table exists " << thrConfig.lvl1MasterTableId() << std::endl;
TRG_MSG_ERROR("ThresholdConfigLoader >> No such Master_Table exists " << thrConfig.lvl1MasterTableId());
commitSession();
throw std::runtime_error( "ThresholdConfigLoader >> ThresholdConfig not available" );
}
......@@ -84,18 +85,12 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
if ( cursor0.next() ) {
msg() << "ThresholdConfigLoader >> More than one Master_Table exists "
<< thrConfig.lvl1MasterTableId() << std::endl;
TRG_MSG_ERROR("ThresholdConfigLoader >> More than one Master_Table exists "
<< thrConfig.lvl1MasterTableId());
commitSession();
throw std::runtime_error( "ThresholdConfigLoader >> Master_Table not available" );
}
//=====================================================
// get Thresholds WITH trigger threshold values
......@@ -127,7 +122,9 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
attList.extend<std::string>( "TM2TT.L1TM2TT_CABLE_CONNECTOR" );
attList.extend<int> ( "TM2TT.L1TM2TT_CABLE_START" );
attList.extend<int> ( "TM2TT.L1TM2TT_CABLE_END" );
attList.extend<int> ( "TM2TT.L1TM2TT_CABLE_CLOCK" );
if(isRun2()) {
attList.extend<int> ( "TM2TT.L1TM2TT_CABLE_CLOCK" );
}
attList.extend<int> ( "TT.L1TT_ID" );
attList.extend<std::string>( "TT.L1TT_NAME" );
attList.extend<int> ( "TT.L1TT_VERSION" );
......@@ -195,7 +192,11 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
tt->setCableConnector(row["TM2TT.L1TM2TT_CABLE_CONNECTOR"].data<std::string>());
tt->setCableStart (row["TM2TT.L1TM2TT_CABLE_START"].data<int>());
tt->setCableEnd (row["TM2TT.L1TM2TT_CABLE_END"].data<int>());
int clock = row["TM2TT.L1TM2TT_CABLE_CLOCK"].data<int>();
int clock = 0;
if(isRun2()) {
clock = row["TM2TT.L1TM2TT_CABLE_CLOCK"].data<int>();
}
if(clock >= 0) {
tt->setClock(clock);
}
......@@ -281,8 +282,7 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
ttv->setWindow(row["TTV.L1TTV_WINDOW"].data<int>());
tt->addThresholdValue(ttv);
++numberofvalues;
if(verbose()>=2)
msg() << "ThresholdConfigLoader loading thresholdvalue with ID = " << ttv->id() << ": " << ttv->name() << std::endl;
TRG_MSG_DEBUG("ThresholdConfigLoader loading thresholdvalue with ID = " << ttv->id() << ": " << ttv->name());
}
nRowsLoop2 = row["TT.L1TT_ID"].data<int>();
......@@ -292,17 +292,6 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
// trigger thresholds sorted by type
thrConfig.addTriggerThreshold(tt);
//===========================================
// now get the Thresholds WITHOUT trigger threshold values
// we are aware that some code is duplicated below
......@@ -331,7 +320,9 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
attList1.extend<std::string>( "TM2TT.L1TM2TT_CABLE_CONNECTOR" );
attList1.extend<int> ( "TM2TT.L1TM2TT_CABLE_START" );
attList1.extend<int> ( "TM2TT.L1TM2TT_CABLE_END" );
attList1.extend<int> ( "TM2TT.L1TM2TT_CABLE_CLOCK" );
if(isRun2()) {
attList1.extend<int> ( "TM2TT.L1TM2TT_CABLE_CLOCK" );
}
attList1.extend<int> ( "TT.L1TT_ID" );
attList1.extend<std::string>( "TT.L1TT_NAME" );
attList1.extend<int> ( "TT.L1TT_VERSION" );
......@@ -392,7 +383,10 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
tt->setCableStart (row["TM2TT.L1TM2TT_CABLE_START"].data<int>());
tt->setCableEnd (row["TM2TT.L1TM2TT_CABLE_END"].data<int>());
int clock = row["TM2TT.L1TM2TT_CABLE_CLOCK"].data<int>();
int clock = 0;
if(isRun2()) {
clock = row["TM2TT.L1TM2TT_CABLE_CLOCK"].data<int>();
}
if(clock >= 0) {
tt->setClock(clock);
}
......
......@@ -1635,11 +1635,14 @@ TrigConfCoolWriter::readL1PrescalePayload( unsigned int run, unsigned int lb,
bool isRun2 = ( nPrescales == 512 );
prescale.resize( nPrescales );
for(cool::ChannelId channel = 0; channel<prescale.prescales().size(); channel++) {
for(cool::ChannelId channel = 0; channel < nPrescales; channel++) {
objects = lvl1PsFolder->browseObjects( vr.since(), vr.until(), channel );
if(objects->size()!=1) {
throw std::runtime_error("Lvl1 prescale access error: found empty prescale channel ");
}
objects->goToNext();
const IObject& obj = objects->currentRef();
const IRecord & payload = obj.payload();
......@@ -1648,7 +1651,7 @@ TrigConfCoolWriter::readL1PrescalePayload( unsigned int run, unsigned int lb,
if( isRun2 ) {
prescale.setCut( channel, prescaleVal );
} else {
prescale.setPrescale( channel, prescaleVal );
prescale.setPrescale( channel, (float)prescaleVal );
}
}
prescale.setId( lvl1PrescaleKey );
......
......@@ -25,9 +25,6 @@ TrigConf::XMLPrescaleSetLoader::load(PrescaleSet& ps) {
}
ps.resize(maxctpid+1);
vector<int64_t> prescale_val(maxctpid+1,-1);
int ival = 0;
string sval("");
readAttribute(pt(), "id", ival); ps.setId(ival);
......@@ -49,7 +46,9 @@ TrigConf::XMLPrescaleSetLoader::load(PrescaleSet& ps) {
string scut("");
float prescale = -1;
if ( readAttribute(v.second, "n", nn) && readAttribute(v.second, "m", mm) && readAttribute(v.second, "d", dd) ) { // fractional prescale - run 1
prescale_val[ctpid] = L1PSNumber::encodeNMD(nn, mm, dd);
int64_t prescale64bit = L1PSNumber::encodeNMD(nn, mm, dd);
prescale = L1PSNumber(prescale64bit).getFloatPrescale();
ps.setPrescale(ctpid, prescale);
} else if( readAttribute(v.second, "cut", scut) ) { // new style contains 'cut' and 'value' as attributes
int cut;
stringstream ss;
......@@ -58,15 +57,12 @@ TrigConf::XMLPrescaleSetLoader::load(PrescaleSet& ps) {
ps.setCut(ctpid, cut);
newStyle = true;
} else if( readAttribute(v.second, "ps", prescale) ) { // new style contains 'cut' and 'value' as attributes
prescale_val[ctpid] = L1PSNumber::decodeFloat(prescale);
ps.setPrescale(ctpid, prescale);
} else if( getTextContent(v.second, prescale) ) {
prescale_val[ctpid] = L1PSNumber::decodeFloat(prescale);
ps.setPrescale(ctpid, prescale);
}
}
if(!newStyle)
ps.setPrescales(prescale_val);
ps.setNewPrescaleStyle(newStyle);
return true;
......
Supports Markdown
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