Presentation is loading. Please wait.

Presentation is loading. Please wait.

N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Prototype GEANT4 Service for ATHENA framework ATLAS Software Workshop Dec 3.

Similar presentations


Presentation on theme: "N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Prototype GEANT4 Service for ATHENA framework ATLAS Software Workshop Dec 3."— Presentation transcript:

1 N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Prototype GEANT4 Service for ATHENA framework ATLAS Software Workshop Dec 3 2001 Architecture Session

2 2 Charles Leggett Objectives F Access GEANT4 services from ATHENA framework F Use HepMC event as produced by Generators F Understand various geometry formats: l basic GEANT4 C++ geometry classes l AGDD l DOM F Use GEANT4 Physics Lists F Preserve GEANT4 Hits and Tracks for further processing F Visualization F Use ATHENA framework facilities for persistification F Use ATHENA framework facilities for histograms F Use any other ATHENA framework component...

3 3 Charles Leggett Components F G4Svc: ATHENA/GAUDI service l G4Svc inherits from IService, IG4Svc. usually, only thing the user needs to talk to l G4SvcRunManager inherits from G4RunManager extends functionality splits up event loop so G4 event/hit store doesn’t get cleared until end of Athena event l AthenaHepMCtoG4EventAction converts HepMC event in StoreGate to G4Event F AGDD geometry builder l reads XML files and builds geometry/materials specifications F DOM geometry builder l reads other XML files using DOM model

4 4 Charles Leggett Access to GEANT4 Services F pure GEANT4 facilities can be accessed in several different ways: l using pre-defined G4Svc access methods, such as: SetUserAction( G4VUserEventAction ); SetUserInitialization(G4VUserDetectorConstruction* ); l direct access to G4RunManager l via command line userInterface session l sending text commands to the UImanager l get hold of various other G4 objects, such as G4Event* and talk directly to them

5 5 Charles Leggett Process Loop: initialize() G4Svc::initialize() AddListner(EndEvent, McEventGenerated) new G4SvcRunManager LArG4Sim::initialize() G4Svc->SetUserInitialization(new LArDetectorConstruction) G4Svc->SetUserAction(new LArRunAction) G4Svc->SetUserAction(new LArEventAction) G4Svc->SetUserAction(new LArSteppingAction) initialize()

6 6 Charles Leggett Process Loop: execute() GenModule::execute() create HepMCEventCollection, put in StoreGate fire McEventGenerated incident G4Svc::handle(McEventGenerated) if (FirstEvent) { runMgr->SetUserInitialization(PhysicsList) runMgr->SetUserAction(AthenaHepMCtoG4EventAction) setup visualization runMgr->Initialize() } G4SvcRunManager::StartEvent(n) SetNumberOfEventsToBeStored(n) RunInitialization() DoEventLoop(n) AthenaHepMCtoG4EventAction::GeneratePrimaries() for (1,n) { SaveHits() SaveTracks() } execute()

7 7 Charles Leggett Process Loop: execute() cont. LArG4Sim::execute() access G4VHits in StoreGate process Hits G4Svc::handle(EndEvent) runMgr->EndEvent() G4SvcRunManager::RunTermination() execute()

8 8 Charles Leggett MC Event Conversion F Convert HepMC::GenEvent as produced by Generators into a G4Event, using a class that inherits from G4VUserPrimaryGeneratorAction F Can do multiple events per event F Trivial to do with SingleParticleGun F For Pythia events, don’t need all the particles, can ignore unstable ones F Problem: particle tree becomes disconnected. l put all particles into one primary vertex? l create many primary vertices, one for each HepMC::GenVertex causes problems with GEANT when have lots of vertices (segfault)

9 9 Charles Leggett Physics Lists F Very simple: copy directly from GEANT4 examples. F Select via jobOption l G4Svc.PhysicsList = “string” F Available lists: l Geantino (ExN01, ExN02) l ElectroMagnetic (ExN03) l Full (ExN04) l “none”  user must supply their own F Users can also create their own lists, and load them via l G4Svc->SetUserInitialization( PhysicsList  )

10 10 Charles Leggett Saving G4VHits G4SvcRunManager::SaveHits(G4Event  event) { event->GetHCofThisEvent() new vector hit_keys for (HitCollections in event) { new vector v_HC hit_keys->push_back(HitCollection->GetName()) for (G4VHits in HitCollection) { v_HC->push_back(G4VHit) } StoreGate->record(v_HC,HitCollectionName) } StoreGate->record(hit_keys,”HitKeys”) }

11 11 Charles Leggett Saving G4VTrajectories F Very similar to G4VHits, except all stored in one container F debug mode prints out all G4TrajectoryPoints in each G4VTrajectory. Turn off when using Pythia! G4SvcRunManager::SaveTracks(G4Event* event) { vector *v_TC = new vector ; G4TrajectoryContainer* TC = event->GetTrajectoryContainer(); for (G4VTrajectory* in TrajectoryContainer) { v_TC->push_back(G4VTrajectory*) } storeGate->record(v_TC,"G4VTrajectory") }

12 12 Charles Leggett Accessing the G4Svc F Tell the jobOptions about it: F Get hold of the service inside your algorithm: ApplicationMgr.DLLs += { "G4Svc" }; ApplicationMgr.ExtSvc += { "G4Svc" }; #include "G4Svc/IG4Svc.h" IG4Svc* p_G4Svc; StatusCode status = service("G4Svc",p_G4Svc);

13 13 Charles Leggett G4Svc Job Options F G4Svc.PhysicsList: l "ExN01", "ExN02", "ExN03", "ExN04 " l "Geantino", "EM", "Full", "none" F G4Svc.DefaultPhysicsCut l for a PhysicsList F G4Svc.Visualize l turn on visualization F G4Svc.VisType l default VRML F G4Svc.Tracking l G4RunManager->SetSaveTracks F G4Svc.RunVerbosity, EventVerbosity, TrackingVerbosity l how much G4 output to print out

14 14 Charles Leggett G4Svc UserInterface F Can access the G4UI text user interface at any time: p_G4Svc->StartUISession(); F Can also pass commands directly to the UImanager: l p_G4Svc->uiMgr()->ApplyCommand( "G4 command" );

15 15 Charles Leggett Accessing Hits and Tracks F As shown before, G4VHits and G4VTrajectories are stored in StoreGate in vectors, keyed by name F To retrieve hits: const DataHandle > hit_keys; vector ::const_iterator kitr; StatusCode status = m_sgSvc->retrieve( hit_keys, "HitKeys" ); if (status.isSuccess()) { for (kitr=hit_keys->begin(); kitr!=hit_keys->end(); ++kitr) { const DataHandle > hits; status = m_sgSvc->retrieve(hits, (*kitr)); if (status.isSuccess()) { vector ::const_iterator itr; for (itr=hits->begin(); itr!=hits->end(); ++itr) { (*itr) -> Print(); }

16 16 Charles Leggett Building Geometry from XML F Several XML geom/material builders have been implemented: l Stan’s G4Builder: G4Builder l Jean-Francois’s AGDDBuilder: G4AGDDBuilder l Andrea’s DOM model: G4DOMBuilder ApplicationMgr.DLLs += { "G4Builder" }; ApplicationMgr.TopAlg = {..., "G4BuilderAlg",... }; G4BuilderAlg.MaterialXML = "Material_AGDD.xml"; G4BuilderAlg.DetectorXML = "Atlas_AGDD.xml"; ApplicationMgr.DLLs += { "G4AGDDBuilder" }; ApplicationMgr.TopAlg = {..., "G4AGDDBuilder",... }; G4AGDDBuilder.MaterialXML = "Material_AGDD.xml"; G4AGDDBuilder.DetectorXML = "Atlas_AGDD.xml"; ApplicationMgr.DLLs += { “G4DOMBuilder” }; ApplicationMgr.TopAlg = {..., "G4DOMBuilder",... }; G4DOMBuilder.XML = { ”SCTDesc.xml”, “color.xml” };

17 17 Charles Leggett Building AGDD Geometry F Use AGDD to read in (uncompacted) XML G4VPhysicalVolume* DetectorConstruction::Construct() { AGDD_Factory &f = AGDD_Factory::Expat_instance(); f.build_detector_description (m_materialFile); BuildMaterial build_material; build_material.parseAGDD (f.get_detector_description() ); f.build_detector_description (m_detectorFile); BuildGeometry build_geometry; build_geometry.parseAGDD (f.get_detector_description() ); }

18 18 Charles Leggett Visualization F Several vis models are currently supported: l VRML/vrweb l DAWN l will add the other G4 standards when I get the chance: had trouble compiling them in under Linux when I first started F By turning visualization on via the jobOptions, the G4Svc will write out the appropriate visualization file at the end of every event.

19 19 Charles Leggett Implementations F GEANT4 novice examples 1 through 4 l package G4Sim/G4Ex. l use Algorithm “G4ExN01”, “G4ExN02”, “G4ExN03”, “G4ExN04” F Liquid Argon Calorimeter, l package G4Sim/LArG4Sim l uses C++ classes F SCT with G4Builder l package G4Sim/G4Builder F SCT,Muon,HEC with G4AGDDBuilder l package G4Sim/G4AGDDBuilder F SCT with G4DOM l package G4Sim/G4DOMBuilder

20 20 Charles Leggett Documentation F online: l http://annwm.lbl.gov/G4 http://annwm.lbl.gov/G4 F CVS: l currently at BNL $CVSROOT = /afs/rhic/usatlas/project/localcvs F G4Sim container package contains: l GEANT4 (interface package for G4, using geant4.3.2) l G4Svc l G4Builder l G4AGDDBuilder l LArG4Sim l G4Ex


Download ppt "N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Prototype GEANT4 Service for ATHENA framework ATLAS Software Workshop Dec 3."

Similar presentations


Ads by Google