52 bool decay = ( pmcp->
daughterList() ).size() == 0 ? false :
true;
55 for (
int m = 0; m < tab; m++ ) { os <<
'\t'; }
57 m_pid = ( *pmcp ).particleProperty();
58 m_trkIndex = ( *pmcp ).trackIndex();
59 map<int, string>::iterator iterPar;
60 iterPar = map_pid.find( m_pid );
61 if ( iterPar != map_pid.end() )
62 os << iterPar->second <<
"[" << m_trkIndex <<
"]"
67 SmartRefVector<Event::McParticle>::const_iterator begin = ( pmcp->
daughterList() ).begin();
68 SmartRefVector<Event::McParticle>::const_iterator end = ( pmcp->
daughterList() ).end();
69 SmartRefVector<Event::McParticle>::const_iterator it;
70 for ( it = begin; it != end; it++ )
72 m_trkIndex = ( *it )->trackIndex();
73 map<int, string>::iterator
iter;
74 iter = map_pid.find( ( *it )->particleProperty() );
75 if (
iter != map_pid.end() )
77 daughters =
iter->second;
78 m_trkIndex = ( *it )->trackIndex();
80 os << daughters <<
"[" << m_trkIndex <<
"]"
84 else cout <<
"can not find the daughter particle in pdt_table" << endl;
88 for ( it = begin; it != end; it++ )
90 SmartRef<Event::McParticle> pdMc = ( *it );
91 printTree( os, pdMc, m_OutputLevel, tab + 1 );
96 m_pid = ( *pmcp ).particleProperty();
97 map<int, string>::iterator iterPar;
98 iterPar = map_pid.find( m_pid );
99 if ( iterPar != map_pid.end() )
101 <<
"********************************************************" << endl
102 <<
" in this tree, there's only one primary particle : " << iterPar->second << endl
103 <<
"********************************************************" << endl;
109 bool decay = ( pMc->
daughterList() ).size() == 0 ? false :
true;
111 SmartDataPtr<Event::MdcMcHitCol> mdcMcHitCol( eventSvc(),
"/Event/MC/MdcMcHitCol" );
112 SmartDataPtr<Event::TofMcHitCol> tofMcHitCol( eventSvc(),
"/Event/MC/TofMcHitCol" );
113 SmartDataPtr<Event::EmcMcHitCol> emcMcHitCol( eventSvc(),
"/Event/MC/EmcMcHitCol" );
114 SmartDataPtr<Event::MucMcHitCol> mucMcHitCol( eventSvc(),
"/Event/MC/MucMcHitCol" );
118 os.setf( ios::left );
119 map<int, string>::iterator iter_map;
121 if ( iter_map != map_pid.end() )
123 if ( m_OutputLevel == 1 )
125 string name = iter_map->second;
126 os <<
"[" << pMc->
trackIndex() <<
"]" << name << endl;
127 HepLorentzVector p4 = ( pMc )->initialFourMomentum();
129 <<
"[" << setw( 12 ) << p4.vect().cosTheta() << setw( 12 ) << p4.vect().phi()
131 os <<
"[" << setw( 12 ) << p4.x() << setw( 12 ) << p4.y() << setw( 12 ) << p4.z()
132 <<
" " << setw( 10 ) << p4.t() <<
"] ";
135 os <<
"[" << setw( 12 ) << ipst.x();
136 os << setw( 12 ) << ipst.y();
137 os << setw( 10 ) << ipst.z() <<
"] ";
139 HepLorentzVector fpst = ( pMc )->finalPosition();
140 os <<
"[" << setw( 12 ) << fpst.x();
141 os << setw( 12 ) << fpst.y();
142 os << setw( 10 ) << fpst.z() <<
"] ";
145 if ( m_OutputLevel == 2 )
155 SmartRefVector<Event::McParticle>::const_iterator begin = ( pMc->
daughterList() ).begin();
156 SmartRefVector<Event::McParticle>::const_iterator end = ( pMc->
daughterList() ).end();
157 SmartRefVector<Event::McParticle>::const_iterator it;
158 for ( it = begin; it != end; it++ )
160 m_trkIndex = ( *it )->trackIndex();
161 map<int, string>::iterator
iter;
162 iter = map_pid.find( ( *it )->particleProperty() );
163 if (
iter != map_pid.end() )
165 daughters =
iter->second;
166 if ( m_OutputLevel == 1 )
168 os.setf( ios::left );
169 os <<
"[" << m_trkIndex <<
"]" << setw( 20 ) << daughters << endl;
171 HepLorentzVector p4 = ( *it )->initialFourMomentum();
173 <<
"[" << setw( 12 ) << p4.vect().cosTheta() << setw( 12 ) << p4.vect().phi()
175 os <<
"[" << setw( 12 ) << p4.x() << setw( 12 ) << p4.y() << setw( 12 ) << p4.z()
176 <<
" " << setw( 10 ) << p4.t() <<
"] ";
179 HepLorentzVector ipst = ( *it )->initialPosition();
180 os <<
"[" << setw( 12 ) << ipst.x();
181 os << setw( 12 ) << ipst.y();
182 os << setw( 10 ) << ipst.z() <<
"] ";
186 HepLorentzVector fpst = ( *it )->finalPosition();
187 os <<
"[" << setw( 12 ) << fpst.x();
188 os << setw( 12 ) << fpst.y();
189 os << setw( 10 ) << fpst.z() <<
"] ";
192 if ( m_OutputLevel == 2 )
194 if ( ( ( *mdcMcHitCol ).size() == 0 && ( *tofMcHitCol ).size() == 0 &&
195 ( *emcMcHitCol ).size() == 0 && ( *mucMcHitCol ).size() == 0 ) &&
197 os <<
" --------------------------------------------------------" << endl
198 <<
" mdcMcHitCol,tofMcHitCol,emcMcHitCol,mucMcHitCol all empty" << endl
199 <<
" --------------------------------------------------------" << endl;
200 if ( !( ( *mdcMcHitCol ).size() == 0 && ( *tofMcHitCol ).size() == 0 &&
201 ( *emcMcHitCol ).size() == 0 && ( *mucMcHitCol ).size() == 0 ) )
204 os.setf( ios::left );
205 os <<
"[" << m_trkIndex <<
"]" << setw( 12 ) << daughters << endl;
208 int trkIdx = ( *it )->trackIndex();
214 else cout <<
"can not find the daughter particle in pdt_table" << endl;
218 for ( it = begin; it != end; it++ )
220 SmartRef<Event::McParticle> pdMc = ( *it );
229 if ( !( mdcCol.size() == 0 && tofCol.size() == 0 && emcCol.size() == 0 &&
230 mucCol.size() == 0 ) )
232 os <<
'\t' << setw( 66 ) <<
"MdcHit" << setw( 25 ) <<
"TofHit" << setw( 17 ) <<
"EmcHit"
234 os <<
'\t' <<
"(layer, wire, position(x,y,z)(mm) ,drift_d(mm), DeDx(MeV/m))"
236 <<
"(B/EC layer phi_module)"
238 <<
"(B/EC theta phi)"
240 <<
"(B/EC segment layer strip)" << endl;
242 Event::MdcMcHitCol::const_iterator it_mdc = mdcCol.begin();
243 Event::TofMcHitCol::const_iterator it_tof = tofCol.begin();
244 Event::EmcMcHitCol::const_iterator it_emc = emcCol.begin();
245 Event::MucMcHitCol::const_iterator it_muc = mucCol.begin();
246 vector<Event::MdcMcHitCol::const_iterator> vmdc;
247 vector<Event::TofMcHitCol::const_iterator> vtof;
248 vector<Event::EmcMcHitCol::const_iterator> vemc;
249 vector<Event::MucMcHitCol::const_iterator> vmuc;
250 if ( mdcCol.size() != 0 )
252 for ( ; it_mdc != mdcCol.end(); it_mdc++ )
254 int trkIndexmdc = ( *it_mdc )->getTrackIndex();
255 if ( trkIndexmdc == trk_Idx ) { vmdc.push_back( it_mdc ); }
258 if ( tofCol.size() != 0 )
260 for ( ; it_tof != tofCol.end(); it_tof++ )
262 int trkIndextof = ( *it_tof )->getTrackIndex();
263 if ( trkIndextof == trk_Idx ) vtof.push_back( it_tof );
267 if ( emcCol.size() != 0 )
269 for ( ; it_emc != emcCol.end(); it_emc++ )
271 int trkIndexemc = ( *it_emc )->getTrackIndex();
272 if ( trkIndexemc == trk_Idx ) vemc.push_back( it_emc );
276 if ( mucCol.size() != 0 )
278 for ( ; it_muc != mucCol.end(); it_muc++ )
280 int trkIndexmuc = ( *it_muc )->getTrackIndex();
281 if ( trkIndexmuc == trk_Idx ) vmuc.push_back( it_muc );
285 for (
int i = 0;; i++ )
287 bool bmdc = ( i > vmdc.size() ) ? true :
false;
288 bool btof = ( i > vtof.size() ) ? true :
false;
289 bool bemc = ( i > vemc.size() ) ? true :
false;
290 bool bmuc = ( i > vmuc.size() ) ? true :
false;
291 if ( ( i >= vmdc.size() ) && ( i >= vtof.size() ) && ( i >= vemc.size() ) &&
292 ( i >= vmuc.size() ) )
295 if ( vmdc.size() > 0 )
297 if ( i < vmdc.size() )
299 const Identifier ident_mdc = ( *vmdc[i] )->identify();
303 os << setw( 10 ) << ( *vmdc[i] )->getPositionX();
304 os << setw( 10 ) << ( *vmdc[i] )->getPositionY();
305 os << setw( 10 ) << ( *vmdc[i] )->getPositionZ();
307 os << setw( 10 ) << ( *vmdc[i] )->getDriftDistance();
308 os << setw( 10 ) << ( *vmdc[i] )->getDepositEnergy();
312 for (
int m = 0; m < 64; m++ ) os <<
" ";
317 for (
int m = 0; m < 64; m++ ) os <<
" ";
320 if ( vtof.size() > 0 )
322 if ( i < vtof.size() )
324 const Identifier ident_tof = ( *vtof[i] )->identify();
345 for (
int m = 0; m < 25; m++ ) os <<
" ";
350 for (
int m = 0; m < 25; m++ ) os <<
" ";
353 if ( vemc.size() > 0 )
355 if ( i < vemc.size() )
357 const Identifier ident_emc = ( *vemc[i] )->identify();
378 for (
int m = 0; m < 19; m++ ) os <<
" ";
383 for (
int m = 0; m < 19; m++ ) os <<
" ";
386 if ( vmuc.size() > 0 )
388 if ( i < vmuc.size() )
390 const Identifier ident_muc = ( *vmuc[i] )->identify();
bool primaryParticle() const
Retrieve whether this is a primary particle.
const HepLorentzVector & initialPosition() const
Retrieve pointer to the start, end vertex positions.
const SmartRefVector< McParticle > & daughterList() const
access the process name
StdHepId particleProperty() const
Retrieve particle property.