BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
BestDTagSvc Class Reference

#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)
 
EvtRecDTaggetSingleTag (int modeid, int charm=0)
 
EvtRecDTag ** getDoubleTag (int modeid1, int modeid2, int charm=0)
 
bool isCosmicOrLepton ()
 
- Public Member Functions inherited from IBestDTagSvc
virtual ~IBestDTagSvc ()
 
virtual EvtRecDTaggetSingleTag (int modeid=-1, int charm=0)=0
 
virtual EvtRecDTag ** getDoubleTag (int modeid1, int modeid2, int charm=0)=0
 
virtual bool isCosmicOrLepton ()=0
 

Friends

class CnvFactory< BestDTagSvc >
 

Additional Inherited Members

- Static Public Member Functions inherited from IBestDTagSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 12 of file BestDTagSvc.h.

Constructor & Destructor Documentation

◆ BestDTagSvc()

BestDTagSvc::BestDTagSvc ( const std::string &  name,
ISvcLocator *  svcLoc 
)

Definition at line 10 of file BestDTagSvc.cxx.

11 : Service(name, svcLoc)
12{
13 //declareProperty("", m_);
14 declareProperty("pidTight", m_isPidTight = true);
15}

◆ ~BestDTagSvc()

BestDTagSvc::~BestDTagSvc ( )
virtual

Definition at line 17 of file BestDTagSvc.cxx.

18{
19}

Member Function Documentation

◆ finalize()

StatusCode BestDTagSvc::finalize ( )
virtual

Definition at line 34 of file BestDTagSvc.cxx.

35{
36 MsgStream log(messageService(), name());
37 log << MSG::INFO << "@initialize()" << endreq;
38
39 StatusCode sc = Service::finalize();
40
41 return sc;
42}

◆ getDoubleTag()

EvtRecDTag ** BestDTagSvc::getDoubleTag ( int  modeid1,
int  modeid2,
int  charm = 0 
)
virtual

Implements IBestDTagSvc.

Definition at line 89 of file BestDTagSvc.cxx.

90{
91 static EvtRecDTag** tagpp = new EvtRecDTag*[2];
92
93 //not implemented yet, just a placeholder for the future
94
95
96 if ( false ) {
97 return tagpp;
98 }
99
100 return NULL;
101}

◆ getSingleTag()

EvtRecDTag * BestDTagSvc::getSingleTag ( int  modeid,
int  charm = 0 
)
virtual

Implements IBestDTagSvc.

Definition at line 56 of file BestDTagSvc.cxx.

57{
58 MsgStream log(messageService(), name());
59
60 SmartDataPtr<EvtRecDTagCol> dtags(eventSvc_, EventModel::EvtRec::EvtRecDTagCol);
61 if ( !dtags ) {
62 log << MSG::ERROR << "Can't retrieve the EvtRecDTagCol!" << endreq;
63 return NULL;
64 }
65
66 EvtRecDTag* pbest = NULL;
67
68 double bestDE = 999.;
69
70 for (EvtRecDTagCol::iterator it = dtags->begin(); it != dtags->end(); ++it) {
71 if (m_isPidTight ) {
72 if ( (*it)->type() != EvtRecDTag::Tight) continue;
73 }
74 if ( modeid >= 0 && (*it)->decayMode() != modeid ) {
75 continue;
76 }
77 if ( charm != 0 && (*it)->charm() != charm ) {
78 continue;
79 }
80 if ( fabs((*it)->deltaE()) < bestDE ) {
81 bestDE = fabs((*it)->deltaE());
82 pbest = (*it);
83 }
84 }
85
86 return pbest;
87}
_EXTERN_ std::string EvtRecDTagCol
Definition: EventModel.h:122

◆ initialize()

StatusCode BestDTagSvc::initialize ( )
virtual

Definition at line 21 of file BestDTagSvc.cxx.

22{
23 MsgStream log(messageService(), name());
24 log << MSG::INFO << "@initialize()" << endreq;
25
26 StatusCode sc = Service::initialize();
27
28 sc = serviceLocator()->service("EventDataSvc", eventSvc_, true);
29 sc = serviceLocator()->service("VertexDbSvc", vtxSvc_, true);
30
31 return sc;
32}

◆ isCosmicOrLepton()

bool BestDTagSvc::isCosmicOrLepton ( )
virtual

Implements IBestDTagSvc.

Definition at line 103 of file BestDTagSvc.cxx.

104{
105 SmartDataPtr<EvtRecEvent> evt(eventSvc_, "/Event/EvtRec/EvtRecEvent");
106 SmartDataPtr<EvtRecTrackCol> trks(eventSvc_, EventModel::EvtRec::EvtRecTrackCol);
107 if ( !evt || !trks ) {
108 return false;
109 }
110
111 std::vector<EvtRecTrack*> gtrks;
112 for (int i = 0; i < evt->totalCharged(); ++i) {
113 EvtRecTrack* trk = *(trks->begin() + i);
114 if ( isGoodTrack(trk) ) {
115 gtrks.push_back(trk);
116 }
117 }
118 if ( gtrks.size() != 2 ) return false;
119
120 double time[2] = { -100., -100.};
121 for ( int i = 0; i < 2; ++i ) {
122 if ( gtrks[i]->isTofTrackValid() ){
123 SmartRefVector<RecTofTrack> tofTrks = gtrks[i]->tofTrack();
124 for ( SmartRefVector<RecTofTrack>::iterator it = tofTrks.begin(); it != tofTrks.end(); ++it ) {
125 if ( ( (*it)->status() & 0x8 ) == 0x8 ) {
126 time[i] = (*it)->tof();
127 break;
128 }
129 }
130 }
131 }
132 if ( time[0] > -99. && time[1] > -99. && fabs(time[0]-time[1]) > 5 ) return true;
133
134 if ( isElectron(gtrks[0]) && isElectron(gtrks[1]) ) return true;
135 if ( isMuon(gtrks[0]) && isMuon(gtrks[1]) ) return true;
136
137 return false;
138}
SmartRefVector< RecTofTrack > tofTrack()
Definition: EvtRecTrack.h:57
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:117

◆ queryInterface()

StatusCode BestDTagSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvIF 
)
virtual

Definition at line 44 of file BestDTagSvc.cxx.

45{
46 if ( IBestDTagSvc::interfaceID().versionMatch(riid) ) {
47 *ppvIF = dynamic_cast<IBestDTagSvc*>(this);
48 }
49 else {
50 return Service::queryInterface(riid, ppvIF);
51 }
52 addRef();
53 return StatusCode::SUCCESS;
54}
static const InterfaceID & interfaceID()
Definition: IBestDTagSvc.h:16

Friends And Related Function Documentation

◆ CnvFactory< BestDTagSvc >

friend class CnvFactory< BestDTagSvc >
friend

Definition at line 1 of file BestDTagSvc.h.


The documentation for this class was generated from the following files: