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

#include <PrintMcInfo.h>

Inheritance diagram for PrintMcInfo:

Public Member Functions

 PrintMcInfo (const std::string &name, ISvcLocator *pSvcLocator)
 ~PrintMcInfo ()
StatusCode initialize ()
StatusCode beginRun ()
StatusCode execute ()
StatusCode finalize ()
void mkmap ()
void printTitle (ofstream &os, int)
void printTree (ofstream &, Event::McParticle *, int, int)
void printPartInf (ofstream &, Event::McParticle *, int, int)
void printHitInf (ofstream &)
void printHit (ofstream &, Event::MdcMcHitCol &, Event::TofMcHitCol &, Event::EmcMcHitCol &, Event::MucMcHitCol &, int &)
void printDigi (ofstream &)

Detailed Description

Definition at line 47 of file PrintMcInfo.h.

Constructor & Destructor Documentation

◆ PrintMcInfo()

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

Definition at line 25 of file PrintMcInfo.cxx.

26 : Algorithm( name, pSvcLocator ) {
27
28 declareProperty( "PrintLevel", m_OutputLevel = 0 );
29 declareProperty( "FileName", m_FileName );
30 declareProperty( "fstreamOption", m_fstreamOption = 1 );
31}

Referenced by PrintMcInfo().

◆ ~PrintMcInfo()

PrintMcInfo::~PrintMcInfo ( )

Definition at line 32 of file PrintMcInfo.cxx.

32{}

Member Function Documentation

◆ beginRun()

StatusCode PrintMcInfo::beginRun ( )

Definition at line 47 of file PrintMcInfo.cxx.

47 {
48 MsgStream log( msgSvc(), name() );
49 log << MSG::INFO << "PrintMcInfo::beginRun()" << endmsg;
50 // add your code here
51 return StatusCode::SUCCESS;
52}
IMessageSvc * msgSvc()

◆ execute()

StatusCode PrintMcInfo::execute ( )

Definition at line 56 of file PrintMcInfo.cxx.

56 {
57 MsgStream log( msgSvc(), name() );
58 log << MSG::INFO << "PrintMcInfo::execute()" << endmsg;
59
60 /* if(m_fstreamOption==0)
61 {
62 os.open(m_FileName.c_str(),ios::app);
63 }
64 else os.open(m_FileName.c_str());
65 */
66 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
67 int runNo = eventHeader->runNumber();
68 int event = eventHeader->eventNumber();
69 os << "run number:" << runNo << endl << "event number:" << event << endl << endl;
70
71 SmartDataPtr<Event::McParticleCol> mcPartCol( eventSvc(), "/Event/MC/McParticleCol" );
72 if ( runNo < 0 )
73 {
74 if ( !mcPartCol )
75 {
76 log << MSG::ERROR << "Could not retrieve McParticelCol" << endmsg;
77 return StatusCode::FAILURE;
78 }
79
80 Event::McParticleCol::iterator iter_mc = mcPartCol->begin();
81 for ( ; iter_mc != mcPartCol->end(); iter_mc++ )
82 {
83 bool primary = ( *iter_mc )->primaryParticle();
84 bool gamma = ( ( *iter_mc )->particleProperty() ) == 22 ? true : false;
85 if ( primary && ( !gamma ) )
86 {
87 Event::McParticle* pMcPart = ( *iter_mc );
88 pMcPart->trackIndex();
89 PrintMcInfo::printTree( os, pMcPart, m_OutputLevel, 0 );
90 if ( m_OutputLevel > 0 )
91 {
92 os << endl
93 << "\n- - - - - - - - - - - - - - Information in this decay tree : particle "
94 "level - - - - - - - - - - - - - -- - -- - -\n"
95 << endl;
97 PrintMcInfo::printPartInf( os, pMcPart, 1, 0 );
98 }
99 if ( m_OutputLevel > 1 )
100 {
101 os << endl
102 << "\n- - - - - - - - - - - - - - Information in this decay tree : hit "
103 "level - - - - - - - - - - - - - - - - - - - -\n"
104 << endl;
105 PrintMcInfo::printPartInf( os, pMcPart, 2, 0 );
106 }
107 }
108 }
109 if ( m_OutputLevel > 2 )
110 {
111 os << endl
112 << "\n- - - - - - - - - - - - - - Digi Information in this EVENT - - - - - - - - - "
113 "- - - - - - - - - -\n"
114 << endl;
115 printDigi( os );
116 }
117
118 os << endl
119 << "\n******************************** end of this event "
120 "*********************************\n"
121 << endl;
122
123 } // end of if(runNo < 0)
124 return StatusCode::SUCCESS;
125}
int runNo
Definition DQA_TO_DB.cxx:13
void printPartInf(ofstream &, Event::McParticle *, int, int)
Definition McTruth.cxx:107
void printTree(ofstream &, Event::McParticle *, int, int)
Definition McTruth.cxx:50
void printDigi(ofstream &)
Definition Digi.cxx:4
void printTitle(ofstream &os, int)
Definition McTruth.cxx:25

