CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
Cgem2DVStrip Class Reference

#include <Cgem2DStrip.h>

+ Inheritance diagram for Cgem2DVStrip:

Public Member Functions

 Cgem2DVStrip (const char *name, const char *title, double v, double r, double len, double wid, double ang, double xmin, double zmin, double pit, Double_t size, Double_t thick, Int_t layer, Int_t sheet, Int_t strip, Double_t rUF)
 
virtual ~Cgem2DVStrip ()
 
virtual void CloseInfo ()
 
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 Draw (Option_t *option="")
 
virtual void Paint (Option_t *option="")
 
virtual ECgemStripType GetType () const
 
- Public Member Functions inherited from Cgem2DStripBase
 Cgem2DStripBase (const char *name, const char *title, Int_t layer, Int_t sheet, Int_t strip)
 
virtual ~Cgem2DStripBase ()
 
virtual void SetHighlighted (bool status=true)
 
virtual void SetFired (bool status=true)
 
virtual bool IsHighlighted () const
 
virtual bool IsFired () const
 
virtual void AddInfo (TString info)
 
virtual void ClearInfo ()
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Int_t GetLayer () const
 
virtual Int_t GetSheet () const
 
virtual Int_t GetStrip () const
 

Protected Attributes

BesPolygon2DfVStripXY
 
BesPolygon2DfVStripZR
 
BesPolygon2DfVStripUF
 
- Protected Attributes inherited from Cgem2DStripBase
std::vector< TString > fInfoCon
 
BesPaveTextfTip
 
Int_t fLayer
 
Int_t fSheet
 
Int_t fStrip
 
bool fHighlighted
 
bool fFired
 
Int_t lcStrip
 
Int_t lwStrip
 
Int_t fcStrip
 
Int_t fsStrip
 
Int_t lcStripFired
 
Int_t lwStripFired
 
Int_t fcStripFired
 
Int_t fsStripFired
 
Int_t lcStripHL
 
Int_t lwStripHL
 
Int_t fcStripHL
 
Int_t fsStripHL
 

Detailed Description

Definition at line 163 of file Cgem2DStrip.h.

Constructor & Destructor Documentation

◆ Cgem2DVStrip()

Cgem2DVStrip::Cgem2DVStrip ( const char * name,
const char * title,
double v,
double r,
double len,
double wid,
double ang,
double xmin,
double zmin,
double pit,
Double_t size,
Double_t thick,
Int_t layer,
Int_t sheet,
Int_t strip,
Double_t rUF )

Definition at line 612 of file Cgem2DStrip.cxx.

