Emc2DCrystal Class Reference

#include <Emc2DCrystal.h>

List of all members.

Public Member Functions

 Emc2DCrystal ()
 Emc2DCrystal (const char *name, const char *title, Int_t N, Double_t *P, Int_t part, Int_t theta)
 ~Emc2DCrystal ()
virtual void SetStyle ()
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
virtual void SetHighlighted (bool status=true)
virtual void SetFired (bool status=true)
virtual bool IsHighlighted ()
virtual bool IsFired ()
virtual void AddInfo (TString info)
virtual void CloseInfo ()
virtual void ClearInfo ()
virtual void SetTime (Double_t time)
virtual void SetCharge (Double_t charge)
virtual Double_t GetTime ()
virtual Double_t GetCharge ()
virtual void ResetTimeCharge ()
virtual void Draw (Option_t *option="")
virtual void Paint (Option_t *option="")
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual Int_t GetPart ()
virtual Int_t GetTheta ()
virtual bool HasZRSection ()
Double_t GetAngle (Double_t x, Double_t y)
Double_t Range360 (Double_t input)
virtual bool IsXYVisible ()
virtual bool IsSideVisible ()
virtual void SetXYPoint (Double_t *p1, Double_t *p2, Double_t *newP, Double_t z)
virtual void SetZRPoint (Double_t *p1, Double_t *p2, Double_t *newP, Double_t r)
virtual void ProjectECToSide (Double_t *p1, Double_t *newP)

Private Attributes

Int_t fPart
Int_t fTheta
BesPolygon2DfCrystalXY
BesPolygon2DfCrystalZR
BesPolygon2DfCrystalSide
BesPolygon2DfCrystalXYFired
BesPolygon2DfCrystalZRFired
BesPolygon2DfCrystalSideFired
Double_t fTime
Double_t fCharge
Double_t fZRSectionTolerance [3]
Double_t fPhiMin
Double_t fPhiMax
std::vector< TString > fInfoCon
BesPaveTextfTip
bool fHighlighted
bool fFired
Int_t lcCrystal
Int_t lwCrystal
Int_t fcCrystal
Int_t fsCrystal
Int_t fsCrystalTrans
Int_t lcCrystalFired
Int_t lwCrystalFired
Int_t fcCrystalFired
Int_t fsCrystalFired
Int_t lcCrystalHL
Int_t lwCrystalHL
Int_t fcCrystalHL
Int_t fsCrystalHL
Int_t lcCrystalFiredHL
Int_t lwCrystalFiredHL
Int_t fcCrystalFiredHL
Int_t fsCrystalFiredHL

Static Private Attributes

static const Int_t fChargeMax = 300
static const Int_t ecXYPointZ = 1420
static const Int_t brZRPointR = 990
static const Int_t sideDeltaPhi = 21


Detailed Description

Definition at line 18 of file Emc2DCrystal.h.


Constructor & Destructor Documentation

Emc2DCrystal::Emc2DCrystal (  ) 

Emc2DCrystal::Emc2DCrystal ( const char *  name,
const char *  title,
Int_t  N,
Double_t *  P,
Int_t  part,
Int_t  theta 
)

Definition at line 25 of file Emc2DCrystal.cxx.

References brZRPointR, CloseInfo(), ecXYPointZ, fCharge, fCrystalSide, fCrystalSideFired, fCrystalXY, fCrystalXYFired, fCrystalZR, fCrystalZRFired, fFired, fHighlighted, fPart, fPhiMax, fPhiMin, fTheta, fTime, fTip, fZRSectionTolerance, GetAngle(), GetPart(), genRecEmupikp::i, ganga-rec::j, ProjectECToSide(), SetStyle(), SetXYPoint(), and SetZRPoint().

00026 {
00027     SetName(name);
00028     SetTitle(title);
00029     fTip = 0;
00030     fHighlighted = false;
00031     fFired = false;
00032     fPart  = part;
00033     fTheta = theta;
00034 
00035     fTime      = 0.0;
00036     fCharge    = 0.0;
00037 
00038     fZRSectionTolerance[1] = 0.1;  // degree
00039     fZRSectionTolerance[2] = fZRSectionTolerance[0] = 1.2;   // degree
00040 
00041     // ------XY------
00042 
00043     Double_t Pxy[3*5]; // 4 side and 5 side shape in Emc End crystal
00044     if (N == 8) {  // 4 side
00045         Int_t iXYSeq[4] = {0,2,6,4};
00046         for (Int_t i = 0; i < 4; i++) {
00047             if (part == 1) {
00048                 for (Int_t j = 0; j < 3; j++) {
00049                     Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i]+1)+j] )/2.0;
00050                 }
00051             }
00052             else if (part == 0) {
00053                 SetXYPoint(&P[3*i], &P[3*(i+4)], &Pxy[3*i], ecXYPointZ);
00054                 //for (Int_t j = 0; j < 3; j++) Pxy[3*i+j] = P[3*i+j];
00055             }
00056             else if (part == 2) {
00057                 SetXYPoint(&P[3*i], &P[3*(i+4)], &Pxy[3*i], -ecXYPointZ);
00058                 //for (Int_t j = 0; j < 3; j++) Pxy[3*i+j] = P[3*i+j];
00059             }
00060             //cout << GetName() << endl;
00061             //if (GetName() == TString("EastEcTheta5Phi0")) cout << Pxy[3*i] << " " << Pxy[3*i+1] << " " << Pxy[3*i+2] << endl;
00062         }
00063 
00064         fCrystalXY      = new BesPolygon2D(name, title, 4, &Pxy[0]);
00065         fCrystalXYFired = new BesPolygon2D(name, title, 4, &Pxy[0]);
00066     }
00067     if (N == 16) {  // 5 side
00068         Int_t iXYSeq[5] = {8,9,1,2,3};            //  9 10,1 2
00069         for (Int_t i = 0; i < 5; i++) {           //  8 11,0 3
00070             if (part == 0) {
00071                 SetXYPoint(&P[3*iXYSeq[i]], &P[3*(iXYSeq[i]+4)], &Pxy[3*i], ecXYPointZ);
00072             }
00073             else if (part == 2) {
00074                 SetXYPoint(&P[3*iXYSeq[i]], &P[3*(iXYSeq[i]+4)], &Pxy[3*i], -ecXYPointZ);
00075             }
00076             //for (Int_t j = 0; j < 3; j++) Pxy[3*i+j] = P[3*iXYSeq[i]+j];
00077         }
00078 
00079         fCrystalXY      = new BesPolygon2D(name, title, 5, &Pxy[0]);
00080         fCrystalXYFired = new BesPolygon2D(name, title, 5, &Pxy[0]);
00081     }
00082 
00083     // ------ZR------
00084 
00085     Double_t Pzr[3*4];
00086     Int_t iSeq[8] = {0,3,1,2,5,6,4,7}; // center of 0+3, 1+2, 5+6, 4+7
00087     for (Int_t i = 0; i < 4; i++) {
00088         for (Int_t j = 0; j < 3; j++) {
00089             Pzr[3*i+j] = (P[3*iSeq[2*i]+j] + P[3*iSeq[2*i+1]+j])/2.0;
00090         }
00091         //if (GetName() == TString("EastEcCrystal0")) cout << Pxy[i] << endl;
00092     }
00093 
00094 
00095     fCrystalZR      = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
00096     fCrystalZRFired = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
00097 
00098     if (N == 8) {
00099         if (GetPart() == 1) {
00100             fPhiMin = GetAngle( P[3*0], P[3*0+1] );
00101             fPhiMax = GetAngle( P[3*3], P[3*3+1] );
00102         }
00103         else {
00104             fPhiMin = GetAngle( P[3*3], P[3*3+1] );
00105             fPhiMax = GetAngle( P[3*0], P[3*0+1] );
00106         }
00107     }
00108     else if (N == 16) {
00109         fPhiMin = GetAngle( P[3*3], P[3*3+1] );
00110         fPhiMax = GetAngle( P[3*8], P[3*8+1] );
00111     }
00112 
00113     if (fPhiMin > fPhiMax && fabs(fPhiMax-fPhiMin) < 180.0) { // not cross 0 degree
00114         Double_t phiTemp = fPhiMin;
00115         fPhiMin = fPhiMax;
00116         fPhiMax = phiTemp;
00117     }
00118     //cout << GetName() << " min "<< fPhiMin << " max " << fPhiMax << endl;
00119 
00120     // ------Side------
00121 
00122     Double_t Pside[3*5]; // 4 side and 5 side shape in Emc End crystal
00123     if (N == 8) {  // 4 side
00124         //Int_t iSideSeq[4] = {0,1,2,3};
00125         for (Int_t i = 0; i < 4; i++) {
00126             if (part == 1) {
00127                 SetZRPoint(&P[3*i], &P[3*(i+4)], &Pside[3*i], brZRPointR);
00128             }
00129             else {
00130                 ProjectECToSide(&Pxy[3*i], &Pside[3*i]);
00131             }
00132         }
00133 
00134         fCrystalSide      = new BesPolygon2D(name, title, 4, &Pside[0]);
00135         fCrystalSideFired = new BesPolygon2D(name, title, 4, &Pside[0]);
00136     }
00137     if (N == 16) {  // 5 side
00138         for (Int_t i = 0; i < 5; i++) {
00139             ProjectECToSide(&Pxy[3*i], &Pside[3*i]);
00140         }
00141 
00142         fCrystalSide      = new BesPolygon2D(name, title, 5, &Pside[0]);
00143         fCrystalSideFired = new BesPolygon2D(name, title, 5, &Pside[0]);
00144     }
00145 
00146     // Init
00147 
00148     SetStyle();
00149 
00150     fTip = new BesPaveText(0, 0, 0.45, 0.08);
00151     CloseInfo();
00152 }

Emc2DCrystal::~Emc2DCrystal (  ) 

Definition at line 156 of file Emc2DCrystal.cxx.

References fCrystalXY, fCrystalXYFired, fCrystalZR, and fCrystalZRFired.

00156                             {
00157 
00158     if (fCrystalXY)  delete fCrystalXY;
00159     if (fCrystalZR)  delete fCrystalZR;
00160     if (fCrystalXYFired)  delete fCrystalXYFired;
00161     if (fCrystalZRFired)  delete fCrystalZRFired;
00162 }


Member Function Documentation

virtual void Emc2DCrystal::AddInfo ( TString  info  )  [inline, virtual]

Definition at line 35 of file Emc2DCrystal.h.

References fInfoCon.

Referenced by EmcROOTGeo::SetHits().

00035 { fInfoCon.push_back(info); }

void Emc2DCrystal::ClearInfo (  )  [virtual]

Definition at line 188 of file Emc2DCrystal.cxx.

References fInfoCon, and fTip.

Referenced by EmcROOTGeo::SetHits().

00189 {
00190     fInfoCon.clear();
00191     fTip->DeleteText();
00192 }

void Emc2DCrystal::CloseInfo (  )  [virtual]

Definition at line 194 of file Emc2DCrystal.cxx.

References fInfoCon, fTip, and BesPaveText::SetText().

Referenced by Emc2DCrystal(), and EmcROOTGeo::SetHits().

00195 {
00196     if (fTip) {
00197         fTip->Clear();
00198 
00199         if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
00200         fTip->SetText(fInfoCon);
00201     }
00202     else
00203         cout << "Emc2DCrystal::CloseInfo, not initialized" << endl;
00204 }

Int_t Emc2DCrystal::DistancetoPrimitive ( Int_t  px,
Int_t  py 
) [virtual]

Definition at line 208 of file Emc2DCrystal.cxx.

References BesPolygon2D::DistancetoPrimitive(), fCrystalSide, fCrystalXY, fCrystalZR, BesView::GetViewType(), BesView::GetVisEmcHitsSide(), BesView::GetVisEmcSide(), HasZRSection(), IsFired(), IsSideVisible(), IsXYVisible(), kXYView, and kZRView.

00208                                                           {
00209 
00210     BesView *view = (BesView*)gPad->GetView();
00211     if ( view->GetViewType() & kXYView ) {
00212         if ( fCrystalXY && IsXYVisible() ) {
00213             return fCrystalXY->DistancetoPrimitive(px, py);
00214         }
00215     }
00216     else if ( view->GetViewType() & kZRView && fCrystalZR && fCrystalSide ) {
00217         if (HasZRSection())
00218             return fCrystalZR->DistancetoPrimitive(px, py);
00219         else if ( IsSideVisible() &&
00220                   (view->GetVisEmcSide() || (view->GetVisEmcHitsSide() && IsFired())) )
00221             return fCrystalSide->DistancetoPrimitive(px, py);
00222     }
00223 
00224     return 9999;
00225 }

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

Definition at line 284 of file Emc2DCrystal.cxx.

Referenced by EmcROOTGeo::Draw(), EmcROOTGeo::DrawHits(), and ExecuteEvent().

00284                                         {
00285     //
00286     // Emc2DCrystal draw function
00287     TString opt = option;
00288     opt.ToUpper();
00289 
00290     AppendPad(option);
00291 }

void Emc2DCrystal::ExecuteEvent ( Int_t  event,
Int_t  px,
Int_t  py 
) [virtual]

Definition at line 229 of file Emc2DCrystal.cxx.

References Draw(), fTip, gBesCursor, BesCursor::GetType(), kBesHand, kBesPick, SetHighlighted(), BesPaveText::SetPos(), and BesView::UpdateView().

00229                                                                {
00230 
00231     //if (fWireType == 2 && fWireBubble[0] ) {
00232     //if (fWireCone->GetLineWidth() > 1) // FIRED
00233     //cout << GetName() << endl;
00234 
00235     BesView *view = (BesView*)gPad->GetView();
00236 
00237     if (gBesCursor->GetType() == kBesHand) {
00238         if (view) view->ExecuteEvent(event, px, py);
00239     }
00240     else if (gBesCursor->GetType() == kBesPick){
00241 
00242         if (gPad) gPad->SetCursor(kPointer);
00243 
00244         switch (event) {
00245 
00246         case kMouseEnter :
00247             this->SetHighlighted(true);
00248 
00249             //if (this->IsFired() || view->GetVisEmcHitsGlobal()) {
00250             Draw();
00251 
00252             fTip->SetPos(px, py);
00253             view->UpdateView(0);
00254 
00255             fTip->Draw("BR,SAME"); // "BR,ARC,SAME"
00256             gPad->Modified();
00257             gPad->Update();
00258             break;
00259 
00260         case kMouseLeave:
00261             if (this->IsHighlighted()) {
00262                 this->SetHighlighted(false);
00263                 //if (view->GetVisEmcHitsGlobal())
00264                 Draw();
00265 
00266                 /*
00267                   if (fTip) {
00268                   delete fTip;
00269                   fTip = 0;
00270                 }
00271                 */
00272 
00273                 view->UpdateView(0);
00274                 gPad->Modified();
00275                 gPad->Update();
00276                 break;
00277             }
00278         }
00279     }
00280 }

Double_t Emc2DCrystal::GetAngle ( Double_t  x,
Double_t  y 
)

Definition at line 501 of file Emc2DCrystal.cxx.

References Range360().

Referenced by Emc2DCrystal().

00502 {
00503     Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg();
00504     if ( y<0.0 ) angle *= -1;
00505     angle = Range360(angle);
00506 
00507     return angle;
00508 }

virtual Double_t Emc2DCrystal::GetCharge (  )  [inline, virtual]

Definition at line 42 of file Emc2DCrystal.h.

References fCharge.

00042 { return fCharge; }

char * Emc2DCrystal::GetObjectInfo ( Int_t  px,
Int_t  py 
) const [virtual]

Definition at line 454 of file Emc2DCrystal.cxx.

References BesView::GetObjectInfo().

00454                                                           {
00455 
00456     BesView *view = (BesView*)gPad->GetView();
00457     if (view) return view->GetObjectInfo(px, py);
00458     else return TObject::GetObjectInfo(px, py);
00459 }

virtual Int_t Emc2DCrystal::GetPart (  )  [inline, virtual]

Definition at line 49 of file Emc2DCrystal.h.

References fPart.

Referenced by Emc2DCrystal(), HasZRSection(), and IsXYVisible().

00049 { return fPart; }

virtual Int_t Emc2DCrystal::GetTheta (  )  [inline, virtual]

Definition at line 50 of file Emc2DCrystal.h.

References fTheta.

Referenced by IsXYVisible().

00050 { return fTheta; }

virtual Double_t Emc2DCrystal::GetTime (  )  [inline, virtual]

Definition at line 41 of file Emc2DCrystal.h.

References fTime.

00041 { return fTime; }

bool Emc2DCrystal::HasZRSection (  )  [virtual]

Definition at line 463 of file Emc2DCrystal.cxx.

References fPhiMax, fPhiMin, fZRSectionTolerance, BesTView::GetLongitude(), GetPart(), genRecEmupikp::i, and Range360().

Referenced by DistancetoPrimitive(), and Paint().

00464 {
00465     bool flag = false;
00466     BesView *view = (BesView*)gPad->GetView();
00467     Double_t viewPhi = view->GetLongitude();
00468     viewPhi = Range360(viewPhi);
00469     //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
00470 
00471     Double_t zrPhi = viewPhi-90.0;
00472     zrPhi = Range360(zrPhi);
00473     //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl;
00474 
00475     for (Int_t i = 0; i < 2; i++) {
00476         if (i==1) {
00477             zrPhi += 180.0;
00478             zrPhi = Range360(zrPhi);
00479         }
00480 
00481         if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] &&
00482                 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
00483             flag = true;
00484             break;
00485         }
00486         else if (fPhiMin > fPhiMax) { // cross 0 degree
00487             //cout << GetName() << " zrPhi " << zrPhi << " min " << fPhiMin << " max " << fPhiMax << endl;
00488             if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] ||
00489                     zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
00490                 flag = true;
00491                 break;
00492             }
00493         }
00494     }
00495 
00496     return flag;
00497 }

virtual bool Emc2DCrystal::IsFired (  )  [inline, virtual]

Definition at line 33 of file Emc2DCrystal.h.

References fFired.

Referenced by DistancetoPrimitive(), IsXYVisible(), and Paint().

00033 { return fFired; }

virtual bool Emc2DCrystal::IsHighlighted (  )  [inline, virtual]

Definition at line 32 of file Emc2DCrystal.h.

References fHighlighted.

00032 { return fHighlighted; }

bool Emc2DCrystal::IsSideVisible (  )  [virtual]

Definition at line 538 of file Emc2DCrystal.cxx.

References fPhiMax, BesTView::GetLongitude(), Range360(), and sideDeltaPhi.

Referenced by DistancetoPrimitive(), and Paint().

00539 {
00540     BesView *view = (BesView*)gPad->GetView();
00541     Double_t viewPhi = view->GetLongitude();
00542     Double_t viewPhiMin = viewPhi - sideDeltaPhi;
00543     Double_t viewPhiMax = viewPhi + sideDeltaPhi;
00544 
00545     viewPhi    = Range360(viewPhi);
00546     viewPhiMin = Range360(viewPhiMin);
00547     viewPhiMax = Range360(viewPhiMax);
00548     //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
00549 
00550     if (viewPhiMin < viewPhiMax) { // not cross 0 degree
00551         if (fPhiMax > viewPhiMin && fPhiMax < viewPhiMax) return true;
00552     }
00553     else { // cross 0 degree
00554         if (fPhiMax > viewPhiMin || fPhiMax < viewPhiMax) return true;
00555     }
00556 
00557     return false;
00558 }

bool Emc2DCrystal::IsXYVisible (  )  [virtual]

Definition at line 530 of file Emc2DCrystal.cxx.

References GetPart(), GetTheta(), and IsFired().

Referenced by DistancetoPrimitive(), and Paint().

00531 {
00532     if ( GetPart() != 1 || GetTheta() == 0 || IsFired() )
00533         return true;
00534     else
00535         return false;
00536 }

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

Definition at line 295 of file Emc2DCrystal.cxx.

References fcCrystal, fcCrystalFired, fcCrystalFiredHL, fcCrystalHL, fCharge, fChargeMax, fCrystalSide, fCrystalSideFired, fCrystalXY, fCrystalXYFired, fCrystalZR, fCrystalZRFired, fPart, fsCrystal, fsCrystalFired, fsCrystalFiredHL, fsCrystalHL, fsCrystalTrans, BesView::GetViewType(), BesView::GetVisEmcHitsBarrel(), BesView::GetVisEmcHitsEast(), BesView::GetVisEmcHitsGlobal(), BesView::GetVisEmcHitsSide(), BesView::GetVisEmcHitsWest(), BesView::GetVisEmcSide(), HasZRSection(), IsFired(), IsSideVisible(), IsXYVisible(), kXYView, kZRView, lcCrystal, lcCrystalFired, lcCrystalFiredHL, lcCrystalHL, lwCrystal, lwCrystalFired, lwCrystalFiredHL, lwCrystalHL, and BesPolygon2D::Paint().

00295                                          {
00296 
00297     TString opt = option;
00298     opt.ToUpper();
00299 
00300     BesView *view = (BesView*)gPad->GetView();
00301     if (view->GetViewType() & kXYView) {
00302 
00303         if (fCrystalXY) {
00304             fCrystalXY->SetLineColor(lcCrystal);
00305             fCrystalXY->SetLineWidth(lwCrystal);
00306             fCrystalXY->SetFillColor(fcCrystal);
00307             fCrystalXY->SetFillStyle(fsCrystal);
00308         }
00309 
00310         if (this->IsFired()) {
00311             if (fCrystalXY) {
00312                 fCrystalXY->SetFillStyle(fsCrystalTrans);
00313             }
00314             if (fCrystalXYFired) {
00315                 fCrystalXYFired->SetLineColor(lcCrystalFired);
00316                 fCrystalXYFired->SetLineWidth(lwCrystalFired);
00317                 fCrystalXYFired->SetFillColor(fcCrystalFired);
00318                 fCrystalXYFired->SetFillStyle(fsCrystalFired);
00319             }
00320         }
00321 
00322         if (this->IsHighlighted()) {
00323             if (fCrystalXY) {
00324                 fCrystalXY->SetLineColor(lcCrystalHL);
00325                 fCrystalXY->SetLineWidth(lwCrystalHL);
00326                 fCrystalXY->SetFillColor(fcCrystalHL);
00327                 fCrystalXY->SetFillStyle(fsCrystalHL);
00328             }
00329             if (fCrystalXYFired) {
00330                 fCrystalXYFired->SetLineColor(lcCrystalFiredHL);
00331                 fCrystalXYFired->SetLineWidth(lwCrystalFiredHL);
00332                 fCrystalXYFired->SetFillColor(fcCrystalFiredHL);
00333                 fCrystalXYFired->SetFillStyle(fsCrystalFiredHL);
00334             }
00335         }
00336 
00337         if ( fCrystalXY && IsXYVisible() ) fCrystalXY->Paint();
00338         if (this->IsFired()) {
00339             if (view->GetVisEmcHitsGlobal() &&
00340                     ( (fPart == 0 && view->GetVisEmcHitsEast())   ||
00341                       (fPart == 1 && view->GetVisEmcHitsBarrel()) ||
00342                       (fPart == 2 && view->GetVisEmcHitsWest()) )) {
00343                 if (fCrystalXYFired) {
00344                     fCrystalXY->Paint();
00345                     //if (this->IsHighlighted()) cout << GetName() << " is highlighted " << endl;
00346                     //cout << "Emc fired Crystal size " << fCharge/fChargeMax << endl;
00347                     fCrystalXYFired->Restore(); // restore default size
00348                     fCrystalXYFired->SetSize(fCharge/fChargeMax);
00349                     fCrystalXYFired->Paint();
00350                 }
00351             }
00352         }
00353     }
00354 
00355     if (view->GetViewType() & kZRView) {
00356         if (HasZRSection()) {
00357             if (this->IsFired()) {
00358                 if (fCrystalZRFired) {
00359                     fCrystalZRFired->SetLineColor(lcCrystalFired);
00360                     fCrystalZRFired->SetLineWidth(lwCrystalFired);
00361                     fCrystalZRFired->SetFillColor(fcCrystalFired);
00362                     fCrystalZRFired->SetFillStyle(fsCrystalFired);
00363                 }
00364             }
00365 
00366             if (fCrystalZR) {
00367                 fCrystalZR->SetLineColor(lcCrystal);
00368                 fCrystalZR->SetLineWidth(lwCrystal);
00369                 fCrystalZR->SetFillColor(fcCrystal);
00370                 fCrystalZR->SetFillStyle(fsCrystal);
00371             }
00372 
00373             if (this->IsHighlighted()) {
00374                 if (fCrystalZR) {
00375                     fCrystalZR->SetLineColor(lcCrystalHL);
00376                     fCrystalZR->SetLineWidth(lwCrystalHL);
00377                     fCrystalZR->SetFillColor(fcCrystalHL);
00378                     fCrystalZR->SetFillStyle(fsCrystalHL);
00379                 }
00380                 if (fCrystalZRFired) {
00381                     fCrystalZRFired->SetLineColor(lcCrystalFiredHL);
00382                     fCrystalZRFired->SetLineWidth(lwCrystalFiredHL);
00383                     fCrystalZRFired->SetFillColor(fcCrystalFiredHL);
00384                     fCrystalZRFired->SetFillStyle(fsCrystalFiredHL);
00385                 }
00386             }
00387 
00388             if ( fCrystalZR ) fCrystalZR->Paint();
00389             if (this->IsFired()) {
00390                 if (view->GetVisEmcHitsGlobal() &&
00391                         ( (fPart == 0 && view->GetVisEmcHitsEast())   ||
00392                           (fPart == 1 && view->GetVisEmcHitsBarrel()) ||
00393                           (fPart == 2 && view->GetVisEmcHitsWest()) )) {
00394                     if (fCrystalZRFired) {
00395                         //cout << "Emc fired Crystal size " << fCharge/fChargeMax << endl;
00396                         fCrystalZRFired->Restore(); // restore default size
00397                         fCrystalZRFired->SetSize(fCharge/fChargeMax);
00398                         fCrystalZRFired->Paint();
00399                     }
00400                 }
00401             }
00402         }
00403 
00404         // side
00405         if (this->IsFired()) {
00406             if (fCrystalSideFired) {
00407                 fCrystalSideFired->SetLineColor(lcCrystalFired);
00408                 fCrystalSideFired->SetLineWidth(lwCrystalFired);
00409                 fCrystalSideFired->SetFillColor(fcCrystalFired);
00410                 fCrystalSideFired->SetFillStyle(fsCrystalFired);
00411             }
00412         }
00413 
00414         if (fCrystalSide) {
00415             fCrystalSide->SetLineColor(lcCrystal);
00416             fCrystalSide->SetLineWidth(lwCrystal);
00417             fCrystalSide->SetFillColor(fcCrystal);
00418             fCrystalSide->SetFillStyle(fsCrystal);
00419         }
00420 
00421         if (this->IsHighlighted()) {
00422             if (fCrystalSide) {
00423                 fCrystalSide->SetLineColor(lcCrystalHL);
00424                 fCrystalSide->SetLineWidth(lwCrystalHL);
00425                 fCrystalSide->SetFillColor(fcCrystalHL);
00426                 fCrystalSide->SetFillStyle(fsCrystalHL);
00427             }
00428             if (fCrystalSideFired) {
00429                 fCrystalSideFired->SetLineColor(lcCrystalFiredHL);
00430                 fCrystalSideFired->SetLineWidth(lwCrystalFiredHL);
00431                 fCrystalSideFired->SetFillColor(fcCrystalFiredHL);
00432                 fCrystalSideFired->SetFillStyle(fsCrystalFiredHL);
00433             }
00434         }
00435 
00436         if ( IsSideVisible() ) {
00437             if ( (view->GetVisEmcSide() || view->GetVisEmcHitsSide() && this->IsFired()) && fCrystalSide ) fCrystalSide->Paint();
00438             if ( this->IsFired() ) {
00439                 if (view->GetVisEmcHitsGlobal() && view->GetVisEmcHitsSide()) {
00440                     if (fCrystalSideFired) {
00441                         //cout << "Emc fired Crystal size " << fCharge/fChargeMax << endl;
00442                         fCrystalSideFired->Restore(); // restore default size
00443                         fCrystalSideFired->SetSize(fCharge/fChargeMax);
00444                         fCrystalSideFired->Paint();
00445                     }
00446                 }
00447             }
00448         }
00449     }
00450 }

void Emc2DCrystal::ProjectECToSide ( Double_t *  p1,
Double_t *  newP 
) [virtual]

Definition at line 583 of file Emc2DCrystal.cxx.

References brZRPointR, and ecXYPointZ.

Referenced by Emc2DCrystal().

00584 {
00585     //  ------ R         ---------
00586     //       |     -->        |
00587     //       | r              |
00588 
00589     Double_t r1 = sqrt(p1[0]*p1[0] + p1[1]*p1[1]);
00590     newP[0] = p1[0] * (brZRPointR/r1);
00591     newP[1] = p1[1] * (brZRPointR/r1);
00592 
00593     Double_t drToR = brZRPointR - r1;
00594     newP[2] = fabs(ecXYPointZ + drToR) * (p1[2]/fabs(p1[2]));
00595 
00596 
00597     //if (GetName() == TString("EastEcTheta0Phi0")) {
00598     //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl;
00599     //cout << newP[0] << " " << newP[1] << " " << newP[2] << endl;
00600     //}
00601 
00602 }

Double_t Emc2DCrystal::Range360 ( Double_t  input  ) 

Definition at line 512 of file Emc2DCrystal.cxx.

Referenced by GetAngle(), HasZRSection(), and IsSideVisible().

00513 {
00514     if (input >= 360.0) {
00515         do {
00516             input -= 360.0;
00517         }
00518         while (input >= 360.0);
00519     }
00520     else if (input < 0.0) {
00521         do {
00522             input += 360.0;
00523         }
00524         while (input < 0.0);
00525     }
00526 
00527     return input;
00528 }

virtual void Emc2DCrystal::ResetTimeCharge (  )  [inline, virtual]

Definition at line 43 of file Emc2DCrystal.h.

References fCharge, and fTime.

Referenced by EmcROOTGeo::DrawHits().

00043 { fTime = 0.0; fCharge = 0.0; }

virtual void Emc2DCrystal::SetCharge ( Double_t  charge  )  [inline, virtual]

Definition at line 40 of file Emc2DCrystal.h.

References fCharge.

Referenced by EmcROOTGeo::DrawHits().

00040 { fCharge = charge; }

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

Definition at line 31 of file Emc2DCrystal.h.

References fFired.

Referenced by EmcROOTGeo::Draw(), and EmcROOTGeo::DrawHits().

00031 { fFired = status; }

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

Definition at line 30 of file Emc2DCrystal.h.

References fHighlighted.

Referenced by ExecuteEvent().

00030 { fHighlighted = status; }

void Emc2DCrystal::SetStyle (  )  [virtual]

Definition at line 164 of file Emc2DCrystal.cxx.

References fcCrystal, fcCrystalFired, fcCrystalFiredHL, fcCrystalHL, fsCrystal, fsCrystalFired, fsCrystalFiredHL, fsCrystalHL, fsCrystalTrans, lcCrystal, lcCrystalFired, lcCrystalFiredHL, lcCrystalHL, lwCrystal, lwCrystalFired, lwCrystalFiredHL, and lwCrystalHL.

Referenced by Emc2DCrystal().

00165 {
00166     lcCrystal = 15;
00167     lwCrystal = 1;
00168     fcCrystal = 1005;  // lightBlue
00169     fsCrystal = 1001;
00170     fsCrystalTrans = 4000;
00171 
00172     lcCrystalFired = kRed;
00173     lwCrystalFired = 1;
00174     fcCrystalFired = kRed;
00175     fsCrystalFired = 1001;
00176 
00177     lcCrystalHL = lcCrystal;
00178     lwCrystalHL = 1;
00179     fcCrystalHL = kBlue;
00180     fsCrystalHL = 1001;
00181 
00182     lcCrystalFiredHL = kRed;
00183     lwCrystalFiredHL = 2;
00184     fcCrystalFiredHL = kWhite;
00185     fsCrystalFiredHL = 4000;
00186 }

virtual void Emc2DCrystal::SetTime ( Double_t  time  )  [inline, virtual]

Definition at line 39 of file Emc2DCrystal.h.

References fTime.

00039 { fTime = time; }

void Emc2DCrystal::SetXYPoint ( Double_t *  p1,
Double_t *  p2,
Double_t *  newP,
Double_t  z 
) [virtual]

Definition at line 562 of file Emc2DCrystal.cxx.

References genRecEmupikp::i.

Referenced by Emc2DCrystal().

00563 {
00564     Double_t ratio = fabs( (z-p1[2]) / (p2[2]-p1[2]) );
00565     for (Int_t i = 0; i < 3; i++) {
00566         newP[i] = p1[i] * (1.0-ratio) + p2[i] * ratio;
00567     }
00568 }

void Emc2DCrystal::SetZRPoint ( Double_t *  p1,
Double_t *  p2,
Double_t *  newP,
Double_t  r 
) [virtual]

Definition at line 572 of file Emc2DCrystal.cxx.

References genRecEmupikp::i.

Referenced by Emc2DCrystal().

00573 {
00574     Double_t r1 = sqrt(p1[0]*p1[0] + p1[1]*p1[1]);
00575     Double_t r2 = sqrt(p2[0]*p2[0] + p2[1]*p2[1]);
00576 
00577     Double_t ratio = fabs( (r-r1) / (r2-r1) );
00578     for (Int_t i = 0; i < 3; i++) {
00579         newP[i] = p1[i] * (1.0-ratio) + p2[i] * ratio;
00580     }
00581 }


Member Data Documentation

const Int_t Emc2DCrystal::brZRPointR = 990 [static, private]

Definition at line 81 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), and ProjectECToSide().

const Int_t Emc2DCrystal::ecXYPointZ = 1420 [static, private]

Definition at line 80 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), and ProjectECToSide().

Int_t Emc2DCrystal::fcCrystal [private]

Definition at line 92 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fcCrystalFired [private]

Definition at line 98 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fcCrystalFiredHL [private]

Definition at line 108 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fcCrystalHL [private]

Definition at line 103 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Double_t Emc2DCrystal::fCharge [private]

Definition at line 72 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), GetCharge(), Paint(), ResetTimeCharge(), and SetCharge().

const Int_t Emc2DCrystal::fChargeMax = 300 [static, private]

Definition at line 71 of file Emc2DCrystal.h.

Referenced by Paint().

BesPolygon2D* Emc2DCrystal::fCrystalSide [private]

Definition at line 66 of file Emc2DCrystal.h.

Referenced by DistancetoPrimitive(), Emc2DCrystal(), and Paint().

BesPolygon2D* Emc2DCrystal::fCrystalSideFired [private]

Definition at line 69 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), and Paint().

BesPolygon2D* Emc2DCrystal::fCrystalXY [private]

Definition at line 64 of file Emc2DCrystal.h.

Referenced by DistancetoPrimitive(), Emc2DCrystal(), Paint(), and ~Emc2DCrystal().

BesPolygon2D* Emc2DCrystal::fCrystalXYFired [private]

Definition at line 67 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), Paint(), and ~Emc2DCrystal().

BesPolygon2D* Emc2DCrystal::fCrystalZR [private]

Definition at line 65 of file Emc2DCrystal.h.

Referenced by DistancetoPrimitive(), Emc2DCrystal(), Paint(), and ~Emc2DCrystal().

BesPolygon2D* Emc2DCrystal::fCrystalZRFired [private]

Definition at line 68 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), Paint(), and ~Emc2DCrystal().

bool Emc2DCrystal::fFired [private]

Definition at line 87 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), IsFired(), and SetFired().

bool Emc2DCrystal::fHighlighted [private]

Definition at line 86 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), IsHighlighted(), and SetHighlighted().

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

Definition at line 84 of file Emc2DCrystal.h.

Referenced by AddInfo(), ClearInfo(), and CloseInfo().

Int_t Emc2DCrystal::fPart [private]

Definition at line 62 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), GetPart(), and Paint().

Double_t Emc2DCrystal::fPhiMax [private]

Definition at line 75 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), HasZRSection(), and IsSideVisible().

Double_t Emc2DCrystal::fPhiMin [private]

Definition at line 75 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), and HasZRSection().

Int_t Emc2DCrystal::fsCrystal [private]

Definition at line 93 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fsCrystalFired [private]

Definition at line 99 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fsCrystalFiredHL [private]

Definition at line 109 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fsCrystalHL [private]

Definition at line 104 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fsCrystalTrans [private]

Definition at line 94 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::fTheta [private]

Definition at line 63 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), and GetTheta().

Double_t Emc2DCrystal::fTime [private]

Definition at line 72 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), GetTime(), ResetTimeCharge(), and SetTime().

BesPaveText* Emc2DCrystal::fTip [private]

Definition at line 85 of file Emc2DCrystal.h.

Referenced by ClearInfo(), CloseInfo(), Emc2DCrystal(), and ExecuteEvent().

Double_t Emc2DCrystal::fZRSectionTolerance[3] [private]

Definition at line 74 of file Emc2DCrystal.h.

Referenced by Emc2DCrystal(), and HasZRSection().

Int_t Emc2DCrystal::lcCrystal [private]

Definition at line 90 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lcCrystalFired [private]

Definition at line 96 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lcCrystalFiredHL [private]

Definition at line 106 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lcCrystalHL [private]

Definition at line 101 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lwCrystal [private]

Definition at line 91 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lwCrystalFired [private]

Definition at line 97 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lwCrystalFiredHL [private]

Definition at line 107 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

Int_t Emc2DCrystal::lwCrystalHL [private]

Definition at line 102 of file Emc2DCrystal.h.

Referenced by Paint(), and SetStyle().

const Int_t Emc2DCrystal::sideDeltaPhi = 21 [static, private]

Definition at line 82 of file Emc2DCrystal.h.

Referenced by IsSideVisible().


Generated on Tue Nov 29 23:18:37 2016 for BOSS_7.0.2 by  doxygen 1.4.7