00001 #include "RootEventData/TMcHitEvent.h" 00002 #include "TCollection.h" // Declares TIter 00003 00004 ClassImp(TMcHitEvent) 00005 00006 //*************************************************************** 00007 TMcHitEvent::TMcHitEvent() 00008 { 00009 m_beamTime = -1.; 00010 m_tTofMcHitCol = new TObjArray(); 00011 m_tMdcMcHitCol = new TObjArray(); 00012 m_tEmcMcDigiCol= new TObjArray(); 00013 Clear(); 00014 } 00015 00016 //***************************************************************** 00017 TMcHitEvent::~TMcHitEvent() { 00018 m_tTofMcHitCol->Delete(); 00019 delete m_tTofMcHitCol; 00020 m_tTofMcHitCol = 0; 00021 00022 m_tMdcMcHitCol->Delete(); 00023 delete m_tMdcMcHitCol; 00024 m_tMdcMcHitCol = 0; 00025 00026 m_tEmcMcDigiCol->Delete(); 00027 delete m_tEmcMcDigiCol; 00028 m_tEmcMcDigiCol = 0; 00029 } 00030 00031 00032 //***************************************************************** 00033 void TMcHitEvent::Clear(Option_t *option) { 00034 int i = 0; 00035 00036 for(i = 0; i < m_tTofMcHitCol->GetEntries(); i++)delete m_tTofMcHitCol->At(i); 00037 m_tTofMcHitCol->Clear(); 00038 00039 for(i = 0; i < m_tMdcMcHitCol->GetEntries(); i++)delete m_tMdcMcHitCol->At(i); 00040 m_tMdcMcHitCol->Clear(); 00041 00042 for(i = 0; i < m_tEmcMcDigiCol->GetEntries(); i++)delete m_tEmcMcDigiCol->At(i); 00043 m_tEmcMcDigiCol->Clear(); 00044 } 00045 00046 //***************************************************************************** 00047 void TMcHitEvent::Print(Option_t *option) const { 00048 TObject::Print(option); 00049 } 00050 00052 void TMcHitEvent::addMcDigiEmc(TMcDigiEmc * mcDigi){ 00053 m_tEmcMcDigiCol->Add(mcDigi); 00054 } 00055 00056 00057 const TMcDigiEmc* TMcHitEvent::getMcDigiEmc(Int_t i) const { 00058 if(Int_t(i) >=m_tEmcMcDigiCol->GetEntries()) return 0; 00059 else return (TMcDigiEmc*) m_tEmcMcDigiCol->At(i); 00060 } 00061 00063 void TMcHitEvent::addMcHitTof(TMcHitTof * mcHit){ 00064 m_tTofMcHitCol->Add(mcHit); 00065 } 00066 00067 00068 const TMcHitTof* TMcHitEvent::getMcHitTof(Int_t i) const { 00069 if(Int_t(i) >=m_tTofMcHitCol->GetEntries()) return 0; 00070 else return (TMcHitTof*) m_tTofMcHitCol->At(i); 00071 } 00072 00074 void TMcHitEvent::addMcHitMdc(TMcHitMdc * mcHit){ 00075 m_tMdcMcHitCol->Add(mcHit); 00076 } 00077 00078 00079 const TMcHitMdc* TMcHitEvent::getMcHitMdc(Int_t i) const { 00080 if(Int_t(i) >=m_tMdcMcHitCol->GetEntries()) return 0; 00081 else return (TMcHitMdc*) m_tMdcMcHitCol->At(i); 00082 } 00083