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

static 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

Detailed Description

Definition at line 8 of file PixelSpot.h.


Constructor & Destructor Documentation

PixelSpot::PixelSpot (  ) 

Definition at line 12 of file PixelSpot.cxx.

References Init().

00013 {
00014         Init(-1);
00015 }

PixelSpot::PixelSpot ( int  id  ) 

Definition at line 17 of file PixelSpot.cxx.

References Init().

00018 {
00019         Init(id);
00020 }

PixelSpot::~PixelSpot (  ) 

Definition at line 10 of file PixelSpot.cxx.

00010 {}


Member Function Documentation

void PixelSpot::AddE ( double  e  ) 

Definition at line 108 of file PixelSpot.cxx.

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

Referenced by XTalkFilter::CleanXTalk().

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

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

Definition at line 93 of file PixelSpot.cxx.

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

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

void PixelSpot::Dump (  ) 

Definition at line 84 of file PixelSpot.cxx.

References n, printit, q, and strips.

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

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.

References n.

00026 {return n;};

Pixel * PixelSpot::GetPixel (  ) 

Definition at line 27 of file PixelSpot.cxx.

References parentPixel.

Referenced by AddE(), and TakeE().

00028 {
00029         return parentPixel;
00030 }

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.

References sum_strip_e.

00025 {return sum_strip_e;};

double PixelSpot::GetStripQ ( int  idx  )  [inline]

Definition at line 29 of file PixelSpot.h.

References n, and q.

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.

References strips.

Referenced by XTalkFilter::SaveAdjustment().

00028 {return strips;};

void PixelSpot::Init ( int  id  )  [private]

Definition at line 32 of file PixelSpot.cxx.

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

Referenced by PixelSpot().

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

void PixelSpot::SetPixel ( Pixel p  ) 

Definition at line 22 of file PixelSpot.cxx.

References parentPixel.

Referenced by Pixel::GetPixelSpot().

00023 {
00024         parentPixel=p;
00025 }

void PixelSpot::TakeE ( double  e  ) 

Definition at line 54 of file PixelSpot.cxx.

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

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


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(), GetNStrips(), GetStripQ(), and Init().

Definition at line 49 of file PixelSpot.h.

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

int PixelSpot::printit = -1 [static]

Definition at line 35 of file PixelSpot.h.

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

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

Definition at line 43 of file PixelSpot.h.

Referenced by AddE(), Dump(), GetStripQ(), 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(), GetStrips(), 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(), GetStripE(), Init(), and TakeE().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1