122 {
123 MsgStream log(messageService(), name());
124 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
125 int run = eventHeader->runNumber();
126 if(run<0){
127 log << MSG::INFO << "This data is the MC sample with the Run Number: " << run << endreq;
128 run=-run;
129 }
130
131 char stmt1[200];
132 sprintf(stmt1,
"select TOFCalib "
133 "from RunParams where run_number = %d", run);
134
136 int row_no = m_dbsvc->
query(
"run",stmt1,res);
137 if(!row_no){
138 log << MSG::ERROR<<"search errror"<<endreq;
139 exit(1);
140 }
143 sscanf((*records1)[
"TOFCalib"],
"%ld", &
runNo);
144
145 char stmt2[200];
146 sprintf(stmt2,
"select be,end,counter,a1,a2,a3 "
147 "from TOF_Q where run_number = %ld",
runNo);
148
150 row_no = m_dbsvc->
query(
"run",stmt2,res);
151 if(!row_no){
152 log << MSG::ERROR<<"search errror"<<endreq;
153 exit(1);
154 }
155
156 long int be,end,counter;
157 double sql_result[3];
158
159 for(int jjj=0;jjj<row_no;jjj++){
161 sscanf((*records2)["be"], "%ld", &be);
162 sscanf((*records2)["end"], "%ld", &end);
163 sscanf((*records2)["counter"], "%ld", &counter);
164 sscanf((*records2)["a1"], "%lf", &sql_result[0]);
165 sscanf((*records2)["a2"], "%lf", &sql_result[1]);
166 sscanf((*records2)["a3"], "%lf", &sql_result[2]);
167 if(be==0&&end==0){
168 m_Endcap[counter][0]=sql_result[0];
169 m_Endcap[counter][1]=sql_result[1];
170 m_Endcap[counter][2]=sql_result[2];
171 }
172 if(be==1&&end==0){
173 m_Bar_East[counter][0]=sql_result[0];
174 m_Bar_East[counter][1]=sql_result[1];
175 m_Bar_East[counter][2]=sql_result[2];
176 }
177 if(be==1&&end==1){
178 m_Bar_West[counter][0]=sql_result[0];
179 m_Bar_West[counter][1]=sql_result[1];
180 m_Bar_West[counter][2]=sql_result[2];
181 }
182}
184}
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0
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)