Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DRootGeom.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DRootGeom.h
4 // Created: Fri Feb 13 08:43:39 EST 2009
5 // Creator: zihlmann
6 //
7 
8 #ifndef _DRootGeom_
9 #define _DRootGeom_
10 
11 #include <JANA/jerror.h>
12 #include <DANA/DApplication.h>
13 
14 #include <DVector3.h>
15 
16 // the root part
17 #include <TGeoManager.h>
18 #include <TGeoVolume.h>
19 #include <TGeoMaterial.h>
20 #include <TGeoMedium.h>
21 #include <TGeoPcon.h>
22 #include <TGeoPgon.h>
23 #include <TGeoMatrix.h>
24 
25 
26 struct VolMat
27 {
28  double A ;
29  double Z ;
30  double Density ;
31  double RadLen ;
32  double rhoZ_overA; // density*Z/A
33  double rhoZ_overA_logI; // density*Z/A * log(mean excitation energy)
34 };
35 
36 class DRootGeom{
37 
38  public:
39 
40  DRootGeom(JApplication *japp, unsigned int run_number=1);
41  virtual ~DRootGeom();
42 
43  virtual const char* className(void){return static_className();}
44  static const char* static_className(void){return "DRootGeom";}
45 
46  int ReadMap(string namepath, int32_t runnumber);
47  void InitTable(void);
48 
49  TGeoNode* GetCurrentNode(){return Current_Node;};
50  TGeoVolume* GetCurrentVolume(){return Current_Volume;};
51  struct VolMat GetCurrentMat(){return Mat;};
52 
53  TGeoNode* FindNode(double *x);
54  TGeoVolume* FindVolume(double *x);
55  struct VolMat FindMat(double *x);
56 
57  jerror_t FindMat(DVector3 pos, double &rhoZ_overA, double &rhoZ_overA_logI, double &RadLen) const;
58  jerror_t FindMat(DVector3 pos,double &density, double &A, double &Z, double &RadLen) const;
59 
60  jerror_t FindMatLL(DVector3 pos, double &rhoZ_overA, double &rhoZ_overA_logI, double &RadLen) const;
61  jerror_t FindMatLL(DVector3 pos,double &density, double &A, double &Z, double &RadLen) const;
62  jerror_t FindMatLL(DVector3 pos,double &density, double &A, double &Z, double &RadLen,double &LnI) const;
63 
64  jerror_t FindMatTable(DVector3 pos, double &rhoZ_overA, double &rhoZ_overA_logI, double &RadLen) const;
65  jerror_t FindMatTable(DVector3 pos,double &density, double &A, double &Z, double &RadLen) const;
66 
67  jerror_t FindMat(const char* matname,double &rhoZ_overA,
68  double &rhoZ_overA_logI, double &RadLen) const;
69 
70  private:
71 
72  void InitDRGeom(void);
73 
74  TGeoManager *DRGeom;
75  TGeoNode *Current_Node ;
76  TGeoVolume *Current_Volume ;
77  TGeoMaterial *Current_Material;
78  JCalibration *jcalib;
79  Int_t Mat_Index ;
80  struct VolMat Mat; // material property : A, Z, Density, RadLen
81  pthread_mutex_t mutex;
82  pthread_mutexattr_t mutex_attr;
83 
85  VolMat **MatTable; // MatTable[R][Z];
87  int Nr, Nz; // Number of points in R and Z
88  double dr, dz; // Distance between points in R and Z
89  double r0, z0; // Location of first point in R and Z
90 
91 };
92 
93 #endif // _DRootGeom_
struct VolMat FindMat(double *x)
Definition: DRootGeom.cc:518
double A
Definition: DRootGeom.h:28
JCalibration * jcalib
Definition: DRootGeom.h:78
bool table_initialized
Definition: DRootGeom.h:84
void InitTable(void)
Definition: DRootGeom.cc:140
TVector3 DVector3
Definition: DVector3.h:14
TGeoManager * DRGeom
Definition: DRootGeom.h:74
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
struct VolMat Mat
Definition: DRootGeom.h:80
virtual ~DRootGeom()
Definition: DRootGeom.cc:43
TGeoVolume * GetCurrentVolume()
Definition: DRootGeom.h:50
TGeoMaterial * Current_Material
Definition: DRootGeom.h:77
TGeoVolume * Current_Volume
Definition: DRootGeom.h:76
jerror_t FindMatLL(DVector3 pos, double &rhoZ_overA, double &rhoZ_overA_logI, double &RadLen) const
Definition: DRootGeom.cc:402
double rhoZ_overA_logI
Definition: DRootGeom.h:33
TGeoNode * Current_Node
Definition: DRootGeom.h:75
JApplication * japp
struct VolMat GetCurrentMat()
Definition: DRootGeom.h:51
pthread_mutex_t mutex
Definition: DRootGeom.h:81
double r0
Definition: DRootGeom.h:89
TGeoNode * FindNode(double *x)
Definition: DRootGeom.cc:250
pthread_mutexattr_t mutex_attr
Definition: DRootGeom.h:82
DRootGeom(JApplication *japp, unsigned int run_number=1)
Definition: DRootGeom.cc:17
virtual const char * className(void)
Definition: DRootGeom.h:43
static const char * static_className(void)
Definition: DRootGeom.h:44
double rhoZ_overA
Definition: DRootGeom.h:32
int ReadMap(string namepath, int32_t runnumber)
Definition: DRootGeom.cc:52
TGeoNode * GetCurrentNode()
Definition: DRootGeom.h:49
double dz
Definition: DRootGeom.h:88
jerror_t FindMatTable(DVector3 pos, double &rhoZ_overA, double &rhoZ_overA_logI, double &RadLen) const
Definition: DRootGeom.cc:327
Int_t Mat_Index
Definition: DRootGeom.h:79
double z0
Definition: DRootGeom.h:89
VolMat * buff
Definition: DRootGeom.h:86
void InitDRGeom(void)
Definition: DRootGeom.cc:225
VolMat ** MatTable
Definition: DRootGeom.h:85
int Nr
Definition: DRootGeom.h:87
double dr
Definition: DRootGeom.h:88
TGeoVolume * FindVolume(double *x)
Definition: DRootGeom.cc:267
double Density
Definition: DRootGeom.h:30
double RadLen
Definition: DRootGeom.h:31
int Nz
Definition: DRootGeom.h:87
double Z
Definition: DRootGeom.h:29