MPD Simulation&AnalysisMPD Simulation&Analysis Framework Framework
Mohammad Al-Turany, Ilse Kőnig, Denis Bertini, Florian Uhlig,
Oleg Rogachevsky
VHMP-2007 Dubna
18 september 2007 NICA@VHMP 2
OverviewOverview
• 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 3
MotivationsMotivations
• 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 4
Virtual Monte Carlo (VMC)Virtual Monte Carlo (VMC)
FLUKA transportFLUKA
User Code VMC
Geometrical Modeller
G3 G3 transport
G4 transportG4
Reconstruction
Visualisation
18 september 2007 NICA@VHMP 5
CbmRoot Features 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 6
CbmRoot: Simulation CbmRoot: Simulation
OracleConfigurati
on, Parameters,
Geometry
ROOT
Run Manager
Virtual MCGeant3
Geant4
FLUKA
Particle Generator
ASCII
PIPE
Target
STS
TRD
Cave
TOF
Magnet
RICH
EVGEN
Primary Generator
Urqmd
Magnetic
Field
Module
Detector
GeometryManager
IO Manager
Tasks
Field Map
GeoInterface
ECAL
RunTimeDataBase
Pluto
Root filesConfiguration, Parameters,Geometry
18 september 2007 NICA@VHMP 7
MpdRoot: Simulation MpdRoot: Simulation
ROOT
Run Manager
Virtual MCGeant3
Geant4FLUKA
Particle Generator
ASCII
PIPE
TPC
IT
Cave
TOF
Magnet
ZDC
EVGEN
Primary Generator
Urqmd
Magnetic
Field
Module
Detector
GeometryManager
IO Manager
Tasks
Field Map
GeoInterface
ECAL
RunTimeDataBase
Pluto
OracleConfigurat
ion, Parameter
s,Geometry
Root filesConfiguration, Parameters,Geometry
18 september 2007 NICA@VHMP 8
CbmRoot: AnalysisCbmRoot: Analysis
ROOT
Run Manager
EVGEN
Primary Generator
Magnetic
Field
Module
Detector
Geometry
Manager
IO Manager
Tasks
Delta Trackingdigitizers
GeoInterfaceRunTimeDataBase
Root filesConfiguration, Parameters,Geometry
Oracle
Configuration, Parameters,
Geometry
Root filesMCPoints, Hits,
Digits, Tracks
18 september 2007 NICA@VHMP 9
ASCII: Input format for the GeometryASCII: Input format for the Geometry
Creation of a volume Volume nameShapeShape parametersMedium
Positioning of the volume in a mother (Node)
MotherTransformation (position and rotation
matrix)
TUBE
pipe_1caveTUBEcarbon0. 0. -50.0. 5.50. 0. 100.
0. 0. 0.1. 0. 0. 0. 1. 0. 0. 0. 1.// *********************************************
pipe_vac_1pipe_1TUBEvacuum
0. 0. -50.0. 5.0. 0. 100.
0. 0. 0.1. 0. 0. 0. 1. 0. 0. 0. 1.// *********************************************targetpipe_vac_1TUBEgold0. 0. -0.250. 2.50. 0. 0.25
0. 0. 0.1. 0. 0. 0. 1. 0. 0. 0. 1.
xy
z. .x
y
z
xy
z. .
18 september 2007 NICA@VHMP 10
Material & Geometry InterfaceMaterial & Geometry Interface
OracleDB
ASCII
CbmGeoInterface
TGeo Geometry/MaterialTGeoVolumeTGeoNode
TGeoMaterial
RootBuilderG3Builder
G3 Geometry/Material
XYZBuilder
XYZ Geometry/Material
Rootfiles
Advantage:more flexibility : different inputs can be used.
18 september 2007 NICA@VHMP 11
CBM Runtime DatabaseCBM Runtime Database
Runtime Database
2 Inputs
1 Output
List of Parameter Containers
ASCII FileROOT FileOracle
List of Runs
The Runtime Database is the manager class for all Parameter containers:
Creation, Initialization, Output
Container Factories
IO defined in the macro
Created in the init() function of the tasks via the container factories or in the macro
Filled during initialization
read()write()
18 september 2007 NICA@VHMP 12
IO FeaturesIO 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 13
Simulation Macro – loading LibsSimulation Macro – loading Libs
Base Libs
Cbm Spec. 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 NICA@VHMP 14
Simulation MacroSimulation Macro
//create the Run ClassCbmRunSim *fRun = new CbmRunSim();
// set the MC version used fRun->SetName("TGeant3"); //for G4 use "TGeant4" //Choose the Geant 3 Navigation SystemfRun->SetGeoModel("G3Native"); // "TGeo" flag in case of TGeoManager
// choose an output file namefRun->SetOutputFile("test.root");
18 september 2007 NICA@VHMP 15
Simulation Macro- Create ModulesSimulation 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 16
Simulation Macro- Create DetectorsSimulation 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 17
Simulation Macro-Simulation Macro-Event GeneratorsEvent 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 18
Simulation Macro-Magnetic FieldSimulation 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 19
Simulation Macro- Run SimulationSimulation Macro- Run Simulation
fRun->Init(); // Initialize the simulationSimulation:
1. Initialize the VMC (Simulation)2. Initialize Tasks (if they are used in Simulation)
fRun->Run(NoOfEvent); //Run the Simulation
18 september 2007 NICA@VHMP 20
CBM Detector GeometryCBM Detector Geometry
18 september 2007 NICA@VHMP 21
MPD Detector GeometryMPD Detector Geometry
18 september 2007 NICA@VHMP 22
Analysis MacroAnalysis 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 23
Algorithms : CBMTaskAlgorithms : CBMTask
• Tasks can be organized into a hierarchy and displayed in the browser.
• The CBMTask base class (TTask): – Init(); //Initialization – Exec(Option_t * option);
• 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 24
Tasks MechanismTasks 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->Add(Task2)Task1->Add(Task3)Task2->Add(Task4)Task2->Add(Task5)Task3->Add(Task6)
Task1
Task2 Task3
Task4 Task6Task5
18 september 2007 NICA@VHMP 25
Initialisation scheme (Analysis)Initialisation scheme (Analysis)
File=1
File=2
RunId1
RunId2
Sim. Data
Sim. Data
CbmTask ParametersRunId1
RunId2
Par. Cont.
Par. Cont
CbmTask::SetContainers()CbmTask::init()
CbmTask::Exec()
CbmTask::Exec()
CbmTask::Reinit()
CbmParIo
CbmParIo
Data
18 september 2007 NICA@VHMP 26
Track VisualizationTrack Visualization
18 september 2007 NICA@VHMP 27
SummarySummary
• 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 28
Example: Visualization macroExample: 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 29
CBM Silicon Tracker Station CBM Silicon Tracker Station