67 {
69
70
71 TriggerThresholdLoader& ttldr =
dynamic_cast<TriggerThresholdLoader&
>( (
dynamic_cast<StorageMgr&
>(
m_storageMgr))
72 .triggerThresholdLoader() );
73 ttldr.setMenuId(
menu.id());
74 ttldr.setLoadCableInfo(false);
75
76
77
78 std::map<int,TriggerThreshold*> thresholdNotFoundCache;
79
80 unique_ptr< coral::IQuery >
query(
m_session.nominalSchema().newQuery() );
81 query->addToTableList (
"L1_TM_TO_TI",
"TM2TI" );
82 query->addToTableList (
"L1_TRIGGER_ITEM",
"TI" );
83 query->addToTableList (
"L1_TI_TO_TT",
"TI2TT" );
84
85
86 coral::AttributeList bindList;
87 bindList.extend<int>("menuId");
88 bindList[0].data<
int>() =
menu.id();
89
90 std::string theCondition = "";
91 theCondition += std::string( " TM2TI.L1TM2TI_TRIGGER_MENU_ID = :menuId" );
92 theCondition += std::string( " AND TM2TI.L1TM2TI_TRIGGER_ITEM_ID = TI.L1TI_ID" );
93 theCondition += std::string( " AND TI2TT.L1TI2TT_TRIGGER_ITEM_ID = TI.L1TI_ID" );
94
95 query->setCondition( theCondition, bindList );
96
97
98 coral::AttributeList attList;
99 attList.extend<int> ( "TI.L1TI_ID" );
100 attList.extend<std::string>( "TI.L1TI_NAME" );
101 attList.extend<int> ( "TI.L1TI_VERSION" );
103 attList.extend<int> ( "TI.L1TI_PARTITION" );
104 attList.extend<string> ( "TI.L1TI_MONITOR" );
105 }
106 attList.extend<int> ( "TI.L1TI_CTP_ID" );
107 attList.extend<std::string>( "TI.L1TI_PRIORITY" );
108 attList.extend<std::string>( "TI.L1TI_DEFINITION" );
109 attList.extend<int> ( "TI.L1TI_TRIGGER_TYPE" );
110 attList.extend<int> ( "TI2TT.L1TI2TT_TRIGGER_THRESHOLD_ID" );
111 attList.extend<int> ( "TI2TT.L1TI2TT_POSITION" );
112 attList.extend<int> ( "TI2TT.L1TI2TT_MULTIPLICITY" );
114
115
116 std::string theOrder = "";
117
118 theOrder += " TI.L1TI_CTP_ID ASC";
119
120 theOrder += ", TI2TT.L1TI2TT_POSITION ASC";
121 query->addToOrderList( theOrder );
122
123
124 query->setRowCacheSize(500);
125
126 query->setDistinct();
127
129
130
131 vector<int> ctpIDs;
132 map<int,vector<ThrInfo> > item_thrInfo;
133
134
136
137 const coral::AttributeList&
row =
cursor.currentRow();
138 int ctpid =
row[
"TI.L1TI_CTP_ID"].data<
int>();
139 TriggerItem*
item =
menu.item(ctpid);
140 if(! item) {
141 item =
new TriggerItem();
142 item->setCtpId (ctpid);
148 string mon =
row[
"TI.L1TI_MONITOR"].data<
string>();
149 unsigned short monMask = 0;
150
151 const short TBP = 0x1;
152 const short TAP = 0x2;
153 const short TAV = 0x4;
154
155 vector<string> monLfHf;
156 boost::split(monLfHf, mon, boost::is_any_of(":|"));
157
158
159 if(monLfHf.size()==4 && monLfHf[0]=="LF" && monLfHf[2]=="HF" && monLfHf[1].size()==3 && monLfHf[3].size()==3) {
160
161 if( monLfHf[1][2]=='1' ) monMask |= TBP;
162 if( monLfHf[1][1]=='1' ) monMask |= TAP;
163 if( monLfHf[1][0]=='1' ) monMask |= TAV;
164
165 if( monLfHf[3][2]=='1' ) monMask |= TBP << 3;
166 if( monLfHf[3][1]=='1' ) monMask |= TAP << 3;
167 if( monLfHf[3][0]=='1' ) monMask |= TAV << 3;
168 } else {
169
170 if(
mon.find(
"TBP") != string::npos) monMask |= TBP;
171 if(
mon.find(
"TAP") != string::npos) monMask |= TAP;
172 if(
mon.find(
"TAV") != string::npos) monMask |= TAV;
173 }
174 item->setMonitor( monMask );
175 }
176
177 string priority =
row[
"TI.L1TI_PRIORITY"].data<
string>();
178 if(priority=="0" || priority=="HIGH") {
179 item->setComplexDeadtime(0);
180 } else if(priority=="1" || priority=="LOW") {
181 item->setComplexDeadtime(1);
182 }
184 item->setTriggerType(row[
"TI.L1TI_TRIGGER_TYPE"].
data<int>());
185 menu.addTriggerItem(item);
187 msg() <<
"MenuLoader: Created Item " <<
item->name() <<
" with CTPID " <<
item->ctpId() << endl;
188 item_thrInfo[ctpid] = vector<ThrInfo>();
189 ctpIDs.push_back(ctpid);
190 }
191
193 thr_info.
thrId =
row[
"TI2TT.L1TI2TT_TRIGGER_THRESHOLD_ID"].data<
int>();
194 thr_info.thrPos =
row[
"TI2TT.L1TI2TT_POSITION"].data<
int>();
195 thr_info.thrMult =
row[
"TI2TT.L1TI2TT_MULTIPLICITY"].data<
int>();
196 thr_info.thr =
menu.thresholdConfig().findTriggerThreshold(thr_info.thrId);
197 if(thr_info.thr==0) {
198
199 thr_info.thr = new TriggerThreshold();
200 thr_info.thr->setId(thr_info.thrId);
201 if ( ! ttldr.load( *thr_info.thr ) ) {
202 msg() <<
"MenuLoader: Error loading TriggerThreshold " << thr_info.thrId << endl;
203 throw runtime_error( "MenuLoader::loadItems: error loading TriggerThreshold " );
204 }
205 menu.thresholdConfig().addTriggerThreshold(thr_info.thr);
206 }
207 item_thrInfo[ctpid].push_back(thr_info);
208 }
209
210
211 for(int ctpid : ctpIDs) {
212 TriggerItem* titem =
menu.findTriggerItem( ctpid );
214 msg() <<
"MenuLoader: Number of thresholds for item " << titem->name()
215 << ": " << item_thrInfo[ctpid].size() << " - definition: " << titem->definition() << endl;
216 }
217
218
219
220 titem->setTopNode(
constructTree(titem->definition(), item_thrInfo[ctpid]) );
221 }
222}
char data[hepevt_bytes_allocation_ATLAS]
virtual int verbose() const override
row
Appending html table to final .html summary file.
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)