BOSS 7.1.0
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 ()
 
EvtRecDTaggetSingleTag (int modeid, int charm=0)
 
EvtRecDTag ** getDoubleTag (int modeid1, int modeid2, int charm=0)
 
bool isCosmicOrLepton ()
 

Friends

class CnvFactory< BestDTagSvc >
 

Detailed Description

Definition at line 13 of file BestDTagSvc.h.

Constructor & Destructor Documentation

◆ BestDTagSvc()

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

Definition at line 11 of file BestDTagSvc.cxx.

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

◆ ~BestDTagSvc()

BestDTagSvc::~BestDTagSvc ( )
virtual

Definition at line 18 of file BestDTagSvc.cxx.

19{
20}

Member Function Documentation

◆ finalize()

StatusCode BestDTagSvc::finalize ( )
virtual

Definition at line 35 of file BestDTagSvc.cxx.

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

◆ getDoubleTag()

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

Definition at line 90 of file BestDTagSvc.cxx.

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

◆ getSingleTag()

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

Definition at line 57 of file BestDTagSvc.cxx.

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

◆ initialize()

StatusCode BestDTagSvc::initialize ( )
virtual

Definition at line 22 of file BestDTagSvc.cxx.

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

◆ isCosmicOrLepton()

bool BestDTagSvc::isCosmicOrLepton ( )

Definition at line 104 of file BestDTagSvc.cxx.

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

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: