Changeset 54 for MEMPHYS


Ignore:
Timestamp:
Dec 6, 2005, 5:08:55 PM (19 years ago)
Author:
barrand
Message:

G.Barrand : have hit collection logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MEMPHYS/HEAD/applications/MEMPHYS_session.cxx

    r10 r54  
    1212
    1313// Lib :
    14 #include <Lib/Interfaces/ISession.h>
    15 #include <Lib/Manager.h>
     14#include <Lib/Interfaces/IManager.h>
    1615#include <Lib/System.h>
    17 //#include <Lib/Debug.h>
     16#include <Lib/Cast.h>
    1817
    1918// G4Lab :
    2019#include <G4Lab/UIOnX.h>
    2120#include <G4Lab/TrackingAction.h>
     21#include <G4Lab/Helpers.h>
    2222
    2323//MEMPHYS:
     
    4343  virtual void* cast(const std::string& aTo) const {
    4444    if(aTo=="MEMPHYSAnalysisManager") {
    45       return (MEMPHYSAnalysisManager*)this;
     45      return Lib_SCast(MEMPHYSAnalysisManager);
    4646    } else if(aTo=="MEMPHYSIAnalysis") {
    47       return (MEMPHYSIAnalysis*)this;
     47      return Lib_SCast(MEMPHYSIAnalysis);
    4848    } else if(aTo=="MEMPHYSAnalysis") {
    49       return (MEMPHYSAnalysis*)this;
     49      return Lib_SCast(MEMPHYSAnalysis);
    5050    } else if(aTo=="IManager") {
    51       return (IManager*)this;
     51      return Lib_SCast(IManager);
    5252    } else {
    5353      return 0;
     
    7777  // Need to pass the G4RunManager at UIOnX creation
    7878  std::string gui = "$MEMPHYSROOT/scripts/OnX/MEMPHYS_session.onx";
    79   G4Lab::UIOnX* session = new G4Lab::UIOnX(runManager,gui,aArgc,aArgv);
     79  G4Lab::UIOnX* session = new G4Lab::UIOnX(*runManager,gui,aArgc,aArgv);
    8080
    8181  MEMPHYSAnalysisManager* analysisManager = 0;
    8282
    83   // Declare actions that needs some UI or analysis facilities :
    84   ISession* onxSession = session->session();
    85   if(onxSession) {
    86     // Get theg AIDA Lab implementation :
    87     AIDA::IAnalysisFactory* aida =
    88       Lib_findManager(*onxSession,"AnalysisFactory",AIDA::IAnalysisFactory);
    89     if(!aida) {
    90       std::cout << "MEMPHYS_session :"
    91                 << " AnalysisFactory not found." << std::endl;
    92     } else {
    93       analysisManager = new MEMPHYSAnalysisManager(*aida,false);
    94       onxSession->addManager(analysisManager);
    95     }
     83  AIDA::IAnalysisFactory* aida = G4Lab::UIOnX_aida(*session);
     84  if(!aida) {
     85    std::cout << "MEMPHYS_session : AIDA not found." << std::endl;
     86  } else {
     87    analysisManager = new MEMPHYSAnalysisManager(*aida,false);
     88    session->addManager(analysisManager);
    9689  }
    9790
     
    113106
    114107  // Set user action classes
    115   MEMPHYSPrimaryGeneratorAction* myGeneratorAction = new MEMPHYSPrimaryGeneratorAction(MEMPHYSdetector);
     108  MEMPHYSPrimaryGeneratorAction* myGeneratorAction =
     109    new MEMPHYSPrimaryGeneratorAction(MEMPHYSdetector);
    116110  runManager->SetUserAction(myGeneratorAction);
    117111
Note: See TracChangeset for help on using the changeset viewer.