3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/SmartDataPtr.h"
5#include "GaudiKernel/PropertyMgr.h"
6#include "GaudiKernel/Bootstrap.h"
8#include "GaudiKernel/INTupleSvc.h"
9#include "GaudiKernel/NTuple.h"
10#include "GaudiKernel/ITHistSvc.h"
12#include "CLHEP/Vector/ThreeVector.h"
13#include "CLHEP/Vector/LorentzVector.h"
17#include "EventModel/EventModel.h"
18#include "EventModel/Event.h"
20#include "EvtRecEvent/EvtRecEvent.h"
21#include "EvtRecEvent/EvtRecTrack.h"
22#include "DstEvent/TofHitStatus.h"
23#include "EventModel/EventHeader.h"
26#include "ParticleID/ParticleID.h"
28#include "DQAEvent/DQAEvent.h"
29#include "DQAFillEx/DQAFillEx.h"
31#ifndef ENABLE_BACKWARDS_COMPATIBILITY
34using CLHEP::HepLorentzVector;
40 Algorithm(name, pSvcLocator) {
47 MsgStream log(
msgSvc(), name());
49 log << MSG::INFO <<
"in initialize()" << endmsg;
57 if ( nt ) m_tuple = nt;
59 m_tuple =
ntupleSvc()->book(
"DQAFILE/MDC", CLID_ColumnWiseTuple,
"MDC ntuple");
61 status = m_tuple->addItem(
"runNo", m_runNo);
62 status = m_tuple->addItem(
"event", m_event);
64 log << MSG::ERROR <<
"Can not book N-tuple:" << long(m_tuple) << endreq;
68 if(service(
"THistSvc", m_thsvc).isFailure()) {
69 log << MSG::ERROR <<
"Couldn't get THistSvc" << endreq;
70 return StatusCode::FAILURE;
75 TH1F* hrxy =
new TH1F(
"Rxy",
"Rxy distribution", 110, -1., 10.);
76 if(m_thsvc->regHist(
"/DQAHist/MDC/hrxy", hrxy).isFailure()) {
77 log << MSG::ERROR <<
"Couldn't register Rxy" << endreq;
79 TH1F* hz =
new TH1F(
"z",
"z distribution", 200, -100., 100.);
80 if(m_thsvc->regHist(
"/DQAHist/MDC/hz", hz).isFailure()) {
81 log << MSG::ERROR <<
"Couldn't register z" << endreq;
84 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
85 return StatusCode::SUCCESS;
93 MsgStream log(
msgSvc(), name());
94 log << MSG::INFO <<
"in execute()" << endreq;
96 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
97 m_runNo=eventHeader->runNumber();
98 m_event=eventHeader->eventNumber();
99 log << MSG::DEBUG <<
"run, evtnum = "
106 SmartDataPtr<DQAEvent::DQAEvent> dqaevt(eventSvc(),
"/Event/DQATag");
108 log << MSG::INFO <<
"success get DQAEvent" << endreq;
110 log << MSG::ERROR <<
"Error accessing DQAEvent" << endreq;
111 return StatusCode::FAILURE;
114 log << MSG::DEBUG <<
"event tag = " << dqaevt->EventTag() << endreq;
117 if ( dqaevt->Bhabha() ) {
118 log << MSG::INFO <<
"Bhabha event" << endreq;
120 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
122 log << MSG::DEBUG << i <<
" " << (*itTrk)->partId() <<
" "
123 << (*itTrk)->quality() << endreq;
128 if ( !(*itTrk)->isElectron() )
continue;
135 int qual = (*itTrk)->quality();
136 if ( qual != 0 && qual != 2)
continue;
139 if ( mdcTrk->
charge() > 0 ) {
140 log << MSG::DEBUG <<
"is electron" << endreq;
142 log << MSG::DEBUG <<
"is positron" << endreq;
144 double x0 =mdcTrk->
x();
145 double y0 =mdcTrk->
y();
146 double z0 =mdcTrk->
z();
147 double Rxy=sqrt(x0*x0+y0*y0);
150 if (m_thsvc->getHist(
"/DQAHist/MDC/hrxy", h).isSuccess()) {
153 log << MSG::ERROR <<
"Couldn't retrieve hrxy" << endreq;
155 if (m_thsvc->getHist(
"/DQAHist/MDC/hz", h).isSuccess()) {
158 log << MSG::ERROR <<
"Couldn't retrieve hz" << endreq;
165 return StatusCode::SUCCESS;
172 MsgStream log(
msgSvc(), name());
173 log << MSG::INFO <<
"in finalize()" << endmsg;
174 return StatusCode::SUCCESS;
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
DQAFillEx(const std::string &name, ISvcLocator *pSvcLocator)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol