105 coral::AttributeList conditionData;
106 std::cout << std::endl <<
"L1RPCHwConfigSourceHandler: start to build L1RPC Hw Config..." << std::flush << std::endl << std::endl;
109 coral::IQuery* query1 = schema.newQuery();
110 query1->addToTableList(
"CRATEDISABLED" );
111 query1->addToTableList(
"CRATE" );
112 query1->addToTableList(
"BOARD" );
113 query1->addToTableList(
"TRIGGERBOARD" );
114 query1->addToOutputList(
"TRIGGERBOARD.TOWERTO",
"TOWERTO");
115 query1->addToOutputList(
"TRIGGERBOARD.TOWERFROM",
"TOWERFROM");
116 query1->addToOutputList(
"TRIGGERBOARD.SECTOR",
"SECTOR");
117 query1->addToOrderList(
"TOWERTO" );
118 query1->addToOrderList(
"SECTOR" );
119 condition =
"CRATE.CRATEID=CRATEDISABLED.CRATE_CRATEID AND BOARD.CRATE_CRATEID=CRATE.CRATEID AND BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID AND CRATE.TYPE='TRIGGERCRATE'";
120 query1->setCondition( condition, conditionData );
121 coral::ICursor& cursor1 = query1->execute();
122 while ( cursor1.next() ) {
124 const coral::AttributeList& row = cursor1.currentRow();
125 int sector = atoi((row[
"SECTOR"].data<std::string>()).c_str());
126 int first = atoi((row[
"TOWERTO"].data<std::string>()).c_str());
127 int last = atoi((row[
"TOWERFROM"].data<std::string>()).c_str());
128 for (
int iTower=first; iTower<=
last; iTower++) {
129 for (
int jSegment=0; jSegment<12; jSegment++) {
137 coral::IQuery* query2 = schema.newQuery();
138 query2->addToTableList(
"BOARDDISABLED" );
139 query2->addToTableList(
"BOARD" );
140 query2->addToTableList(
"TRIGGERBOARD" );
141 query2->addToOutputList(
"TRIGGERBOARD.TOWERTO",
"TOWERTO");
142 query2->addToOutputList(
"TRIGGERBOARD.TOWERFROM",
"TOWERFROM");
143 query2->addToOutputList(
"TRIGGERBOARD.SECTOR",
"SECTOR");
144 query2->addToOrderList(
"TOWERTO" );
145 query2->addToOrderList(
"SECTOR" );
146 condition =
"BOARD.BOARDID=BOARDDISABLED.BOARD_BOARDID AND BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID";
147 query2->setCondition( condition, conditionData );
148 coral::ICursor& cursor2 = query2->execute();
149 while ( cursor2.next() ) {
151 const coral::AttributeList& row = cursor2.currentRow();
152 int sector = atoi((row[
"SECTOR"].data<std::string>()).c_str());
153 int first = atoi((row[
"TOWERTO"].data<std::string>()).c_str());
154 int last = atoi((row[
"TOWERFROM"].data<std::string>()).c_str());
155 for (
int iTower=first; iTower<=
last; iTower++) {
156 for (
int jSegment=0; jSegment<12; jSegment++) {
196 coral::IQuery* query4 = schema.newQuery();
197 query4->addToTableList(
"CHIPDISABLED" );
198 query4->addToTableList(
"CHIP" );
199 query4->addToTableList(
"BOARD" );
200 query4->addToTableList(
"TRIGGERBOARD" );
201 query4->addToOutputList(
"TRIGGERBOARD.TOWERTO",
"TOWERTO");
202 query4->addToOutputList(
"TRIGGERBOARD.TOWERFROM",
"TOWERFROM");
203 query4->addToOutputList(
"TRIGGERBOARD.SECTOR",
"SECTOR");
204 query4->addToOutputList(
"CHIP.POSITION",
"POSITION");
205 query4->addToOrderList(
"TOWERTO" );
206 query4->addToOrderList(
"SECTOR" );
207 query4->addToOrderList(
"POSITION" );
208 condition =
"CHIP.CHIPID=CHIPDISABLED.CHIP_CHIPID AND CHIP.BOARD_BOARDID=BOARD.BOARDID AND BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID AND CHIP.TYPE='PAC'";
209 query4->setCondition( condition, conditionData );
210 coral::ICursor& cursor4 = query4->execute();
211 while ( cursor4.next() ) {
213 const coral::AttributeList& row = cursor4.currentRow();
214 int sector = atoi((row[
"SECTOR"].data<std::string>()).c_str());
215 int first = atoi((row[
"TOWERTO"].data<std::string>()).c_str());
216 int last = atoi((row[
"TOWERFROM"].data<std::string>()).c_str());
217 int chipPos=row[
"POSITION"].data<
short>();
218 int tower=first+chipPos-8;
220 for (
int jSegment=0; jSegment<12; jSegment++) {
DbTransaction & transaction()
int start(bool readOnly=false)
start transaction
L1RPCHwConfig * disabledDevs
coral::ISchema & nominalSchema()
void enablePAC(int tower, int sector, int segment, bool enable)
cond::DbSession * session