◆ finalize()

StatusCode PrintMcInfo::finalize ( )

Definition at line 127 of file PrintMcInfo.cxx.

127 {
128 MsgStream log( msgSvc(), name() );
129 log << MSG::INFO << "PrintMcInfo::finalize()" << endmsg;
130 return StatusCode::SUCCESS;
131}

◆ initialize()

StatusCode PrintMcInfo::initialize ( )

Definition at line 34 of file PrintMcInfo.cxx.

34 {
35 // make a map for tanslating the PDG code to its name
37
38 if ( m_fstreamOption == 0 ) { os.open( m_FileName.c_str(), ios::app ); }
39 else os.open( m_FileName.c_str() );
40
41 MsgStream log( msgSvc(), name() );
42 log << MSG::INFO << "PrintMcInfo::initialize()" << endmsg;
43
44 StatusCode status;
45 return StatusCode::SUCCESS;
46}
void mkmap()
Definition McTruth.cxx:4

◆ mkmap()

void PrintMcInfo::mkmap ( )

Definition at line 4 of file McTruth.cxx.

4 {
5 string str, str1, str2, str3, str4;
6 int id;
7
8 char* pdt_path = getenv( "BESEVTGENROOT" );
9 if ( 0 == pdt_path ) std::cerr << "ERROR : Can't get env $BESEVTGENROOT" << std::endl;
10 std::string pdtname = std::string( pdt_path ) + "/share/pdt.table";
11 ifstream fin( pdtname.c_str() );
12
13 while ( getline( fin, str ) )
14 {
15 fin >> str;
16 if ( str == "add" )
17 {
18 fin >> str1 >> str2 >> str3 >> str4;
19 id = atoi( str4.c_str() );
20 map_pid.insert( map<int, string>::value_type( id, str3 ) );
21 }
22 }
23}

Referenced by initialize().

◆ printDigi()

void PrintMcInfo::printDigi ( ofstream & os)

Definition at line 4 of file Digi.cxx.

4 {
5
6 os << '\t' << setw( 40 ) << "MdcDigi" << setw( 30 ) << "TofDigi" << setw( 29 ) << "EmcDigi"
7 << "MucDig" << endl;
8 os << '\t' << "(layer , wire, trkIndex)"
9 << " "
10 << "(B/EC, layer, phi_module, trkIndex)"
11 << " "
12 << "(B/EC, theta, phi, trkIndex)"
13 << " "
14 << "(B/EC, segment, layer, strip, trkIndex)" << endl;
15
16 SmartDataPtr<MdcDigiCol> mdcCol( eventSvc(), "/Event/Digi/MdcDigiCol" );
17 SmartDataPtr<TofDigiCol> tofCol( eventSvc(), "/Event/Digi/TofDigiCol" );
18 SmartDataPtr<EmcDigiCol> emcCol( eventSvc(), "/Event/Digi/EmcDigiCol" );
19 SmartDataPtr<MucDigiCol> mucCol( eventSvc(), "/Event/Digi/MucDigiCol" );
20
21 MdcDigiCol::const_iterator it_mdc = mdcCol->begin();
22 TofDigiCol::const_iterator it_tof = tofCol->begin();
23 EmcDigiCol::const_iterator it_emc = emcCol->begin();
24 MucDigiCol::const_iterator it_muc = mucCol->begin();
25
26 vector<MdcDigiCol::const_iterator> vmdc;
27 vector<TofDigiCol::const_iterator> vtof;
28 vector<EmcDigiCol::const_iterator> vemc;
29 vector<MucDigiCol::const_iterator> vmuc;
30
31 if ( mdcCol->size() != 0 )
32 {
33 for ( ; it_mdc != mdcCol->end(); it_mdc++ ) { vmdc.push_back( it_mdc ); }
34 }
35 if ( tofCol->size() != 0 )
36 {
37 for ( ; it_tof != tofCol->end(); it_tof++ ) { vtof.push_back( it_tof ); }
38 }
39
40 if ( emcCol->size() != 0 )
41 {
42 for ( ; it_emc != emcCol->end(); it_emc++ ) { vemc.push_back( it_emc ); }
43 }
44
45 if ( mucCol->size() != 0 )
46 {
47 for ( ; it_muc != mucCol->end(); it_muc++ ) { vmuc.push_back( it_muc ); }
48 }
49
50 for ( int i = 0;; i++ )
51 {
52 bool bmdc = ( i > vmdc.size() ) ? true : false;
53 bool btof = ( i > vtof.size() ) ? true : false;
54 bool bemc = ( i > vemc.size() ) ? true : false;
55 bool bmuc = ( i > vmuc.size() ) ? true : false;
56 if ( ( i >= vmdc.size() ) && ( i >= vtof.size() ) && ( i >= vemc.size() ) &&
57 ( i >= vmuc.size() ) )
58 break;
59 for ( int m = 0; m < 8; m++ ) os << " ";
60 if ( vmdc.size() > 0 )
61 {
62 if ( i < vmdc.size() )
63 {
64 const Identifier ident_mdc = ( *vmdc[i] )->identify();
65 os << setw( 6 ) << MdcID::layer( ident_mdc );
66 os << setw( 6 ) << MdcID::wire( ident_mdc );
67 os << setw( 15 ) << ( *vmdc[i] )->getTrackIndex();
68 }
69 else
70 {
71 for ( int m = 0; m < 27; m++ ) os << " ";
72 }
73 }
74 else
75 {
76 for ( int m = 0; m < 27; m++ ) os << " ";
77 }
78
79 if ( vtof.size() > 0 )
80 {
81 if ( i < vtof.size() )
82 {
83 const Identifier ident_tof = ( *vtof[i] )->identify();
84 if ( TofID::barrel_ec( ident_tof ) == 1 )
85 {
86 os << "B "
87 << " ";
88 }
89 if ( TofID::barrel_ec( ident_tof ) == 0 )
90 {
91 os << "E_E"
92 << " ";
93 }
94 if ( TofID::barrel_ec( ident_tof ) == 2 )
95 {
96 os << "W_E"
97 << " ";
98 }
99 os << setw( 6 ) << TofID::layer( ident_tof );
100 os << setw( 6 ) << TofID::phi_module( ident_tof );
101 os << setw( 22 ) << ( *vtof[i] )->getTrackIndex();
102 }
103 else
104 {
105 for ( int m = 0; m < 39; m++ ) os << " ";
106 }
107 }
108 else
109 {
110 for ( int m = 0; m < 39; m++ ) os << " ";
111 }
112
113 if ( vemc.size() > 0 )
114 {
115 if ( i < vemc.size() )
116 {
117 const Identifier ident_emc = ( *vemc[i] )->identify();
118 if ( EmcID::barrel_ec( ident_emc ) == 1 )
119 {
120 os << "B "
121 << " ";
122 }
123 if ( EmcID::barrel_ec( ident_emc ) == 0 )
124 {
125 os << "E_E"
126 << " ";
127 }
128 if ( EmcID::barrel_ec( ident_emc ) == 2 )
129 {
130 os << "W_E"
131 << " ";
132 }
133 os << setw( 6 ) << EmcID::theta_module( ident_emc );
134 os << setw( 6 ) << EmcID::phi_module( ident_emc );
135 os << setw( 12 ) << ( *vemc[i] )->getTrackIndex();
136 }
137 else
138 {
139 for ( int m = 0; m < 29; m++ ) os << " ";
140 }
141 }
142 else
143 {
144 for ( int m = 0; m < 29; m++ ) os << " ";
145 }
146
147 if ( vmuc.size() > 0 )
148 {
149 if ( i < vmuc.size() )
150 {
151 const Identifier ident_muc = ( *vmuc[i] )->identify();
152 if ( MucID::barrel_ec( ident_muc ) == 1 )
153 {
154 os << "B "
155 << " ";
156 }
157 if ( MucID::barrel_ec( ident_muc ) == 0 )
158 {
159 os << "E_E"
160 << " ";
161 }
162 if ( MucID::barrel_ec( ident_muc ) == 2 )
163 {
164 os << "W_E"
165 << " ";
166 }
167 os << setw( 6 ) << MucID::segment( ident_muc );
168 os << setw( 6 ) << MucID::layer( ident_muc );
169 os << setw( 6 ) << MucID::strip( ident_muc );
170 os << setw( 6 ) << ( *vmuc[i] )->getTrackIndex();
171 os << endl;
172 }
173 else { os << endl; }
174 }
175 else { os << endl; }
176 }
177 vmdc.clear();
178 vtof.clear();
179 vemc.clear();
180 vmuc.clear();
181}
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0).
Definition EmcID.cxx:36
static unsigned int theta_module(const Identifier &id)
Definition EmcID.cxx:41
static unsigned int phi_module(const Identifier &id)
Definition EmcID.cxx:46
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
Definition MdcID.cxx:47
static int wire(const Identifier &id)
Definition MdcID.cxx:52
static int barrel_ec(const Identifier &id)
Values of different levels.
Definition MucID.cxx:38
static int layer(const Identifier &id)
Definition MucID.cxx:58
static int segment(const Identifier &id)
Definition MucID.cxx:48
static int strip(const Identifier &id)
Definition MucID.cxx:73
static int phi_module(const Identifier &id)
Definition TofID.cxx:65
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0).
Definition TofID.cxx:54
static int layer(const Identifier &id)
Definition TofID.cxx:59

