00001 #ifndef BDSOutputROOT_h
00002 #define BDSOutputROOT_h
00003
00004 #ifdef USE_ROOT
00005
00006 #include "BDSOutputBase.hh"
00007 #include "BDSTrajectory.hh"
00008
00009 #include "TROOT.h"
00010 #include "TH1F.h"
00011 #include "TFile.h"
00012 #include "TTree.h"
00013
00024 class BDSOutputROOT : public BDSOutputBase {
00025
00026 public:
00027
00028 BDSOutputROOT();
00029
00030 virtual ~BDSOutputROOT();
00031
00033 virtual void WriteHits(BDSSamplerHitsCollection*);
00035 virtual void WriteEnergyLoss(BDSEnergyCounterHitsCollection*);
00037 virtual void WritePrimaryLoss(BDSEnergyCounterHit*);
00039 virtual void WritePrimaryHit(BDSEnergyCounterHit*);
00041 virtual void WriteTrajectory(std::vector<BDSTrajectory*> &TrajVec);
00043 virtual void WritePrimary(G4String samplerName,
00044 G4double E,
00045 G4double x0,
00046 G4double y0,
00047 G4double z0,
00048 G4double xp,
00049 G4double yp,
00050 G4double zp,
00051 G4double t,
00052 G4double weight,
00053 G4int PDGType,
00054 G4int nEvent,
00055 G4int TurnsTaken);
00056
00058 virtual void WriteHistogram(BDSHistogram1D* histogramIn);
00059 virtual void Commit();
00060 virtual void Write();
00061
00062 private:
00063
00064 void Init();
00065
00066 void BuildSamplerTree(G4String name);
00067 TFile* theRootOutputFile;
00068
00069
00070 TTree* PrecisionRegionEnergyLossTree;
00071 TTree* EnergyLossTree;
00072 TTree* PrimaryLossTree;
00073 TTree* PrimaryHitsTree;
00074
00075 float x0,xp0,y0,yp0,z0,zp0,E0,t0;
00076 float x_prod,xp_prod,y_prod,yp_prod,z_prod,zp_prod,E_prod,t_prod;
00077 float x_lastScat,xp_lastScat,y_lastScat,yp_lastScat,z_lastScat,zp_lastScat,E_lastScat,t_lastScat;
00078 float x,xp,y,yp,z,zp,E,t;
00079 float X,Xp,Y,Yp,Z,Zp,s,weight;
00080 int part,nev, pID, track_id, turnnumber;
00082 float S_el,E_el;
00084 float X_pl,Y_pl,Z_pl,S_pl,x_pl,y_pl,z_pl,E_pl,weight_pl;
00085 int part_pl, turnnumber_pl, eventno_pl;
00087 float X_ph,Y_ph,Z_ph,S_ph,x_ph,y_ph,z_ph,E_ph,weight_ph;
00088 int part_ph, turnnumber_ph, eventno_ph;
00090 float X_el_p,Y_el_p,Z_el_p,S_el_p,x_el_p,y_el_p,z_el_p,E_el_p;
00091 int part_el_p, weight_el_p, turnnumber_el_p, eventno_el_p;
00092 char volumeName_el_p[100];
00093
00094 void WriteRootHit(G4String Name,
00095 G4double InitMom,
00096 G4double InitX,
00097 G4double InitY,
00098 G4double InitZ,
00099 G4double InitXPrime,
00100 G4double InitYPrime,
00101 G4double InitZPrime,
00102 G4double InitT,
00103 G4double ProdMom,
00104 G4double ProdX,
00105 G4double ProdY,
00106 G4double ProdZ,
00107 G4double ProdXPrime,
00108 G4double ProdYPrime,
00109 G4double ProdZPrime,
00110 G4double ProdT,
00111 G4double LastScatMom,
00112 G4double LastScatX,
00113 G4double LastScatY,
00114 G4double LastScatZ,
00115 G4double LastScatXPrime,
00116 G4double LastScatYPrime,
00117 G4double LastScatZPrime,
00118 G4double LastScatT,
00119 G4double Mom,
00120 G4double X,
00121 G4double Y,
00122 G4double Z,
00123 G4double XPrime,
00124 G4double YPrime,
00125 G4double ZPrime,
00126 G4double T,
00127 G4double GlobalX,
00128 G4double GlobalY,
00129 G4double GlobalZ,
00130 G4double GlobalXPrime,
00131 G4double GlobalYPrime,
00132 G4double GlobalZPrime,
00133 G4double S,
00134 G4double Weight,
00135 G4int PDGtype,
00136 G4int EventNo,
00137 G4int ParentID,
00138 G4int TrackID,
00139 G4int TurnsTaken);
00140
00141 };
00142
00143 extern BDSOutputBase* bdsOutput;
00144
00145 #endif // USE_ROOT
00146 #endif