#include <BestDTagSvc.h>
Inheritance diagram for BestDTagSvc:
Public Member Functions | |
BestDTagSvc (const std::string &name, ISvcLocator *svcLoc) | |
virtual | ~BestDTagSvc () |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvIF) |
EvtRecDTag * | getSingleTag (int modeid, int charm=0) |
EvtRecDTag ** | getDoubleTag (int modeid1, int modeid2, int charm=0) |
bool | isCosmicOrLepton () |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Private Member Functions | |
bool | isGoodTrack (EvtRecTrack *atrk) |
bool | isElectron (EvtRecTrack *atrk) |
bool | isMuon (EvtRecTrack *atrk) |
Private Attributes | |
bool | m_isPidTight |
IDataProviderSvc * | eventSvc_ |
IVertexDbSvc * | vtxSvc_ |
Friends | |
class | CnvFactory< BestDTagSvc > |
Definition at line 12 of file BestDTagSvc.h.
BestDTagSvc::BestDTagSvc | ( | const std::string & | name, | |
ISvcLocator * | svcLoc | |||
) |
Definition at line 10 of file BestDTagSvc.cxx.
References m_isPidTight.
00011 : Service(name, svcLoc) 00012 { 00013 //declareProperty("", m_); 00014 declareProperty("pidTight", m_isPidTight = true); 00015 }
BestDTagSvc::~BestDTagSvc | ( | ) | [virtual] |
StatusCode BestDTagSvc::finalize | ( | ) | [virtual] |
Definition at line 34 of file BestDTagSvc.cxx.
References Bes_Common::INFO.
00035 { 00036 MsgStream log(messageService(), name()); 00037 log << MSG::INFO << "@initialize()" << endreq; 00038 00039 StatusCode sc = Service::finalize(); 00040 00041 return sc; 00042 }
EvtRecDTag ** BestDTagSvc::getDoubleTag | ( | int | modeid1, | |
int | modeid2, | |||
int | charm = 0 | |||
) | [virtual] |
Implements IBestDTagSvc.
Definition at line 89 of file BestDTagSvc.cxx.
00090 { 00091 static EvtRecDTag** tagpp = new EvtRecDTag*[2]; 00092 00093 //not implemented yet, just a placeholder for the future 00094 00095 00096 if ( false ) { 00097 return tagpp; 00098 } 00099 00100 return NULL; 00101 }
EvtRecDTag * BestDTagSvc::getSingleTag | ( | int | modeid, | |
int | charm = 0 | |||
) | [virtual] |
Implements IBestDTagSvc.
Definition at line 56 of file BestDTagSvc.cxx.
References calibUtil::ERROR, eventSvc_, EventModel::EvtRec::EvtRecDTagCol, m_isPidTight, and EvtRecDTag::Tight.
00057 { 00058 MsgStream log(messageService(), name()); 00059 00060 SmartDataPtr<EvtRecDTagCol> dtags(eventSvc_, EventModel::EvtRec::EvtRecDTagCol); 00061 if ( !dtags ) { 00062 log << MSG::ERROR << "Can't retrieve the EvtRecDTagCol!" << endreq; 00063 return NULL; 00064 } 00065 00066 EvtRecDTag* pbest = NULL; 00067 00068 double bestDE = 999.; 00069 00070 for (EvtRecDTagCol::iterator it = dtags->begin(); it != dtags->end(); ++it) { 00071 if (m_isPidTight ) { 00072 if ( (*it)->type() != EvtRecDTag::Tight) continue; 00073 } 00074 if ( modeid >= 0 && (*it)->decayMode() != modeid ) { 00075 continue; 00076 } 00077 if ( charm != 0 && (*it)->charm() != charm ) { 00078 continue; 00079 } 00080 if ( fabs((*it)->deltaE()) < bestDE ) { 00081 bestDE = fabs((*it)->deltaE()); 00082 pbest = (*it); 00083 } 00084 } 00085 00086 return pbest; 00087 }
StatusCode BestDTagSvc::initialize | ( | ) | [virtual] |
Definition at line 21 of file BestDTagSvc.cxx.
References eventSvc_, Bes_Common::INFO, and vtxSvc_.
00022 { 00023 MsgStream log(messageService(), name()); 00024 log << MSG::INFO << "@initialize()" << endreq; 00025 00026 StatusCode sc = Service::initialize(); 00027 00028 sc = serviceLocator()->service("EventDataSvc", eventSvc_, true); 00029 sc = serviceLocator()->service("VertexDbSvc", vtxSvc_, true); 00030 00031 return sc; 00032 }
static const InterfaceID& IBestDTagSvc::interfaceID | ( | ) | [inline, static, inherited] |
Definition at line 16 of file IBestDTagSvc.h.
References IID_IBestDTagSvc().
Referenced by queryInterface().
00016 { return IID_IBestDTagSvc; }
bool BestDTagSvc::isCosmicOrLepton | ( | ) | [virtual] |
Implements IBestDTagSvc.
Definition at line 103 of file BestDTagSvc.cxx.
References eventSvc_, EventModel::EvtRec::EvtRecTrackCol, genRecEmupikp::i, isElectron(), isGoodTrack(), and isMuon().
00104 { 00105 SmartDataPtr<EvtRecEvent> evt(eventSvc_, "/Event/EvtRec/EvtRecEvent"); 00106 SmartDataPtr<EvtRecTrackCol> trks(eventSvc_, EventModel::EvtRec::EvtRecTrackCol); 00107 if ( !evt || !trks ) { 00108 return false; 00109 } 00110 00111 std::vector<EvtRecTrack*> gtrks; 00112 for (int i = 0; i < evt->totalCharged(); ++i) { 00113 EvtRecTrack* trk = *(trks->begin() + i); 00114 if ( isGoodTrack(trk) ) { 00115 gtrks.push_back(trk); 00116 } 00117 } 00118 if ( gtrks.size() != 2 ) return false; 00119 00120 double time[2] = { -100., -100.}; 00121 for ( int i = 0; i < 2; ++i ) { 00122 if ( gtrks[i]->isTofTrackValid() ){ 00123 SmartRefVector<RecTofTrack> tofTrks = gtrks[i]->tofTrack(); 00124 for ( SmartRefVector<RecTofTrack>::iterator it = tofTrks.begin(); it != tofTrks.end(); ++it ) { 00125 if ( ( (*it)->status() & 0x8 ) == 0x8 ) { 00126 time[i] = (*it)->tof(); 00127 break; 00128 } 00129 } 00130 } 00131 } 00132 if ( time[0] > -99. && time[1] > -99. && fabs(time[0]-time[1]) > 5 ) return true; 00133 00134 if ( isElectron(gtrks[0]) && isElectron(gtrks[1]) ) return true; 00135 if ( isMuon(gtrks[0]) && isMuon(gtrks[1]) ) return true; 00136 00137 return false; 00138 }
bool BestDTagSvc::isElectron | ( | EvtRecTrack * | atrk | ) | [private] |
Definition at line 173 of file BestDTagSvc.cxx.
References DstMdcDedx::chiE(), EvtRecTrack::emcShower(), DstEmcShower::energy(), EvtRecTrack::isEmcShowerValid(), EvtRecTrack::isMdcDedxValid(), EvtRecTrack::isMdcKalTrackValid(), EvtRecTrack::mdcDedx(), EvtRecTrack::mdcKalTrack(), and DstMdcKalTrack::p().
Referenced by isCosmicOrLepton().
00174 { 00175 if ( atrk->isMdcDedxValid() && atrk->isMdcKalTrackValid() && atrk->isEmcShowerValid() ) { 00176 double trkP = atrk->mdcKalTrack()->p(); 00177 double emcE = atrk->emcShower()->energy(); 00178 double dedxChi = atrk->mdcDedx()->chiE(); 00179 00180 if ( emcE/trkP > 0.8 && fabs(dedxChi) < 5 ) return true; 00181 } 00182 00183 return false; 00184 }
bool BestDTagSvc::isGoodTrack | ( | EvtRecTrack * | atrk | ) | [private] |
Definition at line 140 of file BestDTagSvc.cxx.
References VFHelix::a(), cos(), EvtRecTrack::isMdcKalTrackValid(), IVertexDbSvc::isVertexValid(), EvtRecTrack::mdcKalTrack(), DstMdcKalTrack::pion, VFHelix::pivot(), IVertexDbSvc::PrimaryVertex(), DstMdcKalTrack::setPidType(), IVertexDbSvc::SigmaPrimaryVertex(), vec, and vtxSvc_.
Referenced by isCosmicOrLepton().
00141 { 00142 Hep3Vector xorigin(0,0,0); 00143 if(vtxSvc_->isVertexValid()){ 00144 double* dbv = vtxSvc_->PrimaryVertex(); 00145 double* vv = vtxSvc_->SigmaPrimaryVertex(); 00146 xorigin.setX(dbv[0]); 00147 xorigin.setY(dbv[1]); 00148 xorigin.setZ(dbv[2]); 00149 } 00150 00151 if ( atrk->isMdcKalTrackValid() ) { 00152 RecMdcKalTrack *mdcKalTrk = atrk->mdcKalTrack(); 00153 mdcKalTrk->setPidType(RecMdcKalTrack::pion); 00154 HepVector a = mdcKalTrk->getZHelix(); 00155 HepSymMatrix Ea = mdcKalTrk->getZError(); 00156 HepPoint3D pivot(0., 0., 0.); 00157 HepPoint3D IP(xorigin[0], xorigin[1], xorigin[2]); 00158 VFHelix helixp(pivot, a, Ea); 00159 helixp.pivot(IP); 00160 HepVector vec = helixp.a(); 00161 double vrl = vec[0]; 00162 double vzl = vec[3]; 00163 double costheta = cos( mdcKalTrk->theta() ); 00164 00165 if ( fabs(vrl) < 1 && fabs(vzl) < 10 && fabs(costheta) < 0.93 ) { 00166 return true; 00167 } 00168 } 00169 00170 return false; 00171 }
bool BestDTagSvc::isMuon | ( | EvtRecTrack * | atrk | ) | [private] |
Definition at line 186 of file BestDTagSvc.cxx.
References DstMucTrack::depth(), EvtRecTrack::isMucTrackValid(), and EvtRecTrack::mucTrack().
Referenced by isCosmicOrLepton().
00187 { 00188 if ( atrk->isMucTrackValid() ) { 00189 if ( atrk->mucTrack()->depth() >= 5 ) { 00190 return true; 00191 } 00192 } 00193 00194 return false; 00195 }
StatusCode BestDTagSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvIF | |||
) | [virtual] |
Definition at line 44 of file BestDTagSvc.cxx.
References IBestDTagSvc::interfaceID().
00045 { 00046 if ( IBestDTagSvc::interfaceID().versionMatch(riid) ) { 00047 *ppvIF = dynamic_cast<IBestDTagSvc*>(this); 00048 } 00049 else { 00050 return Service::queryInterface(riid, ppvIF); 00051 } 00052 addRef(); 00053 return StatusCode::SUCCESS; 00054 }
friend class CnvFactory< BestDTagSvc > [friend] |
Definition at line 14 of file BestDTagSvc.h.
IDataProviderSvc* BestDTagSvc::eventSvc_ [private] |
Definition at line 40 of file BestDTagSvc.h.
Referenced by getSingleTag(), initialize(), and isCosmicOrLepton().
bool BestDTagSvc::m_isPidTight [private] |
IVertexDbSvc* BestDTagSvc::vtxSvc_ [private] |