43 {
44
46 msg() <<
"ThresholdMonitorLoader started loading data via ID. ID = "
47 << tmTarget.id() << " for MenuId = "
49
50 try {
52
54 coral::ITable&
table =
m_session.nominalSchema().tableHandle(
"L1_TM_TO_TT_MON");
56 query->setRowCacheSize( 6 );
57
58
59 coral::AttributeList bindList;
60 bindList.extend<int>("tmId");
61 bindList.extend<int>("menuId");
62 bindList[0].data<int>() = tmTarget.id();
64 std::string theCondition = "";
65 theCondition += std::string( " L1TM2TTM_ID = :tmId" );
66 theCondition += std::string( " AND L1TM2TTM_TRIGGER_MENU_ID = :menuId" );
67 query->setCondition( theCondition, bindList );
68
69
70 coral::AttributeList attList;
71 attList.extend<std::string>( "L1TM2TTM_NAME" );
72 attList.extend<long>( "L1TM2TTM_TRIGGER_THRESHOLD_ID" );
73 attList.extend<int>( "L1TM2TTM_INTERNAL_COUNTER" );
74 attList.extend<int>( "L1TM2TTM_MULTIPLICITY" );
75 if(schema <= 6) attList.extend<long>( "L1TM2TTM_BUNCH_GROUP_SET_ID" );
76 if(schema > 6) attList.extend<long>( "L1TM2TTM_BUNCH_GROUP_ID" );
77 attList.extend<std::string>( "L1TM2TTM_COUNTER_TYPE" );
78 query->defineOutput(attList);
79
80 query->addToOutputList(
"L1TM2TTM_NAME" );
81 query->addToOutputList(
"L1TM2TTM_TRIGGER_THRESHOLD_ID" );
82 query->addToOutputList(
"L1TM2TTM_INTERNAL_COUNTER" );
83 query->addToOutputList(
"L1TM2TTM_MULTIPLICITY" );
84 if(schema <= 6)
query->addToOutputList(
"L1TM2TTM_BUNCH_GROUP_SET_ID" );
85 else if(schema > 6)
query->addToOutputList(
"L1TM2TTM_BUNCH_GROUP_ID" );
86 query->addToOutputList(
"L1TM2TTM_COUNTER_TYPE" );
87
89
91 msg() <<
"ThresholdMonitorLoader >> No such ThresholdMonitor exists "
92 << tmTarget.id() << std::endl;
95 throw std::runtime_error( "ThresholdMonitorLoader >> ThresholdMonitor not available" );
96 }
97
98 const coral::AttributeList&
row =
cursor.currentRow();
99 long trigger_threshold_id =0;
100 trigger_threshold_id =
row[
"L1TM2TTM_TRIGGER_THRESHOLD_ID"].data<
long>();
101 int internal_counter =0;
102 internal_counter =
row[
"L1TM2TTM_INTERNAL_COUNTER"].data<
int>();
103 int multiplicity;
104 multiplicity =
row[
"L1TM2TTM_MULTIPLICITY"].data<
int>();
105 long bunch_group_id=0;
106 if(schema <= 6) bunch_group_id =
row[
"L1TM2TTM_BUNCH_GROUP_SET_ID"].data<
long>();
107 else if(schema > 6) bunch_group_id =
row[
"L1TM2TTM_BUNCH_GROUP_ID"].data<
long>();
108 std::string countertype="";
109 countertype =
row[
"L1TM2TTM_COUNTER_TYPE"].data<std::string>();
111 name =
row[
"L1TM2TTM_NAME"].data<std::string>();
112
113
114 tmTarget.setName(name);
115 tmTarget.setThresholdId(trigger_threshold_id);
116 tmTarget.setInternalCounter(internal_counter );
117 tmTarget.setMultiplicity(multiplicity);
118
119 tmTarget.setCounterType(countertype );
120 tmTarget.setBunchGroupId(bunch_group_id );
121
122
123
124 coral::ITable& tableThresh =
m_session.nominalSchema().tableHandle(
"L1_TRIGGER_THRESHOLD");
125 coral::IQuery* queryThresh = tableThresh.newQuery();
126 queryThresh->setRowCacheSize( 4 );
127
128
129 std::string cond = "L1TT_ID = :threshId";
130 coral::AttributeList alist;
131 alist.extend<long>("threshId");
132 alist[0].data<long>() = static_cast<long>(trigger_threshold_id);
133 queryThresh->setCondition( cond, alist );
134
135
136 coral::AttributeList attList1;
137 attList1.extend<std::string>( "L1TT_NAME" );
138 attList1.extend<int>( "L1TT_ACTIVE" );
139 queryThresh->defineOutput(attList1);
140 queryThresh->addToOutputList( "L1TT_NAME" );
141 queryThresh->addToOutputList( "L1TT_ACTIVE" );
142
143 coral::ICursor& cursorThresh = queryThresh->execute();
144 if ( ! cursorThresh.next() ) {
145 msg() <<
"ThresholdMonitorLoader >> No such trigger threshold exists : " << trigger_threshold_id << std::endl;
147 delete queryThresh;
149 throw std::runtime_error( "ThresholdMonitorLoader >> TriggerThreshold not available" );
150 }
151
152 const coral::AttributeList& rowThresh = cursorThresh.currentRow();
154 tmTarget.setThresholdActive( rowThresh[
"L1TT_ACTIVE"].
data<int>() );
155
156
157
158 coral::ITable& tableTMTOTT =
m_session.nominalSchema().tableHandle(
"L1_TM_TO_TT");
159 coral::IQuery* queryTMTOTT = tableTMTOTT.newQuery();
160 queryTMTOTT->setRowCacheSize( 5 );
161
162
163 cond = "L1TM2TT_TRIGGER_THRESHOLD_ID = :ttId AND L1TM2TT_TRIGGER_MENU_ID = :menuId";
164 coral::AttributeList alistTMTOTT;
165 alistTMTOTT.extend<long>("ttId");
166 alistTMTOTT.extend<long>("menuId");
167 alistTMTOTT[0].data<long>() = trigger_threshold_id;
168 alistTMTOTT[1].data<
long>() =
m_MenuId;
169 queryTMTOTT->setCondition( cond, alistTMTOTT );
170
171
172 coral::AttributeList attList2;
173 attList2.extend<std::string>( "L1TM2TT_CABLE_CTPIN" );
174 attList2.extend<std::string>( "L1TM2TT_CABLE_CONNECTOR" );
175 attList2.extend<int>( "L1TM2TT_CABLE_START" );
176 attList2.extend<int>( "L1TM2TT_CABLE_END" );
177 queryTMTOTT->defineOutput(attList2);
178 queryTMTOTT->addToOutputList( "L1TM2TT_CABLE_CTPIN" );
179 queryTMTOTT->addToOutputList( "L1TM2TT_CABLE_CONNECTOR" );
180 queryTMTOTT->addToOutputList( "L1TM2TT_CABLE_START" );
181 queryTMTOTT->addToOutputList( "L1TM2TT_CABLE_END" );
182
183 coral::ICursor& cursorTMTOTT = queryTMTOTT->execute();
184 if ( ! cursorTMTOTT.next() ) {
185 msg() <<
"ThresholdMonitorLoader >> No such trigger threshold ( " << trigger_threshold_id
186 <<
" ) or menu ( " <<
m_MenuId <<
" ) exists in table L1_TM_TO_TT" << std::endl;
188 delete queryThresh;
189 delete queryTMTOTT;
191 throw std::runtime_error( "ThresholdMonitorLoader >> TriggerThreshold link entry not available" );
192 }
193 const coral::AttributeList& rowTMTOTT = cursorTMTOTT.currentRow();
194
195 std::string slotString = rowTMTOTT["L1TM2TT_CABLE_CTPIN"].data<std::string>();
197 if(slotString.find("SLOT7") != std::string::npos) {
198 slot = 7;
199 } else if(slotString.find("SLOT8") != std::string::npos) {
200 slot = 8;
201 } else if(slotString.find("SLOT9") != std::string::npos) {
202 slot = 9;
203 } else {
204 msg() <<
"Unknown CTPIN string '" << slotString <<
"'" << std::endl;
206 delete queryThresh;
207 delete queryTMTOTT;
209 throw std::runtime_error( "ThresholdMonitorLoader: Error loading Counters " );
210 }
211 tmTarget.setCtpinSlot( slot );
212 std::string conString = rowTMTOTT["L1TM2TT_CABLE_CONNECTOR"].data<std::string>();
214 if(conString.find("CON0") != std::string::npos) {
215 con = 0;
216 } else if(conString.find("CON1") != std::string::npos) {
217 con = 1;
218 } else if(conString.find("CON2") != std::string::npos) {
219 con = 2;
220 } else if(conString.find("CON3") != std::string::npos) {
221 con = 3;
222 } else {
223 msg() <<
"Unknown CTPIN connector string '" << conString <<
"'" << std::endl;
225 delete queryThresh;
226 delete queryTMTOTT;
228 throw std::runtime_error( "ThresholdMonitorLoader: Error loading Counters " );
229 }
230 tmTarget.setCtpinConnector(con);
231 tmTarget.setThresholdStartBit( rowTMTOTT[
"L1TM2TT_CABLE_START"].
data<int>() );
232 tmTarget.setThresholdEndBit( rowTMTOTT[
"L1TM2TT_CABLE_END"].
data<int>() );
233
235 delete queryThresh;
236 delete queryTMTOTT;
238 return true;
239 } catch( const coral::SchemaException& e ) {
240 msg() <<
"ThresholdMonitorLoader >> SchemaException: "
241
242 <<
e.what() << std::endl;
244 return false;
245 } catch( const std::exception& e ) {
246 msg() <<
"ThresholdMonitorLoader >> Standard C++ exception: " <<
e.what() << std::endl;
247
249 return false;
250 } catch( ... ) {
251 msg() <<
"ThresholdMonitorLoader >> unknown C++ exception" << std::endl;
252
254 return false;
255 }
256}
char data[hepevt_bytes_allocation_ATLAS]
virtual int verbose() const override
void commitSession()
commit session if not already done
unsigned int triggerDBSchemaVersion()
void startSession()
start session if not already active
MsgStreamTC & msg() const
The standard message stream.
row
Appending html table to final .html summary file.