BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
DTagSkim Class Reference

#include <DTagSkim.h>

+ Inheritance diagram for DTagSkim:

Public Member Functions

 DTagSkim (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 17 of file DTagSkim.h.

Constructor & Destructor Documentation

◆ DTagSkim()

DTagSkim::DTagSkim ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 43 of file DTagSkim.cxx.

43 :
44 Algorithm(name, pSvcLocator) {
45 //Declare the properties
46 declareProperty("WriteDst", m_ifwritedst=true);
47 declareProperty("WriteRec", m_ifwriterec=false);
48}

Member Function Documentation

◆ execute()

StatusCode DTagSkim::execute ( )

Definition at line 86 of file DTagSkim.cxx.

86 {
87 MsgStream log(msgSvc(), name());
88 log << MSG::INFO << "in execute()" << endreq;
89
90
91 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
92 if(!eventHeader)
93 {
94 cout<<" eventHeader "<<endl;
95 return StatusCode::FAILURE;
96 }
97
98 int run=eventHeader->runNumber();
99 int event=eventHeader->eventNumber();
100
101
102 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
103 if(!evtRecEvent ) {
104 cout<<" evtRecEvent "<<endl;
105 return StatusCode::FAILURE;
106 }
107
108
109 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
110 << evtRecEvent->totalCharged() << " , "
111 << evtRecEvent->totalNeutral() << " , "
112 << evtRecEvent->totalTracks() <<endreq;
113 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
114 if(!evtRecTrkCol){
115 cout<<" evtRecTrkCol "<<endl;
116 return StatusCode::FAILURE;
117 }
118
119 if(evtRecEvent->totalTracks()!=evtRecTrkCol->size()) return StatusCode::SUCCESS;
120
121
122 SmartDataPtr<EvtRecDTagCol> evtRecDTagCol(eventSvc(), EventModel::EvtRec::EvtRecDTagCol);
123 if ( ! evtRecDTagCol ) {
124 log << MSG::FATAL << "Could not find EvtRecDTagCol" << endreq;
125 return StatusCode::FAILURE;
126 }
127
128
129 if(evtRecDTagCol->size()==0){
130 //cout<<"no D candidates found in this event"<<endl;
131 return StatusCode::SUCCESS;
132 }
133 //else{
134 //cout<<"there are D candidates found in this event"<<endl;
135 //}
136
137 // -------- Write to root file
138 if(m_ifwritedst) m_subalg1->execute();
139 if(m_ifwriterec) m_subalg2->execute();
140
141
142 return StatusCode::SUCCESS;
143
144}
IMessageSvc * msgSvc()
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:111
_EXTERN_ std::string EvtRecDTagCol
Definition: EventModel.h:117
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:112

◆ finalize()

StatusCode DTagSkim::finalize ( )

Definition at line 147 of file DTagSkim.cxx.

147 {
148
149 MsgStream log(msgSvc(), name());
150 log << MSG::INFO << "in finalize()" << endmsg;
151
152
153 return StatusCode::SUCCESS;
154}

◆ initialize()

StatusCode DTagSkim::initialize ( )

Definition at line 51 of file DTagSkim.cxx.

51 {
52 MsgStream log(msgSvc(), name());
53
54 log << MSG::INFO << "in initialize()" << endmsg;
55 StatusCode sc;
56
57 log << MSG::INFO << "creating sub-algorithms...." << endreq;
58
59
60 sc = createSubAlgorithm( "EventWriter", "WriteDst", m_subalg1);
61 if( sc.isFailure() ) {
62 log << MSG::ERROR << "Error creating Sub-Algorithm WriteDst" <<endreq;
63 return sc;
64 } else {
65 log << MSG::INFO << "Success creating Sub-Algorithm WriteDst" <<endreq;
66 }
67
68
69
70 sc = createSubAlgorithm( "EventWriter", "WriteRec", m_subalg2);
71 if( sc.isFailure() ) {
72 log << MSG::ERROR << "Error creating Sub-Algorithm WriteRec" <<endreq;
73 return sc;
74 } else {
75 log << MSG::INFO << "Success creating Sub-Algorithm WriteRec" <<endreq;
76 }
77
78
79
80 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
81 return StatusCode::SUCCESS;
82
83}

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