22#include <CoralBase/Attribute.h>
23#include <CoralBase/AttributeList.h>
25#include "RelationalAccess/SchemaException.h"
26#include "RelationalAccess/ITransaction.h"
27#include "RelationalAccess/ITable.h"
28#include "RelationalAccess/ISchema.h"
29#include "RelationalAccess/ICursor.h"
30#include "RelationalAccess/IQuery.h"
47 TRG_MSG_DEBUG(
"TriggerThresholdValueLoader loading thresholdvalue with ID = " << ttvTarget.
id());
59 string emisolation =
"";
60 string hadisolation =
"";
69 coral::ITable& table =
m_session.nominalSchema().tableHandle(
"L1_TRIGGER_THRESHOLD_VALUE");
70 coral::IQuery*
query = table.newQuery();
71 query->setRowCacheSize( 5 );
74 coral::AttributeList bindList;
75 bindList.extend<
long>(
"ttvId");
76 std::string cond=
"L1TTV_ID = :ttvId";
77 bindList[0].data<
long>() = ttvTarget.
id();
78 query->setCondition( cond, bindList );
81 coral::AttributeList attList;
82 attList.extend<std::string>(
"L1TTV_NAME" );
83 attList.extend<
int>(
"L1TTV_VERSION" );
84 attList.extend<std::string>(
"L1TTV_TYPE" );
85 attList.extend<std::string>(
"L1TTV_PT_CUT" );
86 attList.extend<
int>(
"L1TTV_ETA_MIN" );
87 attList.extend<
int>(
"L1TTV_ETA_MAX" );
88 attList.extend<
int>(
"L1TTV_PHI_MIN" );
89 attList.extend<
int>(
"L1TTV_PHI_MAX" );
90 attList.extend<std::string>(
"L1TTV_EM_ISOLATION" );
91 attList.extend<std::string>(
"L1TTV_HAD_ISOLATION" );
92 attList.extend<std::string>(
"L1TTV_HAD_VETO" );
93 attList.extend<
int>(
"L1TTV_WINDOW" );
94 attList.extend<std::string>(
"L1TTV_PRIORITY" );
95 query->defineOutput(attList);
96 query->addToOutputList(
"L1TTV_NAME" );
97 query->addToOutputList(
"L1TTV_VERSION" );
98 query->addToOutputList(
"L1TTV_TYPE" );
99 query->addToOutputList(
"L1TTV_PT_CUT" );
100 query->addToOutputList(
"L1TTV_ETA_MIN" );
101 query->addToOutputList(
"L1TTV_ETA_MAX" );
102 query->addToOutputList(
"L1TTV_PHI_MIN" );
103 query->addToOutputList(
"L1TTV_PHI_MAX" );
104 query->addToOutputList(
"L1TTV_EM_ISOLATION" );
105 query->addToOutputList(
"L1TTV_HAD_ISOLATION" );
106 query->addToOutputList(
"L1TTV_HAD_VETO" );
107 query->addToOutputList(
"L1TTV_WINDOW" );
108 query->addToOutputList(
"L1TTV_PRIORITY" );
110 coral::ICursor& cursor =
query->execute();
111 if ( !cursor.next()) {
112 msg() <<
"TriggerThresholdValueLoader >> No such TriggerThresholdValue exists "
113 << ttvTarget.
id() << std::endl;
116 throw std::runtime_error(
"TriggerThresholdValueLoader >> TriggerThresholdValue not available" );
119 const coral::AttributeList& row = cursor.currentRow();
121 name = row[
"L1TTV_NAME"].data<std::string>();
122 version = row[
"L1TTV_VERSION"].data<
int>();
123 type = row[
"L1TTV_TYPE"].data<std::string>();
125 etamin = row[
"L1TTV_ETA_MIN"].data<
int>();
126 etamax = row[
"L1TTV_ETA_MAX"].data<
int>();
127 phimin = row[
"L1TTV_PHI_MIN"].data<
int>();
128 phimax = row[
"L1TTV_PHI_MAX"].data<
int>();
129 window = row[
"L1TTV_WINDOW"].data<
int>();
131 emisolation = row[
"L1TTV_EM_ISOLATION"].data<std::string>();
132 hadisolation = row[
"L1TTV_HAD_ISOLATION"].data<std::string>();
133 hadveto = row[
"L1TTV_HAD_VETO"].data<std::string>();
137 msg() <<
"TriggerThresholdValueLoader >> More than one TriggerThresholdValue exists "
138 << ttvTarget.
id() << std::endl;
141 throw std::runtime_error(
"TriggerThresholdValueLoader >> TriggerThresholdValue not available" );
155 catch(
const coral::Exception& e ) {
159 catch(
const std::exception& e ) {
167 msg() <<
"TriggerThresholdValueLoader >> No type match for ttv_id = "
168 << ctvTarget.
id() <<
" " <<
type << std::endl;
169 throw std::runtime_error(
"TriggerThresholdValueLoader >> ClusterThresholdValue not available" );
172 cout <<
"ISO " << emisolation <<
" " << hadisolation <<
" " << hadveto << endl;
174 if(hadveto==
"USEISOBITS" || std::stoi(hadveto)==99 ) {
189 }
catch (std::bad_cast& ex) { }
198 msg() <<
"TriggerThresholdValueLoader >> No type match for ttv_id = "
199 << jtvTarget.
id() <<
type << std::endl;
200 throw std::runtime_error(
"TriggerThresholdValueLoader >> TriggerThresholdValue not available" );
207 }
catch (std::bad_cast& ex) {}
char data[hepevt_bytes_allocation_ATLAS]
void setHadIsolation(float v)
void setEmIsolation(float v)
void setUseIsolationMask(bool use=true)
void setIsolationMask(uint16_t mask)
void commitSession()
commit session if not already done
coral::ISessionProxy & m_session
CORAL interface to database session.
void startSession()
start session if not already active
static std::string & typeAsString(TriggerType tt)
void setName(const std::string &name)
void setVersion(unsigned int version)
MsgStreamTC & msg() const
The standard message stream.
virtual bool load(TriggerThresholdValue &data) override
void setEtaMax(int value)
void setWindow(int value)
void setPriority(float prio)
void setType(const std::string &type)
void setPhiMin(int value)
void setPhiMax(int value)
void setEtaMin(int value)
uint32_t bin2uint(const std::string &binary)