BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ValidRecMdcDedxAlg.cxx
Go to the documentation of this file.
2#include "GaudiKernel/IHistogramSvc.h"
3#include "GaudiKernel/INTupleSvc.h"
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/SmartDataPtr.h"
6
7#include "Identifier/MdcID.h"
8#include "MdcRecEvent/RecMdcDedx.h"
9
11ValidRecMdcDedxAlg::ValidRecMdcDedxAlg( const std::string& name, ISvcLocator* pSvcLocator )
12 : Algorithm( name, pSvcLocator ) {
13
14 m_tuple1 = 0;
15}
16
18 StatusCode status;
19 MsgStream log( msgSvc(), name() );
20
21 // Book N-tuple 1
22 NTuplePtr nt1( ntupleSvc(), "DedxTuples/Mdc_dedx" );
23 if ( nt1 ) m_tuple1 = nt1;
24 else
25 {
26 m_tuple1 = ntupleSvc()->book( "DedxTuples/Mdc_dedx", CLID_RowWiseTuple, "Dedx parameter" );
27 if ( m_tuple1 )
28 {
29 status = m_tuple1->addItem( "dedx", m_dedx );
30 status = m_tuple1->addItem( "parttype", m_parttype );
31 status = m_tuple1->addItem( "chidedx", m_chidedx );
32 status = m_tuple1->addItem( "chidedxE", m_chidedxE );
33 status = m_tuple1->addItem( "chidedxMu", m_chidedxMu );
34 status = m_tuple1->addItem( "chidedxPi", m_chidedxPi );
35 status = m_tuple1->addItem( "chidedxK", m_chidedxK );
36 status = m_tuple1->addItem( "chidedxP", m_chidedxP );
37 }
38 else
39 { // did not manage to book the N tuple....
40 log << MSG::ERROR << " Cannot book N-tuple:" << long( m_tuple1 ) << endmsg;
41 return StatusCode::FAILURE;
42 }
43 }
44 log << MSG::INFO << "Finished booking NTuples" << endmsg;
45 return StatusCode::SUCCESS;
46}
47
49 MsgStream log( msgSvc(), name() );
50 SmartDataPtr<RecMdcDedxCol> mdcDedx( eventSvc(), "/Event/Recon/RecMdcDedxCol" );
51 if ( !mdcDedx )
52 {
53 log << MSG::ERROR << "Unable to retrieve RecMdcDedxCol" << endmsg;
54 return StatusCode::FAILURE;
55 }
56 else
57 {
58 log << MSG::DEBUG << "RecMdcDedxCol retrieved of size " << mdcDedx->size() << endmsg;
59 int i = 0;
60 for ( RecMdcDedxCol::iterator it = mdcDedx->begin(); it != mdcDedx->end(); it++, i++ )
61 {
62 m_dedx = ( *it )->probPH();
63 m_parttype = ( *it )->particleId();
64 // cout<<"m_parttype is = "<<m_parttype<<endl;
65 if ( m_parttype > 5 || m_parttype < 0 ) continue;
66 m_chidedx = ( *it )->chi( m_parttype - 1 );
67 m_chidedxE = ( *it )->chiE();
68 m_chidedxMu = ( *it )->chiMu();
69 m_chidedxPi = ( *it )->chiPi();
70 m_chidedxK = ( *it )->chiK();
71 m_chidedxP = ( *it )->chiP();
72
73 log << MSG::INFO << "particle chi=" << m_chidedx << endmsg;
74 log << MSG::INFO << "m_dedx=" << m_dedx << endmsg;
75 log << MSG::INFO << " m_parttype=" << m_parttype << endmsg;
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()
ValidRecMdcDedxAlg(const std::string &name, ISvcLocator *pSvcLocator)