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