128 {
129
130 MsgStream log(
msgSvc(), name());
131 log << MSG::INFO << "in execute()" << endreq;
132
133 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
134 m_run = eventHeader->runNumber();
135 m_event = eventHeader->eventNumber();
136 log << MSG::DEBUG <<"Run " << m_run << "\tEvent " << m_event <<endreq;
137
138 SmartDataPtr<DQAEvent::DQAEvent> dqaevt(eventSvc(), "/Event/DQATag");
139 if ( dqaevt ) {
140 log << MSG::INFO << "success get DQAEvent" << endreq;
141 } else {
142 log << MSG::ERROR << "Error accessing DQAEvent" << endreq;
143 return StatusCode::FAILURE;
144 }
145 log << MSG::DEBUG << "DQA event tag = " << dqaevt->EventTag() << endreq;
146
147 double p;
149 bool isDimu = false;
150 if ( dqaevt->Dimu() ) isDimu = true;
151 log << MSG::INFO << "DQADimuTag:\t" << dqaevt->Dimu() << endreq;
152
153
154 bool isBb = false;
155 if ( dqaevt->Bhabha() ) isBb= true;
156 log << MSG::INFO << "DQABbTag:\t" << dqaevt->Bhabha() << endreq;
157
158
159 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
160 if (!kaltrkCol) {
161 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
162 return StatusCode::FAILURE;
163 }
164 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
165 for(; iter_trk != kaltrkCol->end(); iter_trk++) {
168
169
170 double dr = (*iter_trk)->dr();
171 double phi0 = (*iter_trk)->fi0();
172 double kappa = (*iter_trk)->kappa();
173 double dz = (*iter_trk)->dz();
174 double tanl = (*iter_trk)->tanl();
175 double pt = 1.0 / kappa;
176 HepLorentzVector p4;
177 p4.setPx(-
sin(phi0) / fabs(kappa));
178 p4.setPy(
cos(phi0) / fabs(kappa));
179 p4.setPz(tanl / fabs(kappa));
180
181 double p3 = p4.mag();
183 if(isBb)
mass = 0.000511;
184 else if(isDimu)
mass = 0.105658;
185
186 p4.setE(sqrt(p3 * p3 +
mass *
mass));
187 p = p4.rho();
188
189 double ecm = 3.68632;
190 HepLorentzVector psip(0.011 * ecm, 0, 0.0075, ecm);
191 Hep3Vector boostv = psip.boostVector();
192 p4.boost(- boostv);
194 TH1 *hmom(0);
195 if (isBb){
196 if (m_thsvc->getHist("/DQAHist/MDC/hpTotLabBb", hmom).isSuccess()) {
197 hmom->Fill(p);
198 } else {
199 log << MSG::ERROR << "Couldn't retrieve hpTotLabBb" << endreq;
200 }
201 if (m_thsvc->getHist("/DQAHist/MDC/hpTotCmsBb", hmom).isSuccess()) {
203 } else {
204 log << MSG::ERROR << "Couldn't retrieve hpTotCmsBb" << endreq;
205 }
206 if (pt > 0) {
207 if (m_thsvc->getHist("/DQAHist/MDC/hppLabBb", hmom).isSuccess()) {
208 hmom->Fill(p);
209 } else {
210 log << MSG::ERROR << "Couldn't retrieve hppLabBb" << endreq;
211 }
212 if (m_thsvc->getHist("/DQAHist/MDC/hppCmsBb", hmom).isSuccess()) {
213 hmom->Fill(p);
214 } else {
215 log << MSG::ERROR << "Couldn't retrieve hppCmsBb" << endreq;
216 }
217 } else if (pt < 0) {
218 if (m_thsvc->getHist("/DQAHist/MDC/hpmLabBb", hmom).isSuccess()) {
219 hmom->Fill(p);
220 } else {
221 log << MSG::ERROR << "Couldn't retrieve hpmLabBb" << endreq;
222 }
223 if (m_thsvc->getHist("/DQAHist/MDC/hpmCmsBb", hmom).isSuccess()) {
224 hmom->Fill(p);
225 } else {
226 log << MSG::ERROR << "Couldn't retrieve hpmCmsBb" << endreq;
227 }
228 }
229 } else if (isDimu){
230 if (m_thsvc->getHist("/DQAHist/MDC/hpTotLabDimu", hmom).isSuccess()) {
231 hmom->Fill(p);
232 } else {
233 log << MSG::ERROR << "Couldn't retrieve hpTotLabDimu" << endreq;
234 }
235 if (m_thsvc->getHist("/DQAHist/MDC/hpTotCmsDimu", hmom).isSuccess()) {
237 } else {
238 log << MSG::ERROR << "Couldn't retrieve hpTotCmsDimu" << endreq;
239 }
240 if (pt > 0) {
241 if (m_thsvc->getHist("/DQAHist/MDC/hppLabDimu", hmom).isSuccess()) {
242 hmom->Fill(p);
243 } else {
244 log << MSG::ERROR << "Couldn't retrieve hppLabDimu" << endreq;
245 }
246 if (m_thsvc->getHist("/DQAHist/MDC/hppCmsDimu", hmom).isSuccess()) {
247 hmom->Fill(p);
248 } else {
249 log << MSG::ERROR << "Couldn't retrieve hppCmsDimu" << endreq;
250 }
251 } else if (pt < 0) {
252 if (m_thsvc->getHist("/DQAHist/MDC/hpmLabDimu", hmom).isSuccess()) {
253 hmom->Fill(p);
254 } else {
255 log << MSG::ERROR << "Couldn't retrieve hpmLabDimu" << endreq;
256 }
257 if (m_thsvc->getHist("/DQAHist/MDC/hpmCmsDimu", hmom).isSuccess()) {
258 hmom->Fill(p);
259 } else {
260 log << MSG::ERROR << "Couldn't retrieve hpmCmsDimu" << endreq;
261 }
262 }
263 }
264
265 }
266
267 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc(), "/Event/Recon/RecMdcTrackCol");
268 if(!newtrkCol){
269 log << MSG::ERROR << "Could not find RecMdcTrackCol" << endreq;
270 return ( StatusCode::FAILURE );
271 }
272
273 RecMdcTrackCol::iterator it_trk = newtrkCol->begin();
274 for(; it_trk != newtrkCol->end(); it_trk++){
275 HitRefVec gothits = (*it_trk) -> getVecHits();
276 HitRefVec::iterator it_hit = gothits.begin();
277 for(; it_hit != gothits.end(); it_hit++){
278
279
280
281 double lr = (*it_hit) -> getFlagLR();
282 if(-1 == lr) lr = 0;
283 double resilrInc;
284 double resilrExc;
285
286 double docaInc = (*it_hit) ->
getDoca();
287 double docaExc = docaInc;
288
289
290
291 double dmeas;
292 if(0 == lr){
293 dmeas = (*it_hit) -> getDriftDistLeft();
294 }else {
295 dmeas = (*it_hit) -> getDriftDistRight();
296 }
297
298 double df = 10.0;
299 docaInc *= df;
300 docaExc *= df;
301 dmeas *= df;
302 double resiInc = fabs(dmeas) - fabs(docaInc);
303 if( 0 == lr ) resilrInc = -1.0 * resiInc;
304 else resilrInc = resiInc;
305
306 double resiExc = fabs(dmeas) - fabs(docaExc);
307 if( 0 == lr ) resilrExc = -1.0 * resiExc;
308 else resilrExc = resiExc;
309
310 double resilrEva = 0.5 * (resilrInc + resilrExc);
311
312 TH1 *htmp(0);
313 if (isBb){
314 if (m_thsvc->getHist("/DQAHist/MDC/hresAllIncBb", htmp).isSuccess()) {
315 htmp->Fill(resilrInc);
316 } else {
317 log << MSG::ERROR << "Couldn't retrieve hresAllIncBb" << endreq;
318 }
319 if (m_thsvc->getHist("/DQAHist/MDC/hresAllExcBb", htmp).isSuccess()) {
320 htmp->Fill(resilrExc);
321 } else {
322 log << MSG::ERROR << "Couldn't retrieve hresAllExcBb" << endreq;
323 }
324 if (m_thsvc->getHist("/DQAHist/MDC/hresAllEvaBb", htmp).isSuccess()) {
325 htmp->Fill(resilrEva);
326 } else {
327 log << MSG::ERROR << "Couldn't retrieve hresAllEvaBb" << endreq;
328 }
329
330 } else if (isDimu){
331 if (m_thsvc->getHist("/DQAHist/MDC/hresAllIncDimu", htmp).isSuccess()) {
332 htmp->Fill(resilrInc);
333 } else {
334 log << MSG::ERROR << "Couldn't retrieve hresAllIncDimu" << endreq;
335 }
336 if (m_thsvc->getHist("/DQAHist/MDC/hresAllExcDimu", htmp).isSuccess()) {
337 htmp->Fill(resilrExc);
338 } else {
339 log << MSG::ERROR << "Couldn't retrieve hresAllExcDimu" << endreq;
340 }
341 if (m_thsvc->getHist("/DQAHist/MDC/hresAllEvaDimu", htmp).isSuccess()) {
342 htmp->Fill(resilrEva);
343 } else {
344 log << MSG::ERROR << "Couldn't retrieve hresAllEvaDimu" << endreq;
345 }
346 }
347 }
348 }
349
350 return StatusCode::SUCCESS;
351}
double sin(const BesAngle a)
double cos(const BesAngle a)
const HepLorentzVector p_cms(0.034067, 0.0, 0.0, 3.097)
SmartRefVector< RecMdcHit > HitRefVec
static void setPidType(PidType pidType)
bool getDoca(double trkpar[], double wpos[], double &doca, double whitPos[], double zini)