Referenced by execute().

◆ printHit()

void PrintMcInfo::printHit ( ofstream & os,
Event::MdcMcHitCol & mdcCol,
Event::TofMcHitCol & tofCol,
Event::EmcMcHitCol & emcCol,
Event::MucMcHitCol & mucCol,
int & trk_Idx )

Definition at line 226 of file McTruth.cxx.

228 {
229 if ( !( mdcCol.size() == 0 && tofCol.size() == 0 && emcCol.size() == 0 &&
230 mucCol.size() == 0 ) )
231 {
232 os << '\t' << setw( 66 ) << "MdcHit" << setw( 25 ) << "TofHit" << setw( 17 ) << "EmcHit"
233 << "MucHit" << endl;
234 os << '\t' << "(layer, wire, position(x,y,z)(mm) ,drift_d(mm), DeDx(MeV/m))"
235 << " "
236 << "(B/EC layer phi_module)"
237 << " "
238 << "(B/EC theta phi)"
239 << " "
240 << "(B/EC segment layer strip)" << endl;
241 }
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 )
251 {
252 for ( ; it_mdc != mdcCol.end(); it_mdc++ )
253 {
254 int trkIndexmdc = ( *it_mdc )->getTrackIndex();
255 if ( trkIndexmdc == trk_Idx ) { vmdc.push_back( it_mdc ); }
256 }
257 }
258 if ( tofCol.size() != 0 )
259 {
260 for ( ; it_tof != tofCol.end(); it_tof++ )
261 {
262 int trkIndextof = ( *it_tof )->getTrackIndex();
263 if ( trkIndextof == trk_Idx ) vtof.push_back( it_tof );
264 }
265 }
266
267 if ( emcCol.size() != 0 )
268 {
269 for ( ; it_emc != emcCol.end(); it_emc++ )
270 {
271 int trkIndexemc = ( *it_emc )->getTrackIndex();
272 if ( trkIndexemc == trk_Idx ) vemc.push_back( it_emc );
273 }
274 }
275
276 if ( mucCol.size() != 0 )
277 {
278 for ( ; it_muc != mucCol.end(); it_muc++ )
279 {
280 int trkIndexmuc = ( *it_muc )->getTrackIndex();
281 if ( trkIndexmuc == trk_Idx ) vmuc.push_back( it_muc );
282 }
283 }
284
285 for ( int i = 0;; i++ )
286 {
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() ) )
293 break;
294 os << '\t';
295 if ( vmdc.size() > 0 )
296 {
297 if ( i < vmdc.size() )
298 {
299 const Identifier ident_mdc = ( *vmdc[i] )->identify();
300 os << setw( 5 ) << MdcID::layer( ident_mdc );
301 os << setw( 5 ) << MdcID::wire( ident_mdc );
302 os << "[ ";
303 os << setw( 10 ) << ( *vmdc[i] )->getPositionX();
304 os << setw( 10 ) << ( *vmdc[i] )->getPositionY();
305 os << setw( 10 ) << ( *vmdc[i] )->getPositionZ();
306 os << "] ";
307 os << setw( 10 ) << ( *vmdc[i] )->getDriftDistance();
308 os << setw( 10 ) << ( *vmdc[i] )->getDepositEnergy();
309 }
310 else
311 {
312 for ( int m = 0; m < 64; m++ ) os << " ";
313 }
314 }
315 else
316 {
317 for ( int m = 0; m < 64; m++ ) os << " ";
318 }
319
320 if ( vtof.size() > 0 )
321 {
322 if ( i < vtof.size() )
323 {
324 const Identifier ident_tof = ( *vtof[i] )->identify();
325 if ( TofID::barrel_ec( ident_tof ) == 1 )
326 {
327 os << "B "
328 << " ";
329 }
330 if ( TofID::barrel_ec( ident_tof ) == 0 )
331 {
332 os << "E_E"
333 << " ";
334 }
335 if ( TofID::barrel_ec( ident_tof ) == 2 )
336 {
337 os << "W_E"
338 << " ";
339 }
340 os << setw( 3 ) << TofID::layer( ident_tof );
341 os << setw( 17 ) << TofID::phi_module( ident_tof );
342 }
343 else
344 {
345 for ( int m = 0; m < 25; m++ ) os << " ";
346 }
347 }
348 else
349 {
350 for ( int m = 0; m < 25; m++ ) os << " ";
351 }
352
353 if ( vemc.size() > 0 )
354 {
355 if ( i < vemc.size() )
356 {
357 const Identifier ident_emc = ( *vemc[i] )->identify();
358 if ( EmcID::barrel_ec( ident_emc ) == 1 )
359 {
360 os << "B "
361 << " ";
362 }
363 if ( EmcID::barrel_ec( ident_emc ) == 0 )
364 {
365 os << "E_E"
366 << " ";
367 }
368 if ( EmcID::barrel_ec( ident_emc ) == 2 )
369 {
370 os << "W_E"
371 << " ";
372 }
373 os << setw( 5 ) << EmcID::theta_module( ident_emc );
374 os << setw( 9 ) << EmcID::phi_module( ident_emc );
375 }
376 else
377 {
378 for ( int m = 0; m < 19; m++ ) os << " ";
379 }
380 }
381 else
382 {
383 for ( int m = 0; m < 19; m++ ) os << " ";
384 }
385
386 if ( vmuc.size() > 0 )
387 {
388 if ( i < vmuc.size() )
389 {
390 const Identifier ident_muc = ( *vmuc[i] )->identify();
391 if ( MucID::barrel_ec( ident_muc ) == 1 )
392 {
393 os << "B "
394 << " ";
395 }
396 if ( MucID::barrel_ec( ident_muc ) == 0 )
397 {
398 os << "E_E"
399 << " ";
400 }
401 if ( MucID::barrel_ec( ident_muc ) == 2 )
402 {
403 os << "W_E"
404 << " ";
405 }
406 os << setw( 3 ) << MucID::segment( ident_muc );
407 os << setw( 3 ) << MucID::layer( ident_muc );
408 os << setw( 4 ) << MucID::strip( ident_muc );
409 os << endl;
410 }
411 else { os << endl; }
412 }
413 else { os << endl; }
414
415 // i++;
416 }
417 vmdc.clear();
418 vtof.clear();
419 vemc.clear();
420 vmuc.clear();
421}

