Title: CBM Simulation
1CBM SimulationAnalysis FrameworkCbmroot
- Mohammad Al-Turany Denis Bertini
2CBM Framework Features
- The same framework can be used for Simulation and
Analysis - Fully ROOT based
- VMC for simulation
- Geometry Modeller (TGeoManager) for geometry
definition - IO scheme (TChain, friend TTrees, TFolders ) for
persistency - TTask to organize analysis data flow
- Improved ROOT IO Combined Chaining Friend
mechanism - Completely configurable via ROOT macros
- Reuse of HADES Geometry Interface.
- Reuse of HADES Parameter containers.
- Easy to maintain (only ROOT standard services are
used) - Event merging before and/or after transport
3CBMROOT is based on The Virtual Monte Carlo (VMC)
4CBM Analysis and Simulation Framework
ROOT
Geant3
Geometry Manager
Virtual MC
Geant4
FLUKA
Magnet
Target
IO Manager
Run Manager
GeoInterface
PIPE
Primary Generator
Cave
Module
STS
Magnetic Field
Urqmd
Detector
Tasks
EVGEN
TRD
Pluto
TOF
Particle Generator
RICH
Delta
Tracking
ASCII
Field Map
digitizers
ECAL
5CBM Analysis and Simulation Framework
ROOT
ROOT FILES Input MC Points, Configuration Output
Hits, Digits, Tracks
Geometry Manager
Virtual MC
IO Manager
Run Manager
GeoInterface
Primary Generator
Module
Magnetic Field
Detector
Tasks
EVGEN
Delta
Tracking
digitizers
6HYDRA Geometry Interface, why ?
- Use the copy mechanism
- reduce the size of ASCII files
- Reduce the number of Volumes in Geant
- Improve Geant tracking performance
- Oracle interface
- Hades geometry table design reusable
7HYDRA Geometry Interface, why ?
- Advantage
- more flexibility different inputs can be used.
- closer to technical drawings and analysis
coordinate systems - Disadvantage
- more points than really needed for the basic
shapes
8Material Geometry Interface
- Geometry/Material CBM
Geometry TGeoManager - input
Builder Interface -
-
Oracle DB
CBM Geometry/Material TGeoVolume TGeoNode TGeoMate
rial
CbmGeoInterface CbmGeoRootBuilder
ASCII
ROOT
9Full Simulation-Analysis Chain
Determine particle properties at target vertex
Event Generator
Transport particles through the detector material
Simulation
Transport
SIM
Digitizer
Determine detector response
RAW
Determine physical space point parameters from
detector hits
Storage Levels
Hit Finder
Determine momentum vector and PID for all tracks
Analysis
Reconstruction
Physics Analysis
Calculate physics observables
10Event merging before transport
Event Generator 1
Event Generator 2
UrQMD
Pluto
Transport
Merger
Digitizer
Hit Finder
Reconstruction
Physics Analysis
11Event merging after transport
Event Generator 1
Event Generator 2
Pluto
UrQMD
Transport
Transport
Merger
Digitizer
Hit Finder
Storage at SIM level is more efficient when
digitizers are fast compared to transport
Reconstruction
Physics Analysis
12Tasks and interfaces
SIM
MC POINT
MC POINT
Merger
Data Objects
MC POINT
Tasks
Storage Levels
Digitizer
Input of a taskis from storageor other task
RAW
DIGIT
Hit Finder
HIT
Reconstruction
TRACK
13Adding a detector or a Module ?
- Material definitions
- Geometry definitions
- Create a detector (or Module) subclass
- Create the library
14Simulation Macro
- Load the Libraries
- Create the Run Manager
- Choose Simulation engine
- Choose an output file name
- Create Modules and detectors and add them to the
Run Manager - Create and Set the Event generator(s)
- Create and set the Magnetic field
- Initialize and run the simulation
15Simulation Macro loading Libs
// Load basic libraries gROOT-gtLoadMacro("VMC
WORKDIR/gconfig/basiclibs.C") basiclibs()
// Load Cbmroot libraries gSystem-gtLoad("lib
Cbm") gSystem-gtLoad("libPassive")
gSystem-gtLoad("libGen") gSystem-gtLoad("libSts
") gSystem-gtLoad("libTrd") gSystem-gtLoad("li
bTof") gSystem-gtLoad("libRich")
16Simulation Macro
-
- //create the Run Class
- CBMRun fRun new CBMRun()
-
- // set the MC version used
- fRun-gtSetName("TGeant4") //for G3 use
"TGeant3" -
- // chose an output file name
- fRun-gtSetOutputFile("test.root")
17Simulation Macro- Create Modules
- CbmModule Cave new CbmCave("WORLD")
- Cave-gtSetGeometryFileName("PASSIVE/CAVE",
"v03a") - fRun-gtAddModule(Cave)
- CbmModule Target new CbmTarget("Target")
- Target-gtSetGeometryFileName("PASSIVE/TARGET",
"v03a") - fRun-gtAddModule(Target)
- CbmModule Pipe new CbmPIPE("PIPE")
- Pipe-gtSetGeometryFileName("PASSIVE/PIPE",
"v03a") - fRun-gtAddModule(Pipe)
- CbmModule Magnet new CbmMagnet("MAGNET")
- Magnet-gtSetGeometryFileName("PASSIVE/MAGNET",
"v03a") - fRun-gtAddModule(Magnet)
18Simulation Macro- Create Detectors
- CbmDetector STS new CbmSts("STS", kTRUE)
- STS-gtSetGeometryFileName("STS/STS", "v03c")
- fRun-gtAddModule(STS)
- CbmDetector TOF new CbmTof("TOF", kTRUE )
- TOF-gtSetGeometryFileName("TOF/TOF", "v03_v10")
- fRun-gtAddModule(TOF)
- CbmDetector TRD new CbmTRD("TRD",kFALSE )
- TRD-gtSetGeometryFileName("TRD/TRD", "v04b_9" )
- fRun-gtAddModule(TRD)
19Simulation Macro-Event Generators
- CbmPrimaryGenerator priGen new
CbmPrimaryGenerator() - fRun-gtSetGenerator(priGen)
- CbmUrqmdGenerator fGen1 new CbmUrqmdGenerator("0
0-03fm.100ev.f14") - CbmPlutoGenerator fGen2 new CbmPlutoGenerator("j
psi.root") - CbmParticleGenerator fGen3 new
CbmParticleGenerator() - fRun-gtAddGenerator(fGen1)
- fRun-gtAddGenerator(fGen2)
- fRun-gtAddGenerator(fGen3)
20Simulation Macro-Magnetic Field
- // setting a field map
- CbmFieldMap fMagField new CbmFieldMap("FIELD.v03
b.map") - // setting a constant field
- CbmConstField fMagFieldnew CbmConstField()
- fMagField-gtSetFieldXYZ(0, 30 ,0 ) // values are
in kG - // MinX-75, MinY-40,MinZ-12 ,MaxX75, MaxY40
,MaxZ124 ) - fMagField-gtSetFieldRegions(-74, -39 ,-22 , 74, 39
, 160 ) // values are in cm - fRun-gtSetField(fMagField)
21Simulation Macro- Run Simulation
- fRun-gtInit() // Initialize the simulation
- Simulation
- 1. Initialize the VMC (Simulation)
- 2. Initialize Tasks (if they are used in
Simulation) - fRun-gtRun(NoOfEvent) //Run the Simulation
22CBM Detector Geometry
23Example Rich Detector
24CbmTask
- Tasks can be organized into a hierarchy and
displayed in the browser. - The CbmTask class is the base class from which
the tasks are derived. - To give task functionality, you need to subclass
the CbmTask class and override - Init() //Initialization
- Exec(Option_t option)
25Tasks Mechanism
- CbmTask Task1new CbmTask("Task1") CbmTask
Task2new CbmTask("Task2") - CbmTask Task3new CbmTask("Task3")
- CbmTask Task4new CbmTask("Task4")
- CbmTask Task5new CbmTask("Task5")
- CbmTask Task6new CbmTask("Task6")
- Task1-gtAdd(Task2)
- Task1-gtAdd(Task3)
- Task2-gtAdd(Task4)
- Task2-gtAdd(Task5)
- Task3-gtAdd(Task6)
26CbmTasks
27Analysis creating a Task
- class CbmITrack public CbmTask
-
- public
- CbmDITrack(const char name, const char
title"CBM Task") - virtual void Init() //Initialization
- virtual void Exec(Option_t
option) //called for each event - virtual void Finish() //called for each event
- virtual CbmITrack()
-
- ClassDef(CbmITrack,1) //CbmITrack
28Analysis Task- Init example
- void CbmITrackInit()
-
- // Get a pointer to the ROOT Manager ( data
store ) - CbmRootManager fManager CbmRootManagerInstanc
e() - // Get the relevant data for the Task
- // activate in IO the corresponding TTree
branch - fListSTSpts(TClonesArray )fManager-gtActivateBr
anch("STSPoint") -
- //Create a new branch in the output file for the
results - fHitCollection new TClonesArray("CBMSTSDoubleHi
t") - fManager-gtRegister("STSDoubleHit","STS",
fHitCollection) -
29Analysis Task- Exec example
- void CBMITrackExec(Option_t option)
-
- CBMSTSDoublePoint ptNULL
- CBMSTSDoubleHit hitNULL
- for (int j0 j lt fListSTSpts-gtGetEntries() j
) - pt (CBMSTSDoublePoint) fListSTSpts-gtAt(j)
- if (pt ( pt-gtGetDetectorID(0)
pt-gtGetDetectorID(1)) ) - hit AddHit() hit-gtSetDetectorID(
pt-gtGetDetectorID(1)) - else continue
- hit-gtSetPos_in( pt-gtGetPos_in() )
- hit-gtSetPos_out( pt-gtGetPos_out() )
- TVector3 xy(gRandom-gtGaus(0,fDx),
gRandom-gtGaus(0,fDy),0.0) - hit-gtSetDPos_in( xy )
- hit-gtSetDPos_out( xy )
-
-
30Analysis Macro
-
- gROOT-gtLoadMacro("VMCWORKDIR/gconfig/basiclibs.C
") - basiclibs()
- gSystem-gtLoad("libCbm")
- gSystem-gtLoad("libITrack")
- CBMRun fRun new CBMRun()
- fRun-gtSetInputFile(/d/STS_AuAu25Gev_Urqmd.root")
- fRun-gtSetOutputFile(trackOutput.root")
- CBMITrack tr new CBMITrack("Tracking
Algorithm") - fRun-gtAddTask(tr)
- fRun-gtInit()
- fRun-gtRun()
-
31Chaining root files
- Chaining mechanism supported in the Analysis
- //
- CbmRun fRun new CbmRun()
- fRun-gtSetInputFile(myfile1.root)
- fRun-gtAddFile(myfile2.root)
- fRun-gtAddFile(myfile3.root)
- // loop over all entries
- fRun-gtRun()
-
-
32Combined Chain Friend (ROOT)
- ROOT IO problem
- //
- TChain ch(cbmsim)
- ch.Add(rich_hit1.root)
- ch.Add(rich_hit2.root)
- TFile f1(Rguidance1.root)
- TFile f2(Rguidance2.root)
- ch.AddFriend(cbmsim, f1)
- ch.AddFriend(cbmsim, f2)
- //
- Does NOT Work !!
-
33Combined Chain Friend (CbmRoot)
- Make use of our CbmRootManager (IO)
- When the TChain switch to new file
- Clear the global list of friends
- Add the correct next friend to the list
- Update the corresponding pointers (TTree, Friend
Tree ..) - Problem is solved
- //
- CbmRun fRun new CbmRun()
- fRun-gtSetInputFile(rich_hit1.root)
- fRun-gtAddFriend(Rguidance1.root)
- fRun-gtAddFile(rich_hit2.root)
- fRun-gtAddFriend(Rguidance2.root)
- //
- fRun-gtInit()
- fRun-gtRun()
-
34Track Visualization
- In the Simulation macro add
- .........
- fRun-gtSetStoreTraj(kTRUE)
- fRun-gtInit()
- // Set cuts for storing the trajectories
- CbmTrajFilter trajFilter CbmTrajFilterInstan
ce() - trajFilter-gtSetStepSizeCut(1) // 1 cm
- trajFilter-gtSetEnergyCut(0., 1.04) // 0 lt
Etot lt 1.04 GeV - trajFilter-gtSetStorePrimaries(kFALSE)
- .........
35Example Visualization macro
-
- gROOT-gtLoadMacro("VMCWORKDIR/gconfig/basiclibs.C"
) - basiclibs()
- gSystem-gtLoad("libCbm")
- ......
- TFile file new TFile("test.root")
- TGeoManager geoMan (TGeoManager)
file-gtGet("CBMGeom") - TCanvas c1 new TCanvas("c1", "", 100, 100,
800, 800) - c1-gtSetFillColor(10)
- geoMan-gtDrawTracks("same/Nneutron")
- geoMan-gtSetVisLevel(3)
- geoMan-gtGetMasterVolume()-gtDraw("same")
36Track Visualization
37Track Visualization
38Code Convention
- CodeWizard is being used as automatic rule
checker - Will be integrated with cvs commit
39Hades Simulation using Cbmroot, why?
- Need to simulate heavy system at High energy
- Need external stack for Geant3 internal stack
capacity reached - Check data with geant4
- Easy to use CBM framework services
- The Only efforts
- Definition of Detector MC point container
- Field map reader
- Conversion from Lab. MC point definition to
points defined in the local ref. Frame of the
sensitive volume - Modification of some particles physical
characteristics - Use of TVirtualMCGspart()
40Hades Simulation
ROOT
Geant3
Geometry Manager
Virtual MC
Geant4
FLUKA
Magnet
Target
IO Manager
Run Manager
GeoInterface
PIPE
Primary Generator
Cave
Module
MDC
Magnetic Field
Urqmd
Detector
Tasks
EVGEN
RICH
Pluto
Particle Generator
SHOWER
Field Map
TOF/TOFINO
ASCII
41Hades Simulation
42Summary
- A VMC based framework for CBM has been
implemented - First released in March 2004
- Work on digitizers and full tracking is going on.
- OCT04 release of Cbmroot was used to produce data
for the progress report - Packages ( ROOT 4.01/02 , GEANT3/GEANT4.6.2 )
- Tested on
- Red Hat 9.0 (gcc 3.2.2 and icc 8.1)
- Suse 9.0 (gcc 3.3.1)
- Debian (gcc 3.2.3)
- Fedora Core 2 (gcc 3.3.3)
- Binaries are also available for these platforms
43Summary
- Hades spectrometer has been fully integrated
- Gives us the opportunity to tune Geant4
(cuts/physics list ) to real Data ! - Realistic test of the framework.
- FLUKA simulation will be also possible with no
efforts ! - CBM Convention rules will be forced via
CodeWizard very soon - HADES Parameter containers are implemented and
ready to use - The Hades Oracle interface is already available
and will be integrated within the next months