Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MucRecHitContainer Class Reference

#include <MucRecHitContainer.h>

List of all members.

Public Types

typedef std::map< MucRecHitID,
int > 
GapHitCountMap
typedef std::map< MucRecHitID,
int > 
GapHitCountMap
typedef std::map< MucRecHitID,
MucRecHit * > 
pHitMap
typedef std::map< MucRecHitID,
MucRecHit * > 
pHitMap

Public Member Functions

void AddHit (const int part, const int seg, const int gap, const int strip)
 Place a new hit object in the container.
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 AddHit (const Identifier id)
void Clear ()
 Remove all hit objects from the container, and destroy them.
void Clear ()
 Remove all hit objects from the container, and destroy them.
void Destroy ()
 Destroys the *single* instance of MucRecHitContainer.
void Destroy ()
 Destroys the *single* instance of MucRecHitContainer.
int GetGapHitCount (const int part, const int seg, const int gap)
 How many hits are there in this gap?
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?
int GetGapHitCount (const MucRecHitID gapID)
 How many hits are there in this gap?
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.
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.
MucRecHitGetHit (const MucRecHitID hitID)
 Get a MucRecHit object by hit identifier.
MucRecHitGetHitByIdentifier (const int part, const int seg, const int gap, const int strip)
MucRecHitGetHitByIdentifier (const Identifier id)
MucRecHitGetHitByIdentifier (const int part, const int seg, const int gap, const int strip)
MucRecHitGetHitByIdentifier (const Identifier id)
int GetHitCount ()
 How many hits are there in this event?
int GetHitCount ()
 How many hits are there in this event?
MucRecHitColGetMucRecHitCol ()
 Get MucRecHitCol pointer.
MucRecHitColGetMucRecHitCol ()
 Get MucRecHitCol pointer.
void Init ()
 Initializes the MucRecHitContainer with MucRecHitCol.
void Init ()
 Initializes the MucRecHitContainer with MucRecHitCol.
 MucRecHitContainer (const MucRecHitContainer &source)
 MucRecHitContainer ()
 MucRecHitContainer (const MucRecHitContainer &source)
 MucRecHitContainer ()
MucRecHitContaineroperator= (const MucRecHitContainer &orig)
MucRecHitContaineroperator= (const MucRecHitContainer &orig)
void SetMucRecHitCol (MucRecHitCol *p)
void SetMucRecHitCol (MucRecHitCol *p)
 ~MucRecHitContainer ()
 ~MucRecHitContainer ()

Private Attributes

MucRecHitContainer::GapHitCountMap m_GapHitCount
MucRecHitContainer::pHitMap m_pHit
MucRecHitColm_pMucRecHitCol
MucRecHitColm_pMucRecHitCol


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 {mailto:youzy@hep.pku.cn}
See also:
MucRecHit


Member Typedef Documentation

typedef std::map<MucRecHitID, int> MucRecHitContainer::GapHitCountMap
 

typedef std::map<MucRecHitID, int> MucRecHitContainer::GapHitCountMap
 

typedef std::map<MucRecHitID, MucRecHit*> MucRecHitContainer::pHitMap
 

typedef std::map<MucRecHitID, MucRecHit*> MucRecHitContainer::pHitMap
 


Constructor & Destructor Documentation

MucRecHitContainer::MucRecHitContainer  ) 
 

00016 { }

MucRecHitContainer::MucRecHitContainer const MucRecHitContainer source  ) 
 

MucRecHitContainer::~MucRecHitContainer  ) 
 

00020 {
00021   //Clear();
00022 }

MucRecHitContainer::MucRecHitContainer  ) 
 

MucRecHitContainer::MucRecHitContainer const MucRecHitContainer source  ) 
 

MucRecHitContainer::~MucRecHitContainer  ) 
 


Member Function Documentation

void MucRecHitContainer::AddHit const int  part,
const int  seg,
const int  gap,
const int  strip
 

Place a new hit object in the container.

void MucRecHitContainer::AddHit const Identifier  id  ) 
 

void MucRecHitContainer::AddHit const int  part,
const int  seg,
const int  gap,
const int  strip
 

Place a new hit object in the container.

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  ) 
 

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.

void MucRecHitContainer::Clear  ) 
 

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

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.

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?

int MucRecHitContainer::GetGapHitCount const MucRecHitID  gapID  ) 
 

How many hits are there in this gap?

int MucRecHitContainer::GetGapHitCount const int  part,
const int  seg,
const int  gap
 

How many hits are there in this gap?

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?

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.

MucRecHit* MucRecHitContainer::GetHit const MucRecHitID  hitID  ) 
 

Get a MucRecHit object by hit identifier.

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.

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.

00085 {
00086   if (m_pHit.count(id)) return m_pHit[id];
00087   else return 0;
00088 }

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.

MucRecHit* MucRecHitContainer::GetHitByIdentifier const Identifier  id  ) 
 

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

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.

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.

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?

int MucRecHitContainer::GetHitCount  ) 
 

How many hits are there in this event?

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.

00061 { return m_pMucRecHitCol; }

MucRecHitCol* MucRecHitContainer::GetMucRecHitCol  )  [inline]
 

Get MucRecHitCol pointer.

00061 { return m_pMucRecHitCol; }

void MucRecHitContainer::Init  ) 
 

Initializes the MucRecHitContainer with MucRecHitCol.

void MucRecHitContainer::Init  ) 
 

Initializes the MucRecHitContainer with MucRecHitCol.

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  ) 
 

MucRecHitContainer& MucRecHitContainer::operator= const MucRecHitContainer orig  ) 
 

void MucRecHitContainer::SetMucRecHitCol MucRecHitCol p  ) 
 

void MucRecHitContainer::SetMucRecHitCol MucRecHitCol p  ) 
 

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 }


Member Data Documentation

MucRecHitContainer::GapHitCountMap MucRecHitContainer::m_GapHitCount [private]
 

MucRecHitContainer::pHitMap MucRecHitContainer::m_pHit [private]
 

MucRecHitCol* MucRecHitContainer::m_pMucRecHitCol [private]
 

MucRecHitCol* MucRecHitContainer::m_pMucRecHitCol [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:36:05 2011 for BOSS6.5.5 by  doxygen 1.3.9.1