9#include "G4RunManager.hh"
13#include "G4HCofThisEvent.hh"
14#include "G4SDManager.hh"
15#include "G4PrimaryVertex.hh"
16#include "G4PrimaryParticle.hh"
22#include "G4ThreeVector.hh"
25#include "G4DigiManager.hh"
31#include "GaudiKernel/IDataProviderSvc.h"
32#include "GaudiKernel/ISvcLocator.h"
33#include "GaudiKernel/Bootstrap.h"
34#include "GaudiKernel/RegistryEntry.h"
35#include "GaudiKernel/MsgStream.h"
36#include "GaudiKernel/SmartDataPtr.h"
42 G4int mdcTruFlag,G4int mdcDigiFlag,
43 G4int cgemTruFlag,G4int cgemDigiFlag,
44 G4int tofTruFlag, G4int tofDigiFlag,
45 G4int emcTruFlag, G4int emcDigiFlag,
46 G4int mucTruFlag, G4int mucDigiFlag,G4String name)
47 :m_mdcTruFlag(mdcTruFlag),m_mdcDigiFlag(mdcDigiFlag),
48 m_cgemTruFlag(cgemTruFlag),m_cgemDigiFlag(cgemDigiFlag),
49 m_tofTruFlag(tofTruFlag),m_tofDigiFlag(tofDigiFlag),
50 m_emcTruFlag(emcTruFlag),m_emcDigiFlag(emcDigiFlag),
51 m_mucTruFlag(mucTruFlag),m_mucDigiFlag(mucDigiFlag),m_rootFile(name)
53 m_DigiMan = G4DigiManager::GetDMpointer();
55 f =
new TFile(m_rootFile,
"RECREATE");
58 HitTree =
new TTree(
"HitTree",
"staff data from HitCollection");
60 HitTree->Branch(
"TMcHitEvent",
"TMcHitEvent", &m_TMcHitEvent, 32000, 99);
89 m_TMcHitEvent->
Clear();
94 G4int emcDigiCollID = -1;
95 emcDigiCollID = m_DigiMan->GetDigiCollectionID(
"BesEmcDigitsCollection");
99 G4int nHits = emcDC->entries();
104 for (
int i = 0; i < nHits; i++) {
128 THCID = m_DigiMan->GetHitsCollectionID(
"BesMdcHitsCollection");
132 G4int nHits = mdcDC->entries();
137 for (
int i=0;i<nHits;i++)
152 G4ThreeVector gTemp = mdcHit->
GetPos();
153 TVector3 tTemp = TVector3(gTemp.x(), gTemp.y(), gTemp.z());
169 THCID = m_DigiMan->GetHitsCollectionID(
"BesCgemHitsCollection");
173 G4int nHits = cgemDC->entries();
178 for (
int i=0;i<nHits;i++)
180 cgemHit=(*cgemDC)[i];
195 TVector3 tmp_XYZ_pre = TVector3(XYZ_pre.x() , XYZ_pre.y() , XYZ_pre.z() );
196 TVector3 tmp_XYZ_post = TVector3(XYZ_post.x() , XYZ_post.y() , XYZ_post.z() );
197 TVector3 tmp_P_pre = TVector3(P_pre.x() , P_pre.y() , P_pre.z() );
198 TVector3 tmp_P_post = TVector3(P_post.x() , P_post.y() , P_post.z() );
233 ISvcLocator* svcLocator = Gaudi::svcLocator();
235 StatusCode sc = svcLocator->service(
"G4Svc", tmpSvc);
236 G4Svc* m_G4Svc =
dynamic_cast<G4Svc *
>(tmpSvc);
242 THCID = m_DigiMan->GetHitsCollectionID(
"BesTofHitsCollection");
246 G4int nHits = tofDC->entries();
251 for (
int i=0;i<nHits;i++)
266 G4ThreeVector gTemp = tofHit->
GetPos();
267 TVector3 tTemp(gTemp.x(), gTemp.y(), gTemp.z());
271 tTemp = TVector3(gTemp.x(), gTemp.y(), gTemp.z());
275 tTemp = TVector3(gTemp.x(), gTemp.y(), gTemp.z());
G4THitsCollection< BesCgemHit > BesCgemHitsCollection
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
G4THitsCollection< BesMdcHit > BesMdcHitsCollection
G4THitsCollection< BesTofHit > BesTofHitsCollection
G4ThreeVector GetPositionOfPrePoint() const
G4ThreeVector GetMomentumOfPostPoint() const
G4double GetGlobalTime() const
G4double GetStepLength() const
G4ThreeVector GetPositionOfPostPoint() const
G4double GetTotalEnergyDeposit() const
G4ThreeVector GetMomentumOfPrePoint() const
void SaveHitRootEvent(G4int, const G4Event *)
void SaveEmcDigiRootEvent()
BesRootIO(G4int, G4int, G4int, G4int, G4int, G4int, G4int, G4int, G4int, G4int, G4String)
G4ThreeVector GetPDirection()
G4ThreeVector GetMomentum()
void SetThetaNb(Int_t nTheta)
void SetPhiNb(Int_t nPhi)
void SetTime(Double_t time)
void SetTrackIndex(Int_t index)
void SetEnergy(Double_t energy)
void SetMomentumOfPrePoint(TVector3 f_P_pre)
void SetPositionOfPrePoint(TVector3 f_XYZ_pre)
void SetStepLength(Double_t f_L_step)
void SetGlobalTime(Double_t f_global_time)
void SetLayerID(Int_t f_ID_layer)
void SetPDGCode(Int_t f_pdg_code)
void SetTotalEnergyDeposit(Double_t f_E_deposit)
void SetPositionOfPostPoint(TVector3 f_XYZ_post)
void SetTrackID(Int_t f_ID_track)
void SetMomentumOfPostPoint(TVector3 f_P_post)
void addMcHitCgem(TMcHitCgem *hit)
Add a McHitCgem into the Cgem Data collection.
void addMcHitTof(TMcHitTof *hit)
Add a McHitTof into the TOF Data collection.
void addMcDigiEmc(TMcDigiEmc *digi)
Add a McHitMdc into the Mdc Data collection.
void addMcHitMdc(TMcHitMdc *hit)
Add a McHitMdc into the Mdc Data collection.
void Clear(Option_t *option="")
void setBeamTime(Double_t time)
void SetDriftT(Double_t time)
void SetDriftD(Double_t distance)
void SetPosFlag(Int_t flag)
void SetGlobalT(Double_t time)
void SetTheta(Double_t angle)
void SetCellNo(Int_t cell)
void SetEnterAngle(Double_t angle)
void SetPos(TVector3 xyz)
void SetTrackID(Int_t track)
void SetEdep(Double_t de)
void SetLayerNo(Int_t layer)
void SetStepL(Double_t stepL)
void SetTime(Double_t time)
void SetTrackIndex(Int_t trackIndex)
void SetG4Index(Int_t index)
void SetPos(TVector3 pos)
void SetMomentum(TVector3 momentum)
void SetDeltaT(Double_t deltaT)
void SetEdep(Double_t edep)
void SetPartId(Int_t partId)
void SetPDirection(TVector3 pDirection)
void SetCharge(Int_t charge)
void SetTrackL(Double_t length)
void SetScinNb(Int_t scinNb)