ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfStorage
src
HLTPrescaleSetCollectionLoader.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
./HLTPrescaleSetLoader.h
"
6
#include "
./HLTPrescaleSetCollectionLoader.h
"
7
#include "
./DBHelper.h
"
8
#include "
TrigConfStorage/StorageMgr.h
"
9
10
#include "
TrigConfHLTData/HLTPrescaleSet.h
"
11
#include "
TrigConfHLTData/HLTPrescaleSetCollection.h
"
12
13
#include <CoralBase/Attribute.h>
14
#include <CoralBase/AttributeList.h>
15
16
#include "RelationalAccess/SchemaException.h"
17
#include "RelationalAccess/ITransaction.h"
18
#include "RelationalAccess/ITable.h"
19
#include "RelationalAccess/ISchema.h"
20
#include "RelationalAccess/ICursor.h"
21
#include "RelationalAccess/IQuery.h"
22
23
#include <algorithm>
24
#include <iostream>
25
#include <sstream>
26
#include <stdexcept>
27
28
using namespace
std
;
29
30
bool
31
TrigConf::HLTPrescaleSetCollectionLoader::load
(
HLTPrescaleSetCollection
& pscoll,
32
unsigned
int
requestcounter,
33
const
std::string&
partition
) {
34
TRG_MSG_INFO
(
"started loading data"
);
35
36
vector< pair<unsigned int, unsigned int> > lb_psk;
37
38
//Find if old or new schema is being used:
39
try
{
40
startSession
();
41
42
unique_ptr< coral::IQuery > q(
m_session
.nominalSchema().newQuery() );
43
44
//Set the tables that are used
45
q->addToTableList (
"HLT_PRESCALE_SET_COLL"
,
"PSC"
);
46
47
//Bind list
48
coral::AttributeList bindings;
49
bindings.extend<
uint
>(
"req"
);
50
bindings.extend<
string
>(
"part"
);
51
bindings[0].data<
uint
>() = requestcounter;
52
bindings[1].data<
string
>() =
partition
;
53
54
string
theCondition =
"HPSC_PARTITION=:part and :req>=0"
;
55
56
q->setCondition( theCondition, bindings );
57
58
//Output data and types
59
coral::AttributeList attList;
60
attList.extend<
int
>(
"PSC.HPSC_LB"
);
61
attList.extend<
int
>(
"PSC.HPSC_HLTPSK"
);
62
fillQuery
(q.get(), attList);
63
64
// the ordering
65
q->addToOrderList(
"PSC.HPSC_LB"
);
66
67
// process the query
68
// query->setRowCacheSize(20);
69
q->setDistinct();
70
71
coral::ICursor& cursor = q->execute();
72
73
// fill chain info list
74
while
(cursor.next()) {
75
const
coral::AttributeList& row = cursor.currentRow();
76
int
lb
= row[
"PSC.HPSC_LB"
].data<
int
>();
77
int
psk = row[
"PSC.HPSC_HLTPSK"
].data<
int
>();
78
lb_psk.push_back( make_pair(
lb
, psk) );
79
}
80
81
TRG_MSG_INFO
(
"LB_PSK map for partition "
<<
partition
);
82
for
(
uint
i=0; i< lb_psk.size(); i++) {
83
TRG_MSG_INFO
(
"For LB "
<< lb_psk[i].first <<
" onwards load psk "
<< lb_psk[i].second);
84
}
85
commitSession
();
86
}
87
catch
(
const
std::exception& e) {
88
TRG_MSG_ERROR
(
"HLTPrescaleSetCollectionLoader: caught exception: "
<< e.what());
89
throw
;
90
}
91
92
pscoll.
set_prescale_keys_to_load
( lb_psk );
93
94
return
load
(pscoll);
95
}
96
97
98
99
bool
100
TrigConf::HLTPrescaleSetCollectionLoader::load
(
HLTPrescaleSetCollection
& psc ) {
101
102
IHLTPrescaleSetLoader
& pssloader =
m_storageMgr
.hltPrescaleSetLoader();
103
pssloader.
setLevel
(
outputLevel
());
104
105
bool
loadsuccess =
true
;
106
107
for
(
HLTPrescaleSetCollection::cont
& psinfo: psc.
sets
()) {
108
109
// already loaded?
110
if
(psinfo.pss!=0)
continue
;
111
112
// create new prescale set and load it
113
psinfo.pss =
new
HLTPrescaleSet
();
114
psinfo.pss->setId(psinfo.psk);
115
bool
loadpss = pssloader.
load
(*psinfo.pss);
116
117
if
(!loadpss) {
118
TRG_MSG_ERROR
(
"HLTPrescaleSetCollectionLoader::load(): Could not load HLT Prescales for key "
<< psinfo.psk);
119
loadsuccess =
false
;
120
}
121
}
122
123
return
loadsuccess;
124
}
125
DBHelper.h
HLTPrescaleSetCollectionLoader.h
HLTPrescaleSetCollection.h
HLTPrescaleSetLoader.h
HLTPrescaleSet.h
uint
unsigned int uint
Definition
LArOFPhaseFill.cxx:19
StorageMgr.h
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
TrigConf::DBLoader::m_storageMgr
StorageMgr & m_storageMgr
reference to the storage manager
Definition
DBLoader.h:66
TrigConf::DBLoader::outputLevel
virtual MSGTC::Level outputLevel() const override
Definition
DBLoader.h:39
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::startSession
void startSession()
start session if not already active
Definition
DBLoader.cxx:36
TrigConf::HLTPrescaleSetCollectionLoader::load
virtual bool load(HLTPrescaleSetCollection &psc)
Definition
HLTPrescaleSetCollectionLoader.cxx:100
TrigConf::HLTPrescaleSetCollection
HLT chain configuration information.
Definition
HLTPrescaleSetCollection.h:25
TrigConf::HLTPrescaleSetCollection::set_prescale_keys_to_load
void set_prescale_keys_to_load(const std::vector< std::pair< unsigned int, unsigned int > > &)
Definition
HLTPrescaleSetCollection.cxx:141
TrigConf::HLTPrescaleSetCollection::sets
std::list< cont > & sets()
Definition
HLTPrescaleSetCollection.h:67
TrigConf::HLTPrescaleSet
HLT chain configuration information.
Definition
HLTPrescaleSet.h:31
TrigConf::IHLTPrescaleSetLoader
Definition
IHLTPrescaleSetLoader.h:14
TrigConf::IHLTPrescaleSetLoader::load
virtual bool load(HLTPrescaleSet &hltpss)=0
TrigConf::ILoader::setLevel
virtual void setLevel(MSGTC::Level lvl)=0
Load the configuration data from the configuration source.
lb
int lb
Definition
globals.cxx:23
TrigConf::fillQuery
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)
Definition
DBHelper.cxx:13
std
STL namespace.
std::partition
DataModel_detail::iterator< DVL > partition(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of partition for DataVector/List.
Definition
DVL_algorithms.h:324
TrigConf::HLTPrescaleSetCollection::cont
Definition
HLTPrescaleSetCollection.h:28
Generated on
for ATLAS Offline Software by
1.17.0