PrintMcInfo Class Reference

#include <PrintMcInfo.h>

List of all members.

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 &)

Private Attributes

int m_OutputLevel
int m_pid
int m_trkIndex
int m_fstreamOption
bool m_firstTime
map< int, stringmap_pid
ofstream os
string daughters
string m_FileName


Detailed Description

Definition at line 47 of file PrintMcInfo.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file PrintMcInfo.cxx.

References m_FileName, m_fstreamOption, and m_OutputLevel.

00024                                                                        :Algorithm(name,pSvcLocator)
00025 {
00026 
00027         declareProperty("PrintLevel", m_OutputLevel=0);
00028         declareProperty("FileName", m_FileName );
00029         declareProperty("fstreamOption",m_fstreamOption=1);
00030 }

PrintMcInfo::~PrintMcInfo (  ) 

Definition at line 31 of file PrintMcInfo.cxx.

00031 {  }


Member Function Documentation

StatusCode PrintMcInfo::beginRun (  ) 

Definition at line 53 of file PrintMcInfo.cxx.

References Bes_Common::INFO, and msgSvc().

00053                                 {
00054         MsgStream log(msgSvc(), name());
00055         log<<MSG::INFO<<"PrintMcInfo::beginRun()"<<endreq;
00056         //add your code here
00057         return StatusCode::SUCCESS;
00058 
00059 }

StatusCode PrintMcInfo::endRun (  ) 

Definition at line 131 of file PrintMcInfo.cxx.

References Bes_Common::INFO, and msgSvc().

00131                               {
00132         MsgStream log(msgSvc(), name());
00133         log<<MSG::INFO<<"PrintMcInfo::endRun()"<<endreq;
00134         return StatusCode::SUCCESS;
00135 
00136 }

StatusCode PrintMcInfo::execute (  ) 

Definition at line 65 of file PrintMcInfo.cxx.

References calibUtil::ERROR, Bes_Common::INFO, m_OutputLevel, msgSvc(), os, printDigi(), printPartInf(), printTitle(), printTree(), runNo, and Event::McParticle::trackIndex().

00065                                {
00066         MsgStream log(msgSvc(), name());
00067         log<<MSG::INFO<<"PrintMcInfo::execute()"<<endreq;
00068 
00069 
00070 /*      if(m_fstreamOption==0)
00071         {
00072                 os.open(m_FileName.c_str(),ios::app);   
00073         }
00074         else    os.open(m_FileName.c_str());
00075 */
00076         SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00077         int runNo=eventHeader->runNumber();
00078         int event=eventHeader->eventNumber();
00079         os<<"run number:"<<runNo<<endl
00080                 <<"event number:"<<event<<endl<<endl;
00081 
00082 
00083         SmartDataPtr<Event::McParticleCol> mcPartCol(eventSvc(), "/Event/MC/McParticleCol");
00084         if (runNo < 0) 
00085         {
00086                 if(!mcPartCol)
00087                 {
00088                         log << MSG::ERROR << "Could not retrieve McParticelCol" << endreq;
00089                         return StatusCode::FAILURE;
00090                 }
00091 
00092                 Event::McParticleCol::iterator iter_mc = mcPartCol->begin();
00093                 for (;iter_mc !=mcPartCol->end();iter_mc++)
00094                 {
00095                         bool primary = (*iter_mc)->primaryParticle();
00096                         bool gamma = ((*iter_mc)->particleProperty())==22?true:false;
00097                         if(primary&&(!gamma))
00098                         {       
00099                                 Event::McParticle* pMcPart = (*iter_mc);
00100                                 pMcPart->trackIndex();
00101                                 PrintMcInfo::printTree(os,pMcPart,m_OutputLevel,0);
00102                                 if(m_OutputLevel>0)
00103                                 {       
00104                                         os<<endl<<"\n- - - - - - - - - - - - - -  Information in this decay tree :   particle level  - - - - - - - - - - - - - -- - -- - -\n"<<endl;
00105                                         PrintMcInfo::printTitle(os,1);
00106                                         PrintMcInfo::printPartInf(os,pMcPart,1,0);
00107                                 }
00108                                 if(m_OutputLevel>1)
00109                                 {       
00110                                         os<<endl<<"\n- - - - - - - - - - - - - -  Information in this decay tree :      hit level  - - - - - - - - - - - - - - - - - - - -\n"<<endl;
00111                                         PrintMcInfo::printPartInf(os,pMcPart,2,0);
00112                                 }
00113                         }                       
00114                 }
00115                 if(m_OutputLevel>2)
00116                 {
00117                         os<<endl<<"\n- - - - - -  - - - - - - - -  Digi Information in this EVENT - - - - - - - - - - - - - - - - - -  -\n"<<endl;
00118                         printDigi(os);
00119                 }
00120 
00121                 os<<endl<<"\n********************************   end of this event   *********************************\n"<<endl;
00122 
00123 
00124         }//end of if(runNo < 0)
00125         return StatusCode::SUCCESS;
00126 }

StatusCode PrintMcInfo::finalize (  ) 

Definition at line 137 of file PrintMcInfo.cxx.

References Bes_Common::INFO, and msgSvc().

00137                                 {
00138         MsgStream log(msgSvc(), name());
00139         log<<MSG::INFO<<"PrintMcInfo::finalize()"<<endreq;
00140         return StatusCode::SUCCESS;
00141 
00142 }

StatusCode PrintMcInfo::initialize (  ) 

Definition at line 33 of file PrintMcInfo.cxx.

References Bes_Common::INFO, m_FileName, m_fstreamOption, mkmap(), msgSvc(), and os.

00033                                   {
00034         //make a map for tanslating the PDG code to its name 
00035         PrintMcInfo::mkmap();
00036 
00037         if(m_fstreamOption==0)
00038         {
00039                 os.open(m_FileName.c_str(),ios::app);   
00040         }
00041         else    os.open(m_FileName.c_str());
00042 
00043 
00044 
00045 
00046 
00047         MsgStream log(msgSvc(), name());
00048         log<<MSG::INFO<<"PrintMcInfo::initialize()"<<endreq;
00049 
00050         StatusCode status;
00051         return StatusCode::SUCCESS;
00052 }

void PrintMcInfo::mkmap (  ) 

Definition at line 4 of file McTruth.cxx.

References map_pid, deljobs::string, and dchain::value_type().

Referenced by initialize().

00005 {
00006         string str,str1,str2,str3,str4;
00007         int id;
00008         
00009         char* pdt_path=getenv("BESEVTGENROOT");
00010         if(0 == pdt_path)
00011                 std::cerr<<"ERROR : Can't get env $BESEVTGENROOT"<<std::endl;
00012         std::string pdtname=std::string(pdt_path) + "/share/pdt.table";
00013         ifstream fin(pdtname.c_str());
00014         
00015         while(getline(fin,str))
00016         {
00017                 fin>>str;
00018                 if(str == "add")
00019                 {
00020                         fin>>str1>>str2>>str3>>str4;
00021                         id = atoi(str4.c_str());
00022                         map_pid.insert(map<int, string>::value_type(id,str3));
00023                 }
00024         }
00025 }

void PrintMcInfo::printDigi ( ofstream  ) 

Definition at line 5 of file Digi.cxx.

References MucID::barrel_ec(), EmcID::barrel_ec(), TofID::barrel_ec(), genRecEmupikp::i, MucID::layer(), TofID::layer(), MdcID::layer(), EmcID::phi_module(), TofID::phi_module(), MucID::segment(), MucID::strip(), EmcID::theta_module(), and MdcID::wire().

Referenced by execute().

00006 {
00007 
00008         os<< '\t' <<setw(40)<<"MdcDigi"<<setw(30)<<"TofDigi"<<setw(29)<<"EmcDigi"<<"MucDig"<<endl;
00009         os<< '\t' <<"(layer , wire, trkIndex)"<<"   "<<"(B/EC, layer, phi_module, trkIndex)"<<"  "<<"(B/EC, theta, phi, trkIndex)"<<"  "<<"(B/EC, segment, layer, strip, trkIndex)"<<endl;
00010 
00011 
00012         SmartDataPtr<MdcDigiCol> mdcCol(eventSvc(),"/Event/Digi/MdcDigiCol");
00013         SmartDataPtr<TofDigiCol> tofCol(eventSvc(),"/Event/Digi/TofDigiCol");
00014         SmartDataPtr<EmcDigiCol> emcCol(eventSvc(),"/Event/Digi/EmcDigiCol");
00015         SmartDataPtr<MucDigiCol> mucCol(eventSvc(),"/Event/Digi/MucDigiCol");
00016 
00017         MdcDigiCol::const_iterator it_mdc = mdcCol->begin();
00018         TofDigiCol::const_iterator it_tof = tofCol->begin();
00019         EmcDigiCol::const_iterator it_emc = emcCol->begin();
00020         MucDigiCol::const_iterator it_muc = mucCol->begin();
00021 
00022         vector<MdcDigiCol::const_iterator> vmdc;
00023         vector<TofDigiCol::const_iterator> vtof;
00024         vector<EmcDigiCol::const_iterator> vemc;
00025         vector<MucDigiCol::const_iterator> vmuc;
00026 
00027 
00028         if(mdcCol->size() != 0)
00029         {       
00030                 for(;it_mdc != mdcCol->end();it_mdc++)
00031                 {       
00032                         vmdc.push_back(it_mdc);
00033                 }
00034         }
00035         if(tofCol->size() != 0)
00036         {
00037                 for(;it_tof != tofCol->end();it_tof++)
00038                 {       
00039                         vtof.push_back(it_tof);
00040                 }
00041         }
00042 
00043         if(emcCol->size() != 0)
00044         {
00045                 for(;it_emc != emcCol->end();it_emc++)
00046                 {
00047                         vemc.push_back(it_emc);
00048                 }
00049         }
00050 
00051         if(mucCol->size() != 0)
00052         {
00053                 for(;it_muc != mucCol->end();it_muc++)
00054                 {
00055                         vmuc.push_back(it_muc);
00056                 }
00057         }
00058 
00059 
00060         for(int i=0;;i++)
00061         {       
00062                 bool bmdc=(i>vmdc.size())?true:false;
00063                 bool btof=(i>vtof.size())?true:false;
00064                 bool bemc=(i>vemc.size())?true:false;
00065                 bool bmuc=(i>vmuc.size())?true:false;   
00066                 if((i>=vmdc.size())&&(i>=vtof.size())&&(i>=vemc.size())&&(i>=vmuc.size())) break;
00067                 for (int m = 0; m < 8; m++)  os<<" ";
00068                 if(vmdc.size()>0)
00069                 {
00070                         if(i<vmdc.size())
00071                         {
00072                                 const Identifier ident_mdc = (*vmdc[i])->identify();
00073                                 os<<setw(6)<<MdcID::layer(ident_mdc);
00074                                 os<<setw(6)<<MdcID::wire(ident_mdc);
00075                                 os<<setw(15)<<(*vmdc[i])->getTrackIndex();
00076                         }else{for (int m = 0; m < 27; m++)  os<<" ";}
00077                 }else{for (int m = 0; m < 27; m++)  os<<" ";}
00078 
00079 
00080                 if(vtof.size()>0)
00081                 {
00082                         if(i<vtof.size())
00083                         {
00084                                 const Identifier ident_tof =(*vtof[i])->identify();
00085                                 if(TofID::barrel_ec(ident_tof)==1){os<<"B  "<<"  ";}
00086                                 if(TofID::barrel_ec(ident_tof)==0){os<<"E_E"<<"  ";}
00087                                 if(TofID::barrel_ec(ident_tof)==2){os<<"W_E"<<"  ";}
00088                                 os<<setw(6)<<TofID::layer(ident_tof);
00089                                 os<<setw(6)<<TofID::phi_module(ident_tof);
00090                                 os<<setw(22)<<(*vtof[i])->getTrackIndex();
00091                         }else{for (int m = 0; m < 39; m++)  os<<" ";}
00092                 }else{for (int m = 0; m < 39; m++)  os<<" ";}
00093 
00094 
00095                 if(vemc.size()>0)
00096                 {
00097                         if(i<vemc.size())
00098                         {
00099                                 const Identifier ident_emc = (*vemc[i])->identify();
00100                                 if(EmcID::barrel_ec(ident_emc)==1){os<<"B  "<<"  ";}
00101                                 if(EmcID::barrel_ec(ident_emc)==0){os<<"E_E"<<"  ";}
00102                                 if(EmcID::barrel_ec(ident_emc)==2){os<<"W_E"<<"  ";}
00103                                 os<<setw(6)<<EmcID::theta_module(ident_emc);
00104                                 os<<setw(6)<<EmcID::phi_module(ident_emc);
00105                                 os<<setw(12)<<(*vemc[i])->getTrackIndex();
00106                         }else{for (int m = 0; m < 29; m++)  os<<" ";}
00107                 }else{for (int m = 0; m < 29; m++)  os<<" ";}
00108 
00109                 if(vmuc.size()>0)
00110                 {
00111                         if(i<vmuc.size())
00112                         {
00113                                 const Identifier ident_muc = (*vmuc[i])->identify();
00114                                 if(MucID::barrel_ec(ident_muc)==1){os<<"B  "<<"  ";}
00115                                 if(MucID::barrel_ec(ident_muc)==0){os<<"E_E"<<"  ";}
00116                                 if(MucID::barrel_ec(ident_muc)==2){os<<"W_E"<<"  ";}
00117                                 os<<setw(6)<<MucID::segment(ident_muc);
00118                                 os<<setw(6)<<MucID::layer(ident_muc);
00119                                 os<<setw(6)<<MucID::strip(ident_muc);
00120                                 os<<setw(6)<<(*vmuc[i])->getTrackIndex();
00121                                 os<<endl;
00122                         }else{ os<<endl;}
00123                 }else{os<<endl;}
00124 
00125         }
00126         vmdc.clear();
00127         vtof.clear();
00128         vemc.clear();
00129         vmuc.clear();
00130 }

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

