CBM Simulation Framework

Download Report

Transcript CBM Simulation Framework

MPD Simulation&Analysis
Framework
Mohammad Al-Turany, Ilse Kőnig,
Denis Bertini, Florian Uhlig,
Oleg Rogachevsky
VHMP-2007
Dubna
Overview
•
•
•
•
•
•
•
Motivations
The Virtual Monte Carlo concept
CbmRoot Features
Geometry Interface
Runtime Database and Parameter Handling
Examples (Simulation and Analysis)
Summary
18 september 2007
NICA@VHMP
2
Motivations
• Which simulation engine to choose?
– Need to move to modern and maintained MC: GEANT4
– Need for
• Working fast ! ( LOI, TDR deadlines … )
• Making reliable simulation
– Usually: better knowledge of “old” MC’s: GEANT3, FLUKA …
– A cross-check of simulation results between different MC is needed
• Better understanding of GEANT4 ( intrinsic cuts / physics list …)
• Preparing for full simulation
• Use of VMC (Virtual Monte Carlo ) : an interface between MCs
– With the same code, the user can switch between different MCs
18 september 2007
NICA@VHMP
3
Virtual Monte Carlo (VMC)
User
Code
VMC
G3
G3 transport
G4
G4 transport
FLUKA
FLUKA
transport
Reconstruction
Geometrical
Modeller
Visualisation
18 september 2007
NICA@VHMP
4
CbmRoot Features
• The same framework can be used for Simulation and Analysis
• Fully ROOT based:
– VMC for simulation
– IO scheme (TChain, friend TTrees, TFolders ) for persistency
– TTask to organize the analysis data flow
• Completely configurable via ROOT macros
• Easy to maintain (only ROOT standard services are used)
• Geometry / navigation system models
– G3/G4 Native geometrical models
– Geometry Modeller (TGeoManager) ( G3/FLUKA + G4?)
18 september 2007
NICA@VHMP
5
CbmRoot: Simulation
Geometry
Manager
Geant3
Virtual MC
ROOT
Magnet
FLUKA
Target
PIPE
Cave
GeoInterface
Module
STS
TRD
Detector
TOF
RICH
ECAL
18 september 2007
Run Manager
Primary
Generator
Magnetic
Field
Field Map
Geant4
IO Manager
RunTime
DataBase
EVGEN
Tasks
Particle
Generator
Pluto
ASCI
Urqmd
I
NICA@VHMP
Oracle
Configuration,
Parameters,
Geometry
Root files
Configuration,
Parameters,
Geometry
6
MpdRoot: Simulation
Geometry
Manager
Virtual MC
GeoInterface
FLUKA
Run Manager
Cave
Module
TPC
IT
Magnetic
Field
Detector
TOF
ZDC
ECAL
18 september 2007
Geant4
ROOT
Magnet
PIPE
Geant3
Field Map
Primary
Generator
IO Manager
RunTime
DataBase
Tasks
EVGEN
Particle
Generator
ASCII
NICA@VHMP
Oracle
Configuration,
Parameters,
Geometry
Urqmd
Root files
Configuration,
Parameters,
Geometry
Pluto
7
CbmRoot: Analysis
ROOT
Geometry
Manager
GeoInterface
Module
Detector
IO Manager
Run Manager
Primary
Generator
Magnetic
Field
Tasks
Delta
18 september 2007
Root files
MCPoints, Hits,
Digits, Tracks
RunTime
DataBase
EVGEN
Oracle
Configuration,
Parameters,
Geometry
Root files
Configuration,
Parameters,
Geometry
digitizers Tracking
NICA@VHMP
8
ASCII: Input format for the Geometry
Creation of a volume
Volume name
Shape
Shape parameters
Medium
Positioning of the volume in a mother
(Node)
Mother
Transformation (position and
rotation matrix)
TUBE
pipe_vac_1
pipe_1
TUBE
vacuum
0. 0. -50.
0. 5.
0. 0. 100.
0. 0. 0.
1. 0. 0. 0. 1. 0. 0. 0. 1.
//
*********************************************
target
pipe_vac_1
TUBE
gold
0. 0. -0.25
0. 2.5
0. 0. 0.25
0. 0. 0.
1. 0. 0. 0. 1. 0. 0. 0. 1.
y
.
18 september 2007
pipe_1
cave
TUBE
carbon
0. 0. -50.
0. 5.5
0. 0. 100.
0. 0. 0.
1. 0. 0. 0. 1. 0. 0. 0. 1.
//
*********************************************
x
z
.
NICA@VHMP
9
Material & Geometry Interface
Advantage:
Oracle
DB
TGeo Geometry/Material
more flexibility : different inputs can be used.
TGeoVolume
TGeoNode
TGeoMaterial
CbmGeoInterface
ASCII
G3 Geometry/Material
G3Builder
Root
files
18 september 2007
RootBuilder
XYZ Geometry/Material
XYZBuilder
NICA@VHMP
10
CBM Runtime Database
The Runtime Database is the manager class for all Parameter containers:
Creation, Initialization, Output
Runtime Database
Container Factories
2 Inputs
List of Parameter Containers
1 Output
List of Runs
read()
Created in the init()
function of the
tasks via the
container factories
or in the macro
write()
Filled during initialization
ASCII File
ROOT File
Oracle
18 september 2007
IO defined in the
macro
NICA@VHMP
11
IO Features
•
Dynamic Tree creation at initialisation time
– Simulation: CbmDetector::Init()
– Analysis: CbmTask::Init()
• ( automatic partial IO )
• Chaining Input data
– TChain services
• Connection of Data levels
– Use of Root Friend mechanism
• Combined Chaining & Friend Mechanism
18 september 2007
NICA@VHMP
12
Simulation Macro – loading Libs
// Load basic libraries
gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
basiclibs();
// Load CBMROOT libraries
gSystem->Load("libGeoBase");
gSystem->Load("libParBase");
gSystem->Load("libCbm");
gSystem->Load("libPassive");
gSystem->Load("libGen");
gSystem->Load("libSts");
gSystem->Load("libTrd");
gSystem->Load("libTof");
gSystem->Load("libRich");
18 september 2007
Base Libs
Cbm Spec. Libs
NICA@VHMP
13
Simulation Macro
//create the Run Class
CbmRunSim *fRun = new CbmRunSim();
// set the MC version used
fRun->SetName("TGeant3");
//for G4 use "TGeant4"
//Choose the Geant 3 Navigation System
fRun->SetGeoModel("G3Native"); // "TGeo" flag in case of TGeoManager
// choose an output file name
fRun->SetOutputFile("test.root");
18 september 2007
NICA@VHMP
14
Simulation Macro- Create Modules
CbmModule *Cave= new CbmCave("WORLD");
Cave->SetGeometryFileName("PASSIVE/CAVE", "v03a");
fRun->AddModule(Cave);
CbmModule *Target= new CbmTarget("Target");
Target->SetGeometryFileName("PASSIVE/TARGET", "v03a");
fRun->AddModule(Target);
CbmModule *Pipe= new CbmPIPE("PIPE");
Pipe->SetGeometryFileName("PASSIVE/PIPE", "v03a");
fRun->AddModule(Pipe);
CbmModule *Magnet= new CbmMagnet("MAGNET");
Magnet->SetGeometryFileName("PASSIVE/MAGNET", "v03a");
fRun->AddModule(Magnet);
18 september 2007
NICA@VHMP
15
Simulation Macro- Create Detectors
CbmDetector *STS= new CbmSts("STS", kTRUE);
STS->SetGeometryFileName("STS/STS", "v03c");
fRun->AddModule(STS);
CbmDetector *TOF= new CbmTof("TOF", kTRUE );
TOF->SetGeometryFileName("TOF/TOF", "v03_v10");
fRun->AddModule(TOF);
CbmDetector *TRD= new CbmTRD("TRD",kFALSE );
TRD->SetGeometryFileName("TRD/TRD", "v04b_9" );
fRun->AddModule(TRD);
18 september 2007
NICA@VHMP
16
Simulation Macro-Event Generators
CbmPrimaryGenerator *priGen= new CbmPrimaryGenerator();
fRun->SetGenerator(priGen);
CbmUrqmdGenerator *fGen1= new CbmUrqmdGenerator("00-03fm.100ev.f14");
CbmPlutoGenerator *fGen2= new CbmPlutoGenerator("jpsi.root");
CbmParticleGenerator *fGen3= new CbmParticleGenerator();
fRun->AddGenerator(fGen1);
fRun->AddGenerator(fGen2);
fRun->AddGenerator(fGen3);
18 september 2007
NICA@VHMP
17
Simulation Macro-Magnetic Field
// setting a field map
CbmField *fMagField= new CbmField("Dipole Field");
fMagField->readAsciifile("FieldIron.map"); // read ASCII file
fMagField->readRootfile("FieldIron.root"); // read Root file
// setting a constant field
CbmConstField *fMagField=new CbmConstField();
fMagField->SetFieldXYZ(0, 30 ,0 );
// values are in kG
// MinX=-75, MinY=-40,MinZ=-12 ,MaxX=75, MaxY=40 ,MaxZ=124 );
fMagField->SetFieldRegions(-74, -39 ,-22 , 74, 39 , 160 ); // values are in cm
fRun->SetField(fMagField);
18 september 2007
NICA@VHMP
18
Simulation Macro- Run Simulation
fRun->Init();
// Initialize the simulation
Simulation:
1. Initialize the VMC (Simulation)
2. Initialize Tasks (if they are used in Simulation)
fRun->Run(NoOfEvent);
18 september 2007
//Run the Simulation
NICA@VHMP
19
CBM Detector Geometry
18 september 2007
NICA@VHMP
20
MPD Detector Geometry
18 september 2007
NICA@VHMP
21
Analysis Macro
{
gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
basiclibs();
gSystem->Load("libCbm");
gSystem->Load("libITrack");
CbmRunAna *fRun= new CbmRunAna();
fRun->SetInputFile(“/d/STS_AuAu25Gev_Urqmd.root");
fRun->SetOutputFile(“trackOutput.root");
18 september 2007
NICA@VHMP
22
Algorithms : CBMTask
• Tasks can be organized into a hierarchy and displayed in the
browser.
• The CBMTask base class (TTask):
– Init();
– Exec(Option_t * option);
//Initialization
• In Analysis macro:
{
// Algorithm definition
CbmStsTrackFinder *tr = CbmStsTrackFinder("track finder");
// Add the algorithm in the list of algorithms
fRun->AddTask(tr);
}
18 september 2007
NICA@VHMP
23
Tasks Mechanism
CBMTask *Task1=new CBMTask("Task1")
CBMTask *Task2=new CBMTask("Task2")
CBMTask *Task3=new CBMTask("Task3")
CBMTask *Task4=new CBMTask("Task4")
CBMTask *Task5=new CBMTask("Task5")
CBMTask *Task6=new CBMTask("Task6")
Task1
Task1->Add(Task2)
Task1->Add(Task3)
Task2->Add(Task4)
Task2->Add(Task5)
Task3->Add(Task6)
18 september 2007
Task2
Task4
NICA@VHMP
Task3
Task5
Task6
24
Initialisation scheme (Analysis)
Data
CbmTask
Parameters
CbmParIo
RunId1
CbmTask::SetContainers()
CbmTask::init()
RunId1
File=1
Sim. Data
Par. Cont.
CbmTask::Exec()
CbmParIo
RunId2
CbmTask::Reinit()
File=2
RunId2
Par. Cont
Sim. Data
CbmTask::Exec()
18 september 2007
NICA@VHMP
25
Track Visualization
18 september 2007
NICA@VHMP
26
Summary
• FAIRROOT was tested for CBM, PANDA, HADES and
NUSTAR experiments
• New branch of FAIRROOT – MpdRoot framework for MPD
detector is implemented now
– First released will be in October 2007
– Work on detector geometry and tracking is going on.
18 september 2007
NICA@VHMP
27
Example: Visualization macro
{
gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
basiclibs();
gSystem->Load("libCbm");
......
TFile* file = new TFile("test.root");
TGeoManager *geoMan = (TGeoManager*) file->Get("CBMGeom");
TCanvas* c1 = new TCanvas("c1", "", 100, 100, 800, 800);
c1->SetFillColor(10);
geoMan->DrawTracks("same/Nneutron");
geoMan->SetVisLevel(3);
geoMan->GetMasterVolume()->Draw("same");
}
18 september 2007
NICA@VHMP
28
CBM Silicon Tracker Station
18 september 2007
NICA@VHMP
29