00001 //$id$ 00002 /* 00003 * 2004/11/29 Zhengyun You Peking University 00004 * Tof Geometry General for EventDisplay 00005 * 00006 * 2004/12/9 Zhengyun You Peking University 00007 * named from TofGeo to MdcROOTGeo 00008 * inherit from class SubDetectorROOTGeo 00009 */ 00010 00011 #ifndef Mdc_ROOT_GEO_H 00012 #define Mdc_ROOT_GEO_H 00013 00014 #include <map> 00015 00016 #include <TGeoVolume.h> 00017 #include <TGeoNode.h> 00018 #include <TGeoPhysicalNode.h> 00019 00020 #include "SubDetectorROOTGeo.h" 00021 #include "Mdc2DWire.h" 00022 00031 class MdcROOTGeo : public SubDetectorROOTGeo 00032 { 00033 public: 00034 00036 MdcROOTGeo(); 00037 00039 ~MdcROOTGeo(); 00040 00042 void InitFromGDML( const char *gdmlFile, const char *setupName ); 00043 00045 void InitFromROOT( TGeoVolume *vol ); 00046 00048 void Init2DGeometry(); 00049 00051 void SetNode(); 00052 00054 int CorrectReplica(int layer, int replica); 00055 00057 void SetVolumeDefaultVis(); 00058 00060 void SetAllVisible(); 00061 00063 void SetQuarterVisible(); 00064 00066 void SetHalfVisible(); 00067 00069 void SetPhysicalNode(); 00070 00072 //void SetPhysicalDefaultVis(); 00073 00075 void SetDetector(); 00076 00078 void SetHits(); 00079 void SetTMatch(Bool_t input); 00080 void SetQMatch(Bool_t input); 00081 00083 void SetVisMdcDetector(); 00084 00086 void SetVisMdcHits(); 00087 00089 int GetSegmentNb() { return m_kSegment; } 00090 00092 int GetLayerNb() { return m_kLayer; } 00093 00095 int GetReplicaNb(int layer) { return m_kReplica[layer]; } 00096 00098 void SetVolumeMdc(TGeoVolume *vol) { m_Mdc = vol; } 00099 00101 TGeoVolume *GetVolumeMdc() { return m_Mdc; } 00102 00104 TGeoVolume *GetVolumeSegment( int segment ); 00105 00107 TGeoVolume *GetVolumeLayer( int layer ); 00108 00110 TGeoVolume *GetVolumeReplica( int layer ); 00111 00113 TGeoNode *GetSegment( int segment, int no ); 00114 00116 TGeoNode *GetLayer( int layer ); 00117 00119 TGeoNode *GetReplica( int layer, int replica ); 00120 00122 TGeoPhysicalNode *GetPhysicalSegment( int segment ); 00123 00125 TGeoPhysicalNode *GetPhysicalReplica( int layer, int replica ); 00126 00128 Mdc2DWire *Get2DWire( Int_t layer, Int_t replica ); 00129 00131 Int_t GetSimuLayer(Int_t trueLayer); 00132 00134 Bool_t IsHit(Int_t layer, Int_t wire); 00135 00137 void Draw(Option_t *option); 00138 00140 void DrawHits(Option_t *option); 00141 00142 private: 00143 00144 static const int m_kSegment = 66; 00145 static const int m_kStereoLayerIn = 8; 00146 static const int m_kAxialLayerIn = 12; 00147 static const int m_kStereoLayerOut = 16; 00148 static const int m_kAxialLayerOut = 7; 00149 static const int m_kLayer = 50; 00150 static const int m_kTrueLayer = 43; // m_kLayer-m_kAxialLayerOut 00151 static const int m_kReplicaMax = 288; 00152 static const int m_kReplica[m_kLayer]; 00153 static const int m_kStereoDir[m_kTrueLayer]; 00154 static const int m_kCorrectLayer = 10; 00155 static const int m_kiCorrectLayer[m_kCorrectLayer]; 00156 static const int m_kiCorrectReplica[m_kCorrectLayer]; 00157 Bool_t k_TMatch; 00158 Bool_t k_QMatch; 00159 00160 static const int MDC_TIME_FACTOR = 100000; 00161 static const int MDC_CHARGE_FACTOR = 1000000; 00162 00163 int m_MdcColor; 00164 int m_segmentColor; 00165 int m_hypeColor; 00166 int m_tubeColor; 00167 int m_twistedTubsColor; 00168 int m_replicaColor; 00169 00170 std::map<int ,int> m_CorrectMap; 00171 typedef std::map<int, int> intMap; 00172 00173 TGeoVolume *m_Mdc; 00174 TGeoNode *m_NodeLayer[m_kLayer]; 00175 TGeoNode *m_NodeReplica[m_kLayer][m_kReplicaMax]; 00176 TGeoPhysicalNode *m_PhysicalSegment[m_kSegment*2]; 00177 TGeoPhysicalNode *m_PhysicalReplica[m_kLayer][m_kReplicaMax]; 00178 00179 const TObjArray *m_MdcDigiCol; 00180 00181 // 2D 00182 BesCircle2D *m_MdcXY; 00183 BesCircle2D *m_MdcXYSuper[4]; 00184 Mdc2DWire *m_Mdc2DWire[m_kTrueLayer][m_kReplicaMax]; 00185 00186 BesPolygon2D *m_MdcZR[2]; 00187 }; 00188 00189 #endif /* Mdc_ROOT_GEO_H */