Definition at line 226 of file McTruth.cxx.

References MucID::barrel_ec(), EmcID::barrel_ec(), TofID::barrel_ec(), genRecEmupikp::i, MucID::layer(), TofID::layer(), MdcID::layer(), EmcID::phi_module(), TofID::phi_module(), MucID::segment(), MucID::strip(), EmcID::theta_module(), and MdcID::wire().

Referenced by printPartInf().

00227 {
00228         if(!(mdcCol.size()==0&&tofCol.size()==0&&emcCol.size()==0&&mucCol.size()==0))
00229         {
00230                 os<< '\t' <<setw(66)<<"MdcHit"
00231                         <<setw(25)<<"TofHit"
00232                         <<setw(17)<<"EmcHit"
00233                         <<"MucHit"<<endl;
00234                 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;
00235         }
00236         Event::MdcMcHitCol::const_iterator it_mdc = mdcCol.begin();
00237         Event::TofMcHitCol::const_iterator it_tof = tofCol.begin();
00238         Event::EmcMcHitCol::const_iterator it_emc = emcCol.begin();
00239         Event::MucMcHitCol::const_iterator it_muc = mucCol.begin();
00240         vector<Event::MdcMcHitCol::const_iterator> vmdc;
00241         vector<Event::TofMcHitCol::const_iterator> vtof;
00242         vector<Event::EmcMcHitCol::const_iterator> vemc;
00243         vector<Event::MucMcHitCol::const_iterator> vmuc;
00244         if(mdcCol.size() != 0)
00245         {       
00246                 for(;it_mdc != mdcCol.end();it_mdc++)
00247                 {       
00248                         int trkIndexmdc = (*it_mdc)->getTrackIndex();
00249                         if(trkIndexmdc == trk_Idx)   
00250                         {  
00251                                 vmdc.push_back(it_mdc);
00252                         }
00253                 }
00254         }
00255         if(tofCol.size() != 0)
00256         {
00257                 for(;it_tof != tofCol.end();it_tof++)
00258                 {       
00259                         int trkIndextof = (*it_tof)->getTrackIndex();
00260                         if(trkIndextof==trk_Idx)      vtof.push_back(it_tof);
00261                 }
00262         }
00263 
00264         if(emcCol.size() != 0)
00265         {
00266                 for(;it_emc != emcCol.end();it_emc++)
00267                 {
00268                         int trkIndexemc = (*it_emc)->getTrackIndex();
00269                         if(trkIndexemc==trk_Idx)      vemc.push_back(it_emc);
00270                 }
00271         }
00272 
00273         if(mucCol.size() != 0)
00274         {
00275                 for(;it_muc != mucCol.end();it_muc++)
00276                 {
00277                         int trkIndexmuc = (*it_muc)->getTrackIndex();
00278                         if(trkIndexmuc==trk_Idx)      vmuc.push_back(it_muc);
00279                 }
00280         }
00281 
00282 
00283         for(int i=0;;i++)
00284         {       
00285                 bool bmdc=(i>vmdc.size())?true:false;
00286                 bool btof=(i>vtof.size())?true:false;
00287                 bool bemc=(i>vemc.size())?true:false;
00288                 bool bmuc=(i>vmuc.size())?true:false;   
00289                 if((i>=vmdc.size())&&(i>=vtof.size())&&(i>=vemc.size())&&(i>=vmuc.size())) break;
00290                 os<< '\t' ;
00291                 if(vmdc.size()>0)
00292                 {
00293                         if(i<vmdc.size())
00294                         {
00295                                 const Identifier ident_mdc = (*vmdc[i])->identify();
00296                                 os<<setw(5)<<MdcID::layer(ident_mdc);
00297                                 os<<setw(5)<<MdcID::wire(ident_mdc);
00298                                 os<<"[ ";
00299                                 os<<setw(10)<<(*vmdc[i])->getPositionX();
00300                                 os<<setw(10)<<(*vmdc[i])->getPositionY();
00301                                 os<<setw(10)<<(*vmdc[i])->getPositionZ();
00302                                 os<<"] ";
00303                                 os<<setw(10)<<(*vmdc[i])->getDriftDistance();
00304                                 os<<setw(10)<<(*vmdc[i])->getDepositEnergy();
00305                         }else{for (int m = 0; m < 64; m++)  os<<" ";}
00306                 }else{for (int m = 0; m < 64; m++)  os<<" ";}
00307 
00308 
00309                 if(vtof.size()>0)
00310                 {
00311                         if(i<vtof.size())
00312                         {
00313                                 const Identifier ident_tof =(*vtof[i])->identify();
00314                                 if(TofID::barrel_ec(ident_tof)==1){os<<"B  "<<"  ";}
00315                                 if(TofID::barrel_ec(ident_tof)==0){os<<"E_E"<<"  ";}
00316                                 if(TofID::barrel_ec(ident_tof)==2){os<<"W_E"<<"  ";}
00317                                 os<<setw(3)<<TofID::layer(ident_tof);
00318                                 os<<setw(17)<<TofID::phi_module(ident_tof);
00319                         }else{for (int m = 0; m < 25; m++)  os<<" ";}
00320                 }else{for (int m = 0; m < 25; m++)  os<<" ";}
00321 
00322 
00323                 if(vemc.size()>0)
00324                 {
00325                         if(i<vemc.size())
00326                         {
00327                                 const Identifier ident_emc = (*vemc[i])->identify();
00328                                 if(EmcID::barrel_ec(ident_emc)==1){os<<"B  "<<"  ";}
00329                                 if(EmcID::barrel_ec(ident_emc)==0){os<<"E_E"<<"  ";}
00330                                 if(EmcID::barrel_ec(ident_emc)==2){os<<"W_E"<<"  ";}
00331                                 os<<setw(5)<<EmcID::theta_module(ident_emc);
00332                                 os<<setw(9)<<EmcID::phi_module(ident_emc);
00333                         }else{for (int m = 0; m < 19; m++)  os<<" ";}
00334                 }else{for (int m = 0; m < 19; m++)  os<<" ";}
00335 
00336                 if(vmuc.size()>0)
00337                 {
00338                         if(i<vmuc.size())
00339                         {
00340                                 const Identifier ident_muc = (*vmuc[i])->identify();
00341                                 if(MucID::barrel_ec(ident_muc)==1){os<<"B  "<<"  ";}
00342                                 if(MucID::barrel_ec(ident_muc)==0){os<<"E_E"<<"  ";}
00343                                 if(MucID::barrel_ec(ident_muc)==2){os<<"W_E"<<"  ";}
00344                                 os<<setw(3)<<MucID::segment(ident_muc);
00345                                 os<<setw(3)<<MucID::layer(ident_muc);
00346                                 os<<setw(4)<<MucID::strip(ident_muc);
00347                                 os<<endl;
00348                         }else{ os<<endl;}
00349                 }else{os<<endl;}
00350 
00351 
00352                 //i++;
00353         }
00354         vmdc.clear();
00355         vtof.clear();
00356         vemc.clear();
00357         vmuc.clear();
00358 
00359 }