Referenced by printPartInf().

◆ printHitInf()

void PrintMcInfo::printHitInf ( ofstream & )

◆ printPartInf()

void PrintMcInfo::printPartInf ( ofstream & os,
Event::McParticle * pMc,
int m_OutputLevel,
int tab = 0 )

Definition at line 107 of file McTruth.cxx.

108 {
109 bool decay = ( pMc->daughterList() ).size() == 0 ? false : true;
110
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" );
115
116 if ( ( !decay ) && ( pMc->primaryParticle() ) )
117 {
118 os.setf( ios::left );
119 map<int, string>::iterator iter_map;
120 iter_map = map_pid.find( pMc->particleProperty() );
121 if ( iter_map != map_pid.end() )
122 {
123 if ( m_OutputLevel == 1 )
124 {
125 string name = iter_map->second;
126 os << "[" << pMc->trackIndex() << "]" << name << endl;
127 HepLorentzVector p4 = ( pMc )->initialFourMomentum();
128 os << " "
129 << "[" << setw( 12 ) << p4.vect().cosTheta() << setw( 12 ) << p4.vect().phi()
130 << "] ";
131 os << "[" << setw( 12 ) << p4.x() << setw( 12 ) << p4.y() << setw( 12 ) << p4.z()
132 << " " << setw( 10 ) << p4.t() << "] ";
133
134 HepLorentzVector ipst = pMc->initialPosition();
135 os << "[" << setw( 12 ) << ipst.x();
136 os << setw( 12 ) << ipst.y();
137 os << setw( 10 ) << ipst.z() << "] ";
138
139 HepLorentzVector fpst = ( pMc )->finalPosition();
140 os << "[" << setw( 12 ) << fpst.x();
141 os << setw( 12 ) << fpst.y();
142 os << setw( 10 ) << fpst.z() << "] ";
143 os << endl;
144 }
145 if ( m_OutputLevel == 2 )
146 {
147 int trkIdx = pMc->trackIndex();
148 PrintMcInfo::printHit( os, mdcMcHitCol, tofMcHitCol, emcMcHitCol, mucMcHitCol,
149 trkIdx );
150 }
151 }
152 }
153 if ( decay )
154 {
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++ )
159 {
160 m_trkIndex = ( *it )->trackIndex();
161 map<int, string>::iterator iter;
162 iter = map_pid.find( ( *it )->particleProperty() );
163 if ( iter != map_pid.end() )
164 {
165 daughters = iter->second;
166 if ( m_OutputLevel == 1 )
167 {
168 os.setf( ios::left );
169 os << "[" << m_trkIndex << "]" << setw( 20 ) << daughters << endl;
170
171 HepLorentzVector p4 = ( *it )->initialFourMomentum();
172 os << " "
173 << "[" << setw( 12 ) << p4.vect().cosTheta() << setw( 12 ) << p4.vect().phi()
174 << "] ";
175 os << "[" << setw( 12 ) << p4.x() << setw( 12 ) << p4.y() << setw( 12 ) << p4.z()
176 << " " << setw( 10 ) << p4.t() << "] ";
177
178 // os<<"["<<setw(4)<<(*it)->vertexIndex0();
179 HepLorentzVector ipst = ( *it )->initialPosition();
180 os << "[" << setw( 12 ) << ipst.x();
181 os << setw( 12 ) << ipst.y();
182 os << setw( 10 ) << ipst.z() << "] ";
183 // os<<setw(8)<<ipst.t()<<"] ";
184
185 // os<<"["<<setw(4)<<(*it)->vertexIndex1();
186 HepLorentzVector fpst = ( *it )->finalPosition();
187 os << "[" << setw( 12 ) << fpst.x();
188 os << setw( 12 ) << fpst.y();
189 os << setw( 10 ) << fpst.z() << "] ";
190 // os<<setw(8)<<fpst.t()<<"]";
191 }
192 if ( m_OutputLevel == 2 )
193 {
194 if ( ( ( *mdcMcHitCol ).size() == 0 && ( *tofMcHitCol ).size() == 0 &&
195 ( *emcMcHitCol ).size() == 0 && ( *mucMcHitCol ).size() == 0 ) &&
196 tab == 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 ) )
202
203 {
204 os.setf( ios::left );
205 os << "[" << m_trkIndex << "]" << setw( 12 ) << daughters << endl;
206 }
207
208 int trkIdx = ( *it )->trackIndex();
209 PrintMcInfo::printHit( os, mdcMcHitCol, tofMcHitCol, emcMcHitCol, mucMcHitCol,
210 trkIdx );
211 }
212 os << endl;
213 }
214 else cout << "can not find the daughter particle in pdt_table" << endl;
215 }
216 daughters.erase();
217
218 for ( it = begin; it != end; it++ )
219 {
220 SmartRef<Event::McParticle> pdMc = ( *it );
221 printPartInf( os, pdMc, m_OutputLevel, tab + 1 );
222 }
223 }
224}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
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.
Definition McParticle.cxx:7
void printHit(ofstream &, Event::MdcMcHitCol &, Event::TofMcHitCol &, Event::EmcMcHitCol &, Event::MucMcHitCol &, int &)
Definition McTruth.cxx:226

