Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Dicom2RunAction Class Reference

#include <Dicom2RunAction.hh>

Inheritance diagram for Dicom2RunAction:
DicomRunAction G4UserRunAction

Public Types

typedef Dicom2Run::Dicom2RunVector Dicom2RunVector
 

Public Member Functions

 Dicom2RunAction ()
 Constructor.
 
virtual ~Dicom2RunAction ()
 Destructor.
 
virtual G4RunGenerateRun () override
 
virtual void EndOfRunAction (const G4Run *aRun) override
 
- Public Member Functions inherited from DicomRunAction
 DicomRunAction ()
 Constructor.
 
 ~DicomRunAction ()
 Destructor.
 
G4RunGenerateRun ()
 
void BeginOfRunAction (const G4Run *)
 
void EndOfRunAction (const G4Run *)
 
DicomRunGetDicomRun () const
 
void PrintHeader (std::ostream *out)
 
std::string FillString (const std::string &name, char c, G4int n, G4bool back=true)
 

Additional Inherited Members

- Protected Attributes inherited from DicomRunAction
DicomRunfDcmrun
 
std::vector< G4StringfSDName
 

Detailed Description

Definition at line 42 of file Dicom2RunAction.hh.

Member Typedef Documentation

◆ Dicom2RunVector

Definition at line 45 of file Dicom2RunAction.hh.

Constructor & Destructor Documentation

◆ Dicom2RunAction()

Dicom2RunAction::Dicom2RunAction ( )

Constructor.

Definition at line 47 of file Dicom2RunAction.cc.

49{ }
DicomRunAction()
Constructor.

◆ ~Dicom2RunAction()

Dicom2RunAction::~Dicom2RunAction ( )
virtual

Destructor.

Definition at line 53 of file Dicom2RunAction.cc.

54{ }

Member Function Documentation

◆ GenerateRun()

G4Run * Dicom2RunAction::GenerateRun ( )
overridevirtual

Definition at line 57 of file Dicom2RunAction.cc.

58{
59 // Generate new RUN object, which is specially
60 // dedicated for MultiFunctionalDetector scheme.
61 // Detail description can be found in Dicom2Run.hh/cc.
62 return fDcmrun = new Dicom2Run(fSDName);
63}
Dicom2Run class.
Definition Dicom2Run.hh:53
DicomRun * fDcmrun
std::vector< G4String > fSDName

◆ EndOfRunAction()

void Dicom2RunAction::EndOfRunAction ( const G4Run aRun)
overridevirtual

Definition at line 66 of file Dicom2RunAction.cc.

