BOSS 7.0.2
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 endRun ()
 
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 &)
 
 PrintMcInfo (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~PrintMcInfo ()
 
StatusCode initialize ()
 
StatusCode beginRun ()
 
StatusCode execute ()
 
StatusCode endRun ()
 
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

Constructor & Destructor Documentation

◆ PrintMcInfo() [1/2]

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

Definition at line 24 of file PrintMcInfo.cxx.

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

◆ ~PrintMcInfo() [1/2]

PrintMcInfo::~PrintMcInfo ( )

Definition at line 31 of file PrintMcInfo.cxx.

31{ }

◆ PrintMcInfo() [2/2]

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

◆ ~PrintMcInfo() [2/2]

PrintMcInfo::~PrintMcInfo ( )

Member Function Documentation

◆ beginRun() [1/2]

StatusCode PrintMcInfo::beginRun ( )

Definition at line 53 of file PrintMcInfo.cxx.

53 {
54 MsgStream log(msgSvc(), name());
55 log<<MSG::INFO<<"PrintMcInfo::beginRun()"<<endreq;
56 //add your code here
57 return StatusCode::SUCCESS;
58
59}

◆ beginRun() [2/2]

StatusCode PrintMcInfo::beginRun ( )

◆ endRun() [1/2]

StatusCode PrintMcInfo::endRun ( )

Definition at line 131 of file PrintMcInfo.cxx.

131 {
132 MsgStream log(msgSvc(), name());
133 log<<MSG::INFO<<"PrintMcInfo::endRun()"<<endreq;
134 return StatusCode::SUCCESS;
135
136}

◆ endRun() [2/2]

StatusCode PrintMcInfo::endRun ( )

◆ execute() [1/2]

StatusCode PrintMcInfo::execute ( )

Definition at line 65 of file PrintMcInfo.cxx.

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

◆ execute() [2/2]

StatusCode PrintMcInfo::execute ( )

◆ finalize() [1/2]

StatusCode PrintMcInfo::finalize ( )

Definition at line 137 of file PrintMcInfo.cxx.

137 {
138 MsgStream log(msgSvc(), name());
139 log<<MSG::INFO<<"PrintMcInfo::finalize()"<<endreq;
140 return StatusCode::SUCCESS;
141
142}

◆ finalize() [2/2]

StatusCode PrintMcInfo::finalize ( )

◆ initialize() [1/2]

StatusCode PrintMcInfo::initialize ( )

Definition at line 33 of file PrintMcInfo.cxx.

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

◆ initialize() [2/2]

StatusCode PrintMcInfo::initialize ( )

◆ mkmap() [1/2]

void PrintMcInfo::mkmap ( )

Definition at line 4 of file McTruth.cxx.

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

Referenced by initialize().

◆ mkmap() [2/2]

void PrintMcInfo::mkmap ( )

◆ printDigi() [1/2]

void PrintMcInfo::printDigi ( ofstream &  os)

Definition at line 5 of file Digi.cxx.

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

Referenced by execute().

◆ printDigi() [2/2]

void PrintMcInfo::printDigi ( ofstream &  )

◆ printHit() [1/2]

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.

227{
228 if(!(mdcCol.size()==0&&tofCol.size()==0&&emcCol.size()==0&&mucCol.size()==0))
229 {
230 os<< '\t' <<setw(66)<<"MdcHit"
231 <<setw(25)<<"TofHit"
232 <<setw(17)<<"EmcHit"
233 <<"MucHit"<<endl;
234 os<< '\t' <<"(layer, wire, position(x,y,z)(mm) ,drift_d(mm), DeDx(MeV/m))"<<" "<<"(B/EC layer phi_module)"<<" "<<"(B/EC theta phi)"<<" "<<"(B/EC segment layer strip)"<<endl;
235 }
236 Event::MdcMcHitCol::const_iterator it_mdc = mdcCol.begin();
237 Event::TofMcHitCol::const_iterator it_tof = tofCol.begin();
238 Event::EmcMcHitCol::const_iterator it_emc = emcCol.begin();
239 Event::MucMcHitCol::const_iterator it_muc = mucCol.begin();
240 vector<Event::MdcMcHitCol::const_iterator> vmdc;
241 vector<Event::TofMcHitCol::const_iterator> vtof;
242 vector<Event::EmcMcHitCol::const_iterator> vemc;
243 vector<Event::MucMcHitCol::const_iterator> vmuc;
244 if(mdcCol.size() != 0)
245 {
246 for(;it_mdc != mdcCol.end();it_mdc++)
247 {
248 int trkIndexmdc = (*it_mdc)->getTrackIndex();
249 if(trkIndexmdc == trk_Idx)
250 {
251 vmdc.push_back(it_mdc);
252 }
253 }
254 }
255 if(tofCol.size() != 0)
256 {
257 for(;it_tof != tofCol.end();it_tof++)
258 {
259 int trkIndextof = (*it_tof)->getTrackIndex();
260 if(trkIndextof==trk_Idx) vtof.push_back(it_tof);
261 }
262 }
263
264 if(emcCol.size() != 0)
265 {
266 for(;it_emc != emcCol.end();it_emc++)
267 {
268 int trkIndexemc = (*it_emc)->getTrackIndex();
269 if(trkIndexemc==trk_Idx) vemc.push_back(it_emc);
270 }
271 }
272
273 if(mucCol.size() != 0)
274 {
275 for(;it_muc != mucCol.end();it_muc++)
276 {
277 int trkIndexmuc = (*it_muc)->getTrackIndex();
278 if(trkIndexmuc==trk_Idx) vmuc.push_back(it_muc);
279 }
280 }
281
282
283 for(int i=0;;i++)
284 {
285 bool bmdc=(i>vmdc.size())?true:false;
286 bool btof=(i>vtof.size())?true:false;
287 bool bemc=(i>vemc.size())?true:false;
288 bool bmuc=(i>vmuc.size())?true:false;
289 if((i>=vmdc.size())&&(i>=vtof.size())&&(i>=vemc.size())&&(i>=vmuc.size())) break;
290 os<< '\t' ;
291 if(vmdc.size()>0)
292 {
293 if(i<vmdc.size())
294 {
295 const Identifier ident_mdc = (*vmdc[i])->identify();
296 os<<setw(5)<<MdcID::layer(ident_mdc);
297 os<<setw(5)<<MdcID::wire(ident_mdc);
298 os<<"[ ";
299 os<<setw(10)<<(*vmdc[i])->getPositionX();
300 os<<setw(10)<<(*vmdc[i])->getPositionY();
301 os<<setw(10)<<(*vmdc[i])->getPositionZ();
302 os<<"] ";
303 os<<setw(10)<<(*vmdc[i])->getDriftDistance();
304 os<<setw(10)<<(*vmdc[i])->getDepositEnergy();
305 }else{for (int m = 0; m < 64; m++) os<<" ";}
306 }else{for (int m = 0; m < 64; m++) os<<" ";}
307
308
309 if(vtof.size()>0)
310 {
311 if(i<vtof.size())
312 {
313 const Identifier ident_tof =(*vtof[i])->identify();
314 if(TofID::barrel_ec(ident_tof)==1){os<<"B "<<" ";}
315 if(TofID::barrel_ec(ident_tof)==0){os<<"E_E"<<" ";}
316 if(TofID::barrel_ec(ident_tof)==2){os<<"W_E"<<" ";}
317 os<<setw(3)<<TofID::layer(ident_tof);
318 os<<setw(17)<<TofID::phi_module(ident_tof);
319 }else{for (int m = 0; m < 25; m++) os<<" ";}
320 }else{for (int m = 0; m < 25; m++) os<<" ";}
321
322
323 if(vemc.size()>0)
324 {
325 if(i<vemc.size())
326 {
327 const Identifier ident_emc = (*vemc[i])->identify();
328 if(EmcID::barrel_ec(ident_emc)==1){os<<"B "<<" ";}
329 if(EmcID::barrel_ec(ident_emc)==0){os<<"E_E"<<" ";}
330 if(EmcID::barrel_ec(ident_emc)==2){os<<"W_E"<<" ";}
331 os<<setw(5)<<EmcID::theta_module(ident_emc);
332 os<<setw(9)<<EmcID::phi_module(ident_emc);
333 }else{for (int m = 0; m < 19; m++) os<<" ";}
334 }else{for (int m = 0; m < 19; m++) os<<" ";}
335
336 if(vmuc.size()>0)
337 {
338 if(i<vmuc.size())
339 {
340 const Identifier ident_muc = (*vmuc[i])->identify();
341 if(MucID::barrel_ec(ident_muc)==1){os<<"B "<<" ";}
342 if(MucID::barrel_ec(ident_muc)==0){os<<"E_E"<<" ";}
343 if(MucID::barrel_ec(ident_muc)==2){os<<"W_E"<<" ";}
344 os<<setw(3)<<MucID::segment(ident_muc);
345 os<<setw(3)<<MucID::layer(ident_muc);
346 os<<setw(4)<<MucID::strip(ident_muc);
347 os<<endl;
348 }else{ os<<endl;}
349 }else{os<<endl;}
350
351
352 //i++;
353 }
354 vmdc.clear();
355 vtof.clear();
356 vemc.clear();
357 vmuc.clear();
358
359}

Referenced by printPartInf().

◆ printHit() [2/2]

void PrintMcInfo::printHit ( ofstream &  ,
Event::MdcMcHitCol ,
Event::TofMcHitCol ,
Event::EmcMcHitCol ,
Event::MucMcHitCol ,
int &   
)

◆ printHitInf() [1/2]

void PrintMcInfo::printHitInf ( ofstream &  )

◆ printHitInf() [2/2]

void PrintMcInfo::printHitInf ( ofstream &  )

◆ printPartInf() [1/2]

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

Definition at line 113 of file McTruth.cxx.

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

◆ printPartInf() [2/2]

void PrintMcInfo::printPartInf ( ofstream &  ,
Event::McParticle ,
int  ,
int   
)

◆ printTitle() [1/2]

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

Definition at line 27 of file McTruth.cxx.

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

Referenced by execute().

◆ printTitle() [2/2]

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

◆ printTree() [1/2]

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

Definition at line 55 of file McTruth.cxx.

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

Referenced by execute(), and printTree().

◆ printTree() [2/2]

void PrintMcInfo::printTree ( ofstream &  ,
Event::McParticle ,
int  ,
int   
)

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