#include <MucRecHitContainer.h>
Public Types | |
typedef std::map< MucRecHitID, int > | GapHitCountMap |
typedef std::map< MucRecHitID, MucRecHit * > | pHitMap |
Public Member Functions | |
MucRecHitContainer () | |
MucRecHitContainer (const MucRecHitContainer &source) | |
MucRecHitContainer & | operator= (const MucRecHitContainer &orig) |
~MucRecHitContainer () | |
void | Init () |
Initializes the MucRecHitContainer with MucRecHitCol. | |
void | Destroy () |
Destroys the *single* instance of MucRecHitContainer. | |
void | SetMucRecHitCol (MucRecHitCol *p) |
MucRecHitCol * | GetMucRecHitCol () |
Get MucRecHitCol pointer. | |
int | GetHitCount () |
How many hits are there in this event? | |
int | GetGapHitCount (const MucRecHitID gapID) |
How many hits are there in this gap? | |
int | GetGapHitCount (const int part, const int seg, const int gap) |
How many hits are there in this gap? | |
MucRecHit * | GetHit (const MucRecHitID hitID) |
Get a MucRecHit object by hit identifier. | |
MucRecHit * | GetHit (const int part, const int seg, const int gap, const int hit) |
Get a MucRecHit by part, seg, gap, and hit within the gap. | |
MucRecHit * | GetHitByIdentifier (const Identifier id) |
MucRecHit * | GetHitByIdentifier (const int part, const int seg, const int gap, const int strip) |
void | AddHit (const Identifier id) |
void | AddHit (const int part, const int seg, const int gap, const int strip) |
Place a new hit object in the container. | |
void | Clear () |
Remove all hit objects from the container, and destroy them. | |
Private Attributes | |
MucRecHitCol * | m_pMucRecHitCol |
MucRecHitContainer::GapHitCountMap | m_GapHitCount |
MucRecHitContainer::pHitMap | m_pHit |
Definition at line 29 of file MucRecHitContainer.h.
typedef std::map<MucRecHitID, int> MucRecHitContainer::GapHitCountMap |
Definition at line 32 of file MucRecHitContainer.h.
typedef std::map<MucRecHitID, MucRecHit*> MucRecHitContainer::pHitMap |
Definition at line 33 of file MucRecHitContainer.h.
MucRecHitContainer::MucRecHitContainer | ( | ) |
MucRecHitContainer::MucRecHitContainer | ( | const MucRecHitContainer & | source | ) |
MucRecHitContainer::~MucRecHitContainer | ( | ) |
void MucRecHitContainer::AddHit | ( | const int | part, | |
const int | seg, | |||
const int | gap, | |||
const int | strip | |||
) |
Place a new hit object in the container.
Definition at line 142 of file MucRecHitContainer.cxx.
References MucID::getGapNum(), MucID::getPartNum(), MucID::getSegNum(), MucID::getStripNum(), m_GapHitCount, m_pHit, and m_pMucRecHitCol.
00146 { 00147 if ( (part >= 0) && (part < (int)MucID::getPartNum()) && 00148 (seg >= 0) && (seg < (int)MucID::getSegNum(part)) && 00149 (gap >= 0) && (gap < (int)MucID::getGapNum(part)) && 00150 (strip >= 0) && (strip < (int)MucID::getStripNum(part, seg, gap)) ) 00151 { 00152 MucRecHitID gapID(part, seg, gap); 00153 // cout << "MucRecHitContainer::AddHit-I1 " << idGap << endl; 00154 00155 int hitCount = m_GapHitCount[gapID]; 00156 MucRecHitID id(part, seg, gap, hitCount); 00157 // cout << "MucRecHitContainer::AddHit-I2 hit id = " << id << endl; 00158 00159 MucRecHit *pHit = new MucRecHit(part, seg, gap, strip); 00160 m_pMucRecHitCol->push_back(pHit); 00161 00162 m_pHit[id] = pHit; 00163 if(!m_pHit[id]) { 00164 cout << "MucRecHitContainer::AddHit-F1 failed to create new MucRecHit" << endl; 00165 } 00166 else { 00167 m_GapHitCount[gapID]++; 00168 } 00169 } 00170 }
void MucRecHitContainer::AddHit | ( | const Identifier | id | ) |
Definition at line 130 of file MucRecHitContainer.cxx.
References MucID::gap(), MucID::part(), MucID::seg(), and MucID::strip().
Referenced by MucRecTrkExt::execute(), and MucRecRoadFinder::execute().
00131 { 00132 int part = MucID::part(id); 00133 int seg = MucID::seg(id); 00134 int gap = MucID::gap(id); 00135 int strip = MucID::strip(id); 00136 00137 AddHit(part, seg, gap, strip); 00138 }
void MucRecHitContainer::Clear | ( | ) |
Remove all hit objects from the container, and destroy them.
Definition at line 36 of file MucRecHitContainer.cxx.
References MucID::getGapNum(), MucID::getPartNum(), MucID::getSegNum(), m_GapHitCount, and m_pHit.
Referenced by MucRecTrkExt::execute(), MucRecRoadFinder::execute(), and Init().
00037 { 00038 for (int part = 0; part < (int)MucID::getPartNum(); part++) { 00039 for (int seg = 0; seg < (int)MucID::getSegNum(part); seg++) { 00040 for (int gap = 0; gap < (int)MucID::getGapNum(part); gap++) { 00041 MucRecHitID gapID(part, seg, gap); 00042 m_GapHitCount[gapID] = 0; 00043 } 00044 } 00045 } 00046 00047 //m_pMucRecHitCol->clear(); 00048 m_pHit.clear(); 00049 }
void MucRecHitContainer::Destroy | ( | ) |
Destroys the *single* instance of MucRecHitContainer.
int MucRecHitContainer::GetGapHitCount | ( | const int | part, | |
const int | seg, | |||
const int | gap | |||
) |
How many hits are there in this gap?
Definition at line 75 of file MucRecHitContainer.cxx.
References m_GapHitCount.
00078 { 00079 MucRecHitID gapID(part, seg, gap); 00080 return m_GapHitCount[gapID]; 00081 }
int MucRecHitContainer::GetGapHitCount | ( | const MucRecHitID | gapID | ) |
How many hits are there in this gap?
Definition at line 68 of file MucRecHitContainer.cxx.
References m_GapHitCount.
Referenced by MucRecTrkExt::execute(), MucRecRoadFinder::execute(), GetHitByIdentifier(), MucRecTrkExt::TrackFinding(), and MucRecRoadFinder::TrackFinding().
00069 { 00070 if (m_GapHitCount.count(gapID)) return m_GapHitCount[gapID]; 00071 return 0; 00072 }
MucRecHit * MucRecHitContainer::GetHit | ( | const int | part, | |
const int | seg, | |||
const int | gap, | |||
const int | hit | |||
) |
Get a MucRecHit by part, seg, gap, and hit within the gap.
Definition at line 91 of file MucRecHitContainer.cxx.
References m_pHit.
00095 { 00096 MucRecHitID id(part, seg, gap, hit); 00097 return m_pHit[id]; 00098 }
MucRecHit * MucRecHitContainer::GetHit | ( | const MucRecHitID | hitID | ) |
Get a MucRecHit object by hit identifier.
Definition at line 84 of file MucRecHitContainer.cxx.
References m_pHit.
Referenced by MucRecTrkExt::execute(), MucRecRoadFinder::execute(), GetHitByIdentifier(), MucRecTrkExt::TrackFinding(), and MucRecRoadFinder::TrackFinding().
MucRecHit * MucRecHitContainer::GetHitByIdentifier | ( | const int | part, | |
const int | seg, | |||
const int | gap, | |||
const int | strip | |||
) |
Get a MucRecHit by part, seg, gap, and strip. If doesnt exist, return null.
Definition at line 112 of file MucRecHitContainer.cxx.
References MucID::channel_id(), GetGapHitCount(), GetHit(), and genRecEmupikp::i.
00116 { 00117 Identifier id = MucID::channel_id(part, seg, gap, strip); 00118 for(int i = 0; i < GetGapHitCount(part, seg, gap); i++) { 00119 MucRecHit *hit = GetHit(part, seg, gap, i); 00120 if(id == hit->GetID()) { 00121 return hit; 00122 } 00123 } 00124 00125 return 0; 00126 }
MucRecHit * MucRecHitContainer::GetHitByIdentifier | ( | const Identifier | id | ) |
Get a MucRecHit by Identifier. If doesnt exist, return null.
Definition at line 101 of file MucRecHitContainer.cxx.
References MucID::gap(), MucID::part(), MucID::seg(), and MucID::strip().
00102 { 00103 int part = MucID::part(id); 00104 int seg = MucID::seg(id); 00105 int gap = MucID::gap(id); 00106 int strip = MucID::strip(id); 00107 00108 return GetHitByIdentifier(part, seg, gap, strip); 00109 }
int MucRecHitContainer::GetHitCount | ( | ) |
How many hits are there in this event?
Definition at line 52 of file MucRecHitContainer.cxx.
References count, MucID::getGapNum(), MucID::getPartNum(), MucID::getSegNum(), and m_GapHitCount.
00053 { 00054 int count = 0; 00055 for (int part = 0; part < (int)MucID::getPartNum(); part++) { 00056 for (int seg = 0; seg < (int)MucID::getSegNum(part); seg++) { 00057 for (int gap = 0; gap < (int)MucID::getGapNum(part); gap++) { 00058 MucRecHitID gapID(part, seg, gap); 00059 count += m_GapHitCount[gapID]; 00060 } 00061 } 00062 } 00063 00064 return count; 00065 }
MucRecHitCol* MucRecHitContainer::GetMucRecHitCol | ( | ) | [inline] |
Get MucRecHitCol pointer.
Definition at line 61 of file MucRecHitContainer.h.
References m_pMucRecHitCol.
Referenced by MucRecRoadFinder::execute().
00061 { return m_pMucRecHitCol; }
void MucRecHitContainer::Init | ( | ) |
Initializes the MucRecHitContainer with MucRecHitCol.
Definition at line 26 of file MucRecHitContainer.cxx.
References Clear().
00027 { 00028 // cout << "MucRecHitContainer::Init-I1 hello world" << endl; 00029 00030 Clear(); 00031 00032 //cout << "*********** Hit Container Initialized! *********** " << endl; 00033 }
MucRecHitContainer& MucRecHitContainer::operator= | ( | const MucRecHitContainer & | orig | ) |
void MucRecHitContainer::SetMucRecHitCol | ( | MucRecHitCol * | p | ) |
Definition at line 173 of file MucRecHitContainer.cxx.
References m_GapHitCount, m_pHit, and m_pMucRecHitCol.
Referenced by MucRecTrkExt::execute(), and MucRecRoadFinder::execute().
00174 { 00175 m_pMucRecHitCol = p; 00176 00177 MucRecHitCol::iterator imuchit; 00178 for(imuchit = p->begin(); 00179 imuchit != p->end(); 00180 imuchit++){ 00181 int part = (*imuchit)->Part(); 00182 int seg = (*imuchit)->Seg(); 00183 int gap = (*imuchit)->Gap(); 00184 int strip= (*imuchit)->Strip(); 00185 00186 MucRecHitID gapID(part, seg, gap); 00187 int hitCount = m_GapHitCount[gapID]; 00188 MucRecHitID id(part, seg, gap, hitCount); 00189 00190 m_pHit[id] = *imuchit; 00191 if(!m_pHit[id]) { 00192 cout << "MucRecHitContainer::AddHit-F1 failed to create new MucRecHit" << endl; 00193 } 00194 else { 00195 m_GapHitCount[gapID]++; 00196 } 00197 00198 00199 } 00200 00201 }
Definition at line 108 of file MucRecHitContainer.h.
Referenced by AddHit(), Clear(), GetGapHitCount(), GetHitCount(), and SetMucRecHitCol().
Definition at line 109 of file MucRecHitContainer.h.
Referenced by AddHit(), Clear(), GetHit(), and SetMucRecHitCol().
MucRecHitCol* MucRecHitContainer::m_pMucRecHitCol [private] |
Definition at line 106 of file MucRecHitContainer.h.
Referenced by AddHit(), GetMucRecHitCol(), and SetMucRecHitCol().