Referenced by execute(), and printPartInf().

◆ printTitle()

void PrintMcInfo::printTitle ( ofstream & os,
int m_OutputLevel )

Definition at line 25 of file McTruth.cxx.

25 {
26 if ( m_OutputLevel == 1 )
27 {
28 os.setf( ios::left );
29 os << " " << setw( 27 ) << "cosTeta phi" << setw( 50 ) << "P4 : momentum Energy"
30 << setw( 10 ) << " " << setw( 40 ) << "initialPosition" << setw( 15 ) << "finalPosition"
31 << endl;
32 os.setf( ios::left );
33 for ( int m = 0; m < 29; m++ ) { os << " "; }
34 os << "Px, Py, Pz , E (Gev)";
35 for ( int m = 0; m < 35; m++ ) { os << " "; }
36 os << "x(cm) y(cm) z(cm)";
37 for ( int m = 0; m < 25; m++ ) { os << " "; }
38 os << "x(cm) y(cm) z(cm)" << endl;
39 }
40 /* if(m_OutputLevel==2)
41 {
42 os<<'\t'<<"MdcHit"<<'\t'<<'\t'<<"TofHit"<<'\t'<<'\t'<<'\t'<<"EmcHit"<<'\t'<<'\t'<<'\t'<<"MucHit"
43 <<endl;
44 os<<'\t'<<"(layer wire)"<<" "<<"(b/ec layer phi_module)"<<" "<<"(b/ec theta
45 phi)"<<" "<<"(b/ec segment layer strip)"<<endl;
46 }
47 */
48}

Referenced by execute().

◆ printTree()

void PrintMcInfo::printTree ( ofstream & os,
Event::McParticle * pmcp,
int m_OutputLevel,
int tab = 0 )

Definition at line 50 of file McTruth.cxx.

51 {
52 bool decay = ( pmcp->daughterList() ).size() == 0 ? false : true;
53 if ( decay )
54 {
55 for ( int m = 0; m < tab; m++ ) { os << '\t'; }
56
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 << "]"
63 << " "
64 << "->";
65
66 // loop: to get the daughters of the decayed particle
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++ )
71 {
72 m_trkIndex = ( *it )->trackIndex();
73 map<int, string>::iterator iter;
74 iter = map_pid.find( ( *it )->particleProperty() );
75 if ( iter != map_pid.end() )
76 {
77 daughters = iter->second;
78 m_trkIndex = ( *it )->trackIndex();
79 os.setf( ios::left );
80 os << daughters << "[" << m_trkIndex << "]"
81 << " ";
82 daughters.erase();
83 }
84 else cout << "can not find the daughter particle in pdt_table" << endl;
85 }
86 os << endl;
87
88 for ( it = begin; it != end; it++ )
89 {
90 SmartRef<Event::McParticle> pdMc = ( *it );
91 printTree( os, pdMc, m_OutputLevel, tab + 1 );
92 }
93 }
94 if ( ( !decay ) && ( pmcp->primaryParticle() ) )
95 {
96 m_pid = ( *pmcp ).particleProperty();
97 map<int, string>::iterator iterPar;
98 iterPar = map_pid.find( m_pid );
99 if ( iterPar != map_pid.end() )
100 os << endl
101 << "********************************************************" << endl
102 << " in this tree, there's only one primary particle : " << iterPar->second << endl
103 << "********************************************************" << endl;
104 }
105}

Referenced by execute(), and printTree().


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