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

sim::HitProfile Class Reference

#include <HitProfile.h>

List of all members.

Public Member Functions

 HitProfile ()
 ~HitProfile ()
unsigned int NComponents () const
std::pair< unsigned short,
float > 
Component (unsigned int i) const
std::pair< unsigned short,
float > 
Component (unsigned int i, float fact) const
unsigned short TrackId (unsigned int i) const
float Fraction (unsigned int i) const
unsigned short NoiseId () const
void Push (std::pair< unsigned short, float > component)
void Push (unsigned short, float)
void SetFraction (unsigned int i, float fraction)
void NormalizeFraction ()
void Combine ()
void Clear ()

Public Attributes

std::vector< unsigned short > fTrackId
std::vector< float > fFraction
unsigned short kNoiseId


Constructor & Destructor Documentation

HitProfile::HitProfile  ) 
 

Definition at line 6 of file HitProfile.cxx.

00006                        :
00007   fTrackId(0), fFraction(0), kNoiseId(65535)
00008 {
00009 }

HitProfile::~HitProfile  ) 
 

Definition at line 13 of file HitProfile.cxx.

00013                         {
00014 }


Member Function Documentation

void HitProfile::Clear  ) 
 

Definition at line 173 of file HitProfile.cxx.

References fFraction, and fTrackId.

Referenced by rsim::FarProcessor::ProcessChannel().

00174 {
00175   fTrackId.clear();
00176   fFraction.clear();
00177   return;
00178 }

void HitProfile::Combine  ) 
 

Definition at line 140 of file HitProfile.cxx.

References fFraction, and fTrackId.

Referenced by rsim::FarProcessor::ProcessChannel().

00141 {
00142   std::vector<unsigned short> copyTrackId = fTrackId;
00143   std::vector<float>          copyFraction = fFraction;
00144   
00145   fTrackId.clear();
00146   fFraction.clear();
00147 
00148   for(unsigned int i=0; i<copyTrackId.size(); i++) {
00149 
00150     bool duplicated = false;
00151 
00152     for(unsigned int j=0; j<fTrackId.size(); j++) {
00153 
00154       if(copyTrackId[i]==fTrackId[j]) {
00155         fFraction[j] += copyFraction[i];
00156         duplicated = true;
00157         continue;
00158       }
00159     }
00160 
00161     if(!duplicated) {
00162       fTrackId.push_back(copyTrackId[i]);
00163       fFraction.push_back(copyFraction[i]);
00164     }
00165 
00166   }
00167 
00168   return;
00169 }

std::pair< unsigned short, float > HitProfile::Component unsigned int  i,
float  fact
const
 

Definition at line 44 of file HitProfile.cxx.

References assert_jobc, fFraction, and fTrackId.

00045 {
00046   char msg[256];
00047   sprintf(msg,"HitProfile::Component(%d) out of range!",i);
00048   assert_jobc(i>=0 && (i<fTrackId.size()),msg);
00049 
00050   std::pair<unsigned short, float> component;
00051   component.first  = fTrackId[i];
00052   component.second = fFraction[i] * fact;
00053 
00054   return component;
00055 }

std::pair< unsigned short, float > HitProfile::Component unsigned int  i  )  const
 

Definition at line 29 of file HitProfile.cxx.

References assert_jobc, fFraction, and fTrackId.

Referenced by sim::MCDigitInfo::GetFraction().

00030 {
00031   char msg[256];
00032   sprintf(msg,"HitProfile::Component(%d) out of range!",i);
00033   assert_jobc(i>=0 && (i<fTrackId.size()),msg);
00034 
00035   std::pair<unsigned short, float> component;
00036   component.first  = fTrackId[i];
00037   component.second = fFraction[i];
00038 
00039   return component;
00040 }

float HitProfile::Fraction unsigned int  i  )  const
 

Definition at line 79 of file HitProfile.cxx.

References assert_jobc, and fFraction.

Referenced by sim::MCDigitInfo::GetFraction().

00080 {
00081   char msg[256];
00082   sprintf(msg,"HitProfile::Fraction(%d) out of range!",i);
00083   assert_jobc(i>=0 && (i<fFraction.size()),msg);
00084 
00085   return fFraction[i];
00086 }

unsigned int HitProfile::NComponents  )  const
 

Definition at line 18 of file HitProfile.cxx.

References assert_jobc, fFraction, and fTrackId.

Referenced by NormalizeFraction().

00018                                            {
00019 
00020   char msg[256];
00021   sprintf(msg,"HitProfile::NComponents() inconsistent size!");
00022   assert_jobc(fTrackId.size()==fFraction.size(),msg);
00023   
00024   return fTrackId.size();
00025 }

unsigned short HitProfile::NoiseId  )  const
 

Definition at line 59 of file HitProfile.cxx.

Referenced by rsim::FarProcessor::ProcessChannel().

00060 {
00061   return kNoiseId;
00062 
00063 }

void HitProfile::NormalizeFraction  ) 
 

Definition at line 122 of file HitProfile.cxx.

References fFraction, and NComponents().

Referenced by rsim::FarProcessor::ProcessChannel().

00123 {
00124   if(this->NComponents()==0) return;
00125 
00126   float total = 0.;
00127   for(unsigned int j=0; j<this->NComponents(); j++) 
00128     total += fFraction[j];
00129 
00130   if(total==0) return;
00131 
00132   for(unsigned int j=0; j<this->NComponents(); j++) 
00133     fFraction[j] /= total;
00134 
00135   return;
00136 }

void HitProfile::Push unsigned  short,
float 
 

Definition at line 99 of file HitProfile.cxx.

References fFraction, and fTrackId.

00100 {
00101   fTrackId.push_back(trackid);
00102   fFraction.push_back(fraction);
00103   return;
00104 }

void HitProfile::Push std::pair< unsigned short, float >  component  ) 
 

Definition at line 90 of file HitProfile.cxx.

References fFraction, and fTrackId.

Referenced by rsim::FarProcessor::ProcessChannel().

00091 {
00092   fTrackId.push_back(component.first);
00093   fFraction.push_back(component.second);
00094   return;
00095 }

void HitProfile::SetFraction unsigned int  i,
float  fraction
 

Definition at line 108 of file HitProfile.cxx.

References assert_jobc, and fFraction.

00109 {
00110   char msg[256];
00111   sprintf(msg,"HitProfile::SetFraction(%d) out of range!",i);
00112   assert_jobc(i>=0 && (i<fFraction.size()),msg);
00113 
00114   fFraction[i] = fraction;
00115 
00116   return;
00117 
00118 }

unsigned short HitProfile::TrackId unsigned int  i  )  const
 

Definition at line 67 of file HitProfile.cxx.

References assert_jobc, and fTrackId.

Referenced by sim::MCDigitInfo::GetFraction().

00068 {
00069   char msg[256];
00070   sprintf(msg,"HitProfile::TrackId(%d) out of range!",i);
00071   assert_jobc(i>=0 && (i<fTrackId.size()),msg);
00072 
00073   return fTrackId[i];
00074 
00075 }


Member Data Documentation

std::vector<float> sim::HitProfile::fFraction
 

Definition at line 46 of file HitProfile.h.

Referenced by Clear(), Combine(), Component(), Fraction(), NComponents(), NormalizeFraction(), Push(), and SetFraction().

std::vector<unsigned short> sim::HitProfile::fTrackId
 

Definition at line 45 of file HitProfile.h.

Referenced by Clear(), Combine(), Component(), NComponents(), Push(), and TrackId().

unsigned short sim::HitProfile::kNoiseId
 

Definition at line 47 of file HitProfile.h.


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 02:35:34 2008 for NOvA Offline by  doxygen 1.3.9.1