616 : Cgem2DStripBase(name, title, layer, sheet, strip)
617{
618 CgemVStripCalculator calc(rUF, len, wid, ang, xmin, zmin, pit);
619 int N = calc.getPointNumberFromV(v);
620
621 if (N > 0)
622 {
623 //Construct XY and ZR view shape
624 double* pxy = new double[6 * N];
625 double* pzr = new double[6 * N];
626 double tphi = 0, tz = 0;
627 double vuf = v / r * rUF; //vuf is v transformed to unfolded view
628 TString shapename = name;
629 TString shapetitle = title;
630 shapename += " XY";
631 shapetitle += " XY";
632
633 for (int i = 0; i < N; ++i)
634 {
635 calc.getNthPointFromV(v, i, tphi, tz);
636 double cosphi = TMath::Cos(tphi);
637 double sinphi = TMath::Sin(tphi);
638 double rplust = r + 0.5 * thick;
639 double rsubt = r - 0.5 * thick;
640
641 pxy[3 * i] = rsubt * cosphi;
642 pxy[3 * i + 1] = rsubt * sinphi;
643 pxy[3 * i + 2] = tz;
644 pxy[6 * N - 3 * i - 3] = rplust * cosphi;
645 pxy[6 * N - 3 * i - 2] = rplust * sinphi;
646 pxy[6 * N - 3 * i - 1] = tz;
647 pzr[3 * i] = r * cosphi;
648 pzr[3 * i + 1] = r * sinphi;
649 pzr[3 * i + 2] = tz - 0.5 * size;
650 pzr[6 * N - 3 * i - 3] = r * cosphi;
651 pzr[6 * N - 3 * i - 2] = r * sinphi;
652 pzr[6 * N - 3 * i - 1] = tz + 0.5 * size;
653 }
654
655 fVStripXY = new BesPolygon2D(shapename, shapetitle, 2 * N, pxy);
656 fVStripZR = new BesPolygon2D(name, title, 2 * N, pzr);
657
658 //Construct UF view shape
659 Double_t coorStrip[12];
660 calc.getStartPointFromV(vuf, tphi, tz);
661 double size_cosang = 0.5 * size * TMath::Cos(-ang);
662 double size_sinang = 0.5 * size * TMath::Sin(-ang);
663 //double subwid = 0;
664 //if (fLayer == 0) subwid = wid / 2;
665 //else subwid = wid;
666
667 //coorStrip[0] = tphi * r - subwid - size_cosang;
668 coorStrip[0] = tphi * rUF - size_cosang; //New Geom
669 coorStrip[1] = tz - size_sinang;
670 coorStrip[2] = 0;
671 //coorStrip[3] = tphi * r - subwid + size_cosang;
672 coorStrip[3] = tphi * rUF + size_cosang; //New Geom
673 coorStrip[4] = tz + size_sinang;
674 coorStrip[5] = 0;
675 calc.getEndPointFromV(vuf, tphi, tz);
676 //coorStrip[6] = tphi * r - subwid + size_cosang;
677 coorStrip[6] = tphi * rUF + size_cosang; //New Geom
678 coorStrip[7] = tz + size_sinang;
679 coorStrip[8] = 0;
680 //coorStrip[9] = tphi * r - subwid - size_cosang;
681 coorStrip[9] = tphi * rUF - size_cosang; //New Geom
682 coorStrip[10] = tz - size_sinang;
683 coorStrip[11] = 0;
684
685 shapename = name;
686 shapetitle = title;
687 shapename += " Unfolded";
688 shapetitle += " Unfolded";
689 fVStripUF = new BesPolygon2D(name, title, 4, coorStrip);
690
691 delete[] pxy;
692 delete[] pzr;
693 }
694 else
695 {
696 fVStripXY = 0;
697 fVStripZR = 0;
698 fVStripUF = 0;
699 }
700
701 SetStyle();
702 CloseInfo();
703}
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
Cgem2DStripBase(const char *name, const char *title, Int_t layer, Int_t sheet, Int_t strip)
virtual void SetStyle()
virtual void CloseInfo()
BesPolygon2D * fVStripZR
BesPolygon2D * fVStripUF
BesPolygon2D * fVStripXY

◆ ~Cgem2DVStrip()

Cgem2DVStrip::~Cgem2DVStrip ( )
virtual

Definition at line 705 of file Cgem2DStrip.cxx.

706{
707 delete fVStripXY;
708 delete fVStripZR;
709 delete fVStripUF;
710}

Member Function Documentation

◆ CloseInfo()

void Cgem2DVStrip::CloseInfo ( )
virtual

Implements Cgem2DStripBase.

Definition at line 712 of file Cgem2DStrip.cxx.

713{
714 if (fTip)
715 {
716 fTip->Clear();
717 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
719 }
720 else cout << "Cgem2DVStrip::CloseInfo, not initialized" << endl;
721}
virtual void SetText(std::vector< TString > infoCon)
BesPaveText * fTip
Definition Cgem2DStrip.h:55
std::vector< TString > fInfoCon
Definition Cgem2DStrip.h:54

Referenced by Cgem2DVStrip().

◆ DistancetoPrimitive()

Int_t Cgem2DVStrip::DistancetoPrimitive ( Int_t px,
Int_t py )
virtual

Implements Cgem2DStripBase.

Definition at line 741 of file Cgem2DStrip.cxx.

742{
743 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
744#ifdef CGEM_V_STRIP_TEST_CONDITIONAL_DISPLAY
745 if (!(CGEM_V_STRIP_DISPLAY_CONDITION)) return 9999;
746#endif
747
748 if ( (view->GetViewType() & kXYView) && fVStripXY &&
749 ( view->GetVisCgemVStrips() || this->IsFired() ))
750 {
751 return fVStripXY->DistancetoPrimitive(px, py);
752 }
753
754 if ((view->GetViewType() & kZRView) && fVStripZR &&
755 ( view->GetVisCgemVStrips() || this->IsFired() ))
756 return fVStripZR->DistancetoPrimitive(px, py);
757
758 if ((view->GetViewType() & kCgemUFView0) && fLayer == 0 && fVStripUF &&
759 ( view->GetVisCgemVStrips() || this->IsFired() ))
760 return fVStripUF->DistancetoPrimitive(px, py);
761
762 if ((view->GetViewType() & kCgemUFView1) && fLayer == 1 && fVStripUF &&
763 ( view->GetVisCgemVStrips() || this->IsFired() ))
764 return fVStripUF->DistancetoPrimitive(px, py);
765
766 if ((view->GetViewType() & kCgemUFView2) && fLayer == 2 && fVStripUF &&
767 ( view->GetVisCgemVStrips() || this->IsFired() ))
768 return fVStripUF->DistancetoPrimitive(px, py);
769
770 return 9999;
771}
@ kCgemUFView2
Definition BesStatus.h:20
@ kCgemUFView0
Definition BesStatus.h:18
@ kXYView
Definition BesStatus.h:15
@ kCgemUFView1
Definition BesStatus.h:19
@ kZRView
Definition BesStatus.h:16
#define CGEM_V_STRIP_DISPLAY_CONDITION
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Bool_t GetVisCgemVStrips()
Definition BesView.h:123
EBESViewType GetViewType()
Definition BesView.h:74

◆ Draw()

void Cgem2DVStrip::Draw ( Option_t * option = "")
virtual

Implements Cgem2DStripBase.

Definition at line 822 of file Cgem2DStrip.cxx.

823{
824 TString opt = option;
825 opt.ToUpper();
826 AppendPad(option);
827}

Referenced by CgemROOTGeo::Draw(), and CgemROOTGeo::DrawUF().

◆ ExecuteEvent()

void Cgem2DVStrip::ExecuteEvent ( Int_t event,
Int_t px,
Int_t py )
virtual

Implements Cgem2DStripBase.

Definition at line 773 of file Cgem2DStrip.cxx.

774{
775 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
776 //cout << "Cgem2DXStrip::ExecuteEvent()" << endl;
777 if (gBesCursor->GetType() == kBesHand)
778 {
779 if (view) view->ExecuteEvent(event, px, py);
780 }
781
782 else if (gBesCursor->GetType() == kBesPick)
783 {
784 if (gPad) gPad->SetCursor(kPointer);
785
786 switch (event)
787 {
788 case kMouseEnter:
789 SetHighlighted(true);
790 if (view->GetViewType() & kXYView) Draw("XY");
791 if (view->GetViewType() & kZRView) Draw("ZR");
792 if ((view->GetViewType() & kCgemUFView0) || (view->GetViewType() & kCgemUFView1) || (view->GetViewType() & kCgemUFView2))
793 Draw("UF");
794
795 fTip->SetPos(px, py);
796 view->UpdateView(0);
797
798 //Long Peixun's update: If ShowInfo is not checked, don't show tip text.
799 if (gBesCursor->GetShowInfo()) fTip->Draw("BR,SAME");
800 gPad->Modified();
801 gPad->Update();
802 break;
803
804 case kMouseLeave:
805 if (IsHighlighted())
806 {
807 SetHighlighted(false);
808 if (view->GetViewType() & kXYView) Draw("XY");
809 if (view->GetViewType() & kZRView) Draw("ZR");
810 if ((view->GetViewType() & kCgemUFView0) || (view->GetViewType() & kCgemUFView1) || (view->GetViewType() & kCgemUFView2))
811 Draw("UF");
812
813 view->UpdateView(0);
814 gPad->Modified();
815 gPad->Update();
816 }
817 break;
818 }
819 }
820}
@ kBesHand
Definition BesCursor.h:15
@ kBesPick
Definition BesCursor.h:14
R__EXTERN BesCursor * gBesCursor
Definition BesCursor.h:40
Bool_t GetShowInfo()
Definition BesCursor.h:35
EBESCursorType GetType()
Definition BesCursor.h:32
virtual void SetPos(Int_t px, Int_t py)
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition BesView.cxx:753
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition BesView.cxx:451
virtual void SetHighlighted(bool status=true)
Definition Cgem2DStrip.h:35
virtual bool IsHighlighted() const
Definition Cgem2DStrip.h:37
c1_1 Draw()

◆ GetType()

virtual ECgemStripType Cgem2DVStrip::GetType ( ) const
inlinevirtual

Implements Cgem2DStripBase.

Definition at line 179 of file Cgem2DStrip.h.

179{ return CGEM_V_STRIP; }
@ CGEM_V_STRIP
Definition Cgem2DStrip.h:21

◆ Paint()

void Cgem2DVStrip::Paint ( Option_t * option = "")
virtual

Implements Cgem2DStripBase.

Definition at line 829 of file Cgem2DStrip.cxx.

830{
831 //TString opt = option;
832 //opt.ToUpper();
833 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
834
835#ifdef CGEM_V_STRIP_TEST_CONDITIONAL_DISPLAY
836 if (!(CGEM_V_STRIP_DISPLAY_CONDITION)) return;
837#endif
838
839 if ((view->GetViewType() & kXYView) && fVStripXY)
840 {
841 if (IsFired())
842 {
843 fVStripXY->SetLineColor(lcStripFired);
844 fVStripXY->SetLineWidth(lwStripFired);
845 fVStripXY->SetFillColor(fcStripFired);
846 fVStripXY->SetFillStyle(fsStripFired);
847 }
848 else
849 {
850 fVStripXY->SetLineColor(lcStrip);
851 fVStripXY->SetLineWidth(lwStrip);
852 fVStripXY->SetFillColor(fcStrip);
853 fVStripXY->SetFillStyle(fsStrip);
854 }
855
856 if (IsHighlighted())
857 {
858 fVStripXY->SetLineColor(lcStripHL);
859 fVStripXY->SetLineWidth(lwStripHL);
860 fVStripXY->SetFillColor(fcStripHL);
861 fVStripXY->SetFillStyle(fsStripHL);
862 }
863
864 fVStripXY->Paint(); //Cannot use Draw()
865 }
866
867 if ((view->GetViewType() & kZRView) && fVStripZR)
868 {
869 if (IsFired())
870 {
871 fVStripZR->SetLineColor(lcStripFired);
872 fVStripZR->SetLineWidth(lwStripFired);
873 fVStripZR->SetFillColor(fcStripFired);
874 fVStripZR->SetFillStyle(fsStripFired);
875 }
876 else
877 {
878 fVStripZR->SetLineColor(lcStrip);
879 fVStripZR->SetLineWidth(lwStrip);
880 fVStripZR->SetFillColor(fcStrip);
881 fVStripZR->SetFillStyle(fsStrip);
882 }
883
884 if (IsHighlighted())
885 {
886 fVStripZR->SetLineColor(lcStripHL);
887 fVStripZR->SetLineWidth(lwStripHL);
888 fVStripZR->SetFillColor(fcStripHL);
889 fVStripZR->SetFillStyle(fsStripHL);
890 }
891
892 fVStripZR->Paint();
893 }
894
895 if ( fVStripUF && (
896 ((view->GetViewType() & kCgemUFView0) && fLayer == 0) ||
897 ((view->GetViewType() & kCgemUFView1) && fLayer == 1) ||
898 ((view->GetViewType() & kCgemUFView2) && fLayer == 2) )
899 )
900 {
901 if (IsFired())
902 {
903 fVStripUF->SetLineColor(lcStripFired);
904 fVStripUF->SetLineWidth(lwStripFired);
905 fVStripUF->SetFillColor(fcStripFired);
906 fVStripUF->SetFillStyle(fsStripFired);
907 }
908 else
909 {
910 fVStripUF->SetLineColor(lcStrip);
911 fVStripUF->SetLineWidth(lwStrip);
912 fVStripUF->SetFillColor(fcStrip);
913 fVStripUF->SetFillStyle(fsStrip);
914 }
915
916 if (IsHighlighted())
917 {
918 fVStripUF->SetLineColor(lcStripHL);
919 fVStripUF->SetLineWidth(lwStripHL);
920 fVStripUF->SetFillColor(fcStripHL);
921 fVStripUF->SetFillStyle(fsStripHL);
922 }
923
924 fVStripUF->Paint();
925 }
926}
virtual void Paint(Option_t *option="")
virtual bool IsFired() const
Definition Cgem2DStrip.h:38

◆ SetStyle()

void Cgem2DVStrip::SetStyle ( )
virtual

Reimplemented from Cgem2DStripBase.

Definition at line 723 of file Cgem2DStrip.cxx.

724{
725 lcStrip = 30; //line color: grey green
726 lwStrip = 1; //line width
727 fcStrip = 30; //fill color: grey green
728 fsStrip = 1001; //fill style
729
730 lcStripFired = kRed;
731 lwStripFired = 1;
732 fcStripFired = kRed;
733 fsStripFired = 1001;
734
735 lcStripHL = kBlue;
736 lwStripHL = 1;
737 fcStripHL = kBlue;
738 fsStripHL = 1001;
739}

Referenced by Cgem2DVStrip().

Member Data Documentation

◆ fVStripUF

BesPolygon2D* Cgem2DVStrip::fVStripUF
protected

Definition at line 184 of file Cgem2DStrip.h.

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

◆ fVStripXY

BesPolygon2D* Cgem2DVStrip::fVStripXY
protected

Definition at line 182 of file Cgem2DStrip.h.

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

◆ fVStripZR

BesPolygon2D* Cgem2DVStrip::fVStripZR
protected

Definition at line 183 of file Cgem2DStrip.h.

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


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