BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
DQACtrlSamples.cxx
Go to the documentation of this file.
1#include <vector>
2
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/SmartDataPtr.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/PropertyMgr.h"
9
10#include "DQAEvent/DQAEvent.h"
12
14
15/////////////////////////////////////////////////////////////////////////////
16
17DQACtrlSamples::DQACtrlSamples(const std::string& name, ISvcLocator* pSvcLocator) :
18 Algorithm(name, pSvcLocator) {
19
20 //Declare the properties
21 declareProperty("SelectBhabha", m_selBhabha = true);
22 declareProperty("SelectDimu", m_selDimu = true);
23 declareProperty("SelectHadron", m_selHadron = false);
24 declareProperty("SelectRhopi", m_selRhopi = false);
25 declareProperty("SelectPpbar", m_selPpbar = false);
26 declareProperty("SelectKstark", m_selKstark = false);
27 declareProperty("SelectLambdalambda", m_selLambdalambda = false);
28 declareProperty("SelectPPpipi", m_selPPpipi = false);
29 declareProperty("SelectKsKpiDedx", m_selKsKpiDedx = false);
30
31 declareProperty("SelectpipiJpsi", m_selpipiJpsi = false);
32
33 declareProperty("OutputBhabha", m_OutBhabha = false);
34 declareProperty("OutputDimu", m_OutDimu = false);
35 declareProperty("OutputHadron", m_OutHadron = false);
36 declareProperty("OutputRhopi", m_OutRhopi = false);
37 declareProperty("OutputPpbar", m_OutPpbar = false);
38 declareProperty("OutputKstark", m_OutKstark = false);
39 declareProperty("OutputLambdalambda", m_OutLambdalambda = false);
40 declareProperty("OutputPPpipi", m_OutPPpipi = false);
41 declareProperty("OutputKsKpiDedx", m_OutKsKpiDedx = false);
42
43 declareProperty("OutputpipiJpsi", m_OutpipiJpsi = false);
44
45}
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
49 MsgStream log(msgSvc(), name());
50
51 log << MSG::INFO << "in initialize()" << endmsg;
52 StatusCode sc;
53
54 if ( m_selBhabha ) {
55 sc = createSubAlgorithm( "DQASelBhabha", "DQASelBhabha", m_dqaBhabha);
56 if (sc.isFailure()) {
57 log << MSG::ERROR << "Error creating Sub-Algorithm DQASelBhabha" << endreq;
58 return StatusCode::FAILURE;
59 }
60 if ( m_OutBhabha ) {
61 sc = createSubAlgorithm( "EventWriter", "DQAOutBhabha", m_dqaoutBhabha);
62 if (sc.isFailure()) {
63 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutBhabha" << endreq;
64 return StatusCode::FAILURE;
65 }
66 }
67 }
68
69 if ( m_selDimu ) {
70 sc = createSubAlgorithm( "DQASelDimu", "DQASelDimu", m_dqaDimu);
71 if (sc.isFailure()) {
72 log << MSG::ERROR << "Error creating Sub-Algorithm DQASelDimu" << endreq;
73 return StatusCode::FAILURE;
74 }
75 if ( m_OutDimu ) {
76 sc = createSubAlgorithm( "EventWriter", "DQAOutDimu", m_dqaoutDimu);
77 if (sc.isFailure()) {
78 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutDimu" << endreq;
79 return StatusCode::FAILURE;
80 }
81 }
82 }
83
84 if ( m_selHadron ) {
85 sc = createSubAlgorithm( "DQASelHadron", "DQASelHadron", m_dqaHadron);
86 if (sc.isFailure()) {
87 log << MSG::ERROR << "Error creating Sub-Algorithm DQASelHadron" << endreq;
88 return StatusCode::FAILURE;
89 }
90 if ( m_OutHadron ) {
91 sc = createSubAlgorithm( "EventWriter", "DQAOutHadron", m_dqaoutHadron);
92 if (sc.isFailure()) {
93 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutHadron" << endreq;
94 return StatusCode::FAILURE;
95 }
96 }
97 }
98
99 if ( m_selRhopi ) {
100 sc = createSubAlgorithm( "DQARhopi", "DQARhopi", m_dqaRhopi);
101 if (sc.isFailure()) {
102 log << MSG::ERROR << "Error creating Sub-Algorithm DQARhopiAlg" << endreq;
103 return StatusCode::FAILURE;
104 }
105 if ( m_OutRhopi ) {
106 sc = createSubAlgorithm( "EventWriter", "DQAOutRhopi", m_dqaoutRhopi);
107 if (sc.isFailure()) {
108 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutRhopi" << endreq;
109 return StatusCode::FAILURE;
110 }
111 }
112 }
113
114 if ( m_selPpbar ) {
115 sc = createSubAlgorithm( "DQAJpsi2PPbarAlg", "DQAJpsi2PPbarAlg", m_dqaPpbar);
116 if (sc.isFailure()) {
117 log << MSG::ERROR << "Error creating Sub-Algorithm Jpsi2PPbarAlg" << endreq;
118 return StatusCode::FAILURE;
119 }
120 if ( m_OutPpbar ) {
121 sc = createSubAlgorithm( "EventWriter", "DQAOutPpbar", m_dqaoutPpbar);
122 if (sc.isFailure()) {
123 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutPpbar" << endreq;
124 return StatusCode::FAILURE;
125 }
126 }
127 }
128
129 if ( m_selKstark ) {
130 sc = createSubAlgorithm( "DQAKsKpi", "DQAKsKpi", m_dqaKstark);
131 if (sc.isFailure()) {
132 log << MSG::ERROR << "Error creating Sub-Algorithm DQAKsKpi" << endreq;
133 return StatusCode::FAILURE;
134 }
135 if ( m_OutKstark ) {
136 sc = createSubAlgorithm( "EventWriter", "DQAOutKstark", m_dqaoutKstark);
137 if (sc.isFailure()) {
138 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutKstark" << endreq;
139 return StatusCode::FAILURE;
140 }
141 }
142 }
143
144 if ( m_selLambdalambda ) {
145 sc = createSubAlgorithm( "JsiLL", "JsiLL", m_dqaLambdalambda);
146 if (sc.isFailure()) {
147 log << MSG::ERROR << "Error creating Sub-Algorithm JsiLL" << endreq;
148 return StatusCode::FAILURE;
149 }
150 if ( m_OutLambdalambda ) {
151 sc = createSubAlgorithm( "EventWriter", "DQAOutLambdalambda", m_dqaoutLambdalambda);
152 if (sc.isFailure()) {
153 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutLambdalambda" << endreq;
154 return StatusCode::FAILURE;
155 }
156 }
157 }
158
159 if ( m_selPPpipi ) {
160 sc = createSubAlgorithm( "DQAPi2p2", "DQAPi2p2", m_dqaPPpipi);
161 if (sc.isFailure()) {
162 log << MSG::ERROR << "Error creating Sub-Algorithm DQAPi2p2" << endreq;
163 return StatusCode::FAILURE;
164 }
165 if ( m_OutPPpipi ) {
166 sc = createSubAlgorithm( "EventWriter", "DQAOutPPpipi", m_dqaoutPPpipi);
167 if (sc.isFailure()) {
168 log << MSG::ERROR << "Error creating Sub-Algorithm DQAPi2p2" << endreq;
169 return StatusCode::FAILURE;
170 }
171 }
172 }
173
174 if ( m_selKsKpiDedx ) {
175 sc = createSubAlgorithm( "DQAKsKpiDEDX", "DQAKsKpiDEDX", m_dqaKsKpiDedx);
176 if (sc.isFailure()) {
177 log << MSG::ERROR << "Error creating Sub-Algorithm DQAKsKpiDedx" << endreq;
178 return StatusCode::FAILURE;
179 }
180 if ( m_OutKsKpiDedx ) {
181 sc = createSubAlgorithm( "EventWriter", "DQAOutKsKpiDedx", m_dqaoutKsKpiDedx);
182 if (sc.isFailure()) {
183 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutKsKpiDedx" << endreq;
184 return StatusCode::FAILURE;
185 }
186 }
187 }
188
189 if ( m_selpipiJpsi ) {
190 sc = createSubAlgorithm( "PipiJpsi", "PipiJpsi", m_dqapipiJpsi);
191 if (sc.isFailure()) {
192 log << MSG::ERROR << "Error creating Sub-Algorithm DQApipiJpsi" << endreq;
193 return StatusCode::FAILURE;
194 }
195 if ( m_OutpipiJpsi ) {
196 sc = createSubAlgorithm( "EventWriter", "DQAOutpipiJpsi", m_dqaoutpipiJpsi);
197 if (sc.isFailure()) {
198 log << MSG::ERROR << "Error creating Sub-Algorithm DQAOutpipiJpsi" << endreq;
199 return StatusCode::FAILURE;
200 }
201 }
202 }
203
204 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
205 return StatusCode::SUCCESS;
206
207
208}
209
210// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
212
213 MsgStream log(msgSvc(), name());
214 log << MSG::INFO << "in execute()" << endreq;
215
216 SmartDataPtr<DQAEvent::DQAEvent> dqaevt(eventSvc(), "/Event/DQATag");
217 if( !dqaevt ) {
218 dqaevt = new DQAEvent::DQAEvent;
219 StatusCode sc;
220 sc = eventSvc()->registerObject("/Event/DQATag", dqaevt);
221 if (sc.isFailure()) {
222 log << MSG::ERROR << "Could not register DQAEvent to TDS" << endreq;
223 return StatusCode::FAILURE;
224 return sc;
225 }
226 }
227
228 if ( m_selBhabha ) {
229 m_dqaBhabha->execute();
230 if ( m_dqaBhabha->filterPassed() ) {
231 dqaevt->setBhabha(1);
232 if ( m_OutBhabha ) m_dqaoutBhabha->execute();
233 }
234 }
235
236 if ( m_selDimu ) {
237 m_dqaDimu->execute();
238 if ( m_dqaDimu->filterPassed() ) {
239 dqaevt->setDimu(1);
240 if ( m_OutDimu ) m_dqaoutDimu->execute();
241 }
242 }
243
244 if ( m_selHadron ) {
245 m_dqaHadron->execute();
246 if ( m_dqaHadron->filterPassed() ) {
247 dqaevt->setHadron(1);
248 if ( m_OutHadron ) m_dqaoutHadron->execute();
249 }
250 }
251
252 if ( m_selRhopi ) {
253 m_dqaRhopi->execute();
254 if ( m_dqaRhopi->filterPassed() ) {
255 dqaevt->setRhopi(1);
256 if ( m_OutRhopi ) m_dqaoutRhopi->execute();
257 }
258 }
259
260 if ( m_selPpbar ) {
261 m_dqaPpbar->execute();
262 if ( m_dqaPpbar->filterPassed() ) {
263 dqaevt->setPpbar(1);
264 if ( m_OutPpbar ) m_dqaoutPpbar->execute();
265 }
266 }
267
268 if ( m_selKstark ) {
269 m_dqaKstark->execute();
270 if ( m_dqaKstark->filterPassed() ) {
271 dqaevt->setKstark(1);
272 if ( m_OutKstark ) m_dqaoutKstark->execute();
273 }
274 }
275
276 if ( m_selLambdalambda ) {
277 m_dqaLambdalambda->execute();
278 if ( m_dqaLambdalambda->filterPassed() ) {
279 dqaevt->setLambdalambdabar(1);
280 if ( m_OutLambdalambda ) m_dqaoutLambdalambda->execute();
281 }
282 }
283
284 if ( m_selPPpipi ) {
285 m_dqaPPpipi->execute();
286 if ( m_dqaPPpipi->filterPassed() ) {
287 dqaevt->setPpbarpipi(1);
288 if ( m_OutPPpipi ) m_dqaoutPPpipi->execute();
289 }
290 }
291
292 if ( m_selKsKpiDedx ) {
293 m_dqaKsKpiDedx->execute();
294 if ( m_dqaKsKpiDedx->filterPassed() ) {
295 dqaevt->setKstark(1);
296 if ( m_OutKsKpiDedx ) m_dqaoutKsKpiDedx->execute();
297 }
298 }
299
300 if ( m_selpipiJpsi ) {
301 m_dqapipiJpsi->execute();
302 if ( m_dqapipiJpsi->filterPassed() ) {
303 dqaevt->setHadron(1);
304 if ( m_OutpipiJpsi ) m_dqaoutpipiJpsi->execute();
305 }
306 }
307
308 return StatusCode::SUCCESS;
309
310}
311
312// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
314
315 MsgStream log(msgSvc(), name());
316 log << MSG::INFO << "in finalize()" << endmsg;
317 return StatusCode::SUCCESS;
318}
319
320
IMessageSvc * msgSvc()
DECLARE_ALGORITHM_FACTORY(ReadRawData)
StatusCode initialize()
StatusCode finalize()
StatusCode execute()