67{
68 // Lock the output because of the external calls to DicomRunAction
69 // otherwise, the output gets too confusing
70 G4AutoLock l(G4TypeMutex<Dicom2RunAction>());
71
72 G4cout << G4endl;
73 G4cout << "[==========================================================="
74 << " DICOM "
75 << "===========================================================]"
76 << G4endl;
77 G4cout << G4endl;
78
80
81 G4cout << G4endl;
82 G4cout << "[==========================================================="
83 << " DICOM2 "
84 << "==========================================================]"
85 << G4endl;
86 G4cout << G4endl;
87
88 G4int nofEvents = aRun->GetNumberOfEvent();
89
90 G4StatAnalysis local_total_dose;
91
92 const Dicom2Run* dcm2Run = static_cast<const Dicom2Run*>(aRun);
93 //--- Dump all scored quantities involved in Dicom2Run.
94 for(uintmax_t i = 0; i < fSDName.size(); i++)
95 {
96 //
97 //---------------------------------------------
98 // Dump accumulated quantities for this RUN.
99 // (Display only central region of x-y plane)
100 // 0 ConcreteSD/DoseDeposit
101 //---------------------------------------------
102 Dicom2RunVector* DoseDeposit =
103 dcm2Run->GetHitsVector(fSDName[i]+"/DoseDeposit");
104
105 if(DoseDeposit && DoseDeposit->size() != 0 )
106 {
107 for(auto itr = DoseDeposit->begin(); itr != DoseDeposit->end(); ++itr)
108 {
109 // this will sometimes return null pointers
110 if(!DoseDeposit->GetObject(itr))
111 continue;
112 local_total_dose += (*DoseDeposit->GetObject(itr));
113 }
114 }
115 }
116
117 if(IsMaster())
118 {
119 G4cout << " ###### EndOfRunAction ###### " << G4endl;
120 //- Dicom2Run object.
121 const Dicom2Run* re02Run = static_cast<const Dicom2Run*>(aRun);
122 //--- Dump all scored quantities involved in Dicom2Run.
123
124 for(uintmax_t i = 0; i < fSDName.size(); i++)
125 {
126 //
127 //---------------------------------------------
128 // Dump accumulated quantities for this RUN.
129 // (Display only central region of x-y plane)
130 // 0 ConcreteSD/DoseDeposit
131 //---------------------------------------------
132 Dicom2RunVector* DoseDeposit =
133 re02Run->GetHitsVector(fSDName[i]+"/DoseDeposit");
134
135 G4cout << "============================================================="
136 <<G4endl;
137 G4cout << " Number of event processed : "
138 << aRun->GetNumberOfEvent() << G4endl;
139 G4cout << "============================================================="
140 <<G4endl;
141
142 std::ofstream fileout;
143 G4String fname = "dicom2-vector.out";
144 fileout.open(fname);
145 G4cout << " opened file " << fname << " for dose output" << G4endl;
146
147 if(DoseDeposit && DoseDeposit->size() != 0)
148 {
149 std::ostream *myout = &G4cout;
150 PrintHeader(myout);
151 for(auto itr = DoseDeposit->begin(); itr != DoseDeposit->end();
152 ++itr)
153 {
154 auto _idx = DoseDeposit->GetIndex(itr);
155 G4StatAnalysis* _stat = DoseDeposit->GetObject(itr);
156 if(_stat && _stat->GetHits() > 0)
157 {
158 G4StatAnalysis _tmp_stat = *_stat;
159 _tmp_stat /= CLHEP::gray;
160 fileout << _idx << " " << (*_stat) << G4endl;
161 }
162 }
163 G4cout << "============================================="<<G4endl;
164 }
165 else
166 {
167 G4Exception("Dicom2RunAction", "000", JustWarning,
168 "DoseDeposit HitsMap is either a null pointer "
169 "of the HitsMap was empty");
170 }
171 fileout.close();
172 G4cout << " closed file " << fname << " for dose output" << G4endl;
173
174 }
175 }
176
177
178 if (IsMaster())
179 {
180 // convert to units of Gy
181 local_total_dose /= gray;
182 G4cout << "--------------------End of Global Run-----------------------"
183 << G4endl;
184 G4cout << " The run was " << nofEvents << " events " << G4endl;
185 G4cout << " TOTAL DOSE : \t" << local_total_dose << " Gy" << G4endl;
186 if(nofEvents > 0)
187 {
188 local_total_dose /= nofEvents;
189 G4cout << " TOTAL DOSE/Bq-s : \t" << local_total_dose << " Gy/Bq-s"
190 << G4endl;
191 }
192 }
193 else
194 {
195 // convert to units of Gy
196 local_total_dose /= gray;
197 G4cout << "--------------------End of Local Run------------------------"
198 << G4endl;
199 G4cout << " The run was " << nofEvents << " events" << G4endl;
200 G4cout << "LOCAL TOTAL DOSE : \t" << local_total_dose << " Gy" << G4endl;
201 if(nofEvents > 0)
202 {
203 local_total_dose /= nofEvents;
204 G4cout << " LOCAL DOSE/Bq-s : \t" << local_total_dose << " Gy/Bq-s"
205 << G4endl;
206 }
207 }
208
209 G4cout << G4endl;
210 G4cout << "Finished : End of Run Action " << aRun->GetRunID() << "\n" << G4endl;
211
212}
Dicom2Run::Dicom2RunVector Dicom2RunVector
Dicom2RunVector * GetHitsVector(G4int i) const
Definition Dicom2Run.hh:75
void EndOfRunAction(const G4Run *)
void PrintHeader(std::ostream *out)

The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration