Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayTelAnalysis.cc,v 1.10 2003/08/13 13:06:02 santin Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: XrayTelAnalysis.cc,v 1.11 2004/05/28 15:56:59 guatelli Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// Author: A. Pfeiffer (Andreas.Pfeiffer@cern.ch)
|
||||
// (copied from his UserAnalyser class)
|
||||
@@ -51,11 +51,11 @@ XrayTelAnalysis::XrayTelAnalysis()
|
||||
: analysisFactory(0)
|
||||
, tree(0)
|
||||
, histoFactory(0)
|
||||
, tupleFactory(0)
|
||||
#ifdef G4ANALYSIS_USE_PLOTTER
|
||||
, plotterFactory(0)
|
||||
, plotter(0)
|
||||
#endif
|
||||
, tupleFactory(0), h1(0), h2(0), h3(0), h4(0), ntuple(0)
|
||||
// #ifdef G4ANALYSIS_USE_PLOTTER
|
||||
// , plotterFactory(0)
|
||||
// , plotter(0)
|
||||
// #endif
|
||||
#endif
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
@@ -74,10 +74,10 @@ XrayTelAnalysis::~XrayTelAnalysis()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
#ifdef G4ANALYSIS_USE_PLOTTER
|
||||
if (plotterFactory) delete plotterFactory;
|
||||
plotterFactory = 0;
|
||||
#endif
|
||||
// #ifdef G4ANALYSIS_USE_PLOTTER
|
||||
// if (plotterFactory) delete plotterFactory;
|
||||
// plotterFactory = 0;
|
||||
// #endif
|
||||
|
||||
if (tupleFactory) delete tupleFactory;
|
||||
tupleFactory = 0;
|
||||
@@ -107,7 +107,7 @@ void XrayTelAnalysis::book()
|
||||
analysisFactory = AIDA_createAnalysisFactory();
|
||||
if(analysisFactory) {
|
||||
//parameters for the TreeFactory
|
||||
G4bool fileExists = false;
|
||||
G4bool fileExists = true;
|
||||
G4bool readOnly = false;
|
||||
AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
|
||||
if(treeFactory) {
|
||||
@@ -125,17 +125,15 @@ void XrayTelAnalysis::book()
|
||||
tupleFactory = analysisFactory->createTupleFactory ( *tree );
|
||||
|
||||
// Book histograms
|
||||
histoFactory->createHistogram1D("1","Energy, all /keV", 100,0.,100.);
|
||||
histoFactory->createHistogram2D("2","y-z, all /mm", 100,-500.,500.,100,-500.,500.);
|
||||
histoFactory->createHistogram1D("3","Energy, entering detector /keV", 500,0.,500.);
|
||||
histoFactory->createHistogram2D("4","y-z, entering detector /mm", 200,-50.,50.,200,-50.,50.);
|
||||
h1 = histoFactory->createHistogram1D("1","Energy, all /keV", 100,0.,100.);
|
||||
h2 = histoFactory->createHistogram2D("2","y-z, all /mm", 100,-500.,500.,100,-500.,500.);
|
||||
h3 = histoFactory->createHistogram1D("3","Energy, entering detector /keV", 500,0.,500.);
|
||||
h4 = histoFactory->createHistogram2D("4","y-z, entering detector /mm", 200,-50.,50.,200,-50.,50.);
|
||||
|
||||
// Book ntuples
|
||||
AIDA::ITuple* ntuple10 = tupleFactory->create( "10", "Track ntuple",
|
||||
ntuple = tupleFactory->create( "10", "Track ntuple",
|
||||
"double energy,x,y,z,dirx,diry,dirz" );
|
||||
assert(ntuple10);
|
||||
|
||||
}
|
||||
}
|
||||
delete treeFactory;
|
||||
}
|
||||
}
|
||||
@@ -148,11 +146,11 @@ void XrayTelAnalysis::finish()
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (tree) {
|
||||
// Committing the transaction with the tree
|
||||
std::cout << "Committing..." << std::endl;
|
||||
G4cout << "Committing..." << G4endl;
|
||||
// write all histograms to file
|
||||
tree->commit();
|
||||
|
||||
std::cout << "Closing the tree..." << std::endl;
|
||||
G4cout << "Closing the tree..." << G4endl;
|
||||
|
||||
// close (will again commit)
|
||||
tree->close();
|
||||
@@ -161,9 +159,9 @@ void XrayTelAnalysis::finish()
|
||||
// extra delete as objects are created in book() method rather than during
|
||||
// initialisation of class
|
||||
|
||||
#ifdef G4ANALYSIS_USE_PLOTTER
|
||||
if (plotterFactory) delete plotterFactory;
|
||||
#endif
|
||||
// #ifdef G4ANALYSIS_USE_PLOTTER
|
||||
// if (plotterFactory) delete plotterFactory;
|
||||
// #endif
|
||||
|
||||
if (tupleFactory) delete tupleFactory;
|
||||
if (histoFactory) delete histoFactory;
|
||||
@@ -185,27 +183,25 @@ void XrayTelAnalysis::analyseStepping(const G4Track& track, G4bool entering)
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Fill histograms, all tracks
|
||||
AIDA::IHistogram1D* h1 = dynamic_cast<AIDA::IHistogram1D *> ( tree->find("1") );
|
||||
|
||||
h1->fill(eKin); // fill(x,y,weight)
|
||||
AIDA::IHistogram2D* h2 = dynamic_cast<AIDA::IHistogram2D *> ( tree->find("2") );
|
||||
|
||||
h2->fill(y,z);
|
||||
|
||||
// Fill histograms and ntuple, tracks entering the detector
|
||||
if (entering) {
|
||||
// Fill and plot histograms
|
||||
AIDA::IHistogram1D* h3 = dynamic_cast<AIDA::IHistogram1D *> ( tree->find("3") );
|
||||
|
||||
h3->fill(eKin);
|
||||
AIDA::IHistogram2D* h4 = dynamic_cast<AIDA::IHistogram2D *> ( tree->find("4") );
|
||||
|
||||
h4->fill(y,z);
|
||||
#ifdef G4ANALYSIS_USE_PLOTTER
|
||||
plotAll();
|
||||
#endif
|
||||
// #ifdef G4ANALYSIS_USE_PLOTTER
|
||||
// plotAll();
|
||||
// #endif
|
||||
}
|
||||
|
||||
// Fill ntuple
|
||||
if (entering) {
|
||||
|
||||
AIDA::ITuple * ntuple = dynamic_cast<AIDA::ITuple *> ( tree->find("10") );
|
||||
if (ntuple) {
|
||||
// Fill the secondaries ntuple
|
||||
ntuple->fill( ntuple->findColumn( "energy" ), (G4double) eKin );
|
||||
@@ -255,40 +251,40 @@ void XrayTelAnalysis::analyseStepping(const G4Track& track, G4bool entering)
|
||||
|
||||
}
|
||||
|
||||
#ifdef G4ANALYSIS_USE_PLOTTER
|
||||
void XrayTelAnalysis::plotAll()
|
||||
{
|
||||
if (!plotter) {
|
||||
AIDA::IPlotterFactory* plotterFactory =
|
||||
analysisFactory->createPlotterFactory();
|
||||
if(plotterFactory) {
|
||||
G4cout << "Creating the Plotter" << G4endl;
|
||||
plotter = plotterFactory->create();
|
||||
if(plotter) {
|
||||
// Map the plotter on screen :
|
||||
G4cout << "Showing the Plotter on screen" << G4endl;
|
||||
plotter->show();
|
||||
} else {
|
||||
G4cout << "XrayTelAnalysis::plotAll: WARNING: Plotter not created" << G4endl;
|
||||
}
|
||||
delete plotterFactory;
|
||||
} else {
|
||||
G4cout << "XrayTelAnalysis::plotAll: WARNING: Plotter Factory not created" << G4endl;
|
||||
}
|
||||
}
|
||||
// #ifdef G4ANALYSIS_USE_PLOTTER
|
||||
// void XrayTelAnalysis::plotAll()
|
||||
// {
|
||||
// if (!plotter) {
|
||||
// AIDA::IPlotterFactory* plotterFactory =
|
||||
// analysisFactory->createPlotterFactory();
|
||||
// if(plotterFactory) {
|
||||
// G4cout << "Creating the Plotter" << G4endl;
|
||||
// plotter = plotterFactory->create();
|
||||
// if(plotter) {
|
||||
// // Map the plotter on screen :
|
||||
// G4cout << "Showing the Plotter on screen" << G4endl;
|
||||
// plotter->show();
|
||||
// } else {
|
||||
// G4cout << "XrayTelAnalysis::plotAll: WARNING: Plotter not created" << G4endl;
|
||||
// }
|
||||
// delete plotterFactory;
|
||||
// } else {
|
||||
// G4cout << "XrayTelAnalysis::plotAll: WARNING: Plotter Factory not created" << G4endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (plotter) {
|
||||
plotter->createRegions(2,1,0);
|
||||
AIDA::IHistogram1D* hp = dynamic_cast<AIDA::IHistogram1D *> ( tree->find("3") );
|
||||
AIDA::IHistogram1D& h = *hp;
|
||||
(plotter->currentRegion()).plot(h);
|
||||
plotter->refresh();
|
||||
plotter->setCurrentRegionNumber(1);
|
||||
AIDA::IHistogram1D* hp2 = dynamic_cast<AIDA::IHistogram1D *> ( tree->find("1") );
|
||||
AIDA::IHistogram1D& h2 = *hp2;
|
||||
(plotter->currentRegion()).plot(h2);
|
||||
plotter->refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// if (plotter) {
|
||||
// plotter->createRegions(2,1,0);
|
||||
// AIDA::IHistogram1D* hp = dynamic_cast<AIDA::IHistogram1D *> ( tree->find("3") );
|
||||
// AIDA::IHistogram1D& h = *hp;
|
||||
// (plotter->currentRegion()).plot(h);
|
||||
// plotter->refresh();
|
||||
// plotter->setCurrentRegionNumber(1);
|
||||
// AIDA::IHistogram1D* hp2 = dynamic_cast<AIDA::IHistogram1D *> ( tree->find("1") );
|
||||
// AIDA::IHistogram1D& h2 = *hp2;
|
||||
// (plotter->currentRegion()).plot(h2);
|
||||
// plotter->refresh();
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ void XrayTelPhysicsList::SetCuts()
|
||||
SetCutValue(cutForProton, "proton");
|
||||
SetCutValue(cutForProton, "anti_proton");
|
||||
|
||||
SetCutValueForOthers(defaultCutValue);
|
||||
// SetCutValueForOthers(defaultCutValue);
|
||||
|
||||
if (verboseLevel >1) {
|
||||
DumpCutValuesTable();
|
||||
|
||||
@@ -103,10 +103,11 @@ void XrayTelSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
XrayTelRunAction* runAction = (XrayTelRunAction*) runManager->GetUserRunAction();
|
||||
runAction->Update(track->GetKineticEnergy());
|
||||
}
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Do the analysis related to this step
|
||||
XrayTelAnalysis* analysis = XrayTelAnalysis::getInstance();
|
||||
analysis->analyseStepping(*track,entering);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user