CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemROOTGeo Class Reference

#include <CgemROOTGeo.h>

+ Inheritance diagram for CgemROOTGeo:

Public Member Functions

 CgemROOTGeo ()
 
virtual ~CgemROOTGeo ()
 
void InitFromGDML (const char *gdmlFile, const char *setupName)
 
void InitFromROOT (TGeoVolume *vol)
 
void InitGeometry ()
 
void SetNode ()
 
void SetVolumeDefaultVis ()
 
void SetPhysicalDefaultVis ()
 
void SetAllVisible ()
 
void SetQuarterVisible ()
 
void SetHalfVisible ()
 
void SetPhysicalNode ()
 
void SetDetector ()
 
void SetHits ()
 
void ClearHits ()
 
void SetVisCgemDetector ()
 
void SetVisCgemHits ()
 
void SetVolumeCgem (TGeoVolume *vol)
 
TGeoVolume * GetVolumeCgem () const
 
Cgem2DStripBaseGet2DStrip (bool is_x, int layer, int sheet, int strip) const
 
TGeoNode * GetCgemAnode (int layer)
 
TGeoNode * GetCgemCathode (int layer)
 
TGeoNode * GetCgemFoil (int layer, int foil)
 
void Draw (Option_t *option)
 
void DrawUF (int layer, Option_t *option="")
 
void DrawHits (Option_t *option)
 
void Draw3DHits (Option_t *option)
 
double calcZFromLayerSheetVIDPhi (int layer, int sheet, double v, double phi) const
 
double getRFromLayerSheet (int layer, int sheet) const
 
double getSheetWidth (int layer, int sheet) const
 
double isPointInSheet (int layer, int sheet, double phi, double z) const
 
- Public Member Functions inherited from SubDetectorROOTGeo
 SubDetectorROOTGeo ()
 Constructor.
 
virtual ~SubDetectorROOTGeo ()
 Destructor.
 
void ReadGdml (const char *gdmlFile, const char *setupName)
 Initialize the instance of ROOTGeo.
 
int IsInitialized ()
 If the ROOT geometry of this subdetctor is initialized;.
 
void SetChildNo (int childNo)
 
TGeoVolume * GetLogicalVolume (const std::string &vn)
 Get a logical volume by name;.
 
TGeoVolume * GetTopVolume ()
 Get the top(world) volume;.
 
TGeoVolumeAssembly * GetAssemblyVolume (const std::string &an)
 Get an assembly by name;.
 
TGeoNode * GetNode (const std::string &nn)
 Get a node(physical volume) by name;.
 
 SubDetectorROOTGeo ()
 Constructor.
 
virtual ~SubDetectorROOTGeo ()
 Destructor.
 
virtual void ReadGdml (const char *gdmlFile, const char *setupName)
 Initialize the instance of ROOTGeo.
 
virtual int IsInitialized ()
 If the ROOT geometry of this subdetctor is initialized;.
 
virtual void SetChildNo (int childNo)
 
virtual TGeoVolume * GetLogicalVolume (const std::string &vn)
 Get a logical volume by name;.
 
virtual TGeoVolume * GetTopVolume ()
 Get the top(world) volume;.
 
virtual TGeoVolumeAssembly * GetAssemblyVolume (const std::string &an)
 Get an assembly by name;.
 
virtual TGeoNode * GetNode (const std::string &nn)
 Get a node(physical volume) by name;.
 
virtual int GetHitsNum ()
 Get number of hits in HitsArray;.
 
virtual TGeoPhysicalNode * GetHit (int i)
 Get ith hit in HitsArray;.
 
virtual void SetDetectorOn ()
 Set all physicalNodes in m_DeteorsArray visible;.
 

Additional Inherited Members

- Protected Attributes inherited from SubDetectorROOTGeo
int m_ROOTGeoInit
 
int m_childNo
 
TGeoVolume * m_TopVolume
 
int m_2DGeoInit
 
TObjArray * m_DetectorsArray
 
TObjArray * m_HitsArray
 
TObjArray * m_2DHitsArray
 

Detailed Description

Definition at line 23 of file CgemROOTGeo.h.

Constructor & Destructor Documentation

◆ CgemROOTGeo()

CgemROOTGeo::CgemROOTGeo ( )

Definition at line 35 of file CgemROOTGeo.cxx.

36{
37 m_CgemColor = kSpring;
38 m_XstripColor = 828;
39 m_VstripColor = kTeal;
40
41 for (int layer = 0; layer < m_kCgemLayer; ++layer)
42 {
43 m_NodeCgemAnode[layer] = 0;
44 m_NodeCgemCathode[layer] = 0;
45 for (int foil = 0; foil < m_kCgemFoil; ++foil)
46 m_NodeCgemFoil[layer][foil] = 0;
47
48 for (int sheet = 0; sheet < 2; ++sheet)
49 {
50 NXStrip[layer][sheet] = 0;
51 NVStrip[layer][sheet] = 0;
52 m_CgemXStrip[layer][sheet] = 0;
53 m_CgemVStrip[layer][sheet] = 0;
54 m_CgemSheet[layer][sheet] = 0;
55 }
56 }
57}

◆ ~CgemROOTGeo()

CgemROOTGeo::~CgemROOTGeo ( )
virtual

Definition at line 60 of file CgemROOTGeo.cxx.

61{
62 cout << "delete old CgemROOTGeo" << endl;
63 for (int layer = 0; layer < m_kCgemLayer; ++layer)
64 {
65 for (int sheet = 0; sheet < 2; ++sheet)
66 {
67 if (layer == 0 && sheet == 1) continue;
68 delete m_CgemSheet[layer][sheet];
69
70 for (int strip = 0; strip < NXStrip[layer][sheet]; ++strip)
71 delete m_CgemXStrip[layer][sheet][strip];
72 delete m_CgemXStrip[layer][sheet];
73 for (int strip = 0; strip < NVStrip[layer][sheet]; ++strip)
74 delete m_CgemVStrip[layer][sheet][strip];
75 delete m_CgemVStrip[layer][sheet];
76 }
77 }
78}

Member Function Documentation

◆ calcZFromLayerSheetVIDPhi()

double CgemROOTGeo::calcZFromLayerSheetVIDPhi ( int  layer,
int  sheet,
double  v,
double  phi 
) const

Definition at line 907 of file CgemROOTGeo.cxx.

908{
909 if (layer < 0 || layer >= m_kCgemLayer || sheet < 0 || sheet >= 2) return 0.0;
910 double ruf = (RV[layer][sheet] + RX[layer][sheet]) / 2;
911 double len = SheetLength[layer][sheet];
912 double wid = SheetWidth[layer][sheet];
913 double ang = StereoAngle[layer][sheet];
914 double xmin = XMin[layer][sheet];
915 double zmin = ZMin[layer][sheet];
916 double pit = VPitch[layer][sheet];
917 double vuf = v / RV[layer][sheet] * ruf;
918 CgemVStripCalculator calc(ruf, len, wid, ang, xmin, zmin, pit);
919 return calc.getZFromVPhi(v, phi);
920}
**********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

◆ ClearHits()

void CgemROOTGeo::ClearHits ( )

Definition at line 479 of file CgemROOTGeo.cxx.

480{
481 for (int i = 0; i < m_2DHitsArray->GetEntries(); ++i)
482 {
484 strip->ClearInfo();
485 strip->AddInfo(strip->GetTitle());
486 strip->CloseInfo();
487 }
488 m_2DHitsArray->Clear("C");
489}
virtual void ClearInfo()
Definition: Cgem2DStrip.cxx:41
virtual void AddInfo(TString info)
Definition: Cgem2DStrip.h:40
virtual void CloseInfo()=0

Referenced by BesEvent::ClearHits(), and SetHits().

◆ Draw()

void CgemROOTGeo::Draw ( Option_t *  option)

Definition at line 596 of file CgemROOTGeo.cxx.

597{
598 TString opt = option;
599 opt.ToUpper();
600
601 if (!m_2DGeoInit) cout << "CgemROOTGeo::Draw(), Geometry not initialized!" << endl;
602 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
603 if (!view) cout << "CgemROOTGeo::Draw(), BesView not found" << endl;
604
605 if (view->GetVisCgemGlobal())
606 {
607 if (opt.Contains("XY")) m_CgemXY->Draw("");
608 if (opt.Contains("ZR"))
609 {
610 m_CgemZR[0]->Draw("");
611 m_CgemZR[1]->Draw("");
612 }
613
614 if (view->GetVisCgemLayers())
615 {
616 if (opt.Contains("XY"))
617 {
618 for (int layer = 0; layer < m_kCgemLayer; ++layer)
619 {
620 m_CgemAnodeXY[layer]->Draw("");
621 m_CgemCathodeXY[layer]->Draw("");
622 for (int foil = 0; foil < m_kCgemFoil; ++foil)
623 m_CgemFoilXY[layer][foil]->Draw("");
624 }
625 }
626
627 if (opt.Contains("ZR"))
628 {
629 for (int layer = 0; layer < m_kCgemLayer; ++layer)
630 {
631 m_CgemAnodeZR[layer][0]->Draw("");
632 m_CgemAnodeZR[layer][1]->Draw("");
633 m_CgemCathodeZR[layer][0]->Draw("");
634 m_CgemCathodeZR[layer][1]->Draw("");
635 for (int foil = 0; foil < m_kCgemFoil; ++foil)
636 {
637 m_CgemFoilZR[layer][foil][0]->Draw("");
638 m_CgemFoilZR[layer][foil][1]->Draw("");
639 }
640 }
641 }
642 }
643
644 if (opt.Contains("ZR")) //In ZR View, draw X-strip first
645 {
646 if (view->GetVisCgemXStrips())
647 {
648 for (int layer = 0; layer < m_kCgemLayer; ++layer)
649 {
650 for (int sheet = 0; sheet < 2; ++sheet)
651 {
652 if (layer == 0 && sheet == 1) continue;
653 for (int strip = 0; strip < NXStrip[layer][sheet]; ++strip)
654 {
655 m_CgemXStrip[layer][sheet][strip]->SetFired(false);
656 m_CgemXStrip[layer][sheet][strip]->Draw(opt);
657 }
658 }
659 }
660 }
661 if (view->GetVisCgemVStrips())
662 {
663 for (int layer = 0; layer < m_kCgemLayer; ++layer)
664 {
665 for (int sheet = 0; sheet < 2; ++sheet)
666 {
667 if (layer == 0 && sheet == 1) continue;
668 for (int strip = 0; strip < NVStrip[layer][sheet]; ++strip)
669 {
670 m_CgemVStrip[layer][sheet][strip]->SetFired(false);
671 m_CgemVStrip[layer][sheet][strip]->Draw(opt);
672 }
673 }
674 }
675 }
676 }
677 else //In XY View, draw V-strip first
678 {
679 if (view->GetVisCgemVStrips())
680 {
681 for (int layer = 0; layer < m_kCgemLayer; ++layer)
682 {
683 for (int sheet = 0; sheet < 2; ++sheet)
684 {
685 if (layer == 0 && sheet == 1) continue;
686 for (int strip = 0; strip < NVStrip[layer][sheet]; ++strip)
687 {
688 m_CgemVStrip[layer][sheet][strip]->SetFired(false);
689 m_CgemVStrip[layer][sheet][strip]->Draw(opt);
690 }
691 }
692 }
693 }
694 if (view->GetVisCgemXStrips())
695 {
696 for (int layer = 0; layer < m_kCgemLayer; ++layer)
697 {
698 for (int sheet = 0; sheet < 2; ++sheet)
699 {
700 if (layer == 0 && sheet == 1) continue;
701 for (int strip = 0; strip < NXStrip[layer][sheet]; ++strip)
702 {
703 m_CgemXStrip[layer][sheet][strip]->SetFired(false);
704 m_CgemXStrip[layer][sheet][strip]->Draw(opt);
705 }
706 }
707 }
708 }
709 }
710 }
711}
virtual void Draw(Option_t *option="")
virtual void Draw(Option_t *option="")
Bool_t GetVisCgemXStrips()
Definition: BesView.h:122
Bool_t GetVisCgemVStrips()
Definition: BesView.h:123
Bool_t GetVisCgemGlobal()
Definition: BesView.h:120
Bool_t GetVisCgemLayers()
Definition: BesView.h:121
virtual void SetFired(bool status=true)
Definition: Cgem2DStrip.h:36
virtual void Draw(Option_t *option="")
virtual void Draw(Option_t *option="")
c1_1 Draw()

