18 MsgStream log(
msgSvc(), name() );
20 char* opt_host_name =
"bes3db2.ihep.ac.cn";
22 char* opt_user_name =
"maqm";
23 char* opt_password =
"maqm_offline";
24 unsigned int opt_port_num = 3306;
25 char* opt_socket_name = NULL;
26 char* opt_db_name =
"offlinedb";
27 unsigned int opt_flags = 0;
31 conn = mysql_init( NULL );
33 mysql_real_connect( conn, opt_host_name, opt_user_name, opt_password, opt_db_name,
34 opt_port_num, opt_socket_name, opt_flags );
35 printf(
"connect the database ok\n" );
39 timenow = localtime( &now );
40 printf(
"Local time is %s\n", asctime( timenow ) );
42 TFile*
f =
new TFile(
"/ihepbatch/besd12/max/bBhabha_EsTime_run6018.root" );
43 cout <<
"step11111111" << endl;
45 TTree* Level0 = (TTree*)
f->Get(
"h2" );
46 TBufferFile Level0_buf( TBuffer::kWrite );
47 Level0->Streamer( Level0_buf );
49 cout <<
"step22222222" << endl;
51 TTree* Level1 = (TTree*)
f->Get(
"calibconst" );
52 TBufferFile Level1_buf( TBuffer::kWrite );
53 Level1->Streamer( Level1_buf );
125 char query[5024000], buf[1024 * 1000], buf1[1024 * 1000], *p, *
p1;
126 unsigned int from_len, from_len1;
132 "INSERT INTO EsTimeCalConst(SerNo,RunFrom,RunTo,EsTimeH2,EsTimeH9) "
133 "VALUES(%d,'100','1000','",
136 printf(
"%s\n", query );
137 p = query + strlen( query );
138 p += mysql_escape_string( p, Level0_buf.Buffer(), Level0_buf.BufferSize() );
141 cout <<
"strlen(query)22222222222=" << strlen( query ) << endl;
143 p = query + strlen( query );
144 p += mysql_escape_string( p, Level1_buf.Buffer(), Level1_buf.BufferSize() );
146 status = mysql_query( conn, query );
147 printf(
"%d\n", status );
151 unsigned long* lengths;
161 sprintf( stmt1,
"select EsTimeH2,EsTimeH9,RunFrom,RunTo from TofCalConst where SerNo=%d",
165 printf(
"%s\n", stmt1 );
166 if ( mysql_real_query( conn, stmt1, strlen( stmt1 ) ) != 0 ) printf(
"query error\n" );
167 res_set = mysql_store_result( conn );
168 mysql_field_seek( res_set, 0 );
170 row = mysql_fetch_row( res_set );
171 lengths = mysql_fetch_lengths( res_set );
172 for (
int i = 0; i < 8; i++ )
175 cout <<
"lengths[" << i <<
"]=" << lengths[i] << endl;
215 return StatusCode::SUCCESS;
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)