CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
MucRecHitContainer Class Reference

#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)
 
MucRecHitContaineroperator= (const MucRecHitContainer &orig)
 
 ~MucRecHitContainer ()
 
void Init ()
 Points to the single instance of MucRecHitContainer.
 
void Destroy ()
 Destroys the single instance of MucRecHitContainer.
 
void SetMucRecHitCol (MucRecHitCol *p)
 
MucRecHitColGetMucRecHitCol ()
 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?
 
MucRecHitGetHit (const MucRecHitID hitID)
 Get a MucRecHit object by hit identifier.
 
MucRecHitGetHit (const int part, const int seg, const int gap, const int hit)
 Get a MucRecHit by part, seg, gap, and hit within the gap.
 
MucRecHitGetHitByIdentifier (const Identifier id)
 
MucRecHitGetHitByIdentifier (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.
 

Detailed Description

MucRecHitContainer has a MucRecHitCol which contains all MucRecHit objects for a single event. Access is optimized for referencing by BesMUCRecHitID indices.

Author
Zhengyun You \URL{youzy.nosp@m.@hep.nosp@m..pku..nosp@m.cn}
See also
MucRecHit

Definition at line 29 of file MucRecHitContainer.h.

Member Typedef Documentation

◆ GapHitCountMap

Definition at line 32 of file MucRecHitContainer.h.

◆ pHitMap

Definition at line 33 of file MucRecHitContainer.h.

Constructor & Destructor Documentation

◆ MucRecHitContainer() [1/2]

MucRecHitContainer::MucRecHitContainer ( )

Definition at line 15 of file MucRecHitContainer.cxx.

16{ }

◆ MucRecHitContainer() [2/2]

MucRecHitContainer::MucRecHitContainer ( const MucRecHitContainer & source)

◆ ~MucRecHitContainer()

MucRecHitContainer::~MucRecHitContainer ( )

Definition at line 19 of file MucRecHitContainer.cxx.

20{
21 //Clear();
22}

Member Function Documentation

◆ AddHit() [1/2]

void MucRecHitContainer::AddHit ( const Identifier id)

Definition at line 130 of file MucRecHitContainer.cxx.

131{
132 int part = MucID::part(id);
133 int seg = MucID::seg(id);
134 int gap = MucID::gap(id);
135 int strip = MucID::strip(id);
136
137 AddHit(part, seg, gap, strip);
138}
static int part(const Identifier &id)
Definition MucID.cxx:46
static int gap(const Identifier &id)
Definition MucID.cxx:66
static int seg(const Identifier &id)
Definition MucID.cxx:56
static int strip(const Identifier &id)
Definition MucID.cxx:76
void AddHit(const Identifier id)

Referenced by AddHit(), MucRecRoadFinder::execute(), and MucRecTrkExt::execute().

◆ AddHit() [2/2]

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.

146{
147 if ( (part >= 0) && (part < (int)MucID::getPartNum()) &&
148 (seg >= 0) && (seg < (int)MucID::getSegNum(part)) &&
149 (gap >= 0) && (gap < (int)MucID::getGapNum(part)) &&
150 (strip >= 0) && (strip < (int)MucID::getStripNum(part, seg, gap)) )
151 {
152 MucRecHitID gapID(part, seg, gap);
153 // cout << "MucRecHitContainer::AddHit-I1 " << idGap << endl;
154
155 int hitCount = m_GapHitCount[gapID];
156 MucRecHitID id(part, seg, gap, hitCount);
157 // cout << "MucRecHitContainer::AddHit-I2 hit id = " << id << endl;
158
159 MucRecHit *pHit = new MucRecHit(part, seg, gap, strip);
160 m_pMucRecHitCol->push_back(pHit);
161
162 m_pHit[id] = pHit;
163 if(!m_pHit[id]) {
164 cout << "MucRecHitContainer::AddHit-F1 failed to create new MucRecHit" << endl;
165 }
166 else {
167 m_GapHitCount[gapID]++;
168 }
169 }
170}
static value_type getPartNum()
Definition MucID.cxx:159
static value_type getSegNum(int part)
Definition MucID.cxx:164
static value_type getStripNum(int part, int seg, int gap)
Definition MucID.cxx:178
static value_type getGapNum(int part)
Definition MucID.cxx:171

◆ Clear()

void MucRecHitContainer::Clear ( )

Remove all hit objects from the container, and destroy them.

Definition at line 36 of file MucRecHitContainer.cxx.

37{
38 for (int part = 0; part < (int)MucID::getPartNum(); part++) {
39 for (int seg = 0; seg < (int)MucID::getSegNum(part); seg++) {
40 for (int gap = 0; gap < (int)MucID::getGapNum(part); gap++) {
41 MucRecHitID gapID(part, seg, gap);
42 m_GapHitCount[gapID] = 0;
43 }
44 }
45 }
46
47 //m_pMucRecHitCol->clear();
48 m_pHit.clear();
49}

Referenced by MucRecRoadFinder::execute(), MucRecTrkExt::execute(), and Init().

◆ Destroy()

void MucRecHitContainer::Destroy ( )

Destroys the single instance of MucRecHitContainer.

◆ GetGapHitCount() [1/2]

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.

78{
79 MucRecHitID gapID(part, seg, gap);
80 return m_GapHitCount[gapID];
81}

◆ GetGapHitCount() [2/2]

int MucRecHitContainer::GetGapHitCount ( const MucRecHitID gapID)

How many hits are there in this gap?

Definition at line 68 of file MucRecHitContainer.cxx.

69{
70 if (m_GapHitCount.count(gapID)) return m_GapHitCount[gapID];
71 return 0;
72}

Referenced by MucRecRoadFinder::execute(), MucRecTrkExt::execute(), GetHitByIdentifier(), MucRecRoadFinder::TrackFinding(), and MucRecTrkExt::TrackFinding().

◆ GetHit() [1/2]

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.

95{
96 MucRecHitID id(part, seg, gap, hit);
97 return m_pHit[id];
98}

◆ GetHit() [2/2]

MucRecHit * MucRecHitContainer::GetHit ( const MucRecHitID hitID)

Get a MucRecHit object by hit identifier.

Definition at line 84 of file MucRecHitContainer.cxx.

85{
86 if (m_pHit.count(id)) return m_pHit[id];
87 else return 0;
88}

Referenced by MucRecRoadFinder::execute(), MucRecTrkExt::execute(), GetHitByIdentifier(), MucRecRoadFinder::TrackFinding(), and MucRecTrkExt::TrackFinding().

◆ GetHitByIdentifier() [1/2]

MucRecHit * MucRecHitContainer::GetHitByIdentifier ( const Identifier id)

Get a MucRecHit by Identifier. If doesnt exist, return null.

Definition at line 101 of file MucRecHitContainer.cxx.

102{
103 int part = MucID::part(id);
104 int seg = MucID::seg(id);
105 int gap = MucID::gap(id);
106 int strip = MucID::strip(id);
107
108 return GetHitByIdentifier(part, seg, gap, strip);
109}
MucRecHit * GetHitByIdentifier(const Identifier id)

Referenced by GetHitByIdentifier().

◆ GetHitByIdentifier() [2/2]

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.

116{
117 Identifier id = MucID::channel_id(part, seg, gap, strip);
118 for(int i = 0; i < GetGapHitCount(part, seg, gap); i++) {
119 MucRecHit *hit = GetHit(part, seg, gap, i);
120 if(id == hit->GetID()) {
121 return hit;
122 }
123 }
124
125 return 0;
126}
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
Definition MucID.cxx:135
MucRecHit * GetHit(const MucRecHitID hitID)
Get a MucRecHit object by hit identifier.
int GetGapHitCount(const MucRecHitID gapID)
How many hits are there in this gap?
Identifier GetID() const
Get soft identifier of this hit.
Definition MucRecHit.h:68

◆ GetHitCount()

int MucRecHitContainer::GetHitCount ( )

How many hits are there in this event?

Definition at line 52 of file MucRecHitContainer.cxx.

53{
54 int count = 0;
55 for (int part = 0; part < (int)MucID::getPartNum(); part++) {
56 for (int seg = 0; seg < (int)MucID::getSegNum(part); seg++) {
57 for (int gap = 0; gap < (int)MucID::getGapNum(part); gap++) {
58 MucRecHitID gapID(part, seg, gap);
59 count += m_GapHitCount[gapID];
60 }
61 }
62 }
63
64 return count;
65}
uint32_t count(const node_t &list)
Definition node.cxx:42

◆ GetMucRecHitCol()

MucRecHitCol * MucRecHitContainer::GetMucRecHitCol ( )
inline

Get MucRecHitCol pointer.

Definition at line 61 of file MucRecHitContainer.h.

61{ return m_pMucRecHitCol; }

Referenced by MucRecRoadFinder::execute().

◆ Init()

void MucRecHitContainer::Init ( )

Points to the single instance of MucRecHitContainer.

Initializes the MucRecHitContainer with MucRecHitCol.

Definition at line 26 of file MucRecHitContainer.cxx.

27{
28 // cout << "MucRecHitContainer::Init-I1 hello world" << endl;
29
30 Clear();
31
32 //cout << "*********** Hit Container Initialized! *********** " << endl;
33}
void Clear()
Remove all hit objects from the container, and destroy them.

◆ operator=()

MucRecHitContainer & MucRecHitContainer::operator= ( const MucRecHitContainer & orig)

◆ SetMucRecHitCol()

void MucRecHitContainer::SetMucRecHitCol ( MucRecHitCol * p)

Definition at line 173 of file MucRecHitContainer.cxx.

174{
175 m_pMucRecHitCol = p;
176
177 MucRecHitCol::iterator imuchit;
178 for(imuchit = p->begin();
179 imuchit != p->end();
180 imuchit++){
181 int part = (*imuchit)->Part();
182 int seg = (*imuchit)->Seg();
183 int gap = (*imuchit)->Gap();
184 int strip= (*imuchit)->Strip();
185
186 MucRecHitID gapID(part, seg, gap);
187 int hitCount = m_GapHitCount[gapID];
188 MucRecHitID id(part, seg, gap, hitCount);
189
190 m_pHit[id] = *imuchit;
191 if(!m_pHit[id]) {
192 cout << "MucRecHitContainer::AddHit-F1 failed to create new MucRecHit" << endl;
193 }
194 else {
195 m_GapHitCount[gapID]++;
196 }
197
198
199 }
200
201}

Referenced by MucRecRoadFinder::execute(), and MucRecTrkExt::execute().


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