BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcNavigation Class Reference

#include <MdcNavigation.h>

Inheritance diagram for MdcNavigation:

Public Member Functions

 MdcNavigation (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
StatusCode beginRun ()

Detailed Description

Definition at line 23 of file MdcNavigation.h.

Constructor & Destructor Documentation

◆ MdcNavigation()

MdcNavigation::MdcNavigation ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 41 of file MdcNavigation.cxx.

42 : Algorithm( name, pSvcLocator ) {
43 declareProperty( "hist", m_hist = 0 );
44 declareProperty( "nMcHit", m_nMcHit = 5 );
45 declareProperty( "mc", m_mc = 1 );
46
47 declareProperty( "maxMdcDigi", m_maxMdcDigi = 0 );
48 declareProperty( "keepBadTdc", m_keepBadTdc = 0 );
49 declareProperty( "dropHot", m_dropHot = 0 );
50 declareProperty( "keepUnmatch", m_keepUnmatch = 0 );
51
52 declareProperty( "poca", m_poca = false );
53 declareProperty( "doSag", m_doSag = false );
54
55 declareProperty( "d0Cut", m_d0Cut = 1. );
56 declareProperty( "z0Cut", m_z0Cut = 10. );
57 declareProperty( "debug", m_debug = 0 );
58}

Referenced by MdcNavigation().

Member Function Documentation

◆ beginRun()

StatusCode MdcNavigation::beginRun ( )

Definition at line 111 of file MdcNavigation.cxx.

111 {
112 MsgStream log( msgSvc(), name() );
113 log << MSG::INFO << "in beginRun()" << endmsg;
114
115 m_gm = MdcDetector::instance( m_doSag );
116 if ( NULL == m_gm ) return StatusCode::FAILURE;
117
118 return StatusCode::SUCCESS;
119}
IMessageSvc * msgSvc()
static MdcDetector * instance()

◆ execute()

StatusCode MdcNavigation::execute ( )

Definition at line 122 of file MdcNavigation.cxx.

122 {
123 setFilterPassed( false );
124 MsgStream log( msgSvc(), name() );
125 StatusCode sc = StatusCode::SUCCESS;
126
127 // Get EventNavigator from the TDS
128 SmartDataPtr<EventNavigator> navigator( eventSvc(), "/Event/Navigator" );
129 if ( !navigator )
130 {
131 log << MSG::WARNING << " Unable to retrieve EventNavigator" << endmsg;
132 m_rawData = true;
133 }
134 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol( eventSvc(), "/Event/Recon/RecMdcTrackCol" );
135 SmartDataPtr<RecMdcHitCol> recMdcHitCol( eventSvc(), "/Event/Recon/RecMdcHitCol" );
136
137 // get eventNo, t0 and MdcDigi
138 if ( m_hist )
139 {
140 sc = fillInit();
141 if ( sc != StatusCode::SUCCESS ) { return StatusCode::FAILURE; }
142 }
143 if ( m_mc )
144 {
145 // Get McParticleCol
146 SmartDataPtr<Event::McParticleCol> mcParticles( eventSvc(), "/Event/MC/McParticleCol" );
147 SmartDataPtr<Event::MdcMcHitCol> mcHit( eventSvc(), "/Event/MC/MdcMcHitCol" );
148 if ( !mcParticles )
149 { log << MSG::WARNING << " Unable to retrieve McParticleCol" << endmsg; }
150 else
151 {
152 // For each McParticle ...
153 t_mcTkNum = 0;
154 McParticleCol::iterator it = mcParticles->begin();
155 log << MSG::INFO << "mcParticles size = " << mcParticles->size()
156 << endmsg; // yzhang debug
157 for ( ; it != mcParticles->end(); it++ )
158 {
159 // int tkId = (*it)->trackIndex();
160 t_mcTkNum++;
161 }
162 }
163 }
164 t_mcTkNum = 0;
165 t_recTkNum = 0;
166 // for each rec track
167
168 if ( !recMdcTrackCol )
169 {
170 log << MSG::WARNING << " Unable to retrieve recMdcTrackCol" << endmsg;
171 return StatusCode::SUCCESS;
172 }
173 t_recTkNum = recMdcTrackCol->size();
174
175 //=============loop over tracks==============
176 RecMdcTrackCol::iterator it = recMdcTrackCol->begin();
177 for ( ; it != recMdcTrackCol->end(); it++ )
178 {
179 if ( m_mc && navigator )
180 {
181 McParticleVector particles = navigator->getMcParticles( *it );
182 t_mcTkNum = particles.size();
183 RecMdcTrackVector tracks = navigator->getMdcTracks( particles[0] );
184 // for FIRST parent particle
185 if ( sc != StatusCode::SUCCESS ) return StatusCode::FAILURE;
186 }
187 sc = fillRecTrack( *it, t_mcTkNum, t_recTkNum );
188 t_nTk++;
189 if ( sc != StatusCode::SUCCESS ) return StatusCode::FAILURE;
190 } // end of loop over tracks
191
192 //=============loop over hits==============
193 fillRecHits( *recMdcHitCol );
194
195 if ( m_hist ) { fillEvent(); }
196
197 return StatusCode::SUCCESS;
198}
std::vector< const RecMdcTrack * > RecMdcTrackVector
std::vector< const Event::McParticle * > McParticleVector

◆ finalize()

StatusCode MdcNavigation::finalize ( )

Definition at line 202 of file MdcNavigation.cxx.

202 {
203 MsgStream log( msgSvc(), name() );
204 log << MSG::INFO << "in finalize()" << endmsg;
205 std::cout << "nTk == " << t_nTk << std::endl; // yzhang debug
206 delete keepedParticles; // FIXME
207 return StatusCode::SUCCESS;
208}

◆ initialize()

StatusCode MdcNavigation::initialize ( )

Definition at line 62 of file MdcNavigation.cxx.

62 {
63 MsgStream log( msgSvc(), name() );
64 StatusCode sc = StatusCode::SUCCESS;
65
66 t_nTk = 0;
67 // Initailize magnetic filed
68 sc = service( "MagneticFieldSvc", m_pIMF );
69 if ( sc != StatusCode::SUCCESS )
70 {
71 log << MSG::ERROR << "Unable to open Magnetic field service" << endmsg;
72 return StatusCode::FAILURE;
73 }
74
75 // Get the Particle Properties Service
76 IPartPropSvc* p_PartPropSvc;
77 static const bool CREATEIFNOTTHERE( true );
78 sc = service( "PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE );
79 if ( !sc.isSuccess() || 0 == p_PartPropSvc )
80 {
81 log << MSG::ERROR << " Could not initialize PartPropSvc" << endmsg;
82 return sc;
83 }
84
85 m_particleTable = p_PartPropSvc->PDT();
86
87 IRawDataProviderSvc* irawDataProviderSvc;
88 sc = service( "RawDataProviderSvc", irawDataProviderSvc );
89 m_rawDataProviderSvc = dynamic_cast<RawDataProviderSvc*>( irawDataProviderSvc );
90 if ( sc.isFailure() )
91 {
92 log << MSG::FATAL << "Could not load RawDataProviderSvc!" << endmsg;
93 return StatusCode::FAILURE;
94 }
95
96 if ( m_hist )
97 {
98 sc = bookNTuple();
99 if ( !sc.isSuccess() )
100 {
101 log << MSG::WARNING << " Could not book NTuple" << endmsg;
102 m_hist = 0;
103 }
104 }
105
106 keepedParticles = new int( 211 );
107
108 return StatusCode::SUCCESS;
109}

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