1#include "RootEventData/TMcHitTof.h"
2#include "RootEventData/TMcHitEvent.h"
3#include "RootEventData/TMcDigiEmc.h"
6#include "BesEmcDigi.hh"
7#include "BesEventAction.hh"
8#include "G4RunManager.hh"
9#include "BesTruthTrack.hh"
10#include "BesTruthVertex.hh"
11#include "BesSensitiveManager.hh"
12#include "G4HCofThisEvent.hh"
13#include "G4SDManager.hh"
14#include "G4PrimaryVertex.hh"
15#include "G4PrimaryParticle.hh"
19#include "BesRootIO.hh"
21#include "G4ThreeVector.hh"
23#include "AsciiDmp/AsciiData.hh"
24#include "G4DigiManager.hh"
30#include "GaudiKernel/IDataProviderSvc.h"
31#include "GaudiKernel/ISvcLocator.h"
32#include "GaudiKernel/Bootstrap.h"
33#include "GaudiKernel/RegistryEntry.h"
34#include "GaudiKernel/MsgStream.h"
35#include "GaudiKernel/SmartDataPtr.h"
37#include "G4Svc/IG4Svc.h"
38#include "G4Svc/G4Svc.h"
41 G4int mdcTruFlag,G4int mdcDigiFlag,
42 G4int tofTruFlag, G4int tofDigiFlag,
43 G4int emcTruFlag, G4int emcDigiFlag,
44 G4int mucTruFlag, G4int mucDigiFlag,G4String name)
45 :m_mdcTruFlag(mdcTruFlag),m_mdcDigiFlag(mdcDigiFlag),
46 m_tofTruFlag(tofTruFlag),m_tofDigiFlag(tofDigiFlag),
47 m_emcTruFlag(emcTruFlag),m_emcDigiFlag(emcDigiFlag),
48 m_mucTruFlag(mucTruFlag),m_mucDigiFlag(mucDigiFlag),m_rootFile(name)
50 m_DigiMan = G4DigiManager::GetDMpointer();
52 f =
new TFile(m_rootFile,
"RECREATE");
55 HitTree =
new TTree(
"HitTree",
"staff data from HitCollection");
57 HitTree->Branch(
"TMcHitEvent",
"TMcHitEvent", &m_TMcHitEvent, 32000, 99);
82 m_TMcHitEvent->
Clear();
87 G4int emcDigiCollID = -1;
88 emcDigiCollID = m_DigiMan->GetDigiCollectionID(
"BesEmcDigitsCollection");
92 G4int nHits = emcDC->entries();
97 for (
int i = 0; i < nHits; i++) {
121 THCID = m_DigiMan->GetHitsCollectionID(
"BesMdcHitsCollection");
125 G4int nHits = mdcDC->entries();
130 for (
int i=0;i<nHits;i++)
145 G4ThreeVector gTemp = mdcHit->
GetPos();
146 TVector3 tTemp = TVector3(gTemp.x(), gTemp.y(), gTemp.z());
161 ISvcLocator* svcLocator = Gaudi::svcLocator();
163 StatusCode sc = svcLocator->service(
"G4Svc", tmpSvc);
164 G4Svc* m_G4Svc =
dynamic_cast<G4Svc *
>(tmpSvc);
170 THCID = m_DigiMan->GetHitsCollectionID(
"BesTofHitsCollection");
174 G4int nHits = tofDC->entries();
179 for (
int i=0;i<nHits;i++)
194 G4ThreeVector gTemp = tofHit->
GetPos();
195 TVector3 tTemp(gTemp.x(), gTemp.y(), gTemp.z());
199 tTemp = TVector3(gTemp.x(), gTemp.y(), gTemp.z());
203 tTemp = TVector3(gTemp.x(), gTemp.y(), gTemp.z());
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
G4THitsCollection< BesMdcHit > BesMdcHitsCollection
G4THitsCollection< BesTofHit > BesTofHitsCollection
void SaveHitRootEvent(G4int, const G4Event *)
void SaveEmcDigiRootEvent()
BesRootIO(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 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)