BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BesTDSWriter.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2//// BOOST --- BESIII Object_Oriented Simulation Tool //
3////---------------------------------------------------------------------------//
4////Description:
5////Author: Dengzy
6////Created: Mar, 2004
7////Modified:
8////Comment:
9//
10
11#include "BesTDSWriter.hh"
12#include "BesRawDataWriter.hh"
13#include "BesMcTruthWriter.hh"
14#include "G4Event.hh"
15
16#include "GaudiKernel/IDataProviderSvc.h"
17#include "GaudiKernel/SmartDataPtr.h"
18#include "GaudiKernel/ISvcLocator.h"
19#include "GaudiKernel/Bootstrap.h"
20#include "EventModel/EventHeader.h"
21
23{
24 m_rawWriter = new BesRawDataWriter;
25 m_mcWriter = new BesMcTruthWriter;
26}
27
29{
30 if(m_rawWriter)
31 delete m_rawWriter;
32 if(m_mcWriter)
33 delete m_mcWriter;
34}
35
36void BesTDSWriter::SaveAll(const G4Event* evt, int runNumber)
37{
38 //interface to event data service
39 ISvcLocator* svcLocator = Gaudi::svcLocator();
40 IDataProviderSvc* evtSvc;
41 StatusCode sc=svcLocator->service("EventDataSvc", evtSvc);
42 if (sc.isFailure())
43 G4cout<<"Could not accesss EventDataSvc!"<<G4endl;
44
45 //save event head
46/*
47 SmartDataPtr<Event::EventHeader> eventHeader(evtSvc,"/Event/EventHeader");
48 if (!eventHeader) {
49 //G4cout<< "Could not find Event Header" << G4endl;
50 Event::EventHeader *eventHeader = new Event::EventHeader;
51 StatusCode sc = evtSvc->registerObject("/Event/EventHeader",eventHeader);
52 }
53 eventHeader->setEventNumber( evt->GetEventID() );
54 eventHeader->setRunNumber( runNumber );
55*/
56 //retrieve
57 SmartDataPtr<Event::EventHeader> aEventHeader(evtSvc,"/Event/EventHeader");
58 G4int run=aEventHeader->runNumber();
59 G4int event=aEventHeader->eventNumber();
60 //G4cout<<"BesTDSWriter: runNumber: "<<run<<" eventNumber:"<<event<<G4endl;
61
62
63 //save raw data
64 m_rawWriter->SaveDigits();
65
66 //save MC Truth
67 m_mcWriter->SaveMcTruth();
68
69}
70
void SaveAll(const G4Event *, int)
Definition: BesTDSWriter.cc:36