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

PixelSpot Class Reference

#include <PixelSpot.h>

List of all members.

Public Member Functions

 PixelSpot ()
 PixelSpot (int id)
 ~PixelSpot ()
int GetId ()
void AddStrip (int strip, double q, double strip_e)
void Dump ()
void SetPixel (Pixel *p)
PixelGetPixel ()
double GetE ()
double GetStripE ()
int GetNStrips ()
std::vector< int > GetStrips ()
double GetStripQ (int idx)
void AddE (double e)
void TakeE (double e)
int GetStatus ()

Static Public Attributes

int printit = -1

Private Member Functions

void Init (int id)

Private Attributes

int id
std::vector< int > strips
std::vector< double > q
std::vector< double > strip_e
double sum_q
double sum_strip_e
double spot_e
int n
PixelparentPixel
int status


Constructor & Destructor Documentation

PixelSpot::PixelSpot  ) 
 

Definition at line 10 of file PixelSpot.cxx.

References Init().

00011 {
00012         Init(-1);
00013 }

PixelSpot::PixelSpot int  id  ) 
 

Definition at line 15 of file PixelSpot.cxx.

References Init().

00016 {
00017         Init(id);
00018 }

PixelSpot::~PixelSpot  ) 
 

Definition at line 8 of file PixelSpot.cxx.

00008 {}


Member Function Documentation

void PixelSpot::AddE double  e  ) 
 

Definition at line 106 of file PixelSpot.cxx.

References Pixel::AddE(), Pixel::AddStripE(), GetPixel(), Pixel::GetPMT(), parentPixel, q, PMT::SetStatus(), Pixel::SetStatus(), spot_e, status, strip_e, strips, and sum_strip_e.

Referenced by XTalkFilter::CleanXTalk().

00107 {
00108         spot_e+=e;
00109         status=1;
00110         GetPixel()->SetStatus(1);
00111         GetPixel()->GetPMT()->SetStatus(1);
00112         for(unsigned int i=0;i<strips.size();i++)
00113         {
00114                 strip_e[i]=strip_e[i] + e*strip_e[i]/sum_strip_e;
00115                 q[i]=q[i] + e*q[i]/sum_q;
00116 
00117         }
00118         sum_q+=e;
00119         sum_strip_e+=e;
00120         parentPixel->AddE(e);
00121         parentPixel->AddStripE(e);
00122         
00123 // if(printit)printf("adding to pixel with addr %p\n",parentPixel);
00124 
00125 }

void PixelSpot::AddStrip int  strip,
double  q,
double  strip_e
 

Definition at line 91 of file PixelSpot.cxx.

References Pixel::AddE(), Pixel::AddStripE(), Pixel::GetPMT(), PMT::IncStripCount(), n, parentPixel, strips, and sum_strip_e.

Referenced by XTalkFilter::DoTrueFilter().

00092 {
00093 // if(printit)printf("adding strip with idx %d\n",strip);
00094 
00095         this->strips.push_back(strip);
00096         this->strip_e.push_back(strip_e);
00097         this->q.push_back(q);
00098         sum_q+=q;
00099         sum_strip_e+=strip_e;
00100         n++;
00101         parentPixel->AddE(q);
00102         parentPixel->AddStripE(strip_e);
00103         parentPixel->GetPMT()->IncStripCount();
00104 }

void PixelSpot::Dump  ) 
 

Definition at line 82 of file PixelSpot.cxx.

References n, q, and strips.

Referenced by Pixel::Dump().

00083 {
00084         if(printit)printf("\t\t PixelSpot %d  n %d  e %f strips ",
00085                                                       id,n,sum_q);
00086         for(unsigned int i=0;i<strips.size();i++)
00087                        if(printit)printf(" %d %f",strips[i],q[i]);
00088         if(printit)printf("\n");
00089 }

double PixelSpot::GetE  )  [inline]
 

Definition at line 24 of file PixelSpot.h.

Referenced by XTalkFilter::CleanXTalk(), and XTalkFilter::SaveAdjustment().

00024 {return sum_q;};

int PixelSpot::GetId  )  [inline]
 

Definition at line 15 of file PixelSpot.h.

Referenced by XTalkFilter::CleanXTalk(), and XTalkFilter::SaveAdjustment().

00015 {return id;};

int PixelSpot::GetNStrips  )  [inline]
 

Definition at line 26 of file PixelSpot.h.

Referenced by Pixel::GetNStrips().

00026 {return n;};

Pixel * PixelSpot::GetPixel  ) 
 

Definition at line 25 of file PixelSpot.cxx.

Referenced by AddE(), and TakeE().

00026 {
00027         return parentPixel;
00028 }

int PixelSpot::GetStatus  )  [inline]
 

Definition at line 35 of file PixelSpot.h.

Referenced by XTalkFilter::CleanXTalk(), and XTalkFilter::SaveAdjustment().

00035 {return status;};

double PixelSpot::GetStripE  )  [inline]
 

Definition at line 25 of file PixelSpot.h.

00025 {return sum_strip_e;};

double PixelSpot::GetStripQ int  idx  )  [inline]
 

Definition at line 29 of file PixelSpot.h.

00029 {if(idx>-1&&idx<n)return q[idx];return 0;};

std::vector<int> PixelSpot::GetStrips  )  [inline]
 

Definition at line 28 of file PixelSpot.h.

Referenced by XTalkFilter::SaveAdjustment().

00028 {return strips;};

void PixelSpot::Init int  id  )  [private]
 

Definition at line 30 of file PixelSpot.cxx.

References MsgService::Instance(), MsgService::IsActive(), n, printit, q, spot_e, status, strip_e, strips, and sum_strip_e.

Referenced by PixelSpot().

00031 {
00032         if(printit<0)
00033         {
00034                 if(MsgService::Instance()->IsActive("XTalkFilter",
00035                                            Msg::kDebug))printit=1;
00036                 else printit=0;
00037         }
00038 
00039         this->id=id;
00040         strips.clear();
00041         q.clear();
00042         sum_q=0;
00043         n=0;
00044         strip_e.clear();
00045         sum_strip_e=0;
00046         spot_e=0;
00047         status=0;
00048 
00049 }

void PixelSpot::SetPixel Pixel p  ) 
 

Definition at line 20 of file PixelSpot.cxx.

References parentPixel.

Referenced by Pixel::GetPixelSpot().

00021 {
00022         parentPixel=p;
00023 }

void PixelSpot::TakeE double  e  ) 
 

Definition at line 52 of file PixelSpot.cxx.

References Pixel::AddE(), Pixel::AddStripE(), GetPixel(), Pixel::GetPMT(), parentPixel, q, PMT::SetStatus(), Pixel::SetStatus(), status, strip_e, strips, and sum_strip_e.

00053 {
00054      //   if(printit)printf("pixelspot take %f\n",e);
00055         if(sum_strip_e<=0)return;
00056                 
00057        // if(printit)printf("sum_strip_e %f\n",sum_strip_e);      
00058         for(unsigned int i=0;i<strip_e.size();i++)
00059         {
00060                 double totake = e * strip_e[i]/sum_strip_e;
00061         
00062                 if(printit)printf("pixelspot adjusting strip %d e from %f to %f\n",
00063                                  strips[i],strip_e[i],strip_e[i]-totake);
00064                 strip_e[i]-=totake;
00065                 q[i]-= + e*q[i]/sum_q;
00066         }
00067 
00068         //recalculate sum_q
00069         sum_q=0;
00070         sum_strip_e=0;
00071         for(unsigned int i=0;i<q.size();i++)sum_q+=q[i];
00072         for(unsigned int i=0;i<strip_e.size();i++)sum_strip_e+=strip_e[i];
00073 
00074 // mark the change
00075         status=1;
00076         GetPixel()->SetStatus(1);
00077         GetPixel()->GetPMT()->SetStatus(1);
00078         parentPixel->AddE(-e);
00079         parentPixel->AddStripE(-e);
00080 }


Member Data Documentation

int PixelSpot::id [private]
 

Definition at line 41 of file PixelSpot.h.

int PixelSpot::n [private]
 

Definition at line 48 of file PixelSpot.h.

Referenced by AddStrip(), Dump(), and Init().

Pixel* PixelSpot::parentPixel [private]
 

Definition at line 49 of file PixelSpot.h.

Referenced by AddE(), AddStrip(), SetPixel(), and TakeE().

int PixelSpot::printit = -1 [static]
 

Definition at line 6 of file PixelSpot.cxx.

Referenced by Init().

std::vector<double> PixelSpot::q [private]
 

Definition at line 43 of file PixelSpot.h.

Referenced by AddE(), Dump(), Init(), and TakeE().

double PixelSpot::spot_e [private]
 

Definition at line 47 of file PixelSpot.h.

Referenced by AddE(), and Init().

int PixelSpot::status [private]
 

Definition at line 51 of file PixelSpot.h.

Referenced by AddE(), Init(), and TakeE().

std::vector<double> PixelSpot::strip_e [private]
 

Definition at line 44 of file PixelSpot.h.

Referenced by AddE(), Init(), and TakeE().

std::vector<int> PixelSpot::strips [private]
 

Definition at line 42 of file PixelSpot.h.

Referenced by AddE(), AddStrip(), Dump(), Init(), and TakeE().

double PixelSpot::sum_q [private]
 

Definition at line 45 of file PixelSpot.h.

double PixelSpot::sum_strip_e [private]
 

Definition at line 46 of file PixelSpot.h.

Referenced by AddE(), AddStrip(), Init(), and TakeE().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:03 2010 for loon by  doxygen 1.3.9.1