190 likes | 377 Views
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: <CBM_VMC>/macro/run/g3Config.C Control of the physical process Full Access to Geant 3 common blocks: /GCPHYS/
E N D
CBM Simulation & Analysis FrameworkGeant3 / Gean4 configuration M. Al-Turany, D. Bertini CBM Software Meeting
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” Simulation Run configuration CBM Software Meeting
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 … g3Config.C CBM Software Meeting
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); Physical processes CBM Software Meeting
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 Physical processes CBM Software Meeting
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); Kinetic Cuts CBM Software Meeting
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"); } g4Config.C CBM Software Meeting
# 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 g4Config.in CBM Software Meeting
# 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 Physical Processes CBM Software Meeting
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/ G4 Config via compiled code CBM Software Meeting
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(); …. } G4 Config via CBMRunConfiguration CBM Software Meeting
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 G4 Config via CBMRunConfiguration CBM Software Meeting
G4ClassificationOfNewTrack 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; } CBMStackingAction CBM Software Meeting
CBM Simulation & Analysis FrameworkMerging Transported Event M. Al-Turany, D. Bertini CBM Software Meeting
Creating bkg+signal Bkg.root TTree Run_all.C STS UrQmD Gen UrQmD Input File TParticle STSPoints SigD0.root TTree Run_all.C STS AscII Gen ASCII Input File D0 signal TParticle STSPoints CBM Software Meeting
Merging at MCPoint level Bkg.root TTree TParticle Bkg+SigD0.root Merging TTree STSPoints TParticle SigD0.root STSPoints TTree TParticle Reindexing/evts of arrays needed CBMStack CBMSTSPoints STSPoints CBM Software Meeting
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 CBMROOTManager CBMRootManager Method to access Data From file: ActivateBranch( brname) From Memory: GetMergedObject( brname) Method to store TObject Register(name,folder,TObject* obj) Register(name,folder,TCollection* obj) Input Data Manipulation AddFriend( ) AddAndMerge() CBM Software Meeting
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++; } } Virtual CBMDetector::CopyClones CBM Software Meeting
// 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); Macro for merging CBM Software Meeting