ShareHolder Class Reference

#include <ShareHolder.h>

List of all members.

Public Member Functions

 ShareHolder ()
 ~ShareHolder ()
void Insert (int chain, int chainhit, double e)
int GetTotRemaining ()
int GetNumShared (int chain, int chainhit)
double GetEShared (int chain, int chainhit)
void Take (int chain, int chainhit, double e)
void BulkInsert (std::vector< Particle3D * > &p3d)
void Reset ()
void dump ()

Private Member Functions

int find (int chain, int chainhit)

Private Attributes

std::vector< hithits

Detailed Description

Definition at line 19 of file ShareHolder.h.


Constructor & Destructor Documentation

ShareHolder::ShareHolder (  ) 

Definition at line 9 of file ShareHolder.cxx.

References hits.

00010 {
00011         hits.clear();
00012 }

ShareHolder::~ShareHolder (  ) 

Definition at line 14 of file ShareHolder.cxx.

00015 {
00016 
00017 }


Member Function Documentation

void ShareHolder::BulkInsert ( std::vector< Particle3D * > &  p3d  ) 

Definition at line 27 of file ShareHolder.cxx.

References MuELoss::e, GetNumShared(), Insert(), and Reset().

00028 {
00029         Reset();
00030         
00031         for(unsigned int i=0;i<p3d.size();i++)
00032         for(int j=0;j<p3d[i]->entries;j++)
00033                         Insert(p3d[i]->chain[j],p3d[i]->chainhit[j],p3d[i]->e[j]);
00034                 
00035         for(unsigned int i=0;i<p3d.size();i++)
00036         for(int j=0;j<p3d[i]->entries;j++)      
00037                 if(GetNumShared(p3d[i]->chain[j],p3d[i]->chainhit[j])>1)
00038                 p3d[i]->SetShared(p3d[i]->chain[j],p3d[i]->chainhit[j]);
00039                         
00040         
00041 }

void ShareHolder::dump (  ) 

Definition at line 120 of file ShareHolder.cxx.

References MuELoss::e, and hits.

Referenced by Finder::RemoveSharedHits().

00121 {
00122 return;
00123 
00124         printf("\ndumping shareholder\n");
00125         for(int i=0;i<(int)hits.size();i++)
00126                 printf("%d %d  #%d  e %f\n",hits[i].chain, hits[i].chainhit, hits[i].nshared,hits[i].e);
00127         printf("\n");
00128 }

int ShareHolder::find ( int  chain,
int  chainhit 
) [private]

Definition at line 105 of file ShareHolder.cxx.

References hits.

Referenced by GetEShared(), GetNumShared(), Insert(), and Take().

00106 {
00107         int idx=-1;
00108         for(int i=0;i<(int)hits.size();i++)
00109                 if(hits[i].chain==chain && hits[i].chainhit==chainhit )
00110                 {
00111                         idx=i;
00112                         break;
00113                 }
00114                 
00115         return idx;
00116 }

double ShareHolder::GetEShared ( int  chain,
int  chainhit 
)

Definition at line 78 of file ShareHolder.cxx.

References find(), and hits.

Referenced by Finder::RemoveSharedHits().

00079 {
00080         int i=find(chain,chainhit);
00081         if(i>-1)
00082                 return hits[i].e;
00083         else
00084                 return 0;
00085 }

int ShareHolder::GetNumShared ( int  chain,
int  chainhit 
)

Definition at line 69 of file ShareHolder.cxx.

References find(), and hits.

Referenced by BulkInsert(), and Finder::RemoveSharedHits().

00070 {
00071         int i=find(chain,chainhit);
00072         if(i>-1)
00073                 return hits[i].nshared;
00074         else
00075                 return 0;
00076 }

int ShareHolder::GetTotRemaining (  ) 

Definition at line 61 of file ShareHolder.cxx.

References hits.

Referenced by Finder::DumpParticle3D().

00062 {
00063         int cnt=0;
00064         for(unsigned int i=0;i<hits.size();i++)
00065                 if(hits[i].nshared>1)cnt++;
00066         return cnt;
00067 }

void ShareHolder::Insert ( int  chain,
int  chainhit,
double  e 
)

Definition at line 44 of file ShareHolder.cxx.

References hit::chain, hit::chainhit, hit::e, find(), hits, and hit::nshared.

Referenced by BulkInsert().

00045 {
00046         int i=find(chain,chainhit);
00047         if(i>-1)
00048         {
00049                 //hits[i].e+=e;
00050                 hits[i].nshared++;
00051         }else{
00052                 hit h;
00053                 h.e=e;
00054                 h.chain=chain;
00055                 h.chainhit=chainhit;
00056                 h.nshared=1;
00057                 hits.push_back(h);
00058         }
00059 }

void ShareHolder::Reset (  ) 

Definition at line 21 of file ShareHolder.cxx.

References hits.

Referenced by BulkInsert(), and Finder::Reset().

00022 {
00023         hits.clear();
00024 }

void ShareHolder::Take ( int  chain,
int  chainhit,
double  e 
)

Definition at line 87 of file ShareHolder.cxx.

References find(), and hits.

Referenced by Finder::RemoveSharedHits(), and Finder::StripMuon1().

00088 {
00089 
00090         //printf("taking hits from %d %d %f    ",chain,chainhit,e);
00091 
00092         int i=find(chain,chainhit);
00093         if(i>-1)
00094         {
00095         
00096                 hits[i].e-=e;
00097                 hits[i].nshared--;
00098                 
00099         //      printf("   now sharing %d\n",hits[i].nshared);  
00100                 
00101         }
00102 }       


Member Data Documentation

std::vector<hit> ShareHolder::hits [private]

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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1