Ignore:
Timestamp:
Jan 8, 2010, 3:02:48 PM (14 years ago)
Author:
garnier
Message:

update to geant4.9.3

Location:
trunk/examples/extended/eventgenerator/exgps
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/eventgenerator/exgps/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.3 2005/07/19 08:35:49 flei Exp $
     1# $Id: GNUmakefile,v 1.5 2008/12/02 21:42:48 flei Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for tests module.  Gabriele Cosmo, 27/06/98.
     
    2121#LDFLAGS += -static
    2222
    23 ifdef G4ANALYSIS_USE
    24    CPPFLAGS += `aida-config --include`
    25    LDLIBS += `aida-config --lib`
    26 endif
  • trunk/examples/extended/eventgenerator/exgps/display_vrml.mac

    r807 r1230  
    77/vis/scene/endOfEventAction accumulate
    88/tracking/storeTrajectory 1
     9#
     10# Flush visualization
     11#/vis/viewer/update
    912
  • trunk/examples/extended/eventgenerator/exgps/exGPS.cc

    r807 r1230  
    3434
    3535#ifdef G4ANALYSIS_USE
    36 #include <AIDA/AIDA.h>
    3736#include "exGPSAnalysisManager.hh"
    3837#endif
    3938
     39#ifdef G4VIS_USE
    4040#include "G4VisExecutive.hh"
     41#endif
    4142
    4243#include "exGPSGeometryConstruction.hh"
     
    5455#ifdef G4ANALYSIS_USE
    5556  //constructe the analysis manager (need here to activate the UI)
    56   exGPSAnalysisManager* aMgr = exGPSAnalysisManager::getInstance();
     57  exGPSAnalysisManager::getInstance();
    5758#endif
    5859
     
    8889 
    8990  // visualization manager
     91#ifdef G4VIS_USE
    9092  G4VisManager* visManager = new G4VisExecutive;
    9193  visManager->Initialize();
     94#endif
    9295   
    9396  //Initialize G4 kernel
     
    114117
    115118#ifdef G4ANALYSIS_USE
    116   delete aMgr;
     119  exGPSAnalysisManager::dispose();
    117120#endif
    118121
     122#ifdef G4VIS_USE
    119123  delete visManager;
     124#endif
    120125  delete runManager;
    121126 
  • trunk/examples/extended/eventgenerator/exgps/include/exGPSAnalysisManager.hh

    r807 r1230  
    3131#include "globals.hh"
    3232
    33 using namespace AIDA;
     33namespace AIDA {
    3434
    35 class AIDA::IAnalysisFactory;
    36 class AIDA::ITree;
    37 class AIDA::IHistogramFactory;
    38 class AIDA::ITupleFactory;
    39 class AIDA::IPlotter;
     35class IAnalysisFactory;
     36class ITree;
     37class IPlotter;
     38class IHistogram1D;
     39class IHistogram2D;
     40class ITuple;
     41}
    4042
    4143class exGPSAnalysisMessenger;
     
    4850private:
    4951  exGPSAnalysisManager ();
     52  virtual ~exGPSAnalysisManager ();
    5053
    5154public:
    52   virtual ~exGPSAnalysisManager ();
    5355  static exGPSAnalysisManager* getInstance ();
    5456  static void dispose();
    55 
    56   IHistogramFactory* getHistogramFactory();
    57   ITupleFactory* getTupleFactory();
    58   IPlotter* createPlotter();
    59 
    6057
    6158public:
     
    8077  G4String fileType;
    8178
    82   IAnalysisFactory* analysisFactory;
    83   IHistogramFactory* hFactory;
    84   ITupleFactory* tFactory;
    85   ITree* tree;
     79  AIDA::IAnalysisFactory* analysisFactory;
     80  AIDA::ITree* tree;
     81  AIDA::IPlotter* plotter;
    8682
    8783  G4double minpos, maxpos;
    8884  G4double mineng, maxeng;
    8985
    90   IHistogram1D* enerHisto;
    91   IHistogram2D* posiXY;
    92   IHistogram2D* posiXZ;
    93   IHistogram2D* posiYZ;
    94   IHistogram2D* anglCTP;
    95   IHistogram2D* anglTP;
    96   ITuple* tuple;
    97 
    98   IPlotter* plotter;
     86  AIDA::IHistogram1D* enerHisto;
     87  AIDA::IHistogram2D* posiXY;
     88  AIDA::IHistogram2D* posiXZ;
     89  AIDA::IHistogram2D* posiYZ;
     90  AIDA::IHistogram2D* anglCTP;
     91  AIDA::IHistogram2D* anglTP;
     92  AIDA::ITuple* tuple;
    9993
    10094  exGPSAnalysisMessenger* analysisMessenger;
  • trunk/examples/extended/eventgenerator/exgps/include/exGPSEventActionMessenger.hh

    r807 r1230  
    3232//
    3333// $Id: exGPSEventActionMessenger.hh,v 1.4 2006/06/29 17:14:26 gunter Exp $
    34 // GEANT4 tag $Name: $
     34// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3535//
    3636//
  • trunk/examples/extended/eventgenerator/exgps/macros/display.mac

    r807 r1230  
    11#
    22/vis/scene/create
    3 /vis/sceneHandler/create OGLIX
     3/vis/sceneHandler/create VRML2FILE
    44/vis/viewer/create
    55/vis/drawVolume
    6 /vis/viewer/viewpointThetaPhi 30 30
     6#/vis/viewer/viewpointThetaPhi 30 30
    77#/vis/viewer/update
    88/vis/scene/endOfEventAction accumulate
  • trunk/examples/extended/eventgenerator/exgps/src/exGPSAnalysisManager.cc

    r807 r1230  
    3737
    3838exGPSAnalysisManager::exGPSAnalysisManager():
    39 fileName("exgps.aida"),fileType("xml"),analysisFactory(0), hFactory(0), tFactory(0),
    40 minpos(-10.),maxpos(10),mineng(0.),maxeng(1000.)
     39fileName("exgps.aida"),fileType("xml"),analysisFactory(0), tree(0),plotter(0),
     40minpos(-10.),maxpos(10),mineng(0.),maxeng(1000.),
     41enerHisto(0),posiXY(0),posiXZ(0),posiYZ(0),anglCTP(0),anglTP(0),tuple(0)
    4142{
    4243  // Define the messenger and the analysis system
     
    5556
    5657
    57 IHistogramFactory* exGPSAnalysisManager::getHistogramFactory()
    58 {
    59   return hFactory;
    60 }
    61 
    62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    63 
    64 
    65 ITupleFactory* exGPSAnalysisManager::getTupleFactory()
    66 {
    67   return tFactory;
    68 }
    69 
    70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    71 
    72 IPlotter* exGPSAnalysisManager::createPlotter()
    73 {
    74 #ifdef JAIDA_HOME
    75   if (analysisFactory)
    76   {
    77     IPlotterFactory* pf = analysisFactory->createPlotterFactory(0,0);
    78     if (pf) return pf->create("Plotter");
    79   }
    80 #endif
    81   return 0;
    82 }
    83 
     58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8459
    8560////////////////////////////////////////////////////////////////////////////////
     
    10883                                G4double t, G4double p, G4double w)
    10984{
    110   enerHisto->fill(e/MeV,w);
    111   posiXY->fill(x/cm,y/cm,w);
    112   posiXZ->fill(x/cm,z/cm,w);
    113   posiYZ->fill(y/cm,z/cm,w);
    114   anglCTP->fill(p/deg,std::cos(t),w);
    115   anglTP->fill(p/deg,t/deg,w);
     85  if(enerHisto) {
     86    enerHisto->fill(e/MeV,w);
     87    posiXY->fill(x/cm,y/cm,w);
     88    posiXZ->fill(x/cm,z/cm,w);
     89    posiYZ->fill(y/cm,z/cm,w);
     90    anglCTP->fill(p/deg,std::cos(t),w);
     91    anglTP->fill(p/deg,t/deg,w);
     92  }
    11693
    11794  if (plotter) plotter->refresh();
     
    141118void exGPSAnalysisManager::BeginOfRun()
    142119{
     120  tree = 0;
     121  plotter = 0;
     122
     123  enerHisto =0;
     124  posiXY = posiXZ = posiYZ = anglCTP =anglTP = 0;
     125  tuple = 0;
    143126
    144127  // Hooking an AIDA compliant analysis system.
    145128  analysisFactory = AIDA_createAnalysisFactory();
    146   if(analysisFactory){
    147     ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
     129  if(!analysisFactory) //Have to check that, it can fail.
     130  {
     131    G4cout << "exGPSAnalysisManager::BeginOfRun: can't get AIDA." << G4endl;
     132    return;
     133  }
     134  AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
     135  if(treeFactory)
     136  {
    148137    tree = treeFactory->create(fileName,fileType,false,true,"compress=yes");
    149     hFactory = analysisFactory->createHistogramFactory(*tree);
    150     tFactory = analysisFactory->createTupleFactory(*tree);
     138    if(!tree) //Have to check that, it can fail.
     139    {
     140      G4cout << "exGPSAnalysisManager::BeginOfRun:"
     141             << " can't create the AIDA::ITree : " << fileName << G4endl;
     142      return;
     143    }
     144
    151145    delete treeFactory; // Will not delete the ITree.
    152146  }
    153   //
    154   enerHisto =0;
    155   posiXY = posiXZ = posiYZ = anglCTP =anglTP = 0;
    156   plotter = 0;
    157   tuple = 0;
    158   //
     147
     148  AIDA::IHistogramFactory* hFactory = analysisFactory->createHistogramFactory(*tree);
    159149  if (hFactory)
    160150  {
     
    173163    anglTP = hFactory->createHistogram2D("Source phi-theta distribution",360,0,360
    174164                                                  ,180,0,180);
    175 #ifdef JAIDA_HOME
    176     plotter = createPlotter();
    177 
     165    delete hFactory;
     166  }
     167
     168  // Create a Tuple
     169
     170  AIDA::ITupleFactory* tFactory = analysisFactory->createTupleFactory(*tree);
     171  if (tFactory)
     172  {
     173     tuple = tFactory->create("MyTuple","MyTuple","string Pname, double Energy, X, Y, Z, Theta, Phi, Weight","");
     174     delete tFactory;
     175  }
     176 
     177  AIDA::IPlotterFactory* pf = analysisFactory->createPlotterFactory(0,0);
     178  if(pf)
     179  {
     180    plotter = pf->create();
    178181    if (plotter)
    179182    {
    180183       plotter->createRegions(2,3);
    181        plotter->region(0)->plot(*enerHisto);
    182        plotter->region(1)->plot(*posiXY);
    183        plotter->region(2)->plot(*posiXZ);
    184        plotter->region(3)->plot(*posiYZ);
    185        plotter->region(4)->plot(*anglCTP);
    186        plotter->region(5)->plot(*anglTP);
     184       if(enerHisto) plotter->region(0)->plot(*enerHisto);
     185       if(posiXY) plotter->region(1)->plot(*posiXY);
     186       if(posiXZ) plotter->region(2)->plot(*posiXZ);
     187       if(posiYZ) plotter->region(3)->plot(*posiYZ);
     188       if(anglCTP) plotter->region(4)->plot(*anglCTP);
     189       if(anglTP) plotter->region(5)->plot(*anglTP);
    187190       plotter->show();
    188      }
    189 #endif
    190   }
    191 
    192   // Create a Tuple
    193 
    194   if (tFactory)
    195   {
    196      tuple = tFactory->create("MyTuple","MyTuple","std::string Pname, std::double Energy, X, Y, Z, Theta, Phi, Weight","");
    197   }
    198 
     191    }
     192    delete pf;
     193  }
    199194}
    200195
     
    210205    if (!tree->commit()) G4cout << "Commit failed: no AIDA file produced!" << G4endl;
    211206    delete tree;
    212     delete tFactory;
    213     delete hFactory;
     207    tree = 0;
    214208    //    G4cout << "Warning: Geant4 will NOT continue unless you close the JAS-AIDA window." << G4endl;
    215     delete analysisFactory;
    216   }
    217   //  dispose();
     209
     210    delete plotter;
     211    plotter = 0;
     212
     213    delete analysisFactory; //cleanup all AIDA related things.
     214    analysisFactory = 0;
     215
     216    enerHisto = 0;
     217    posiXY = posiXZ = posiYZ = anglCTP =anglTP = 0;
     218    tuple = 0;
     219
     220  }
    218221}
    219222
  • trunk/examples/extended/eventgenerator/exgps/src/exGPSAnalysisMessenger.cc

    r807 r1230  
    2525//
    2626#ifdef G4ANALYSIS_USE
    27 
    28 #include <AIDA/AIDA.h>
    2927
    3028#include "exGPSAnalysisMessenger.hh"
  • trunk/examples/extended/eventgenerator/exgps/src/exGPSEventAction.cc

    r807 r1230  
    2828
    2929#ifdef G4ANALYSIS_USE
    30 #include <AIDA/AIDA.h>
    3130#include "exGPSAnalysisManager.hh"
    3231#endif
     
    8988      E=std::sqrt(P*P+E0*E0);   
    9089      E -= E0;
    91       G4String pname = evt->GetPrimaryVertex(j)->GetPrimary(i)->GetG4code()->GetParticleName();
     90//      G4String pname = evt->GetPrimaryVertex(j)->GetPrimary(i)->GetG4code()->GetParticleName();
     91      G4double pid = G4double(evt->GetPrimaryVertex(j)->GetPrimary(i)->GetPDGcode());
    9292      //
    9393      direction=direction*(1./direction.mag());               
     
    101101      z=position.z();
    102102      w = evt->GetPrimaryVertex(j)->GetPrimary(i)->GetWeight();
    103       exGPSAnalysisManager::getInstance()->Fill(pname,E,x,y,z,Theta,Phi,w);
     103//      exGPSAnalysisManager::getInstance()->Fill(pname,E,x,y,z,Theta,Phi,w);
     104     exGPSAnalysisManager::getInstance()->Fill(pid,E,x,y,z,Theta,Phi,w);
    104105    }
    105106  }   
    106107#endif
    107  
     108
     109#ifdef G4VIS_USE
    108110  // extract the trajectories and draw them
    109111  if (G4VVisManager::GetConcreteInstance())
     
    122124       }
    123125   }             
     126#endif
    124127}
    125128
  • trunk/examples/extended/eventgenerator/exgps/src/exGPSEventActionMessenger.cc

    r807 r1230  
    3232//
    3333// $Id: exGPSEventActionMessenger.cc,v 1.3 2006/06/29 17:14:43 gunter Exp $
    34 // GEANT4 tag $Name: $
     34// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3535//
    3636//
  • trunk/examples/extended/eventgenerator/exgps/src/exGPSRunAction.cc

    r807 r1230  
    3333
    3434#ifdef G4ANALYSIS_USE
    35 #include <AIDA/AIDA.h>
    3635#include "exGPSAnalysisManager.hh"
    3736#endif
     
    5554  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
    5655
     56#ifdef G4VIS_USE
    5757  if (G4VVisManager::GetConcreteInstance())
    5858    {
     
    6060      UI->ApplyCommand("/vis/scene/notifyHandlers");
    6161    }
     62#endif
    6263#ifdef G4ANALYSIS_USE
    6364  // If analysis is used reset the histograms
     
    7071void exGPSRunAction::EndOfRunAction(const G4Run* )
    7172{
     73#ifdef G4VIS_USE
    7274  if (G4VVisManager::GetConcreteInstance()) {
    7375     G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
    7476  }
     77#endif
    7578  // If analysis is used
    7679#ifdef G4ANALYSIS_USE
Note: See TracChangeset for help on using the changeset viewer.