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

Tof2DScin Class Reference

#include <Tof2DScin.h>

List of all members.

Public Member Functions

virtual void AddInfo (TString info)
virtual void AddInfo (TString info)
virtual void ClearInfo ()
virtual void ClearInfo ()
virtual void CloseInfo ()
virtual void CloseInfo ()
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual void Draw (Option_t *option="")
virtual void Draw (Option_t *option="")
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
Double_t GetAngle (Double_t x, Double_t y)
Double_t GetAngle (Double_t x, Double_t y)
virtual Double_t GetCharge ()
virtual Double_t GetCharge ()
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual Int_t GetPart ()
virtual Int_t GetPart ()
virtual Double_t GetTime ()
virtual Double_t GetTime ()
virtual bool HasZRSection ()
virtual bool HasZRSection ()
virtual bool IsFired ()
virtual bool IsFired ()
virtual bool IsHighlighted ()
virtual bool IsHighlighted ()
virtual void Paint (Option_t *option="")
virtual void Paint (Option_t *option="")
Double_t Range360 (Double_t input)
Double_t Range360 (Double_t input)
virtual void ResetTimeCharge ()
virtual void ResetTimeCharge ()
virtual void SetCharge (Double_t charge)
virtual void SetCharge (Double_t charge)
virtual void SetFired (bool status=true)
virtual void SetFired (bool status=true)
virtual void SetHighlighted (bool status=true)
virtual void SetHighlighted (bool status=true)
virtual void SetStyle ()
virtual void SetStyle ()
virtual void SetTime (Double_t time)
virtual void SetTime (Double_t time)
 Tof2DScin (const char *name, const char *title, Int_t N, Double_t *P, Int_t part)
 Tof2DScin ()
 Tof2DScin (const char *name, const char *title, Int_t N, Double_t *P, Int_t part)
 Tof2DScin ()
 ~Tof2DScin ()
 ~Tof2DScin ()

Private Attributes

Double_t fCharge
Int_t fcScin
Int_t fcScinFired
Int_t fcScinFiredHL
Int_t fcScinHL
bool fFired
bool fHighlighted
std::vector< TString > fInfoCon
std::vector< TString > fInfoCon
Int_t fPart
Double_t fPhiMax
Double_t fPhiMin
BesPolygon2DfScinXY
BesPolygon2DfScinXY
BesPolygon2DfScinXYFired
BesPolygon2DfScinXYFired
BesPolygon2DfScinZR
BesPolygon2DfScinZR
BesPolygon2DfScinZRFired
BesPolygon2DfScinZRFired
Int_t fsScin
Int_t fsScinFired
Int_t fsScinFiredHL
Int_t fsScinHL
Double_t fTime
BesPaveTextfTip
BesPaveTextfTip
Double_t fZRSectionTolerance [3]
Int_t lcScin
Int_t lcScinFired
Int_t lcScinFiredHL
Int_t lcScinHL
Int_t lwScin
Int_t lwScinFired
Int_t lwScinFiredHL
Int_t lwScinHL

Static Private Attributes

const Int_t fChargeMax = 50


Constructor & Destructor Documentation

Tof2DScin::Tof2DScin  ) 
 

Tof2DScin::Tof2DScin const char *  name,
const char *  title,
Int_t  N,
Double_t *  P,
Int_t  part
 

00024 {
00025     SetName(name);
00026     SetTitle(title);
00027     fTip = 0;
00028     fHighlighted = false;
00029     fFired = false;
00030     fPart = part;
00031 
00032     fTime      = 0.0;
00033     fCharge    = 0.0;
00034 
00035     fZRSectionTolerance[1] = 0.071; // half of gap between two scin
00036     fZRSectionTolerance[2] = fZRSectionTolerance[0] = 0.1647;
00037 
00038     // ------XY------
00039 
00040     Double_t Pxy[3*4]; // N=8
00041     for (Int_t i = 0; i < 3*4; i++) {
00042         Pxy[i] = (P[i] + P[i+3*4])/2.0;
00043         //if (GetName() == TString("EastEcScin0")) cout << Pxy[i] << endl;
00044     }
00045 
00046     fScinXY      = new BesPolygon2D(name, title, 4, &Pxy[0]);
00047     fScinXYFired = new BesPolygon2D(name, title, 4, &Pxy[0]);
00048 
00049     // ------ZR------
00050 
00051     Double_t Pzr[3*4];
00052     Int_t iSeq[8] = {0,3,1,2,5,6,4,7}; // center of 0+3, 1+2, 5+6, 4+7
00053     for (Int_t i = 0; i < 4; i++) {
00054         for (Int_t j = 0; j < 3; j++) {
00055             Pzr[3*i+j] = (P[3*iSeq[2*i]+j] + P[3*iSeq[2*i+1]+j])/2.0;
00056         }
00057         //if (GetName() == TString("EastEcScin0")) cout << Pxy[i] << endl;
00058     }
00059 
00060 
00061     fScinZR      = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
00062     fScinZRFired = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
00063 
00064     fPhiMin = GetAngle( P[3*3], P[3*3+1] );
00065     fPhiMax = GetAngle( P[3*0], P[3*0+1] );
00066     if (GetPart() == 2) {
00067         Double_t phiTemp = fPhiMin;
00068         fPhiMin = fPhiMax;
00069         fPhiMax = phiTemp;
00070     }
00071     //cout << GetName() << " min "<< fPhiMin << " max " << fPhiMax << endl;
00072 
00073     SetStyle();
00074 
00075     fTip = new BesPaveText(0, 0, 0.1, 0.1);
00076     CloseInfo();
00077 }

Tof2DScin::~Tof2DScin  ) 
 

00081                       {
00082 
00083     if (fScinXY)  delete fScinXY;
00084     if (fScinZR)  delete fScinZR;
00085     if (fScinXYFired)  delete fScinXYFired;
00086     if (fScinZRFired)  delete fScinZRFired;
00087 }

Tof2DScin::Tof2DScin  ) 
 

Tof2DScin::Tof2DScin const char *  name,
const char *  title,
Int_t  N,
Double_t *  P,
Int_t  part
 

Tof2DScin::~Tof2DScin  ) 
 


Member Function Documentation

virtual void Tof2DScin::AddInfo TString  info  )  [inline, virtual]
 

00035 { fInfoCon.push_back(info); }

virtual void Tof2DScin::AddInfo TString  info  )  [inline, virtual]
 

00035 { fInfoCon.push_back(info); }

virtual void Tof2DScin::ClearInfo  )  [virtual]
 

void Tof2DScin::ClearInfo  )  [virtual]
 

00114 {
00115     fInfoCon.clear();
00116     fTip->DeleteText();
00117 }

virtual void Tof2DScin::CloseInfo  )  [virtual]
 

void Tof2DScin::CloseInfo  )  [virtual]
 

00120 {
00121     if (fTip) {
00122         fTip->Clear();
00123 
00124         if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
00125         fTip->SetText(fInfoCon);
00126     }
00127     else
00128         cout << "Tof2DScin::CloseInfo, not initialized" << endl;
00129 }

virtual Int_t Tof2DScin::DistancetoPrimitive Int_t  px,
Int_t  py
[virtual]
 

Int_t Tof2DScin::DistancetoPrimitive Int_t  px,
Int_t  py
[virtual]
 

00133                                                        {
00134 
00135     BesView *view = (BesView*)gPad->GetView();
00136     if (view->GetViewType() & kXYView && fScinXY) {
00137         return fScinXY->DistancetoPrimitive(px, py);
00138     }
00139     else if (view->GetViewType() & kZRView && fScinZR) {
00140         if (HasZRSection())
00141             return fScinZR->DistancetoPrimitive(px, py);
00142     }
00143 
00144     return 9999;
00145 }

virtual void Tof2DScin::Draw Option_t *  option = ""  )  [virtual]
 

void Tof2DScin::Draw Option_t *  option = ""  )  [virtual]
 

00195                                      {
00196     //
00197     // Tof2DScin draw function
00198     TString opt = option;
00199     opt.ToUpper();
00200 
00201     AppendPad(option);
00202 }

virtual void Tof2DScin::ExecuteEvent Int_t  event,
Int_t  px,
Int_t  py
[virtual]
 

void Tof2DScin::ExecuteEvent Int_t  event,
Int_t  px,
Int_t  py
[virtual]
 

00149                                                             {
00150 
00151     //cout << GetName() << endl;
00152 
00153     BesView *view = (BesView*)gPad->GetView();
00154 
00155     if (gBesCursor->GetType() == kBesHand) {
00156         if (view) view->ExecuteEvent(event, px, py);
00157     }
00158     else if (gBesCursor->GetType() == kBesPick){
00159 
00160         if (gPad) gPad->SetCursor(kPointer);
00161 
00162         switch (event) {
00163 
00164         case kMouseEnter :
00165             this->SetHighlighted(true);
00166 
00167             //if (this->IsFired() || view->GetVisTofHitsGlobal()) {
00168             Draw();
00169 
00170             fTip->SetPos(px, py);
00171             view->UpdateView(0);
00172 
00173             fTip->Draw("BR,SAME"); // "BR,ARC,SAME"
00174             gPad->Modified();
00175             gPad->Update();
00176             break;
00177 
00178         case kMouseLeave:
00179             if (this->IsHighlighted()) {
00180                 this->SetHighlighted(false);
00181                 //if (view->GetVisTofHitsGlobal())
00182                 Draw();
00183 
00184                 view->UpdateView(0);
00185                 gPad->Modified();
00186                 gPad->Update();
00187                 break;
00188             }
00189         }
00190     }
00191 }

Double_t Tof2DScin::GetAngle Double_t  x,
Double_t  y
 

Double_t Tof2DScin::GetAngle Double_t  x,
Double_t  y
 

00362 {
00363     Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg();
00364     if ( y<0.0 ) angle *= -1;
00365     angle = Range360(angle);
00366 
00367     return angle;
00368 }

virtual Double_t Tof2DScin::GetCharge  )  [inline, virtual]
 

00042 { return fCharge; }

virtual Double_t Tof2DScin::GetCharge  )  [inline, virtual]
 

00042 { return fCharge; }

virtual char* Tof2DScin::GetObjectInfo Int_t  px,
Int_t  py
const [virtual]
 

char * Tof2DScin::GetObjectInfo Int_t  px,
Int_t  py
const [virtual]
 

00315                                                        {
00316 
00317     BesView *view = (BesView*)gPad->GetView();
00318     if (view) return view->GetObjectInfo(px, py);
00319     else return TObject::GetObjectInfo(px, py);
00320 }

virtual Int_t Tof2DScin::GetPart  )  [inline, virtual]
 

00049 { return fPart; }

virtual Int_t Tof2DScin::GetPart  )  [inline, virtual]
 

00049 { return fPart; }

virtual Double_t Tof2DScin::GetTime  )  [inline, virtual]
 

00041 { return fTime; }

virtual Double_t Tof2DScin::GetTime  )  [inline, virtual]
 

00041 { return fTime; }

virtual bool Tof2DScin::HasZRSection  )  [virtual]
 

bool Tof2DScin::HasZRSection  )  [virtual]
 

00325 {
00326     bool flag = false;
00327     BesView *view = (BesView*)gPad->GetView();
00328     Double_t viewPhi = view->GetLongitude();
00329     viewPhi = Range360(viewPhi);
00330     //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
00331 
00332     Double_t zrPhi = viewPhi-90.0;
00333     zrPhi = Range360(zrPhi);
00334     //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl;
00335 
00336     for (Int_t i = 0; i < 2; i++) {
00337         if (i==1) {
00338             zrPhi += 180.0;
00339             zrPhi = Range360(zrPhi);
00340         }
00341 
00342         if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] &&
00343                 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
00344             flag = true;
00345             break;
00346         }
00347         else if (fPhiMin > fPhiMax) { // cross 0 degree
00348             if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] ||
00349                     zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
00350                 flag = true;
00351                 break;
00352             }
00353         }
00354     }
00355 
00356     return flag;
00357 }

virtual bool Tof2DScin::IsFired  )  [inline, virtual]
 

00033 { return fFired; }

virtual bool Tof2DScin::IsFired  )  [inline, virtual]
 

00033 { return fFired; }

virtual bool Tof2DScin::IsHighlighted  )  [inline, virtual]
 

00032 { return fHighlighted; }

virtual bool Tof2DScin::IsHighlighted  )  [inline, virtual]
 

00032 { return fHighlighted; }

virtual void Tof2DScin::Paint Option_t *  option = ""  )  [virtual]
 

void Tof2DScin::Paint Option_t *  option = ""  )  [virtual]
 

00206                                       {
00207 
00208     TString opt = option;
00209     opt.ToUpper();
00210 
00211     BesView *view = (BesView*)gPad->GetView();
00212     if (view->GetViewType() & kXYView) {
00213 
00214         if (this->IsFired()) {
00215             if (fScinXYFired) {
00216                 fScinXYFired->SetLineColor(lcScinFired);
00217                 fScinXYFired->SetLineWidth(lwScinFired);
00218                 fScinXYFired->SetFillColor(fcScinFired);
00219                 fScinXYFired->SetFillStyle(fsScinFired);
00220             }
00221         }
00222 
00223         if (fScinXY) {
00224             fScinXY->SetLineColor(lcScin);
00225             fScinXY->SetLineWidth(lwScin);
00226             fScinXY->SetFillColor(fcScin);
00227             fScinXY->SetFillStyle(fsScin);
00228         }
00229 
00230         if (this->IsHighlighted()) {
00231             if (fScinXY) {
00232                 fScinXY->SetLineColor(lcScinHL);
00233                 fScinXY->SetLineWidth(lwScinHL);
00234                 fScinXY->SetFillColor(fcScinHL);
00235                 fScinXY->SetFillStyle(fsScinHL);
00236             }
00237             if (fScinXYFired) {
00238                 fScinXYFired->SetLineColor(lcScinFiredHL);
00239                 fScinXYFired->SetLineWidth(lwScinFiredHL);
00240                 fScinXYFired->SetFillColor(fcScinFiredHL);
00241                 fScinXYFired->SetFillStyle(fsScinFiredHL);
00242             }
00243         }
00244 
00245         if (fScinXY) fScinXY->Paint();
00246         if (this->IsFired()) {
00247             if (view->GetVisTofHitsGlobal() &&
00248                     ( (fPart == 0 && view->GetVisTofHitsEast())   ||
00249                       (fPart == 1 && view->GetVisTofHitsBarrel()) ||
00250                       (fPart == 2 && view->GetVisTofHitsWest()) )) {
00251                 if (fScinXYFired) {
00252                     //cout << "Tof fired Scin size " << fCharge/fChargeMax << endl;
00253                     fScinXYFired->Restore(); // restore default size
00254                     fScinXYFired->SetSize(fCharge/fChargeMax);
00255                     fScinXYFired->Paint();
00256                 }
00257             }
00258         }
00259     }
00260 
00261     if (view->GetViewType() & kZRView) {
00262         if (HasZRSection()) {
00263             if (this->IsFired()) {
00264                 if (fScinZRFired) {
00265                     fScinZRFired->SetLineColor(lcScinFired);
00266                     fScinZRFired->SetLineWidth(lwScinFired);
00267                     fScinZRFired->SetFillColor(fcScinFired);
00268                     fScinZRFired->SetFillStyle(fsScinFired);
00269                 }
00270             }
00271 
00272             if (fScinZR) {
00273                 fScinZR->SetLineColor(lcScin);
00274                 fScinZR->SetLineWidth(lwScin);
00275                 fScinZR->SetFillColor(fcScin);
00276                 fScinZR->SetFillStyle(fsScin);
00277             }
00278 
00279             if (this->IsHighlighted()) {
00280                 if (fScinZR) {
00281                     fScinZR->SetLineColor(lcScinHL);
00282                     fScinZR->SetLineWidth(lwScinHL);
00283                     fScinZR->SetFillColor(fcScinHL);
00284                     fScinZR->SetFillStyle(fsScinHL);
00285                 }
00286                 if (fScinZRFired) {
00287                     fScinZRFired->SetLineColor(lcScinFiredHL);
00288                     fScinZRFired->SetLineWidth(lwScinFiredHL);
00289                     fScinZRFired->SetFillColor(fcScinFiredHL);
00290                     fScinZRFired->SetFillStyle(fsScinFiredHL);
00291                 }
00292             }
00293 
00294             if (fScinZR) fScinZR->Paint();
00295             if (this->IsFired()) {
00296                 if (view->GetVisTofHitsGlobal() &&
00297                         ( (fPart == 0 && view->GetVisTofHitsEast())   ||
00298                           (fPart == 1 && view->GetVisTofHitsBarrel()) ||
00299                           (fPart == 2 && view->GetVisTofHitsWest()) )) {
00300                     if (fScinZRFired) {
00301                         //cout << "Tof fired Scin size " << fCharge/fChargeMax << endl;
00302                         fScinZRFired->Restore(); // restore default size
00303                         fScinZRFired->SetSize(fCharge/fChargeMax);
00304                         fScinZRFired->Paint();
00305                     }
00306                 }
00307             }
00308         }
00309     }
00310 
00311 }

Double_t Tof2DScin::Range360 Double_t  input  ) 
 

Double_t Tof2DScin::Range360 Double_t  input  ) 
 

00373 {
00374     if (input >= 360.0) {
00375         do {
00376             input -= 360.0;
00377         }
00378         while (input >= 360.0);
00379     }
00380     else if (input < 0.0) {
00381         do {
00382             input += 360.0;
00383         }
00384         while (input < 0.0);
00385     }
00386 
00387     return input;
00388 }

virtual void Tof2DScin::ResetTimeCharge  )  [inline, virtual]
 

00043 { fTime = 0.0; fCharge = 0.0; }

virtual void Tof2DScin::ResetTimeCharge  )  [inline, virtual]
 

00043 { fTime = 0.0; fCharge = 0.0; }

virtual void Tof2DScin::SetCharge Double_t  charge  )  [inline, virtual]
 

00040 { fCharge = charge; }

virtual void Tof2DScin::SetCharge Double_t  charge  )  [inline, virtual]
 

00040 { fCharge = charge; }

virtual void Tof2DScin::SetFired bool  status = true  )  [inline, virtual]
 

00031 { fFired = status; }

virtual void Tof2DScin::SetFired bool  status = true  )  [inline, virtual]
 

00031 { fFired = status; }

virtual void Tof2DScin::SetHighlighted bool  status = true  )  [inline, virtual]
 

00030 { fHighlighted = status; }

virtual void Tof2DScin::SetHighlighted bool  status = true  )  [inline, virtual]
 

00030 { fHighlighted = status; }

virtual void Tof2DScin::SetStyle  )  [virtual]
 

void Tof2DScin::SetStyle  )  [virtual]
 

00090 {
00091     lcScin = 15;
00092     lwScin = 1;
00093     fcScin = 1003;  // lightYellow
00094     fsScin = 1001;
00095 
00096     lcScinFired = kRed;
00097     lwScinFired = 1;
00098     fcScinFired = kRed;
00099     fsScinFired = 1001;
00100 
00101     lcScinHL = lcScin;
00102     lwScinHL = 1;
00103     fcScinHL = kBlue;
00104     fsScinHL = 1001;
00105 
00106     lcScinFiredHL = kRed;
00107     lwScinFiredHL = 2;
00108     fcScinFiredHL = kBlue;
00109     fsScinFiredHL = 4000;
00110 }

virtual void Tof2DScin::SetTime Double_t  time  )  [inline, virtual]
 

00039 { fTime = time; }

virtual void Tof2DScin::SetTime Double_t  time  )  [inline, virtual]
 

00039 { fTime = time; }


Member Data Documentation

Double_t Tof2DScin::fCharge [private]
 

const Int_t Tof2DScin::fChargeMax = 50 [static, private]
 

Int_t Tof2DScin::fcScin [private]
 

Int_t Tof2DScin::fcScinFired [private]
 

Int_t Tof2DScin::fcScinFiredHL [private]
 

Int_t Tof2DScin::fcScinHL [private]
 

bool Tof2DScin::fFired [private]
 

bool Tof2DScin::fHighlighted [private]
 

std::vector<TString> Tof2DScin::fInfoCon [private]
 

std::vector<TString> Tof2DScin::fInfoCon [private]
 

Int_t Tof2DScin::fPart [private]
 

Double_t Tof2DScin::fPhiMax [private]
 

Double_t Tof2DScin::fPhiMin [private]
 

BesPolygon2D* Tof2DScin::fScinXY [private]
 

BesPolygon2D* Tof2DScin::fScinXY [private]
 

BesPolygon2D* Tof2DScin::fScinXYFired [private]
 

BesPolygon2D* Tof2DScin::fScinXYFired [private]
 

BesPolygon2D* Tof2DScin::fScinZR [private]
 

BesPolygon2D* Tof2DScin::fScinZR [private]
 

BesPolygon2D* Tof2DScin::fScinZRFired [private]
 

BesPolygon2D* Tof2DScin::fScinZRFired [private]
 

Int_t Tof2DScin::fsScin [private]
 

Int_t Tof2DScin::fsScinFired [private]
 

Int_t Tof2DScin::fsScinFiredHL [private]
 

Int_t Tof2DScin::fsScinHL [private]
 

Double_t Tof2DScin::fTime [private]
 

BesPaveText* Tof2DScin::fTip [private]
 

BesPaveText* Tof2DScin::fTip [private]
 

Double_t Tof2DScin::fZRSectionTolerance [private]
 

Int_t Tof2DScin::lcScin [private]
 

Int_t Tof2DScin::lcScinFired [private]
 

Int_t Tof2DScin::lcScinFiredHL [private]
 

Int_t Tof2DScin::lcScinHL [private]
 

Int_t Tof2DScin::lwScin [private]
 

Int_t Tof2DScin::lwScinFired [private]
 

Int_t Tof2DScin::lwScinFiredHL [private]
 

Int_t Tof2DScin::lwScinHL [private]
 


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