void PrintMcInfo::printHitInf ( ofstream  ) 

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

Definition at line 113 of file McTruth.cxx.

References Event::McParticle::daughterList(), daughters, deljobs::end, Event::McParticle::initialPosition(), iter(), m_trkIndex, map_pid, Event::McParticle::particleProperty(), Event::McParticle::primaryParticle(), printHit(), delete_small_size::size, deljobs::string, and Event::McParticle::trackIndex().

Referenced by execute().

00114 {
00115         bool decay = (pMc->daughterList()).size()==0?false:true;
00116 
00117         SmartDataPtr<Event::MdcMcHitCol> mdcMcHitCol(eventSvc(), "/Event/MC/MdcMcHitCol");
00118         SmartDataPtr<Event::TofMcHitCol> tofMcHitCol(eventSvc(), "/Event/MC/TofMcHitCol");
00119         SmartDataPtr<Event::EmcMcHitCol> emcMcHitCol(eventSvc(), "/Event/MC/EmcMcHitCol");
00120         SmartDataPtr<Event::MucMcHitCol> mucMcHitCol(eventSvc(), "/Event/MC/MucMcHitCol");
00121 
00122         if((!decay)&&(pMc->primaryParticle()))
00123         {
00124                 os.setf(ios::left);
00125                 map<int,string>::iterator iter_map;
00126                 iter_map = map_pid.find(pMc->particleProperty());
00127                 if(iter_map!=map_pid.end())
00128                 {       
00129                         if(m_OutputLevel==1)
00130                         {
00131                                 string name  = iter_map->second;
00132                                 os<<"["<<pMc->trackIndex()<<"]"<<name<<endl;
00133                                 HepLorentzVector p4 = (pMc)->initialFourMomentum();
00134                                 os<<"  "<<"["<<setw(12)<<p4.vect().cosTheta()<<setw(12)<<p4.vect().phi()<<"]  ";
00135                                 os<<"["<<setw(12)<<p4.x()<<setw(12)<<p4.y()
00136                                         <<setw(12)<<p4.z()<<" "<<setw(10)<<p4.t()<<"]  ";
00137 
00138                                 HepLorentzVector ipst = pMc->initialPosition();
00139                                 os<<"["<<setw(12)<<ipst.x();
00140                                 os<<setw(12)<<ipst.y();
00141                                 os<<setw(10)<<ipst.z()<<"]  ";
00142 
00143                                 HepLorentzVector fpst = (pMc)->finalPosition();
00144                                 os<<"["<<setw(12)<<fpst.x();
00145                                 os<<setw(12)<<fpst.y();
00146                                 os<<setw(10)<<fpst.z()<<"]  ";
00147                                 os<<endl;
00148                         }
00149                         if(m_OutputLevel==2)
00150                         {
00151                                 int trkIdx = pMc->trackIndex();
00152                                 PrintMcInfo::printHit(os,mdcMcHitCol,tofMcHitCol,emcMcHitCol,mucMcHitCol,trkIdx);
00153                         }
00154 
00155                 }
00156         }
00157         if(decay)
00158         {
00159                 SmartRefVector<Event::McParticle>::const_iterator begin = (pMc->daughterList()).begin();
00160                 SmartRefVector<Event::McParticle>::const_iterator end = (pMc->daughterList()).end();
00161                 SmartRefVector<Event::McParticle>::const_iterator it;
00162                 for(it = begin;it != end;it++)
00163                 {       
00164                         m_trkIndex = (*it)->trackIndex();
00165                         map<int,string>::iterator iter;
00166                         iter = map_pid.find((*it)->particleProperty());
00167                         if(iter!=map_pid.end())
00168                         {       
00169                                 daughters = iter->second;
00170                                 if(m_OutputLevel ==1)
00171                                 {       
00172                                         os.setf(ios::left);
00173                                         os<<"["<<m_trkIndex<<"]"<<setw(20)<<daughters<<endl;
00174 
00175                                         HepLorentzVector p4 = (*it)->initialFourMomentum();
00176                                         os<<"  "<<"["<<setw(12)<<p4.vect().cosTheta()<<setw(12)<<p4.vect().phi()<<"]  ";
00177                                         os<<"["<<setw(12)<<p4.x()<<setw(12)<<p4.y()
00178                                                 <<setw(12)<<p4.z()<<" "<<setw(10)<<p4.t()<<"]  ";
00179 
00180                                         //os<<"["<<setw(4)<<(*it)->vertexIndex0();
00181                                         HepLorentzVector ipst = (*it)->initialPosition();
00182                                         os<<"["<<setw(12)<<ipst.x();
00183                                         os<<setw(12)<<ipst.y();
00184                                         os<<setw(10)<<ipst.z()<<"]  ";
00185                                         //os<<setw(8)<<ipst.t()<<"]  ";                                 
00186 
00187                                         //os<<"["<<setw(4)<<(*it)->vertexIndex1();
00188                                         HepLorentzVector fpst = (*it)->finalPosition();
00189                                         os<<"["<<setw(12)<<fpst.x();
00190                                         os<<setw(12)<<fpst.y();
00191                                         os<<setw(10)<<fpst.z()<<"]  ";
00192                                         //os<<setw(8)<<fpst.t()<<"]";
00193                                 }
00194                                 if(m_OutputLevel==2)
00195                                 {       
00196                                         if(((*mdcMcHitCol).size()==0&&(*tofMcHitCol).size()==0&&(*emcMcHitCol).size()==0&&(*mucMcHitCol).size()==0)&&tab==0)
00197                                                 os<<" --------------------------------------------------------"<<endl
00198                                                         <<" mdcMcHitCol,tofMcHitCol,emcMcHitCol,mucMcHitCol all empty"<<endl
00199                                                         <<" --------------------------------------------------------"<<endl;
00200                                         if(!((*mdcMcHitCol).size()==0&&(*tofMcHitCol).size()==0&&(*emcMcHitCol).size()==0&&(*mucMcHitCol).size()==0))
00201 
00202                                         {
00203                                                 os.setf(ios::left);
00204                                                 os<<"["<<m_trkIndex<<"]"<<setw(12)<<daughters<<endl;
00205                                         }
00206 
00207                                         int trkIdx = (*it)->trackIndex();
00208                                         PrintMcInfo::printHit(os,mdcMcHitCol,tofMcHitCol,emcMcHitCol,mucMcHitCol,trkIdx);
00209                                 }
00210                                 os<<endl;
00211                         }
00212                         else cout<<"can not find the daughter particle in pdt_table"<<endl;
00213                 }
00214                 daughters.erase();
00215 
00216                 for(it = begin;it != end;it++)
00217                 {
00218                         SmartRef<Event::McParticle> pdMc = (*it);
00219                         printPartInf(os,pdMc,m_OutputLevel,tab+1);
00220                 }
00221         }
00222 }

