BOSS 7.1.1
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 45 of file DTagSkim.cxx.

45 :
46 Algorithm(name, pSvcLocator) {
47 //Declare the properties
48 declareProperty("TightSkim", m_tightskim=false);
49 declareProperty("WriteDst", m_ifwritedst=true);
50 declareProperty("WriteRec", m_ifwriterec=false);
51}

Member Function Documentation

◆ execute()

StatusCode DTagSkim::execute ( )

Definition at line 89 of file DTagSkim.cxx.

89 {
90 MsgStream log(msgSvc(), name());
91 log << MSG::INFO << "in execute()" << endreq;
92
93
94 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
95 if(!eventHeader)
96 {
97 cout<<" eventHeader "<<endl;
98 return StatusCode::FAILURE;
99 }
100
101 int run=eventHeader->runNumber();
102 int event=eventHeader->eventNumber();
103
104
105 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
106 if(!evtRecEvent ) {
107 cout<<" evtRecEvent "<<endl;
108 return StatusCode::FAILURE;
109 }
110
111
112 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
113 << evtRecEvent->totalCharged() << " , "
114 << evtRecEvent->totalNeutral() << " , "
115 << evtRecEvent->totalTracks() <<endreq;
116 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
117 if(!evtRecTrkCol){
118 cout<<" evtRecTrkCol "<<endl;
119 return StatusCode::FAILURE;
120 }
121
122 if(evtRecEvent->totalTracks()!=evtRecTrkCol->size()) return StatusCode::SUCCESS;
123
124
125 SmartDataPtr<EvtRecDTagCol> evtRecDTagCol(eventSvc(), EventModel::EvtRec::EvtRecDTagCol);
126 if ( ! evtRecDTagCol ) {
127 log << MSG::FATAL << "Could not find EvtRecDTagCol" << endreq;
128 return StatusCode::FAILURE;
129 }
130
131
132
133
134 if(evtRecDTagCol->size()==0){
135 //cout<<"no D candidates found in this event"<<endl;
136 return StatusCode::SUCCESS;
137 }
138
139 if(m_tightskim){
140
141 vector<EvtRecDTagCol::size_type> tagid;
142 tagid.clear();
143 EvtRecDTagCol::iterator iter_begin=evtRecDTagCol->begin();
144 for( EvtRecDTagCol::iterator iter=iter_begin; iter<evtRecDTagCol->end(); ++iter){
145 if( (*iter)->type()!=1){
146 tagid.push_back(iter-iter_begin);
147 }
148 }
149
150 for(EvtRecDTagCol::size_type i=0; i<tagid.size(); ++i){
151 evtRecDTagCol->erase(iter_begin+tagid[i]-i);
152 }
153
154 if(evtRecDTagCol->size()==0){
155 return StatusCode::SUCCESS;
156 }
157
158 }
159
160
161
162
163
164
165 // -------- Write to root file
166 if(m_ifwritedst) m_subalg1->execute();
167 if(m_ifwriterec) m_subalg2->execute();
168
169
170 return StatusCode::SUCCESS;
171
172}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
IMessageSvc * msgSvc()
_EXTERN_ std::string EvtRecEvent
Definition EventModel.h:116
_EXTERN_ std::string EvtRecDTagCol
Definition EventModel.h:122
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:117

◆ finalize()

StatusCode DTagSkim::finalize ( )

Definition at line 175 of file DTagSkim.cxx.

175 {
176
177 MsgStream log(msgSvc(), name());
178 log << MSG::INFO << "in finalize()" << endmsg;
179
180
181 return StatusCode::SUCCESS;
182}

◆ initialize()

StatusCode DTagSkim::initialize ( )

Definition at line 54 of file DTagSkim.cxx.

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

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