6 string str,str1,str2,str3,str4;
9 char* pdt_path=getenv(
"BESEVTGENROOT");
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());
15 while(getline(fin,str))
20 fin>>str1>>str2>>str3>>str4;
21 id = atoi(str4.c_str());
22 map_pid.insert(map<int, string>::value_type(
id,str3));
32 os<<
" "<<setw(27)<<
"cosTeta phi"<<setw(50)<<
"P4 : momentum Energy"
33 <<setw(10)<<
" "<<setw(40)<<
"initialPosition"
34 <<setw(15)<<
"finalPosition"<<endl;
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;
57 bool decay = (pmcp->
daughterList()).size()==0?
false:
true;
60 for (
int m = 0; m < tab; m++) {os<<
'\t';}
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<<
"]"<<
" "<<
"->";
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++)
75 m_trkIndex = (*it)->trackIndex();
76 map<int,string>::iterator
iter;
77 iter = map_pid.find((*it)->particleProperty());
78 if(
iter!=map_pid.end())
80 daughters =
iter->second;
81 m_trkIndex = (*it)->trackIndex();
83 os<<daughters<<
"["<<m_trkIndex<<
"]"<<
" ";
87 cout<<
"can not find the daughter particle in pdt_table"<<endl;
91 for(it = begin;it != end;it++)
93 SmartRef<Event::McParticle> pdMc = (*it);
99 m_pid = (*pmcp).particleProperty();
100 map<int,string>::iterator iterPar;
101 iterPar = map_pid.find(m_pid);
102 if (iterPar!=map_pid.end())
104 <<
"********************************************************"<<endl
105 <<
" in this tree, there's only one primary particle : "<<iterPar->second<<endl
106 <<
"********************************************************"<<endl;
115 bool decay = (pMc->
daughterList()).size()==0?
false:
true;
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");
125 map<int,string>::iterator iter_map;
127 if(iter_map!=map_pid.end())
131 string name = iter_map->second;
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()<<
"] ";
139 os<<
"["<<setw(12)<<ipst.x();
140 os<<setw(12)<<ipst.y();
141 os<<setw(10)<<ipst.z()<<
"] ";
143 HepLorentzVector fpst = (pMc)->finalPosition();
144 os<<
"["<<setw(12)<<fpst.x();
145 os<<setw(12)<<fpst.y();
146 os<<setw(10)<<fpst.z()<<
"] ";
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++)
164 m_trkIndex = (*it)->trackIndex();
165 map<int,string>::iterator
iter;
166 iter = map_pid.find((*it)->particleProperty());
167 if(
iter!=map_pid.end())
169 daughters =
iter->second;
170 if(m_OutputLevel ==1)
173 os<<
"["<<m_trkIndex<<
"]"<<setw(20)<<daughters<<endl;
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()<<
"] ";
181 HepLorentzVector ipst = (*it)->initialPosition();
182 os<<
"["<<setw(12)<<ipst.x();
183 os<<setw(12)<<ipst.y();
184 os<<setw(10)<<ipst.z()<<
"] ";
188 HepLorentzVector fpst = (*it)->finalPosition();
189 os<<
"["<<setw(12)<<fpst.x();
190 os<<setw(12)<<fpst.y();
191 os<<setw(10)<<fpst.z()<<
"] ";
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))
204 os<<
"["<<m_trkIndex<<
"]"<<setw(12)<<daughters<<endl;
207 int trkIdx = (*it)->trackIndex();
212 else cout<<
"can not find the daughter particle in pdt_table"<<endl;
216 for(it = begin;it != end;it++)
218 SmartRef<Event::McParticle> pdMc = (*it);
228 if(!(mdcCol.size()==0&&tofCol.size()==0&&emcCol.size()==0&&mucCol.size()==0))
230 os<<
'\t' <<setw(66)<<
"MdcHit"
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;
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)
246 for(;it_mdc != mdcCol.end();it_mdc++)
248 int trkIndexmdc = (*it_mdc)->getTrackIndex();
249 if(trkIndexmdc == trk_Idx)
251 vmdc.push_back(it_mdc);
255 if(tofCol.size() != 0)
257 for(;it_tof != tofCol.end();it_tof++)
259 int trkIndextof = (*it_tof)->getTrackIndex();
260 if(trkIndextof==trk_Idx) vtof.push_back(it_tof);
264 if(emcCol.size() != 0)
266 for(;it_emc != emcCol.end();it_emc++)
268 int trkIndexemc = (*it_emc)->getTrackIndex();
269 if(trkIndexemc==trk_Idx) vemc.push_back(it_emc);
273 if(mucCol.size() != 0)
275 for(;it_muc != mucCol.end();it_muc++)
277 int trkIndexmuc = (*it_muc)->getTrackIndex();
278 if(trkIndexmuc==trk_Idx) vmuc.push_back(it_muc);
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;
295 const Identifier ident_mdc = (*vmdc[i])->identify();
299 os<<setw(10)<<(*vmdc[i])->getPositionX();
300 os<<setw(10)<<(*vmdc[i])->getPositionY();
301 os<<setw(10)<<(*vmdc[i])->getPositionZ();
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<<
" ";}
313 const Identifier ident_tof =(*vtof[i])->identify();
319 }
else{
for (
int m = 0; m < 25; m++) os<<
" ";}
320 }
else{
for (
int m = 0; m < 25; m++) os<<
" ";}
327 const Identifier ident_emc = (*vemc[i])->identify();
333 }
else{
for (
int m = 0; m < 19; m++) os<<
" ";}
334 }
else{
for (
int m = 0; m < 19; m++) os<<
" ";}
340 const Identifier ident_muc = (*vmuc[i])->identify();
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
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.
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
static int barrel_ec(const Identifier &id)
Values of different levels.
static int layer(const Identifier &id)
static int segment(const Identifier &id)
static int strip(const Identifier &id)
void printPartInf(ofstream &, Event::McParticle *, int, int)
void printTree(ofstream &, Event::McParticle *, int, int)
void printHit(ofstream &, Event::MdcMcHitCol &, Event::TofMcHitCol &, Event::EmcMcHitCol &, Event::MucMcHitCol &, int &)
void printTitle(ofstream &os, int)
static int phi_module(const Identifier &id)
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static int layer(const Identifier &id)
ObjectVector< MdcMcHit > MdcMcHitCol
ObjectVector< MucMcHit > MucMcHitCol
ObjectVector< TofMcHit > TofMcHitCol
ObjectVector< EmcMcHit > EmcMcHitCol