void PrintMcInfo::printTitle ( ofstream os,
int   
)

Definition at line 27 of file McTruth.cxx.

Referenced by execute().

00028 {
00029         if(m_OutputLevel==1)
00030         {
00031                 os.setf(ios::left);
00032                 os<<"  "<<setw(27)<<"cosTeta  phi"<<setw(50)<<"P4 : momentum Energy"
00033                         <<setw(10)<<" "<<setw(40)<<"initialPosition"
00034                         <<setw(15)<<"finalPosition"<<endl;
00035                 os.setf(ios::left);
00036                 for (int m = 0; m < 29; m++) {os<< " ";}
00037                 os<<"Px, Py, Pz , E (Gev)";
00038                 for (int m = 0; m < 35; m++) {os<< " ";}
00039                 os<<"x(cm) y(cm) z(cm)";
00040                 for (int m = 0; m < 25; m++) {os<< " ";}
00041                 os  <<"x(cm) y(cm) z(cm)"<<endl;
00042         }
00043         /*      if(m_OutputLevel==2)  
00044                 {
00045                 os<<'\t'<<"MdcHit"<<'\t'<<'\t'<<"TofHit"<<'\t'<<'\t'<<'\t'<<"EmcHit"<<'\t'<<'\t'<<'\t'<<"MucHit"
00046                 <<endl;
00047                 os<<'\t'<<"(layer wire)"<<"  "<<"(b/ec layer phi_module)"<<"  "<<"(b/ec theta phi)"<<"  "<<"(b/ec segment layer strip)"<<endl;
00048                 }
00049          */
00050 }

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

Definition at line 55 of file McTruth.cxx.

References Event::McParticle::daughterList(), daughters, deljobs::end, iter(), m_pid, m_trkIndex, map_pid, Event::McParticle::primaryParticle(), and delete_small_size::size.

Referenced by execute().

00056 {         
00057         bool decay = (pmcp->daughterList()).size()==0?false:true;
00058         if(decay)
00059         {
00060                 for (int m = 0; m < tab; m++) {os<< '\t';}
00061 
00062                 m_pid = (*pmcp).particleProperty();
00063                 m_trkIndex = (*pmcp).trackIndex();
00064                 map<int,string>::iterator iterPar;
00065                 iterPar = map_pid.find(m_pid);
00066                 if (iterPar!=map_pid.end())
00067                         os<<iterPar->second<<"["<<m_trkIndex<<"]"<<" "<<"->";
00068 
00069                 //loop: to get the daughters of the decayed particle
00070                 SmartRefVector<Event::McParticle>::const_iterator begin = (pmcp->daughterList()).begin();
00071                 SmartRefVector<Event::McParticle>::const_iterator end = (pmcp->daughterList()).end();
00072                 SmartRefVector<Event::McParticle>::const_iterator it;
00073                 for(it = begin;it != end;it++)
00074                 {      
00075                         m_trkIndex = (*it)->trackIndex();
00076                         map<int,string>::iterator iter;
00077                         iter = map_pid.find((*it)->particleProperty());
00078                         if(iter!=map_pid.end())
00079                         {               
00080                                 daughters = iter->second;
00081                                 m_trkIndex = (*it)->trackIndex();
00082                                 os.setf(ios::left);
00083                                 os<<daughters<<"["<<m_trkIndex<<"]"<<" ";
00084                                 daughters.erase();
00085                         }
00086                         else
00087                                 cout<<"can not find the daughter particle in pdt_table"<<endl;
00088                 }
00089                 os<<endl;
00090 
00091                 for(it = begin;it != end;it++)
00092                 {       
00093                         SmartRef<Event::McParticle> pdMc = (*it);
00094                         printTree(os,pdMc,m_OutputLevel,tab+1);
00095                 }
00096         }
00097         if((!decay)&&(pmcp->primaryParticle()))
00098         {
00099                 m_pid = (*pmcp).particleProperty();
00100                 map<int,string>::iterator iterPar;
00101                 iterPar = map_pid.find(m_pid);
00102                 if (iterPar!=map_pid.end())
00103                 os<<endl
00104                   <<"********************************************************"<<endl
00105                   <<" in this tree, there's only one primary particle  : "<<iterPar->second<<endl
00106                   <<"********************************************************"<<endl;
00107         }
00108 }


