BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ValidRecMucTrackAlg.cxx
Go to the documentation of this file.
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/SmartDataPtr.h"
4// #include "GaudiKernel/IHistogramSvc.h"
5
6#include "MucRecEvent/RecMucTrack.h"
7
9ValidRecMucTrackAlg::ValidRecMucTrackAlg( const std::string& name, ISvcLocator* pSvcLocator )
10 : Algorithm( name, pSvcLocator ) {
11
12 m_tuple1 = 0;
13}
14
16
17 StatusCode status;
18 MsgStream log( msgSvc(), name() );
19 log << MSG::INFO << "Booking Histograms" << endmsg;
20
21 // Book N-tuple 1
22 NTuplePtr nt1( ntupleSvc(), "FILE105/T" );
23 if ( nt1 ) m_tuple1 = nt1;
24 else
25 {
26 m_tuple1 = ntupleSvc()->book( "FILE105/T", CLID_RowWiseTuple, "MucTrack parameter" );
27 if ( m_tuple1 )
28 {
29 status = m_tuple1->addItem( "depth", m_depth );
30 status = m_tuple1->addItem( "distance", m_distance );
31 status = m_tuple1->addItem( "deltaPhi", m_deltaPhi );
32 status = m_tuple1->addItem( "maxHits", m_maxHits );
33 status = m_tuple1->addItem( "numLayers", m_numLayers );
34 status = m_tuple1->addItem( "numHits", m_numHits );
35 status = m_tuple1->addItem( "chi2", m_chi2 );
36 status = m_tuple1->addItem( "xPos", m_xPos );
37 status = m_tuple1->addItem( "yPos", m_yPos );
38 status = m_tuple1->addItem( "zPos", m_zPos );
39 }
40 else
41 { // did not manage to book the N tuple....
42 log << MSG::ERROR << " Cannot book N-tuple:" << long( m_tuple1 ) << endmsg;
43 // return StatusCode::FAILURE;
44 }
45 }
46 log << MSG::INFO << "Finished booking NTuples" << endmsg;
47
48 return StatusCode::SUCCESS;
49}
50
52 MsgStream log( msgSvc(), name() );
53 SmartDataPtr<RecMucTrackCol> mucTracks( eventSvc(), "/Event/Recon/RecMucTrackCol" );
54 if ( !mucTracks )
55 {
56 log << MSG::ERROR << "Unable to retrieve RecMucTrackCol" << endmsg;
57 return StatusCode::FAILURE;
58 }
59 else
60 {
61 log << MSG::DEBUG << "RecMucTrackCol retrieved of size " << mucTracks->size() << endmsg;
62 for ( RecMucTrackCol::iterator it = mucTracks->begin(); it != mucTracks->end(); it++ )
63 {
64
65 m_depth = ( *it )->depth();
66 m_distance = ( *it )->distance();
67 m_deltaPhi = ( *it )->deltaPhi();
68 m_maxHits = ( *it )->maxHitsInLayer();
69 m_numLayers = ( *it )->numLayers();
70 m_numHits = ( *it )->numHits();
71 m_chi2 = ( *it )->chi2();
72 m_xPos = ( *it )->xPos();
73 m_yPos = ( *it )->yPos();
74 m_zPos = ( *it )->zPos();
75
76 StatusCode status1 = m_tuple1->write();
77 if ( status1.isFailure() ) { log << MSG::ERROR << "Cannot fill Ntuple1" << endmsg; }
78 }
79 }
80 return StatusCode::SUCCESS;
81}
82
84
85 MsgStream log( msgSvc(), name() );
86 log << MSG::INFO << "Finalizing..." << endmsg;
87 return StatusCode::SUCCESS;
88}
DECLARE_COMPONENT(BesBdkRc)
INTupleSvc * ntupleSvc()
IMessageSvc * msgSvc()
ValidRecMucTrackAlg(const std::string &name, ISvcLocator *pSvcLocator)