8 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"L1RPCHwConfigSourceHandler")),
9 m_dummy(ps.getUntrackedParameter<
int>(
"WriteDummy", 0)),
10 m_validate(ps.getUntrackedParameter<
int>(
"Validate", 0)),
11 m_disableCrates(ps.getUntrackedParameter<
std::vector<
int> >(
"DisabledCrates")),
12 m_disableTowers(ps.getUntrackedParameter<
std::vector<
int> >(
"DisabledTowers")),
13 m_connect(ps.getUntrackedParameter<
std::
string>(
"OnlineConn",
"")),
14 m_authpath(ps.getUntrackedParameter<
std::
string>(
"OnlineAuthPath",
".")) {}
19 std::cout <<
"L1RPCHwConfigSourceHandler: L1RPCHwConfigSourceHandler::getNewObjects begins\n";
35 std::cout <<
" Validation was requested, so will check present contents" << std::endl;
40 std::cout <<
"L1RPCHwConfigSourceHandler: no validation requested" << std::endl;
67 std::cout <<
"No changes - will not write anything!!!" << std::endl;
68 if (difference == 1) {
69 std::cout <<
"Will write new object to offline DB!!!" << std::endl;
73 std::cout <<
"L1RPCHwConfigSourceHandler: L1RPCHwConfigSourceHandler::getNewObjects ends\n";
77 std::cout <<
"L1RPCHwConfigSourceHandler: connecting to " << connect <<
"..." << std::flush;
92 coral::AttributeList conditionData;
94 <<
"L1RPCHwConfigSourceHandler: start to build L1RPC Hw Config..." << std::flush << std::endl
98 coral::IQuery* query1 = schema.newQuery();
99 query1->addToTableList(
"CRATEDISABLED");
100 query1->addToTableList(
"CRATE");
101 query1->addToTableList(
"BOARD");
102 query1->addToTableList(
"TRIGGERBOARD");
103 query1->addToOutputList(
"TRIGGERBOARD.TOWERTO",
"TOWERTO");
104 query1->addToOutputList(
"TRIGGERBOARD.TOWERFROM",
"TOWERFROM");
105 query1->addToOutputList(
"TRIGGERBOARD.SECTOR",
"SECTOR");
106 query1->addToOrderList(
"TOWERTO");
107 query1->addToOrderList(
"SECTOR");
109 "CRATE.CRATEID=CRATEDISABLED.CRATE_CRATEID AND BOARD.CRATE_CRATEID=CRATE.CRATEID AND " 110 "BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID AND CRATE.TYPE='TRIGGERCRATE'";
111 query1->setCondition(condition, conditionData);
112 coral::ICursor& cursor1 = query1->execute();
113 while (cursor1.next()) {
115 const coral::AttributeList& row = cursor1.currentRow();
116 int sector = atoi((row[
"SECTOR"].data<std::string>()).c_str());
117 int first = atoi((row[
"TOWERTO"].data<std::string>()).c_str());
118 int last = atoi((row[
"TOWERFROM"].data<std::string>()).c_str());
119 for (
int iTower = first; iTower <=
last; iTower++) {
120 for (
int jSegment = 0; jSegment < 12; jSegment++) {
128 coral::IQuery* query2 = schema.newQuery();
129 query2->addToTableList(
"BOARDDISABLED");
130 query2->addToTableList(
"BOARD");
131 query2->addToTableList(
"TRIGGERBOARD");
132 query2->addToOutputList(
"TRIGGERBOARD.TOWERTO",
"TOWERTO");
133 query2->addToOutputList(
"TRIGGERBOARD.TOWERFROM",
"TOWERFROM");
134 query2->addToOutputList(
"TRIGGERBOARD.SECTOR",
"SECTOR");
135 query2->addToOrderList(
"TOWERTO");
136 query2->addToOrderList(
"SECTOR");
137 condition =
"BOARD.BOARDID=BOARDDISABLED.BOARD_BOARDID AND BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID";
138 query2->setCondition(condition, conditionData);
139 coral::ICursor& cursor2 = query2->execute();
140 while (cursor2.next()) {
142 const coral::AttributeList& row = cursor2.currentRow();
143 int sector = atoi((row[
"SECTOR"].data<std::string>()).c_str());
144 int first = atoi((row[
"TOWERTO"].data<std::string>()).c_str());
145 int last = atoi((row[
"TOWERFROM"].data<std::string>()).c_str());
146 for (
int iTower = first; iTower <=
last; iTower++) {
147 for (
int jSegment = 0; jSegment < 12; jSegment++) {
187 coral::IQuery* query4 = schema.newQuery();
188 query4->addToTableList(
"CHIPDISABLED");
189 query4->addToTableList(
"CHIP");
190 query4->addToTableList(
"BOARD");
191 query4->addToTableList(
"TRIGGERBOARD");
192 query4->addToOutputList(
"TRIGGERBOARD.TOWERTO",
"TOWERTO");
193 query4->addToOutputList(
"TRIGGERBOARD.TOWERFROM",
"TOWERFROM");
194 query4->addToOutputList(
"TRIGGERBOARD.SECTOR",
"SECTOR");
195 query4->addToOutputList(
"CHIP.POSITION",
"POSITION");
196 query4->addToOrderList(
"TOWERTO");
197 query4->addToOrderList(
"SECTOR");
198 query4->addToOrderList(
"POSITION");
200 "CHIP.CHIPID=CHIPDISABLED.CHIP_CHIPID AND CHIP.BOARD_BOARDID=BOARD.BOARDID AND " 201 "BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID AND CHIP.TYPE='PAC'";
202 query4->setCondition(condition, conditionData);
203 coral::ICursor& cursor4 = query4->execute();
204 while (cursor4.next()) {
206 const coral::AttributeList& row = cursor4.currentRow();
207 int sector = atoi((row[
"SECTOR"].data<std::string>()).c_str());
208 int first = atoi((row[
"TOWERTO"].data<std::string>()).c_str());
209 int last = atoi((row[
"TOWERFROM"].data<std::string>()).c_str());
210 int chipPos = row[
"POSITION"].data<
short>();
211 int tower = first + chipPos - 8;
213 for (
int jSegment = 0; jSegment < 12; jSegment++) {
222 const Ref& set1 = _set1;
223 std::cout <<
"Size of new object is : " << std::flush;
225 std::cout <<
"Size of ref object is : " << std::flush;
228 if (set1->size() != set2->
size()) {
229 std::cout <<
" Number of disabled devices changed " << std::endl;
233 for (
int sector = 0; sector < 12; sector++) {
234 for (
int segment = 0; segment < 12; segment++)
235 if (set1->isActive(
tower, sector, segment) != set2->
isActive(
tower, sector, segment)) {
236 std::cout <<
" Configuration changed for tower " <<
tower <<
", sector " << sector <<
", segment " << segment
void enableTower(int tower, bool enable)
edm::Ref< Container > Ref
void enableCrate(int logSector, bool enable)
void getNewObjects() override
void start(bool readOnly=true)
~L1RPCHwConfigSourceHandler() override
Transaction & transaction()
int Compare2Configs(const Ref &set1, L1RPCHwConfig *set2)
OldContainer m_to_transfer
std::vector< int > m_disableCrates
cond::ValidityInterval lastInterval
std::vector< int > m_disableTowers
bool isActive(int tower, int sector, int segment) const
unsigned long long Time_t
L1RPCHwConfig * disabledDevs
coral::ISchema & nominalSchema()
Session createSession(const std::string &connectionString, bool writeCapable=false)
void enablePAC(int tower, int sector, int segment, bool enable)
cond::persistency::Session session
cond::Time_t currentTime() const
void ConnectOnlineDB(std::string connect, std::string authPath)
void DisconnectOnlineDB()
void setAuthenticationPath(const std::string &p)
L1RPCHwConfigSourceHandler(const edm::ParameterSet &ps)
cond::TagInfo_t const & tagInfo() const