Member Data Documentation

string PrintMcInfo::daughters [private]

Definition at line 74 of file PrintMcInfo.h.

Referenced by printPartInf(), and printTree().

string PrintMcInfo::m_FileName [private]

Definition at line 75 of file PrintMcInfo.h.

Referenced by initialize(), and PrintMcInfo().

bool PrintMcInfo::m_firstTime [private]

Definition at line 69 of file PrintMcInfo.h.

int PrintMcInfo::m_fstreamOption [private]

Definition at line 68 of file PrintMcInfo.h.

Referenced by initialize(), and PrintMcInfo().

int PrintMcInfo::m_OutputLevel [private]

Definition at line 64 of file PrintMcInfo.h.

Referenced by execute(), and PrintMcInfo().

int PrintMcInfo::m_pid [private]

Definition at line 65 of file PrintMcInfo.h.

Referenced by printTree().

int PrintMcInfo::m_trkIndex [private]

Definition at line 66 of file PrintMcInfo.h.

Referenced by printPartInf(), and printTree().

map<int,string> PrintMcInfo::map_pid [private]

Definition at line 70 of file PrintMcInfo.h.

Referenced by mkmap(), printPartInf(), and printTree().

ofstream PrintMcInfo::os [private]

Definition at line 72 of file PrintMcInfo.h.

Referenced by execute(), and initialize().


Generated on Tue Nov 29 23:20:44 2016 for BOSS_7.0.2 by  doxygen 1.4.7