137 {
138 MsgStream log(messageService(), name());
139 if(!m_dbsvc){
140 log << MSG::FATAL << " m_dbsvc=0" << endreq;
141 return StatusCode::FAILURE;
142 }
143
144 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
145 int run = eventHeader->runNumber();
146
147 log << MSG::INFO << "run=" << run << endreq;
148
149 char stmt1[200];
150 sprintf(stmt1,
"select efconfig_id from RunParams where run_number = %d",
abs(run));
151
153 int row_no = m_dbsvc->
query(
"RunInfo",stmt1,res);
154 if(!row_no){
155 log << MSG::ERROR<<"search errror"<<endreq;
156 return StatusCode::FAILURE;
157 }
158 long int efId=atoi((*res[0])["efconfig_id"]);
159
160 char stmt2[200];
161 sprintf(stmt2,
"select Seqlist_dtd,Siglist_dtd,Seqlist_xml,Siglist_xml from EFConfInfo where EFConfId = %ld", efId);
162
164 row_no = m_dbsvc->
query(
"configdb",stmt2,res);
165 if(!row_no){
166 log << MSG::ERROR<<"search errror"<<endreq;
167 return StatusCode::FAILURE;
168 }
169
170 long int seq_dtd,sig_dtd,seq_xml,sig_xml;
171 seq_dtd=atoi((*res[0])["Seqlist_dtd"]);
172 seq_dtd=18;
173 sig_dtd=atoi((*res[0])["Siglist_dtd"]);
174 sig_dtd=15;
175 seq_xml=atoi((*res[0])["Seqlist_xml"]);
176 sig_xml=atoi((*res[0])["Siglist_xml"]);
177
178 ofstream outfile;
179
180 char stmt3[200];
181 sprintf(stmt3,
"select FileName,FileText from EFfile where EFfileId = %ld", seq_dtd);
183 row_no = m_dbsvc->
query(
"configdb",stmt3,res);
184 if(!row_no){
185 log << MSG::ERROR<<"search errror"<<endreq;
186 return StatusCode::FAILURE;
187 }
188 outfile.open((*res[0])["FileName"],ios_base::out);
189 outfile << (*res[0])["FileText"];
190 outfile.close();
191
192 char stmt4[200];
193 sprintf(stmt4,
"select FileName,FileText from EFfile where EFfileId = %ld", sig_dtd);
195 row_no = m_dbsvc->
query(
"configdb",stmt4,res);
196 if(!row_no){
197 log << MSG::ERROR<<"search errror"<<endreq;
198 return StatusCode::FAILURE;
199 }
200 outfile.open((*res[0])["FileName"],ios_base::out);
201 outfile << (*res[0])["FileText"];
202 outfile.close();
203
204 char stmt5[200];
205 sprintf(stmt5,
"select FileName,FileText from EFfile where EFfileId = %ld", seq_xml);
207 row_no = m_dbsvc->
query(
"configdb",stmt5,res);
208 if(!row_no){
209 log << MSG::ERROR<<"search errror"<<endreq;
210 return StatusCode::FAILURE;
211 }
212 outfile.open((*res[0])["FileName"],ios_base::out);
213 outfile << (*res[0])["FileText"];
214 outfile.close();
215 m_seqListFile = string((*res[0])["FileName"]);
216
217 char stmt6[200];
218 sprintf(stmt6,
"select FileName,FileText from EFfile where EFfileId = %ld", sig_xml);
220 row_no = m_dbsvc->
query(
"configdb",stmt6,res);
221 if(!row_no){
222 log << MSG::ERROR<<"search errror"<<endreq;
223 return StatusCode::FAILURE;
224 }
225 outfile.open((*res[0])["FileName"],ios_base::out);
226 outfile << (*res[0])["FileText"];
227 outfile.close();
228 m_sigListFile = string((*res[0])["FileName"]);
229
230 return StatusCode::SUCCESS;
231}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0