Referenced by BesGeometry::Draw2DXY(), and BesGeometry::Draw2DZR().

◆ Draw3DHits()

void CgemROOTGeo::Draw3DHits ( Option_t *  option)

Definition at line 802 of file CgemROOTGeo.cxx.

803{
804 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
805 if (!view) cout << "CgemROOTGeo::Draw3DHits(), BesView not found" << endl;
806
807 if (view->GetVisCgemHitsGlobal())
808 {
809 int NDigiCol = 0;
810 if (gEvent)
811 {
812 m_CgemDigiCol = gEvent->GetCgemDigiCol();
813 if (m_CgemDigiCol) NDigiCol = m_CgemDigiCol->GetEntries();
814 else NDigiCol = 0;
815 }
816
817 for (int i = 0; i < NDigiCol; ++i)
818 {
819 TCgemDigi* aCgemDigi = (TCgemDigi*)m_CgemDigiCol->At(i);
820 Identifier aCgemID(aCgemDigi->getIntId());
821 int layer = CgemID::layer(aCgemID);
822 int sheet = CgemID::sheet(aCgemID);
823 int strip = CgemID::strip(aCgemID);
824 bool is_x = CgemID::is_xstrip(aCgemID);
825 TPolyLine3D* pStrip = 0;
826
827 if (is_x)
828 {
829 if (view->GetVisCgemHitsXStrip() && strip < NXStrip[layer][sheet] && strip >= 0)
830 {
831 //Construct X-strip 3D hits
832 Double_t P[6];
833 double phi = XStripPhi[layer][sheet][strip];
834 double r = RX[layer][sheet];
835 double zmin = ZMin[layer][sheet];
836 P[0] = P[3] = TMath::Cos(phi) * r;
837 P[1] = P[4] = TMath::Sin(phi) * r;
838 P[2] = -zmin;
839 P[5] = zmin;
840
841 pStrip = new TPolyLine3D(2, P);
842 pStrip->SetBit(kCanDelete);
843 pStrip->SetLineWidth(4);
844 pStrip->SetLineColor(m_XstripColor);
845 pStrip->Draw(option);
846 }
847 }
848 else
849 {
850 if (view->GetVisCgemHitsVStrip() && strip < NVStrip[layer][sheet] && strip >= 0)
851 {
852 //Construct V-strip 3D hits
853 double r = RV[layer][sheet];
854 double len = SheetLength[layer][sheet];
855 double wid = SheetWidth[layer][sheet];
856 double ang = StereoAngle[layer][sheet];
857 double xmin = XMin[layer][sheet];
858 double zmin = ZMin[layer][sheet];
859 double pit = VPitch[layer][sheet];
860 CgemVStripCalculator calc(r, len, wid, ang, xmin, zmin, pit);
861
862 int N = calc.getPointNumberFromV(strip);
863 if (N > 0)
864 {
865 pStrip = new TPolyLine3D(N);
866 pStrip->SetBit(kCanDelete);
867 pStrip->SetLineWidth(3);
868 pStrip->SetLineColor(m_VstripColor);
869
870 double tphi = 0, tz = 0;
871 for (int i = 0; i < N; ++i)
872 {
873 //New Geom
874 double v = VStripV[layer][sheet][strip];
875 calc.getNthPointFromV(v, i, tphi, tz);
876 double x = r * TMath::Cos(tphi);
877 double y = r * TMath::Sin(tphi);
878 double z = tz;
879 pStrip->SetPoint(i, x, y, z);
880 }
881
882 pStrip->Draw(option);
883 }
884 }
885 }
886 }
887 }
888}
R__EXTERN BesEvent * gEvent
Definition: BesEvent.h:318
double P(RecMdcKalTrack *trk)
Double_t x[10]
const TObjArray * GetCgemDigiCol() const
Definition: BesEvent.h:92
Bool_t GetVisCgemHitsXStrip()
Definition: BesView.h:202
Bool_t GetVisCgemHitsVStrip()
Definition: BesView.h:203
Bool_t GetVisCgemHitsGlobal()
Definition: BesView.h:201
static int strip(const Identifier &id)
Definition: CgemID.cxx:83
static int sheet(const Identifier &id)
Definition: CgemID.cxx:77
static int layer(const Identifier &id)
Definition: CgemID.cxx:71
static bool is_xstrip(const Identifier &id)
Definition: CgemID.cxx:64
UInt_t getIntId() const
Definition: TRawData.cxx:50

Referenced by BesEvent::DrawCgem3DHits().

◆ DrawHits()

void CgemROOTGeo::DrawHits ( Option_t *  option)

Definition at line 752 of file CgemROOTGeo.cxx.

753{
754 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
755 if (!view) cout << "CgemROOTGeo::DrawHits(), BesView not found" << endl;
756
757 if (view->GetVisCgemHitsGlobal())
758 {
759 for (int i = 0; i < m_2DHitsArray->GetEntries(); ++i)
760 {
762 bool skip = false;
763 if (aStrip->GetType() == CGEM_X_STRIP)
764 {
765 if (!view->GetVisCgemHitsXStrip()) skip = true;
766 }
767 else if (aStrip->GetType() == CGEM_V_STRIP)
768 {
769 if (!view->GetVisCgemHitsVStrip()) skip = true;
770 }
771
772 if (!skip && aStrip)
773 {
774 //normal view
775 if ((view->GetViewType() & kXYView) || (view->GetViewType() & kZRView))
776 {
777 aStrip->SetFired(true);
778 aStrip->Draw(option);
779 }
780
781 //unfolded view
782 else if ((view->GetViewType() & kCgemUFView0) && aStrip->GetLayer() == 0)
783 {
784 aStrip->SetFired(true);
785 aStrip->Draw(option);
786 }
787 else if ((view->GetViewType() & kCgemUFView1) && aStrip->GetLayer() == 1)
788 {
789 aStrip->SetFired(true);
790 aStrip->Draw(option);
791 }
792 else if ((view->GetViewType() & kCgemUFView2) && aStrip->GetLayer() == 2)
793 {
794 aStrip->SetFired(true);
795 aStrip->Draw(option);
796 }
797 }
798 } //for end
799 }
800}
@ 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
@ CGEM_X_STRIP
Definition: Cgem2DStrip.h:20
@ CGEM_V_STRIP
Definition: Cgem2DStrip.h:21
EBESViewType GetViewType()
Definition: BesView.h:74
virtual void Draw(Option_t *option="")=0
virtual ECgemStripType GetType() const =0
virtual Int_t GetLayer() const
Definition: Cgem2DStrip.h:49

Referenced by BesEvent::DrawCgemUFHits(), and BesEvent::DrawHits().

◆ DrawUF()

void CgemROOTGeo::DrawUF ( int  layer,
Option_t *  option = "" 
)

Definition at line 714 of file CgemROOTGeo.cxx.

715{
716 if (layer < 0 || layer >= m_kCgemLayer) return;
717 TString opt = option;
718 opt += ",UF";
719 opt.ToUpper();
720 if (!m_2DGeoInit) cout << "CgemROOTGeo::Draw(), Geometry not initialized!" << endl;
721 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
722 if (!view) cout << "CgemROOTGeo::Draw(), BesView not found" << endl;
723
724 if (view->GetVisCgemGlobal())
725 {
726 for (int sheet = 0; sheet < 2; ++sheet)
727 {
728 if (layer == 0 && sheet == 1) continue;
729 if (view->GetVisCgemLayers()) m_CgemSheet[layer][sheet]->Draw(opt);
730
731 if (view->GetVisCgemXStrips())
732 {
733 for (int strip = 0; strip < NXStrip[layer][sheet]; ++strip)
734 {
735 m_CgemXStrip[layer][sheet][strip]->SetFired(false);
736 m_CgemXStrip[layer][sheet][strip]->Draw(opt);
737 }
738 }
739 if (view->GetVisCgemVStrips())
740 {
741 for (int strip = 0; strip < NVStrip[layer][sheet]; ++strip)
742 {
743 m_CgemVStrip[layer][sheet][strip]->SetFired(false);
744 m_CgemVStrip[layer][sheet][strip]->Draw(opt);
745 }
746 }
747 }
748 }
749}

Referenced by BesGeometry::DrawCgemUF().

◆ Get2DStrip()

Cgem2DStripBase * CgemROOTGeo::Get2DStrip ( bool  is_x,
int  layer,
int  sheet,
int  strip 
) const

Definition at line 891 of file CgemROOTGeo.cxx.

892{
893 if (is_x)
894 {
895 if (strip >= 0 && strip < NXStrip[layer][sheet])
896 return m_CgemXStrip[layer][sheet][strip];
897 }
898 else
899 {
900 if (strip >= 0 && strip < NVStrip[layer][sheet])
901 return m_CgemVStrip[layer][sheet][strip];
902 }
903 return 0;
904}

◆ GetCgemAnode()

TGeoNode * CgemROOTGeo::GetCgemAnode ( int  layer)

Definition at line 580 of file CgemROOTGeo.cxx.

581{
582 return m_NodeCgemAnode[layer];
583}

Referenced by InitGeometry().

◆ GetCgemCathode()

TGeoNode * CgemROOTGeo::GetCgemCathode ( int  layer)

Definition at line 585 of file CgemROOTGeo.cxx.

586{
587 return m_NodeCgemCathode[layer];
588}

Referenced by InitGeometry().

◆ GetCgemFoil()

TGeoNode * CgemROOTGeo::GetCgemFoil ( int  layer,
int  foil 
)

Definition at line 590 of file CgemROOTGeo.cxx.

591{
592 return m_NodeCgemFoil[layer][foil];
593}

Referenced by InitGeometry().

◆ getRFromLayerSheet()

double CgemROOTGeo::getRFromLayerSheet ( int  layer,
int  sheet 
) const

Definition at line 922 of file CgemROOTGeo.cxx.

923{
924 if (layer < 0 || layer >= m_kCgemLayer || sheet < 0 || sheet >= 2) return 0.0;
925 return (RX[layer][sheet] + RV[layer][sheet]) / 2;
926}

Referenced by BesEvent::SetCgemClusters().

◆ getSheetWidth()

double CgemROOTGeo::getSheetWidth ( int  layer,
int  sheet 
) const

Definition at line 928 of file CgemROOTGeo.cxx.

929{
930 if (layer < 0 || layer >= m_kCgemLayer || sheet < 0 || sheet >= 2) return 0.0;
931 return SheetWidth[layer][sheet];
932}

Referenced by BesEvent::SetCgemClusters().

◆ GetVolumeCgem()

TGeoVolume * CgemROOTGeo::GetVolumeCgem ( ) const
inline

Definition at line 70 of file CgemROOTGeo.h.

70{ return m_CGEM; }

Referenced by BesGeometry::GetVolumeCgem(), BesGeometry::InitFromGDML(), and InitGeometry().

◆ InitFromGDML()

void CgemROOTGeo::InitFromGDML ( const char *  gdmlFile,
const char *  setupName 
)

Definition at line 81 of file CgemROOTGeo.cxx.

82{
83 m_ROOTGeoInit = 2;
84 ReadGdml(gdmlFile, setupName);
85 SetNode();
86}
void SetNode()
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.

Referenced by BesGeometry::InitFromGDML().

◆ InitFromROOT()

void CgemROOTGeo::InitFromROOT ( TGeoVolume *  vol)

Definition at line 89 of file CgemROOTGeo.cxx.

90{
91 m_ROOTGeoInit = 1;
92 SetVolumeCgem(vol);
93 SetNode();
94}
void SetVolumeCgem(TGeoVolume *vol)
Definition: CgemROOTGeo.h:68

Referenced by BesGeometry::InitFromROOT().

◆ InitGeometry()

void CgemROOTGeo::InitGeometry ( )

Definition at line 97 of file CgemROOTGeo.cxx.

98{
99 Int_t CgemLineColor = 15;
100 Int_t CgemFillColor = 18;
101 Int_t CgemFillStyle = 1001;
102 Int_t CgemLayerStyle = 3003;
103 Int_t CgemElectrodeColor = 12;
104 Int_t CgemFoilColor = 12;
105 m_2DGeoInit = 1;
106
107 TGeoVolume* CgemVol;
108 TGeoTube* CgemTube;
109 TString name;
110 Double_t center[3] = {0.0, 0.0, 0.0};
111 Double_t P[12];
112
113 //XY View
114 TGeoTube* CgemShape = (TGeoTube*)GetVolumeCgem()->GetShape();
115 m_CgemXY = new BesCircle2D("CGEM", "CGEM", CgemShape->GetRmin(), CgemShape->GetRmax(), &center[0]);
116 m_CgemXY->SetNSegment(360);
117 m_CgemXY->SetFillColor(CgemFillColor);
118 m_CgemXY->SetFillStyle(CgemFillStyle);
119 m_CgemXY->SetLineColor(CgemLineColor);
120
121 for (int layer = 0; layer < m_kCgemLayer; ++layer)
122 {
123 CgemVol = GetCgemAnode(layer)->GetVolume();
124 CgemTube = (TGeoTube*)CgemVol->GetShape();
125 name = "CGEM Layer";
126 name += layer;
127 name += " Anode";
128 center[2] = CgemTube->GetDz();
129 m_CgemAnodeXY[layer] = new BesCircle2D(name, name, CgemTube->GetRmin(), CgemTube->GetRmax(), center);
130 m_CgemAnodeXY[layer]->SetNSegment(360);
131 m_CgemAnodeXY[layer]->SetFillStyle(CgemLayerStyle);
132 m_CgemAnodeXY[layer]->SetLineColor(CgemElectrodeColor);
133 m_CgemAnodeXY[layer]->SetFillColor(CgemElectrodeColor);
134
135 CgemVol = GetCgemCathode(layer)->GetVolume();
136 CgemTube = (TGeoTube*)CgemVol->GetShape();
137 name = "CGEM Layer";
138 name += layer;
139 name += " Cathode";
140 center[2] = CgemTube->GetDz();
141 m_CgemCathodeXY[layer] = new BesCircle2D(name, name, CgemTube->GetRmin(), CgemTube->GetRmax(), center);
142 m_CgemCathodeXY[layer]->SetNSegment(360);
143 m_CgemCathodeXY[layer]->SetFillStyle(CgemLayerStyle);
144 m_CgemCathodeXY[layer]->SetLineColor(CgemElectrodeColor);
145 m_CgemCathodeXY[layer]->SetFillColor(CgemElectrodeColor);
146
147 for (int foil = 0; foil < m_kCgemFoil; ++foil)
148 {
149 CgemVol = GetCgemFoil(layer, foil)->GetVolume();
150 CgemTube = (TGeoTube*)CgemVol->GetShape();
151 name = "CGEM Layer";
152 name += layer;
153 name += " Foil";
154 name += foil;
155 center[2] = CgemTube->GetDz();
156 m_CgemFoilXY[layer][foil] = new BesCircle2D(name, name, CgemTube->GetRmin(), CgemTube->GetRmax(), center);
157 m_CgemFoilXY[layer][foil]->SetNSegment(360);
158 m_CgemFoilXY[layer][foil]->SetFillStyle(CgemLayerStyle);
159 m_CgemFoilXY[layer][foil]->SetLineColor(CgemFoilColor);
160 m_CgemFoilXY[layer][foil]->SetFillColor(CgemFoilColor);
161 }
162 }
163
164 //ZR View
165 for (int j = 0; j < 2; ++j)
166 {
167 P[0] = P[3] = P[6] = P[9] = 0;
168 P[1] = P[10] = CgemShape->GetRmin() * (1 - 2 * j);
169 P[2] = P[5] = -CgemShape->GetDz();
170 P[4] = P[7] = CgemShape->GetRmax() * (1 - 2 * j);
171 P[8] = P[11] = CgemShape->GetDz();
172
173 name = "CgemZR ";
174 if (j == 0) name += "Up";
175 else name += "Down";
176 m_CgemZR[j] = new BesPolygon2D(name, name, 4, P);
177 m_CgemZR[j]->SetFillColor(CgemFillColor);
178 m_CgemZR[j]->SetFillStyle(CgemFillStyle);
179 m_CgemZR[j]->SetLineColor(CgemLineColor);
180 m_CgemZR[j]->SetRotatable(true);
181 }
182
183 for (int layer = 0; layer < m_kCgemLayer; ++layer)
184 {
185 for (int j = 0; j < 2; ++j)
186 {
187 CgemVol = GetCgemAnode(layer)->GetVolume();
188 CgemTube = (TGeoTube*)CgemVol->GetShape();
189 name = "CgemZR Layer";
190 name += layer;
191 if (j == 0) name += " Anode Up";
192 else name += " Anode Down";
193
194 P[0] = P[3] = P[6] = P[9] = 0;
195 P[1] = P[10] = CgemTube->GetRmin() * (1 - 2 * j);
196 P[2] = P[5] = -CgemTube->GetDz();
197 P[4] = P[7] = CgemTube->GetRmax() * (1 - 2 * j);
198 P[8] = P[11] = CgemTube->GetDz();
199
200 m_CgemAnodeZR[layer][j] = new BesPolygon2D(name, name, 4, P);
201 m_CgemAnodeZR[layer][j]->SetFillStyle(CgemLayerStyle);
202 m_CgemAnodeZR[layer][j]->SetLineColor(CgemElectrodeColor);
203 m_CgemAnodeZR[layer][j]->SetFillColor(CgemElectrodeColor);
204 m_CgemAnodeZR[layer][j]->SetRotatable(true);
205
206 CgemVol = GetCgemCathode(layer)->GetVolume();
207 CgemTube = (TGeoTube*)CgemVol->GetShape();
208 name = "CgemZR Layer";
209 name += layer;
210 if (j == 0) name += " Cathode Up";
211 else name += " Cathode Down";
212
213 P[0] = P[3] = P[6] = P[9] = 0;
214 P[1] = P[10] = CgemTube->GetRmin() * (1 - 2 * j);
215 P[2] = P[5] = -CgemTube->GetDz();
216 P[4] = P[7] = CgemTube->GetRmax() * (1 - 2 * j);
217 P[8] = P[11] = CgemTube->GetDz();
218
219 m_CgemCathodeZR[layer][j] = new BesPolygon2D(name, name, 4, P);
220 m_CgemCathodeZR[layer][j]->SetFillStyle(CgemLayerStyle);
221 m_CgemCathodeZR[layer][j]->SetLineColor(CgemElectrodeColor);
222 m_CgemCathodeZR[layer][j]->SetFillColor(CgemElectrodeColor);
223 m_CgemCathodeZR[layer][j]->SetRotatable(true);
224
225 for (int foil = 0; foil < m_kCgemFoil; ++foil)
226 {
227 CgemVol = GetCgemFoil(layer, foil)->GetVolume();
228 CgemTube = (TGeoTube*)CgemVol->GetShape();
229 name = "CgemZR Layer";
230 name += layer;
231 name += " Foil";
232 name += foil;
233 if (j == 0) name += " Up";
234 else name += " Down";
235
236 P[0] = P[3] = P[6] = P[9] = 0;
237 P[1] = P[10] = CgemTube->GetRmin() * (1 - 2 * j);
238 P[2] = P[5] = -CgemTube->GetDz();
239 P[4] = P[7] = CgemTube->GetRmax() * (1 - 2 * j);
240 P[8] = P[11] = CgemTube->GetDz();
241
242 m_CgemFoilZR[layer][foil][j] = new BesPolygon2D(name, name, 4, P);
243 m_CgemFoilZR[layer][foil][j]->SetFillStyle(CgemLayerStyle);
244 m_CgemFoilZR[layer][foil][j]->SetLineColor(CgemFoilColor);
245 m_CgemFoilZR[layer][foil][j]->SetFillColor(CgemFoilColor);
246 m_CgemFoilZR[layer][foil][j]->SetRotatable(true);
247 }
248 }
249 }
250
251 //Calculate CGEM strips by using CgemGeomSvc package
252 CgemGeomSvc cgs("CgemGeomSvc", Gaudi::svcLocator());
253 //cgs.initGeom();
254 cgs.initialize();
255 CgemGeoReadoutPlane* plane = 0;
256 CgemGeoLayer* geolayer = 0;
257
258 for (int layer = 0; layer < 3; ++layer)
259 {
260 for (int sheet = 0; sheet < 2; ++sheet)
261 {
262 //Load data of Readout Plane
263 if (layer == 0 && sheet == 1) continue;
264 plane = cgs.getReadoutPlane(layer, sheet);
265 geolayer = cgs.getCgemLayer(layer);
266
267 cout << "layer" << layer << " sheet" << sheet << " " << plane << endl;
268 cout << "\tRX:" << plane->getRX() << endl;
269 cout << "\tRV:" << plane->getRV() << endl;
270 cout << "\tXmin:" << plane->getXmin() << endl;
271 cout << "\tWidth:" << plane->getWidth() << endl;
272 cout << "\tZmin:" << plane->getZmin() << endl;
273 cout << "\tLength:" << plane->getLength() << endl;
274 cout << "\tXPitch:" << plane->getXPitch() << endl;
275 cout << "\tVPitch:" << plane->getVPitch() << endl;
276 cout << "\tStereo Angle:" << plane->getStereoAngle() << endl;
277 cout << "\tMid R at Gap:" << plane->getMidRAtGap() << endl;
278 cout << "\tVmax:" << plane->getVmax() << endl;
279 cout << "\tX-strip number:" << plane->getNXstrips() << endl;
280 cout << "\tV-strip number:" << plane->getNVstrips() << endl;
281 cout << "\tX-strip width:" << geolayer->getWidthOfStripX() << endl;
282 cout << "\tV-strip width:" << geolayer->getWidthOfStripV() << endl;
283
284 //Construct sheets unfolded geometry
285 //P[1] = P[4] = -plane->getLength() / 2;
286 P[1] = P[4] = plane->getZmin(); //New Geom
287 P[2] = P[5] = P[8] = P[11] = 0;
288 //P[7] = P[10] = plane->getLength() / 2;
289 P[7] = P[10] = plane->getZmin() + plane->getLength(); //New Geom
290 P[0] = P[9] = plane->getXmin(); //New Geom
291 P[3] = P[6] = plane->getXmin() + plane->getWidth(); //New Geom
292 /*
293 if (layer == 0)
294 {
295 P[0] = P[9] = -plane->getWidth() / 2;
296 P[3] = P[6] = plane->getWidth() / 2;
297 }
298 else
299 {
300 P[0] = P[9] = plane->getXmin() - plane->getWidth();
301 P[3] = P[6] = plane->getXmin();
302 }
303 */
304
305 name = "CGEM Layer";
306 name += layer;
307 name += " Sheet";
308 name += sheet;
309 m_CgemSheet[layer][sheet] = new BesPolygon2D(name, name, 4, P);
310 m_CgemSheet[layer][sheet]->SetFillColor(CgemFillColor);
311 m_CgemSheet[layer][sheet]->SetFillStyle(CgemFillStyle);
312 m_CgemSheet[layer][sheet]->SetLineColor(CgemLineColor);
313
314
315 //Variables which will be used in constructing strips geometry
316 double r, wid, len, phi, xmin, zmin, ang, pit, thick, size, v, ruf;
317 ruf = (plane->getRX() + plane->getRV()) / 2;
318
319 //Construct X-strips 2D and 3D geometry
320 int n = plane->getNXstrips();
321 NXStrip[layer][sheet] = n;
322 m_CgemXStrip[layer][sheet] = new Cgem2DXStrip*[n];
323 XStripPhi[layer][sheet] = new Double_t[n];
324 len = plane->getLength();
325 wid = plane->getWidth();
326 zmin = plane->getZmin();
327 r = plane->getRX();
328 thick = 0.1;
329 size = geolayer->getWidthOfStripX();
330 SheetWidth[layer][sheet] = wid;
331 RX[layer][sheet] = r;
332 ZMin[layer][sheet] = zmin;
333
334 for (int strip = 0; strip < n; ++strip)
335 {
336 name = "CGEM X-Strip Layer";
337 name += layer;
338 name += " Sheet";
339 name += sheet;
340 name += " Strip";
341 name += strip;
342 phi = plane->getPhiFromXID(strip);
343 XStripPhi[layer][sheet][strip] = phi;
344 m_CgemXStrip[layer][sheet][strip] = new Cgem2DXStrip(name, name,
345 len, wid, phi, zmin, r, size, thick, layer, sheet, strip, ruf);
346 }
347
348 phi = plane->getPhiFromXID(n - 1);
349 phi -= plane->getPhiFromXID(0);
350
351 //Construct V-strips 2D and 3D geometry
352 n = plane->getNVstrips();
353 NVStrip[layer][sheet] = n;
354 m_CgemVStrip[layer][sheet] = new Cgem2DVStrip*[n];
355 VStripV[layer][sheet] = new Double_t[n];
356 r = plane->getRV();
357 len = plane->getLength();
358 wid = phi * ruf + geolayer->getWidthOfStripX(); //New Geom
359 ang = plane->getStereoAngle();
360 xmin = plane->getXmin();
361 pit = plane->getVPitch();
362 thick = 0.1;
363 size = geolayer->getWidthOfStripV();
364 RV[layer][sheet] = r;
365 SheetLength[layer][sheet] = len;
366 StereoAngle[layer][sheet] = ang;
367 //New Geom
368 XMin[layer][sheet] = plane->getPhiFromXID(0) * ruf - geolayer->getWidthOfStripX() / 2; //New Geom
369 xmin = XMin[layer][sheet];
370 VPitch[layer][sheet] = pit;
371 XPitch[layer][sheet] = plane->getXPitch();
372
373 for (int strip = 0; strip < n; ++strip)
374 {
375 name = "CGEM V-Strip Layer";
376 name += layer;
377 name += " Sheet";
378 name += sheet;
379 name += " Strip";
380 name += strip;
381 //New Geom
382 v = plane->getCentralVFromVID(strip);
383 VStripV[layer][sheet][strip] = v;
384 m_CgemVStrip[layer][sheet][strip] = new Cgem2DVStrip(name, name, v,
385 r, len, wid, ang, xmin, zmin, pit, size, thick, layer, sheet, strip, ruf);
386 }
387 } //sheet
388 } //layer
389}
const Int_t n
virtual void SetNSegment(Int_t np)
Definition: BesCircle2D.h:53
void SetRotatable(Bool_t input)
Definition: BesPolygon2D.h:65
double getWidthOfStripV() const
Definition: CgemGeoLayer.h:223
double getWidthOfStripX() const
Definition: CgemGeoLayer.h:222
double getCentralVFromVID(int V_ID) const
double getPhiFromXID(int X_ID) const
TGeoNode * GetCgemAnode(int layer)
TGeoNode * GetCgemCathode(int layer)
TGeoVolume * GetVolumeCgem() const
Definition: CgemROOTGeo.h:70
TGeoNode * GetCgemFoil(int layer, int foil)

Referenced by BesGeometry::InitGeometry().

◆ isPointInSheet()

double CgemROOTGeo::isPointInSheet ( int  layer,
int  sheet,
double  phi,
double  z 
) const

Definition at line 934 of file CgemROOTGeo.cxx.

935{
936 if (layer < 0 || layer >= m_kCgemLayer || sheet < 0 || sheet >= 2) return 0.0;
937 double ruf = (RV[layer][sheet] + RX[layer][sheet]) / 2;
938 double len = SheetLength[layer][sheet];
939 double wid = SheetWidth[layer][sheet];
940 double ang = StereoAngle[layer][sheet];
941 double xmin = XMin[layer][sheet];
942 double zmin = ZMin[layer][sheet];
943 double pit = VPitch[layer][sheet];
944 CgemVStripCalculator calc(ruf, len, wid, ang, xmin, zmin, pit);
945 return calc.isPointInSheet(phi, z);
946}

◆ SetAllVisible()

void CgemROOTGeo::SetAllVisible ( )

Definition at line 449 of file CgemROOTGeo.cxx.

450{
451
452}

◆ SetDetector()

void CgemROOTGeo::SetDetector ( )

Definition at line 473 of file CgemROOTGeo.cxx.

474{
475
476}

Referenced by BesClient::HandleViewOptionMenu().

◆ SetHalfVisible()

void CgemROOTGeo::SetHalfVisible ( )

Definition at line 461 of file CgemROOTGeo.cxx.

462{
463
464}

◆ SetHits()

void CgemROOTGeo::SetHits ( )

Definition at line 492 of file CgemROOTGeo.cxx.

493{
494 // set previous event 2D hits info to default
495 ClearHits();
496
497 int NDigiCol = 0;
498 if (gEvent)
499 {
500 m_CgemDigiCol = gEvent->GetCgemDigiCol();
501 if (m_CgemDigiCol) NDigiCol = m_CgemDigiCol->GetEntries();
502 else NDigiCol = 0;
503 }
504
505 for (int i = 0; i < NDigiCol; ++i)
506 {
507 TCgemDigi* aCgemDigi = (TCgemDigi*)m_CgemDigiCol->At(i);
508 Identifier aCgemID(aCgemDigi->getIntId());
509 int layer = CgemID::layer(aCgemID);
510 int sheet = CgemID::sheet(aCgemID);
511 int strip = CgemID::strip(aCgemID);
512 bool is_x = CgemID::is_xstrip(aCgemID);
513
514 //Double_t time = RawDataUtil::CgemTime(aCgemDigi->getTimeChannel());
515 //Int_t charge = RawDataUtil::CgemCharge(aCgemDigi->getChargeChannel());
516
517 Double_t charge = aCgemDigi->getCharge_fc();
518 //cout<<"charge="<<charge<<endl;
519 Double_t time = aCgemDigi->getTime_ns();
520
521 //Construct 2D hits
522 Cgem2DStripBase* aStrip = 0;
523 if (is_x)
524 {
525 if (strip < NXStrip[layer][sheet] && strip >= 0)
526 aStrip = m_CgemXStrip[layer][sheet][strip];
527 }
528 else
529 {
530 if (strip < NVStrip[layer][sheet] && strip > 0)
531 aStrip = m_CgemVStrip[layer][sheet][strip];
532 }
533
534 //Add 2D hits
535 if (aStrip)
536 {
537 aStrip->CloseInfo();
538 //aStrip->AddInfo(aStrip->GetTitle());
539 double evTime = gEvent->GetHeader().GetEvTime();
540
541 char data[200];
542 if(time>1000000)
543 sprintf(data, "NO time");
544 else
545 {
546 sprintf(data, "time=%-.1f ns", time);
547 //if(fabs(evTime)>0.0001)
548 // sprintf(data, "%s, Tdrift(Raw)=%-.1f ns", data, time - evTime +230);
549 }
550
551 if(charge>1000000) sprintf(data, "%s, NO charge", data);
552 else sprintf(data, "%s, charge=%-.2f fC", data,charge);
553
554 aStrip->AddInfo(TString(data));
555 sprintf(data, "Fired");
556 aStrip->AddInfo(TString(data));
557 //aStrip->SetTime(time);
558 //aStrip->SetCharge(charge);
559 //unsigned int overflow = aCgemDigi->getOverflow();
560 //aWire->SetQOverflow(overflow & 2);
561 //aWire->SetEvTime(evTime);
562 aStrip->CloseInfo();
563 m_2DHitsArray->Add(aStrip);
564 }
565 }
566}
TTree * data
Double_t time
Double_t GetEvTime()
BesEventHeader GetHeader()
Definition: BesEvent.h:310
void ClearHits()
Double_t getTime_ns()
Definition: TCgemDigi.h:38
Double_t getCharge_fc()
Definition: TCgemDigi.h:39

Referenced by BesEvent::SetHits().

◆ SetNode()

void CgemROOTGeo::SetNode ( )

Definition at line 392 of file CgemROOTGeo.cxx.

393{
394 if (m_ROOTGeoInit == 2)
395 { //from GDML
396 m_CGEM = GetTopVolume();
397 if (!m_CGEM) std::cout << "m_CGEM = 0" << std::endl;
398 // Int_t nDaughters = m_CGEM->GetNodes()->GetEntries();
399 // cout << "CGEM contains " << nDaughters << " nodes : " << endl;
400 // analNodes(m_CGEM->GetNodes(), 0);
401
402 for (int layer = 0; layer < m_kCgemLayer; ++layer)
403 {
404 std::stringstream osanode, oscathode;
405 osanode << "pv_Anode_logic" << layer << "_0";
406 oscathode << "pv_Cathode_logic" << layer << "_8";
407 m_NodeCgemAnode[layer] = GetNode(osanode.str());
408 m_NodeCgemCathode[layer] = GetNode(oscathode.str());
409 // cout << osanode.str() << " " << m_NodeCgemAnode[layer] << endl;
410 // cout << oscathode.str() << " " << m_NodeCgemCathode[layer] << endl;
411
412 for (int foil = 0; foil < m_kCgemFoil; ++foil)
413 {
414 std::stringstream osfoil;
415 osfoil << "pv_GemFoil_logic" << layer << "foil" << foil << "_" << m_kCgemFoil - foil;
416 m_NodeCgemFoil[layer][foil] = GetNode(osfoil.str());
417 // cout << osfoil.str() << " " << m_NodeCgemFoil[layer][foil] << endl;
418 }
419 }
420 }
421 else if (m_ROOTGeoInit == 1)
422 { //from ROOT
423 for (int layer = 0; layer < m_kCgemLayer; ++layer)
424 {
425 TGeoNode* cgemLayer = m_CGEM->GetNode(m_kCgemLayer - layer);
426 m_NodeCgemAnode[layer] = cgemLayer->GetVolume()->GetNode(0);
427 m_NodeCgemCathode[layer] = cgemLayer->GetVolume()->GetNode(8);
428 for (int foil = 0; foil < m_kCgemFoil; ++foil)
429 {
430 m_NodeCgemFoil[layer][foil] = cgemLayer->GetVolume()->GetNode(m_kCgemFoil - foil);
431 }
432 }
433 }
434}
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.

Referenced by InitFromGDML(), and InitFromROOT().

◆ SetPhysicalDefaultVis()

void CgemROOTGeo::SetPhysicalDefaultVis ( )

Definition at line 443 of file CgemROOTGeo.cxx.

444{
445
446}

Referenced by BesGeometry::SetPhysicalDefaultVis().

◆ SetPhysicalNode()

void CgemROOTGeo::SetPhysicalNode ( )

Definition at line 467 of file CgemROOTGeo.cxx.

468{
469
470}

Referenced by BesGeometry::InitGeometry().

◆ SetQuarterVisible()

void CgemROOTGeo::SetQuarterVisible ( )

Definition at line 455 of file CgemROOTGeo.cxx.

456{
457
458}

◆ SetVisCgemDetector()

void CgemROOTGeo::SetVisCgemDetector ( )

Definition at line 569 of file CgemROOTGeo.cxx.

570{
571
572}

Referenced by BesClient::HandleViewOptionMenu().

◆ SetVisCgemHits()

void CgemROOTGeo::SetVisCgemHits ( )

Definition at line 575 of file CgemROOTGeo.cxx.

576{
577
578}

◆ SetVolumeCgem()

void CgemROOTGeo::SetVolumeCgem ( TGeoVolume *  vol)
inline

Definition at line 68 of file CgemROOTGeo.h.

68{ m_CGEM = vol; }

Referenced by InitFromROOT().

◆ SetVolumeDefaultVis()

void CgemROOTGeo::SetVolumeDefaultVis ( )

Definition at line 437 of file CgemROOTGeo.cxx.

438{
439
440}

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