00001
00002
00003
00004 #ifndef FROOT_TFndGeometry
00005 #define FROOT_TFndGeometry
00006
00008
00009
00010
00011
00013
00014 #include "TApplication.h"
00015 #include "TGeoManager.h"
00016
00017 #include "TObject.h"
00018 #include "TCanvas.h"
00019
00020 #include "FROOT.h"
00021 using namespace FROOT;
00022
00023 class TFndGeometry: public TObject{
00024
00025 public:
00026
00027
00028 enum EFndGeoLayers { FGEO_BEAM_PIPE = 0,
00029 FGEO_TOFINO,
00030 FGEO_ISIM, FGEO_TARGETS, FGEO_OSIM,
00031 FGEO_INNER_LMD, FGEO_OUTER_LMD,
00032 FGEO_STRAW_TUBES,
00033 FGEO_STRAW_TUBES_1,FGEO_STRAW_TUBES_2,FGEO_STRAW_TUBES_3,
00034 FGEO_STRAW_TUBES_4,FGEO_STRAW_TUBES_5,FGEO_STRAW_TUBES_6,
00035 FGEO_TOFONE };
00036
00037 enum EFndGeoSetup { FGEO_2003 = 1, FGEO_2006 };
00038
00039 TString GetLayerName(EFndGeoLayers lay)
00040 {
00041 switch(lay){
00042 case FGEO_BEAM_PIPE: return "BEAM-PIPE";
00043 case FGEO_TOFINO: return "TOFINO";
00044 case FGEO_ISIM: return "ISIM";
00045 case FGEO_TARGETS: return "TARGETS";
00046 case FGEO_OSIM: return "OSIM";
00047 case FGEO_INNER_LMD: return "INNER-LMD";
00048 case FGEO_OUTER_LMD: return "OUTER-LMD";
00049 case FGEO_STRAW_TUBES: return "STB";
00050 case FGEO_STRAW_TUBES_1: return "STB Layer 1";
00051 case FGEO_STRAW_TUBES_2: return "STB Layer 2";
00052 case FGEO_STRAW_TUBES_3: return "STB Layer 3";
00053 case FGEO_STRAW_TUBES_4: return "STB Layer 4";
00054 case FGEO_STRAW_TUBES_5: return "STB Layer 5";
00055 case FGEO_STRAW_TUBES_6: return "STB Layer 6";
00056 case FGEO_TOFONE: return "TOFONE";
00057 default: return 0;
00058 }
00059 }
00060
00061
00062
00063 typedef struct{
00064 Int_t det;
00065 Int_t ch;
00066 } FinEvdHit_t;
00067 enum EFndGeoHitMode { FGEO_HIT_DETECTED = 0, FGEO_HIT_RECONSTRUCTED };
00068
00069
00070 protected:
00071 Int_t fVerboseLevel;
00072 Int_t fSetup;
00073 TGeoNode *fPromptNode;
00074 TGeoVolume *fPromptVolume;
00075 TGeoNode *fCurDetNode;
00076
00077 TGeoNode *fTgtNodes[8];
00078
00079
00080
00081 TGeoHMatrix *fGeoMatr_Top_Tof[2][K_N_TOFONE_SLABS];
00082
00083 TGeoMatrix *fGeoMatr_Top_Sil[2][K_N_Sil_Modules];
00084
00085 TGeoMatrix *fGeoMatr_Top_Lmd[K_N_LMD_LAYERS][K_N_LMD_CHAMS_PER_LAYER];
00086 TGeoMatrix *fGeoMatr_InnerLmd_Wire[K_N_LMD_CHAMS_PER_LAYER][K_N_LMD_INNER_WIRES];
00087 TGeoMatrix *fGeoMatr_OuterLmd_Wire[K_N_LMD_CHAMS_PER_LAYER][K_N_LMD_OUTER_WIRES];
00088 TGeoHMatrix *fGeoMatr_Top_InnerLmdWire[K_N_LMD_CHAMS_PER_LAYER][K_N_LMD_INNER_WIRES];
00089 TGeoHMatrix *fGeoMatr_Top_OuterLmdWire[K_N_LMD_CHAMS_PER_LAYER][K_N_LMD_OUTER_WIRES];
00090
00091 TGeoMatrix *fGeoMatr_Top_StbWire[K_N_STB_CROWNS][K_N_STB_TUBES];
00092
00093
00094 TCanvas *fMainCanvas;
00095
00096
00097 private:
00098 void Init();
00099 TString GetSetupName(Int_t set){
00100 switch(set){
00101 case (Int_t)FGEO_2003: return "2003 (first data-taking)";
00102 case (Int_t)FGEO_2006: return "2006 (second data-taking)";
00103 default:
00104 Error("GetSetupName","Maybe you have just found a BUG!");
00105 gApplication->Terminate();
00106 }
00107 }
00108
00109 void LoadGeoMatrices();
00110
00111 Int_t PrintNode(TGeoNode *node,Int_t id_subnum,const Int_t level);
00112
00113 void SetStbLayVis(Int_t lay,Bool_t visible,Bool_t detailed);
00114 void SetLmdLayVis(Int_t lay,Bool_t visible,Bool_t detailed);
00115
00116 public:
00117
00118 TFndGeometry();
00119 ~TFndGeometry();
00120 void SetVerboseLevel(Int_t lev) { fVerboseLevel = lev; }
00121 TString GetCurrentSetup() { return GetSetupName(fSetup); }
00122 TCanvas *GetMainCanvas() { return fMainCanvas; }
00123
00124 TGeoNode *GetPromptNode() { return fPromptNode; }
00125 TGeoVolume *GetPromptVolume() { return fPromptVolume; }
00126 TGeoNode *GetCurrentNode() { return fCurDetNode; }
00127 TGeoNode *SelectDetectorNode(const Int_t &det, const Int_t &ch);
00128
00129 static Double_t GetTofinoSlabAngle() { return (Double_t) ( 360./(Double_t)(K_N_TOFINO_SLABS) ); }
00130 static Double_t GetTofoneSlabAngle() { return (Double_t) ( 360./(Double_t)(K_N_TOFONE_SLABS) ); }
00131 static Double_t GetTofinoRotAngles(Int_t slab);
00132 static Double_t GetTofoneRotAngles(Int_t slab);
00133
00134
00135 static Double_t SilPositionStrip(const Int_t &side, const Double_t &barcha);
00136
00137 void RefSys_TofSlabToMRS(const Int_t &channel,const Double_t* local, Double_t* master);
00138 void RefSys_SilModToMRS(const Int_t &layer,const Int_t &module,const Double_t* local, Double_t* master);
00139 void RefSys_LmdWireToMRS(const Int_t &channel,const Double_t* local, Double_t* master);
00140 void RefSys_StbWireToMRS(const Int_t &channel,const Double_t* local, Double_t* master);
00141
00142 static Int_t ConvertFromGeant3(TString root_geom_filename="fin_spec_geom.root", TString geant3_geom_path="fin_spec.geom",Bool_t CleanTmp=kTRUE);
00143 void PrintStructure(const Int_t levels=7);
00144 void PrintGeoMatrices(Int_t det,Int_t verbose_lev);
00145
00146 Int_t LoadGeometry(TString filename="$FROOTSYS/geom/fin_spec_geom.root");
00147 Int_t ShowGeometry(Option_t *option="ogl",Int_t vis_level=7);
00148
00149 void SetLayerVisibility(Int_t layer,Bool_t visible,Bool_t detailed=kFALSE);
00150 void SetStructureVisibility(Bool_t visible,Int_t detail_lev=0);
00151
00152 Int_t SetDefaultColors();
00153 Int_t SetDefaultVisibility();
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 ClassDef(TFndGeometry,0)
00168 };
00169 R__EXTERN TFndGeometry *gFndGeom;
00170 #endif // FROOT_TFndGeometry