ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfStorage
src
PrescaleSetLoader.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
//
7
//NAME: PrescaleSetLoader.cpp
8
//PACKAGE: TrigConfStorage
9
//
10
//AUTHOR: J.Haller (CERN) Johannes.Haller@cern.ch
11
//CREATED: 25. Jan. 2006
12
//
13
//PURPOSE:
14
//UPDATED: 8 Dec 2008 Paul Bell for sqlite access
15
// (use of defineOutput method to set data type)
16
//
18
19
20
#include "CTPfragment/CTPdataformatVersion.h"
21
#include "
TrigConfL1Data/L1PSNumber.h
"
22
#include "
./PrescaleSetLoader.h
"
23
#include "
./DBHelper.h
"
24
25
using namespace
std
;
26
27
bool
28
TrigConf::PrescaleSetLoader::load
(
unsigned
int
ctpVersion,
PrescaleSet
& prescaleSet ) {
29
30
TRG_MSG_INFO
(
"loading L1 prescale set with PSK "
<< prescaleSet.
id
());
31
32
CTPdataformatVersion ctpformat(ctpVersion);
33
34
prescaleSet.
resize
(ctpformat.getMaxTrigItems());
35
36
try
{
37
startSession
();
38
unique_ptr< coral::IQuery > q(
m_session
.nominalSchema().tableHandle(
"L1_PRESCALE_SET"
).newQuery() );
39
q->setRowCacheSize( 5 );
40
41
//Bind list
42
coral::AttributeList bindList;
43
bindList.extend<
int
>(
"psId"
);
44
std::string cond =
"L1PS_ID = :psId"
;
45
bindList[0].data<
int
>() = prescaleSet.
id
();
46
q->setCondition( cond, bindList );
47
48
//Output data and types
49
coral::AttributeList attList;
50
attList.extend<std::string>(
"L1PS_NAME"
);
51
attList.extend<
int
>(
"L1PS_VERSION"
);
52
attList.extend<std::string>(
"L1PS_COMMENT"
);
53
for
(
unsigned
int
ctpid = 0; ctpid < ctpformat.getMaxTrigItems(); ++ctpid) {
54
attList.extend<int64_t>(
"L1PS_VAL"
+ std::to_string(ctpid+1) );
55
}
56
fillQuery
(q.get(),attList);
57
58
coral::ICursor& cursor = q->execute();
59
60
if
( ! cursor.next() ) {
61
TRG_MSG_ERROR
(
"No such prescaleset exists "
<< prescaleSet.
id
());
62
throw
std::runtime_error(
"PrescaleSetLoader >> PrescaleSet not available"
);
63
}
64
65
const
coral::AttributeList& row = cursor.currentRow();
66
std::string
name
= row[
"L1PS_NAME"
].data<std::string>();
67
int
version = row[
"L1PS_VERSION"
].data<
int
>();
68
std::string comment = row[
"L1PS_COMMENT"
].data<std::string>();
69
70
// fill the object with data
71
prescaleSet.
setName
(
name
);
72
prescaleSet.
setVersion
( version );
73
prescaleSet.
setComment
( comment );
74
for
(
unsigned
int
ctpid=0; ctpid < ctpformat.getMaxTrigItems(); ++ctpid) {
75
int64_t val = row[
"L1PS_VAL"
+std::to_string(ctpid+1)].data<int64_t>();
76
if
(
isRun1
()) {
77
float
prescale =
L1PSNumber
(val).
getFloatPrescale
();
78
prescaleSet.
setPrescale
( ctpid, prescale );
79
}
else
{
80
prescaleSet.
setCut
(ctpid,val);
81
}
82
}
83
84
commitSession
();
85
return
true
;
86
}
87
catch
(
const
coral::Exception& e ) {
88
TRG_MSG_ERROR
(
"Coral::Exception: "
<< e.what());
89
throw
;
90
}
91
92
TRG_MSG_DEBUG
(
"loaded L1 prescale set '"
<< prescaleSet.
name
() <<
"' (psk "
<< prescaleSet.
id
() <<
")"
);
93
94
return
true
;
95
}
DBHelper.h
L1PSNumber.h
PrescaleSetLoader.h
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
TrigConf::DBLoader::commitSession
void commitSession()
commit session if not already done
Definition
DBLoader.cxx:45
TrigConf::DBLoader::m_session
coral::ISessionProxy & m_session
CORAL interface to database session.
Definition
DBLoader.h:67
TrigConf::DBLoader::isRun1
bool isRun1()
Definition
DBLoader.h:59
TrigConf::DBLoader::startSession
void startSession()
start session if not already active
Definition
DBLoader.cxx:36
TrigConf::L1PSNumber
Definition
L1PSNumber.h:33
TrigConf::L1PSNumber::getFloatPrescale
float getFloatPrescale() const
Definition
L1PSNumber.h:76
TrigConf::PrescaleSetLoader::load
virtual bool load(unsigned int ctpVersion, PrescaleSet &data) override
Definition
PrescaleSetLoader.cxx:28
TrigConf::PrescaleSet
Definition
PrescaleSet.h:22
TrigConf::PrescaleSet::setPrescale
void setPrescale(unsigned int num, int64_t prescaleValue) __attribute__((deprecated))
Set the prescale NUM from the int64 value prescaleValue.
Definition
PrescaleSet.cxx:166
TrigConf::PrescaleSet::setCut
void setCut(unsigned int num, int32_t cut)
Definition
PrescaleSet.cxx:96
TrigConf::PrescaleSet::resize
void resize(size_t size)
Definition
PrescaleSet.cxx:80
TrigConf::TrigConfData::id
unsigned int id() const
Definition
TrigConfData.h:21
TrigConf::TrigConfData::setComment
void setComment(const std::string &c)
Definition
TrigConfData.h:32
TrigConf::TrigConfData::setName
void setName(const std::string &name)
Definition
TrigConfData.h:30
TrigConf::TrigConfData::name
const std::string & name() const
Definition
TrigConfData.h:22
TrigConf::TrigConfData::setVersion
void setVersion(unsigned int version)
Definition
TrigConfData.h:31
TrigConf::fillQuery
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)
Definition
DBHelper.cxx:13
std
STL namespace.
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0