62 XrayTelAnalysis::XrayTelAnalysis() :
63 asciiFile(0),nEnteringTracks(0), totEnteringEnergy(0)
65 histFileName =
"xraytel";
68 asciiFileName=
"xraytel.out";
69 asciiFile =
new std::ofstream(asciiFileName);
71 if(asciiFile->is_open())
72 (*asciiFile) <<
"Energy (keV) x (mm) y (mm) z (mm)" <<
G4endl <<
G4endl;
80 delete nEnteringTracks;
81 if (totEnteringEnergy)
82 delete totEnteringEnergy;
104 delete nEnteringTracks;
107 nEnteringTracks =
new std::map<G4int,G4int>;
109 if (totEnteringEnergy)
111 delete totEnteringEnergy;
112 totEnteringEnergy = 0;
114 totEnteringEnergy =
new std::map<G4int,G4double>;
123 G4cout <<
"Opening output file " << histFileName <<
" ... ";
130 man->
CreateH1(
"h1",
"Energy, all /keV", 100,0.,100.);
131 man->
CreateH1(
"h2",
"Energy, entering detector /keV", 500,0.,500.);
134 man->
CreateH2(
"d1",
"y-z, all /mm", 100,-500.,500.,100,-500.,500.);
135 man->
CreateH2(
"d2",
"y-z, entering detector /mm", 200,-50.,50.,200,-50.,50.);
158 delete G4AnalysisManager::Instance();
167 if (nEnteringTracks->count(-2))
170 G4cout <<
"Total Entering Detector : " << nEnteringTracks->find(-2)->second
172 G4cout <<
"Total Entering Detector Energy : "
173 << (totEnteringEnergy->find(-2)->second)/
MeV
184 if (nEnteringTracks->count(-1))
187 G4cout <<
"Total Entering Detector : " << nEnteringTracks->find(-1)->second
189 G4cout <<
"Total Entering Detector Energy : "
190 << (totEnteringEnergy->find(-1)->second)/
MeV
193 G4cout <<
"##########################################" <<
G4endl;
198 G4int totEntries = 0;
201 G4cout <<
"##########################################" <<
G4endl;
202 for (
size_t i=0; loopAgain; i++)
205 if (nEnteringTracks->count(i))
207 G4cout <<
"End of Run summary (thread= " << i <<
")" <<
G4endl;
208 G4int part = nEnteringTracks->find(i)->second;
209 G4cout <<
"Total Entering Detector : " << part <<
G4endl;
210 G4double ene = totEnteringEnergy->find(i)->second;
211 G4cout <<
"Total Entering Detector Energy : "
216 G4cout <<
"##########################################" <<
G4endl;
224 G4cout <<
"End of Run summary (MT) global" << G4endl <<
G4endl;
225 G4cout <<
"Total Entering Detector : " << totEntries <<
G4endl;
226 G4cout <<
"Total Entering Detector Energy : "
229 G4cout <<
"##########################################" <<
G4endl;
269 if(asciiFile->is_open()) {
270 (*asciiFile) << std::setiosflags(std::ios::fixed)
271 << std::setprecision(3)
274 (*asciiFile) << eKin;
275 (*asciiFile) << std::setiosflags(std::ios::fixed)
276 << std::setprecision(3)
280 (*asciiFile) << std::setiosflags(std::ios::fixed)
281 << std::setprecision(3)
285 (*asciiFile) << std::setiosflags(std::ios::fixed)
286 << std::setprecision(3)
299 if (nEnteringTracks->count(threadID))
301 (nEnteringTracks->find(threadID)->second)++;
306 nEnteringTracks->insert(std::make_pair(threadID,tracks));
310 if (totEnteringEnergy->count(threadID))
311 (totEnteringEnergy->find(threadID)->second) += energy;
313 totEnteringEnergy->insert(std::make_pair(threadID,energy));
void book(G4bool isMaster)
G4bool SetFirstHistoId(G4int firstId)
static constexpr double mm
void finish(G4bool isMaster)
G4int CreateH1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")
const G4ThreeVector & GetPosition() const
G4int CreateNtuple(const G4String &name, const G4String &title)
G4bool OpenFile(const G4String &fileName="")
#define G4MUTEX_INITIALIZER
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4bool FillNtupleDColumn(G4int id, G4double value)
void Update(G4double energy, G4int threadID)
const G4ThreeVector & GetMomentumDirection() const
G4bool FillH2(G4int id, G4double xvalue, G4double yvalue, G4double weight=1.0)
G4double energy(const ThreeVector &p, const G4double m)
G4bool FillH1(G4int id, G4double value, G4double weight=1.0)
static constexpr double MeV
void analyseStepping(const G4Track &track, G4bool entering)
G4int CreateNtupleDColumn(const G4String &name)
static constexpr double keV
static const G4double pos
static XrayTelAnalysis * getInstance()
G4int CreateH2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")