cbm simulation & analysis framework geant3 / gean4 configuration
DESCRIPTION
CBM Simulation & Analysis Framework Geant3 / Gean4 configuration. M. Al-Turany, D. Bertini. MC configuration is user defined and done via ROOT macro Geant3 Config Macro: /macro/run/g3Config.C Control of the physical process Full Access to Geant 3 common blocks: /GCPHYS/ - PowerPoint PPT PresentationTRANSCRIPT
10.05.2004 CBM Software Meeting 1
CBM Simulation & Analysis FrameworkCBM Simulation & Analysis FrameworkGeant3 / Gean4 configurationGeant3 / Gean4 configuration
M. Al-Turany, D. Bertini
10.05.2004 CBM Software Meeting 2
Simulation Run configuration Simulation Run configuration
• MC configuration is user defined and done via ROOT macro
• Geant3 Config Macro:– <CBM_VMC>/macro/run/g3Config.C– Control of the physical process
• Full Access to Geant 3 common blocks:– /GCPHYS/– /GCUTS/– /GCKING/
• Geant4 Config Macro– <CBM_VMC>/macro/run/g4Config.C– Definition of physic list ( + intrinsic cuts )– Definition of user defined Geant4 “actions”
10.05.2004 CBM Software Meeting 3
g3Config.Cg3Config.C
void Config() {
TGeant3* geant3 = new TGeant3("C++ Interface to Geant3");
cout << "Geant3 has been created." << endl;
// ******* GEANT3 configuration for simulated Runs *******
geant3->SetTRIG(1); //Number of events to be processed
geant3->SetSWIT(4, 10);
geant3->SetDEBU(0, 0, 1);
geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
geant3->SetABAN(0); //Restore behaviour for abandoned tracks
…
10.05.2004 CBM Software Meeting 4
Physical processesPhysical processes
• Direct pair production, Bremsstrahlung and muon nuclear interaction geant3->SetPAIR(1);
geant3->SetBREM(1); geant3->SetMUNU(1);
• Multiple scattering is switched on with the following line: geant3->SetMULS(1); and can be switched of for test purposes: geant3->SetMULS(0);
• With the following line we chose energy loss with restricted fluctuations and delta-electron production above a threshold. geant3->SetLOSS(1); geant3->SetDRAY(1);
• For test runs you might want to use full Landau fluctuations without delta-ray production: geant3->SetLOSS(2);
• Or no fluctuations at all: geant3->SetLOSS(4);
10.05.2004 CBM Software Meeting 5
Physical processesPhysical processes
• For background simulations it is important to simulate all photon interactions: geant3->SetCOMP(1); geant3->SetPHOT(1); geant3->SetPAIR(1);
• and processes producing photons: geant3->SetANNI(1);
• If Decays of the vector mesons are performed at the generator level through an interface (PYTHIA/JETSET) it is then important to switch on particle decays by GEANT: geant3->SetDCAY(1);
• For the simulation of hadronic showers you can chose between: geant3->SetHADR(1); //Select pure GEANH geant3->SetHADR(3); // GEANH/NUCRIN geant3->SetHADR(4); // FLUKA interface
10.05.2004 CBM Software Meeting 6
Kinetic CutsKinetic Cuts
The kinetic energy cuts for the various particle types are specified in the following line:
Float_t cut = 1.e-3; // 1 MeV cut by default
Float_t tofmax = 1.e10;
// GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDE MUPA TOFMAX geant3->SetCUTS(cut, cut, cut, cut, cut, cut, cut, cut, cut, 2.1e-3, tofmax);
10.05.2004 CBM Software Meeting 7
g4Config.Cg4Config.C
void Config() {
// RunConfiguration for Geant4 (std VMC)
// TG4RunConfiguration* runConfiguration
// = new TG4RunConfiguration();
CBMRunConfiguration* runConfiguration = new CBMRunConfiguration();
cout << "Geant4 has been created. 1 " << endl;
// TGeant4 instance
TGeant4* geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
// Customise Geant4 setting // (verbose level, global range cut, ..)
geant4->ProcessGeantMacro("g4config.in"); }
10.05.2004 CBM Software Meeting 8
g4Config.ing4Config.in
# Geant4 configuration macro for g4
# (called from Root macro Config.C)
#/process/eLoss/subsec false
#/process/eLoss/minsubsec 2 cm
# switch on/off B field
/mcDet/fieldType None
# Store or don't store secondaries
/mcTracking/saveSecondaries true
# use debug/verbosity mode
/mcVerbose/all 1
/mcVerbose/physicsList 2
/tracking/verbose 2
10.05.2004 CBM Software Meeting 9
Physical ProcessesPhysical Processes
# Special setting for the different physic list
#Special cuts “a la Geant3”
/mcPhysics/setSpecialCuts false
mcPhysics/printGeneralCuts true
#Switch on off physic list
/mcPhysics/setEM true
/mcPhysics/setMuon true
/mcPhysics/setHadron false
/mcPhysics/setOptical false
# cut in range ( 1 mm)
/mcPhysics/rangeCut 1.
/run/particle/dumpCutValues
10.05.2004 CBM Software Meeting 10
G4 Config via compiled codeG4 Config via compiled code
• CBMRunConfiguration class– Creates the mandatory Geant4 physic classes and the other
user action classes. – void CBMRunConfiguration::CreateUserConfiguration() – Gives user access to Stacking mechanism
• Can use the new Geant4 Packaging Physic Lists– Recommended compare to using physic list from Example
N04/N06 – Provide different models for hadronic interaction
• User can choose in the Educated Guess Physics Lists for Geant4 HADronic Physics :
• http://cmsdoc.cern.ch/~hpw/GHAD/HomePage/
10.05.2004 CBM Software Meeting 11
G4 Config via CBMRunConfigurationG4 Config via CBMRunConfiguration
void CBMRunConfiguration::CreateUserConfiguration() {// create mandatory Geant4 classes fDetectorConstruction = new TG4DetConstruction(); fSDConstruction = new TG4SDConstruction(); fPhysicsList = new TG4ModularPhysicsList(); fPrimaryGenerator = new TG4PrimaryGeneratorAction();
// create the other user action classes fRunAction = new TG4RunAction(); fEventAction = new TG4EventAction(); fTrackingAction = new TG4TrackingAction(); fSteppingAction = new TG4SteppingAction(); fStackingAction = new CBMSpecialStackingAction();
…. }
10.05.2004 CBM Software Meeting 12
G4 Config via CBMRunConfigurationG4 Config via CBMRunConfiguration
void CBMRunConfiguration::CreateUserConfiguration() {
… TG4ModularPhysicsList* tg4fPhysicsList = dynamic_cast<TG4ModularPhysicsList*>(fPhysicsList);
// take User physic definition
tg4fPhysicsList->SetDefaultCutValue(0.1*mm);
G4double mycut = 0.1*mm;
tg4fPhysicsList->SetRangeCut(mycut);
tg4fPhysicsList->SetVerboseLevel(6);
// Register user defined physics constructor
tg4fPhysicsList->RegisterPhysics( new GeneralPhysics("general")); // General Physics
tg4fPhysicsList->RegisterPhysics( new EMPhysics("standard EM")); // EM Physics
tg4fPhysicsList->RegisterPhysics( new MuonPhysics("muon")); // Muon Physics
tg4fPhysicsList->RegisterPhysics( new HadronPhysicsQGSP("hadron")); // Hadron Physics
tg4fPhysicsList->RegisterPhysics( new IonPhysics("ion")); // Ion Physics
10.05.2004 CBM Software Meeting 13
CBMStackingActionCBMStackingActionG4ClassificationOfNewTrack CBMSpecialStackingAction::ClassifyNewTrack ( const
G4Track * track ) {// Classifies the new track. // --- G4ClassificationOfNewTrack classification; G4int parentID = track->GetParentID();if (parentID ==0) return fUrgent; else{ // exclude secondary neutrinos G4ParticleDefinition* particle = track->GetDefinition(); if( particle == G4NeutrinoE::NeutrinoEDefinition() || particle == G4NeutrinoMu::NeutrinoMuDefinition() || particle == G4NeutrinoTau::NeutrinoTauDefinition() || particle == G4AntiNeutrinoE::AntiNeutrinoEDefinition() || particle == G4AntiNeutrinoMu::AntiNeutrinoMuDefinition() || particle == G4AntiNeutrinoTau::AntiNeutrinoTauDefinition()) { return fKill; } return fWaiting; } …return classification;}
10.05.2004 CBM Software Meeting 14
CBM Simulation & Analysis FrameworkCBM Simulation & Analysis FrameworkMerging Transported EventMerging Transported Event
M. Al-Turany, D. Bertini
10.05.2004 CBM Software Meeting 15
Creating bkg+signal Creating bkg+signal
Run_all.CSTS
UrQmD Gen
UrQmDInput File
STSPoints
Bkg.root
TParticle
TTree
Run_all.CSTS
AscII Gen
ASCIIInput FileD0 signal
STSPoints
SigD0.root
TParticle
TTree
10.05.2004 CBM Software Meeting 16
Merging at MCPoint levelMerging at MCPoint level
STSPoints
Bkg.root
TParticle
TTree
STSPoints
SigD0.root
TParticle
TTreeSTSPoints
Bkg+SigD0.root
TParticle
TTree
Merging
Reindexing/evts of arrays needed CBMStack CBMSTSPoints
10.05.2004 CBM Software Meeting 17
CBMROOTManagerCBMROOTManager
Method to store TObjectRegister(name,folder,TObject* obj)Register(name,folder,TCollection* obj)
Input Data ManipulationAddFriend( )
AddAndMerge()
CBMRootManager
• Provide service for merging:– AddAndMerge(TFile *f); – isMerging => kTRUE
• Modify Event loop– Reading an Event calls
• Reindexation and merging of Particle Stack information from different CBMApplication
• Reindexation and merging of all TClonesArray at the MCPoint level for all Detectors stored in the CBMApplication
• Dispatch calls to the different CBMDetector::CopyClones(…) implementation
Method to access DataFrom file: ActivateBranch( brname)
From Memory: GetMergedObject( brname)
10.05.2004 CBM Software Meeting 18
Virtual CBMDetector::CopyClonesVirtual CBMDetector::CopyClones
void CBMTracker::CopyClones ( TClonesArray *cl_orig, TClonesArray* cl_merged, Int_t offset ){ Int_t entries = cl_orig->GetEntriesFast(); TClonesArray &clRef = *cl_merged; CBMSTSPoint *pts = NULL; // Reindex and add pointer to merged TClonesArray for (Int_t i=0;i< entries ; i++ ) { pts = (CBMSTSPoint *) cl_orig->At(i); Int_t index = pts->GetTrackID() + offset; pts->SetTrackID( index ); CBMSTSPoint* pt = new (clRef[pos] ) CBMSTSPoint( *pts ); pos++; }}
10.05.2004 CBM Software Meeting 19
Macro for merging Macro for merging
// Load Libraries gROOT->LoadMacro("../basiclibs.C"); basiclibs(); gSystem->Load("libCbm"); gSystem->Load("libITrack");
CBMRun *fRun= new CBMRun(); fRun->SetInputFile("background_g3.root"); // merge now inputs at the MC Points fRun->AddAndMerge("signal_g3.root"); fRun->AddAndMerge("background_g3.root");
fRun->SetOutputFile("cbmout.root"); CBMITrack *it= new CBMITrack ("ITrack"); fRun->AddTask(it); fRun->LoadGeometry(); fRun->Init(); fRun->Run(3);