FAIRROOT SIMULATION Panda Computing Week 2012, Torino.

Slides:



Advertisements
Similar presentations
GEANT Simulation of RCS Vahe Mamyan Hall A Analysis Workshop December 10, 2003.
Advertisements

Use of G EANT 4 in CMS AIHENP’99 Crete, April 1999 Véronique Lefébure CERN EP/CMC.
USE OF GEANT4 FOR LHCB RICH SIMULATION S. Easo, RAL, LHCB AND ITS RICH DETECTORS. TESTBEAM DATA FOR LHCB-RICH. OVERVIEW OF GEANT4 SIMULATION.
14 User Documents and Examples I SLAC Geant4 Tutorial 3 November 2009 Dennis Wright Geant4 V9.2.p02.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Japan.
Photon reconstruction and calorimeter software Mikhail Prokudin.
The LiC Detector Toy M. Valentan, M. Regler, R. Frühwirth Austrian Academy of Sciences Institute of High Energy Physics, Vienna InputSimulation ReconstructionOutput.
CBM Software Meeting 1 CBM Simulation & Analysis Framework M. Al-Turany, D. Bertini.
STAR C OMPUTING Maker and I/O Model in STAR Victor Perevoztchikov.
1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.
CBM Simulation&Analysis Framework Cbmroot Mohammad Al-Turany & Denis Bertini.
Gamma calorimeter for R3B: first simulation results INDEX ● The calGamma Geant4 simulation ( a short introduction ) ● Crystal and geometry selection: –
IFluka : a C++ interface between Fairroot and Fluka Motivations Design The CBM case: –Geometry implementation –Settings for radiation studies –Global diagnosis.
ALICE Offline week, CERN 21 February 2005 I. Hrivnacova 1 New geometry framework in MUON I.Hrivnacova IPN, Orsay ALICE Offline week, CERN 21 February 2005.
A Reconstruction Algorithm for a RICH detector for CLAS12 Ahmed El Alaoui RICH Workchop, Jefferson Lab, newport News, VA November th 2011.
The Pipeline Processing Framework LSST Applications Meeting IPAC Feb. 19, 2008 Raymond Plante National Center for Supercomputing Applications.
User Documents and Examples I Sébastien Incerti Slides thanks to Dennis Wrigth, SLAC.
Radiation levels in CBM Radiation effects iFluka (Fluka C++ interface to CbmRoot) Fluka Geometry Models Results Conclusion.
Implementing a dual readout calorimeter in SLIC and testing Geant4 Physics Hans Wenzel Fermilab Friday, 2 nd October 2009 ALCPG 2009.
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
Framework for Raw Data Thomas Kuhr Offline Week 29/06/2004.
FAIR Simulation & Analysis Framework FairRoot M. Al-Turany, D. Bertini, F. Uhlig GSI-IT.
Progress with migration to SVN Part3: How to work with g4svn and geant4tags tools. Geant4.
CBM Software week- M. Al-Turany 1 CBM Simulation & Analysis Framework Simulation Part M. Al-Turany, D. Bertini.
Event Data History David Adams BNL Atlas Software Week December 2001.
SoLID simulation Zhiwen Zhao Uva SoLID Collaboration Meeting 2011/6/2 1.
The european ITM Task Force data structure F. Imbeaux.
Material budget, energy losses and multiple scattering.
ALICE Simulation Framework Ivana Hrivnacova 1 and Andreas Morsch 2 1 NPI ASCR, Rez, Czech Republic 2 CERN, Geneva, Switzerland For the ALICE Collaboration.
LAV Software Status Emanuele Leonardi – Tommaso Spadaro Photon Veto WG meeting – 2015/03/24.
Andreas Morsch, CERN EP/AIP CHEP 2003 Simulation in ALICE Andreas Morsch For the ALICE Offline Project 2003 Conference for Computing in High Energy and.
Darmstadt, 15. November 2015 Tobias Stockmanns, FZ Jülich1 A STEP to ROOT converter for the FairRoot framework ALICE-FAIR Computing Meeting, GSI,
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
The Virtual MonteCarlo D.Adamova 2, V.Berejnoi 1, R.Brun 1, F.Carminati 1, A.Fassó 1, E.Futo 1, I.Gonzalez 3, I.Hrivnacova 4, A.Morsch 1 1 CERN, Geneva;
Simulations for CBM CBM-India Meeting, Jammu, 12 February 2008 V. Friese
1 Calorimeter in G4MICE Berkeley 10 Feb 2005 Rikard Sandström Geneva University.
The GeoModel Toolkit for Detector Description Joe Boudreau Vakho Tsulaia University of Pittsburgh CHEP’04 Interlaken.
Beam MC activity A.K.Ichikawa for beam group For more details,
Apr. 8, 2002Calibration Database Browser Workshop1 Database Access Using D0OM H. Greenlee Calibration Database Browser Workshop Apr. 8, 2002.
H.G.Essel: Go4 - J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel, S.Linev CHEP 2003 GSI Online Offline Object Oriented Go4.
1 ALICE OFFLINE :ORGANIZATION A user point of view Yves Schutz, SUBATECH, France (PHOS biased)
Detector Monte-Carlo ● Goal: Develop software tools to: – Model detector performance – Study background issues – Calculate event rates – Determine feasibility.
Simulations Report E. García, UIC. Run 1 Geometry Radiator (water) 1cm x 2cm x 2cm with optical properties Sensitive Volume (hit collector) acrylic (with.
CBM Software Meeting 1 CBM Simulation & Analysis Framework Geant3 / Gean4 configuration M. Al-Turany, D. Bertini.
CBM ECAL simulation status Prokudin Mikhail ITEP.
SoLID simulation with GEMC Zhiwen Zhao 2015/03/26.
Towards comparisons between TFluka and TGeant3 ( within CbmRoot Framework) Denis Bertini (IT-GSI) Antonin Maire (IPHC Strasbourg)
Evgeny Kryshen (PNPI) Mikhail Ryzhinskiy (SPbSPU) Vladimir Nikulin (PNPI) Detailed geometry of MUCH detector in cbmroot Outline Motivation Realistic module.
M. Oldenburg GridPP Metadata Workshop — July 4–7 2006, Oxford University 1 Markus Oldenburg GridPP Metadata Workshop July 4–7 2006, Oxford University ALICE.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
1 Giuseppe G. Daquino 26 th January 2005 SoFTware Development for Experiments Group Physics Department, CERN Background radiation studies using Geant4.
STAR Simulation. Status and plans V. Perevoztchikov Brookhaven National Laboratory,USA.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.
AliRoot survey: Reconstruction P.Hristov 11/06/2013.
MONTE CARLO TRANSPORT SIMULATION Panda Computing Week 2012, Torino.
News on Rho PANDA Collaboration Meeting, Bochum K. Götzen, GSI 1.
Geant4 Simulation for KM3 Georgios Stavropoulos NESTOR Institute WP2 meeting, Paris December 2008.
Tracking, Computing & other Stuff. Correlation of detector hits The track segments of inner and outer MDCs are matched on Cluster level The track segments.
Working with HGeant Part 1 by Ilse Koenig:  Overview of HGeant  How to install it  How to run it -Initialisation (geaini file, geometry from Oracle.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
FAIRROOT RECONSTRUCTION Panda Computing Week 2012, Torino.
Background simulations: update and simulations of absorbed dose
Current Status of the Geometry Database for the CBM Experiment
L. Pandola INFN, Gran Sasso National Laboratories
EicRoot: a brief overview
Huagen Xu IKP: T. Randriamalala, J. Ritman and T. Stockmanns
Bonn Test Station data analysis with PandaRoot
User Documents and Examples I
Use of Geant4 in experiment interactive frameworks AliRoot
Presentation transcript:

FAIRROOT SIMULATION Panda Computing Week 2012, Torino

Example Setup (Torino Detector)

Building Blocks  Material definitions  Geometry  Module/Detector class  Can be passive (FairModule) or active (FairDetector)  Event generator  Runtime Database???  Magnetic field (optional)

Definitions  Material  Represent the physical properties (mass, charge, density, radiation length, absorption length) of an element or a mixture  Media  Material with tracking parameters needed for the transport (sensitivity flag, field flag, max field value....)  Several media per material possible  Volume  Building block of the geometry with two properties Shape (Box, Tube...) Medium (needed for transport)  Node  A node represent a volume positioned inside another  There is one top volume which has no position and contain all other nodes

Material Definition carbon air e Name Number of components AZDensity Sensitivity flag Relative weights Number of Cerenkov parameters Maximum field Field flagEPSIL see for more detailshttp://fairroot.gsi.de/?q=node/34

Material Definition TRDgas e-4 0 Name Number of components A Z Density Sensitivity flag Number of atoms Number of Cerenkov parameters Maximum field Field flagEPSIL see for more detailshttp://fairroot.gsi.de/?q=node/34

Material Definition CsI Name Number of components A ZDensity Number of Cerenkov parameters photon momentum in eV absorption length in case of dielectric and absorption probabilities in case of a metal detection efficiency refraction index for a dielectric, rindex[0]=0 for a metal proportion by number of atoms

Material Definition The following parameters are normally not read. The default values are -1 and the real values are automatically calculated by Geant. If you want to set these values by yourself, you must type the keyword AUTONULL in your media file. After this keyword all media must contain these additional 4 parameters at the end.  float madfld  maximum angular deviation TMAXFD due to field  float maxstep  maximum step permitted STEMAX  float maxde  maximum fractional energy loss DEEMAX  float minstep  minimum value for step STMIN

Hands On: Media Definition  Please create a file “media.geo” with the following materials.  Air (  Silicon (  Iron ( 0/ see for more detailshttp://fairroot.gsi.de/?q=node/34

ASCII geometry definition (Hades) The position of the local coordinate system of a volume must NOT be the geometrical center. The positioning of the daughter is independent of the size and shape of the mother. The transformation describes the position of the local coordinate system of the daughter relative to the coordinate system of the mother. pipe_1 cave TUBE carbon // ********************************************* pipe_vac_1 pipe_1 TUBE vacuum // ********************************************* target pipe_vac_1 TUBE gold x y z z/mm..

Geometry description (Hades) BOX, TRAP, TRD1 described by the 8 corners x y z.. TUBE, TUBS, CONE, CONS center of front and back circle, inner and other radius + phi section Advantage: more flexibility, closer to technical drawings and analysis coordinate systems Disadvantage: more points then really needed (more typing) More Info:

Geometry description (Hades) pipe1 //Volume Name cave //Mother Volume PCON //Shape carbon //Material //Shape parameters //translation relative to mother volume //rotation relative to mother volume

Example Setup (Torino Detector)  Two layers of silicon detectors before a simple dipole magnet, and two after the dipole magnet

Hands On: Geometry Definition  Cave: Box filled with Air (20m x 20m x 20m) (cave.geo)  Detector: 4 Boxes of Silicon (detector.geo)  2 before the magnet (0.5m x 0.5m x 400mu) at 1m and 2m from the origin  2 after the magnet (1.5m x 1.5m x 400mu) at 6m and 7m from the origin  Magnet: 4 Boxes of Iron to build a window frame magnet with the following dimensions (magnet.geo)  Inner size: 1m x 1m  Outer size: 1.6m x 1.6m  Length: 1m  More Info:

Creating Modules (passive Materials)  The basic building block of the geometry is a Module which is responsible to construct the geometry from an input ifndef PIPE_H #define PIPE_H #include "FairModule.h" class CbmPipe : public FairModule { public: CbmPipe(const char * name, const char *Title="CBM Pipe"); CbmPipe(); virtual ~CbmPipe(); virtual void ConstructGeometry(); ClassDef(CbmPipe,1) //CBMPIPE }; #endif //PIPE_H

Geometry construction from ASCII void CbmPipe::ConstructGeometry(){ FairGeoLoader *loader=FairGeoLoader::Instance(); // Get the geometry loader FairGeoInterface *GeoInterface =loader->getGeoInterface(); // Get the interface CbmGeoPipe *MGeo=new CbmGeoPipe(); // Create the geometry rule class MGeo->setGeomFile(GetGeometryFileName()); // Connect the ASCII file GeoInterface->addGeoModule(MGeo); // Add the new module to the interface Bool_t rc = GeoInterface->readSet(MGeo); // Read the ASCII file if ( rc ) MGeo->create(loader->getGeoBuilder()); // Create the geometrie TList* volList = MGeo->getListOfVolumes(); ProcessNodes( volList ); // Create the geo-parameters for this detector and save it to the FairBaseParSet container, also calculate the lab transform for these nodes }

Creating a detector  The Detector class is a sub class of the module which implements extra functions which are called from the event loop of the MC to make some actions during simulation  Creating and adding a detector is the same as creating a Module except that one has to inherit from FairDetector, and one has to implement some extra functions.

18 Methods Needed for a detector: void Initialize() // called during framework initialization void ConstructGeometry() // create the geometry Bool_t ProcessHits( CbmVolume *v=0) called for each step in detector from MC void Register() // Registers the produced collections to the I/O Manager TClonesArray* GetCollection(Int_t iColl) const // Get a collections ????obsolete void Reset() // has to be called after each event to reset the containers

19 Methods that can implemented if Needed for a detector void ConstructOpGeometry() // To set the optical properties of media void SetSpecialPhysicsCuts() // Can be used to set different physics cuts, switch on and off certain processes for this detector only // Following methods will be called from the MC Application during simulation (if implimented ) void EndOfEvent() void FinishPrimary() void FinishRun() void BeginPrimary() void PostTrack() void PreTrack() void BeginEvent()

Minimal set of files for new detector  For most files one can use templates  In templates/NewDetector  To be adapted after running rename.sh  CMakeLists.txt  NewDetectorGeo.h NewDetectorGeo.cxx  Use as is  NewDetector.h NewDetector.cxx  NewDetectorPoint.h NewDetectorPoint.cxx  NewDetectorContFact.h NewDetectorContFact.cxx  NewDetectorGeoPar.h NewDetectorGeoPar.cxx  NewDetectorLinkDef.h

Hands On: Use detector template  Add the template directory to the list of external directories and get the changes from the repository  svn propedit svn:externals. (In the main directory) Add the following line templates  svn update  Copy the detector template  cp –r templates/NewDetector torinoDetector  Rename the detector classes, variables, etc  cd ./rename.sh ./rename.sh (without parameter show help message) ./rename.sh PndTorinoDetector PandaRoot Pnd  Change kPndTorinoDetector -> kTPC (only needed to avoid complete recompilation)

Hands on: Use detector template cont.  Create the new detector PndTorinoDetector  Change files according to the messages from the rename script  Try to compile the new subdirectory/detector  Add the new subdirectory in the main CMakeLists.txt  Create a directory in the development branch of the pandaroot repository  You need an SVN account

Hands On: SVN usage  For write access one needs an SVN account  If you have one: Good  If you don’t have one: Please follow the instructions at and send the file to  Browse the repository using the web frontend at  Browse the repository from the command line  svn ls  Get help about SVN on the command line  svn help

Hands On: SVN usage cont.  Create a personal directory in the development branch of pandaroot  svn mkdir –parents / /Torino/  Import your new directory into the repository  svn import / /Torino/version1 –m”Initial version.”  Browse the new directory either on the command line or with the web frontend

25 Running a Simulation A simulation session is controlled by a root macro After creating the shared libraries needed for simulation they have to be loaded into a root session which will steer the simulation

26 Simulation Macro: Define Variables // Use non default gconfig and geometry directories TString dir = getenv("VMCWORKDIR"); TString tutdir = dir + "/macro/torinoDetector"; TString tut_geomdir = tutdir + "/geometry"; gSystem->Setenv("GEOMPATH",tut_geomdir.Data()); TString tut_configdir = tutdir + "/gconfig"; gSystem->Setenv("CONFIG_DIR",tut_configdir.Data()); TString rootLogonFile = tut_configdir + "/rootlogon.C";

27 Simulation Macro – loading Libs // Load basic libraries gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); basiclibs(); // This will load thr ROOT and VMC libraries // Load CbmRoot libraries gSystem->Load("libFairTools"); gSystem->Load("libGeoBase"); gSystem->Load("libParBase"); gSystem->Load("libBase"); gSystem->Load("libCbmBase"); ……. // Load basic libraries (Panda) gROOT->LoadMacro(rootLogonFile); rootlogon(); gSystem->Load("libPndTorinoDetector.so");

28 Simulation Macro // Create a simulation run FairRunSim* fRun = new FairRunSim(); // Set MC engine fRun->SetName("TGeant3"); // Define an output file fRun->SetOutputFile("data/testrun.root"); // Set media file fRun->SetMaterials("media.geo”)

Defining a magnetic field // Magnetic field // Constant Field PndConstField *fMagField = new PndConstField(); fMagField->SetField(0., 10.,0. ); // values are in kG fMagField->SetFieldRegion(-50, 50,-50, 50, 350, 450);//values are in cm(xmin,xmax,ymin,ymax,zmin,zmax) fRun->SetField(fMagField); //

30 Simulation Macro- Create Modules FairModule *Cave= new PndCave("CAVE"); // create the top node Cave->SetGeometryFileName("cave.geo"); // select geometry file fRun->AddModule(Cave); // add it to the Run FairModule *Magnet= new PndMagnet("MAGNET"); // passive material only Magnet->SetGeometryFileName("magnet.geo"); fRun->AddModule(Magnet);

31 Simulation Macro- Create Detectors FairDetector *Torino= new PndTorinoDetector("TORINO", kTRUE); Torino->SetGeometryFileName("torino.geo"); fRun->AddModule(Torino);  kTRUE : Active detector  kFALSE: The material will be taken into account during transport, but the process hit method of this detector will not be called

32 Simulation Macro-Event Generators FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); fRun->SetGenerator(primGen); // Box Generator FairBoxGenerator* boxGen = new FairBoxGenerator(2212, 3); // 2212 = proton; 3 = multipl. boxGen->SetPRange(2., 2.); // GeV/c //setPRange vs setPtRange boxGen->SetPhiRange(0, 360); // Azimuth angle range [degree] boxGen->SetThetaRange(3, 10); // Polar angle in lab system range [degree] boxGen->SetCosTheta(); //uniform generation on all the solid angle(default) // boxGen->SetXYZ(0., 0.37, 0.); // origin of the vertex primGen->AddGenerator(boxGen); // Add the particle generator to the primary generator // One can add many different generators

33 Output Files  The Simulation has by default two outputs:  Data File(s)  Tree for the events  Folder structure used to create the Tree  Parameter File  Field map description (optional)  Some geometrical stuff (optional)  User defined stuff  Geometry file (optional)

Parameter file FairRuntimeDb *rtdb=fRun->GetRuntimeDb(); Bool_t kParameterMerged=kTRUE; FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged); output->open("data/testparams.root"); rtdb->setOutput(output); rtdb->saveOutput(); rtdb->print();

35 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);//Run the Simulation  fRun->CreateGeometryFile(”geofile.root"); // Create a separate file with the TGeoManager

36 Output Files: Root Browser Folder Branchlist Data

37 Geometry in Root Browser

38 Tree Viewer

Hands on: Run a simulation  Create a macro which transports some events through the PndTorinoDetector experiment  Check if the geometry is what you expect  Check the distribution of the stored MC points

40 Magnetic Field The Framework deliver a base class which can handle the magnetic field in the simulation or analysis (reconstruction) The User has to derive from this class and implement Init() : Intialization. E.g. read in the field map. If needed, to be implemented in the concrete class. GetFieldValue(const Double_t point[3], Double_t* bField); Get magnetic field value at a certain point. point Coordinates [cm] bField (return) Field components [kG]

Cbm field implementations  Constant field  PndFieldConst  Fieldmaps  PndMultiField  ????

Physics settings  Default settings for all media can be found in the subdirectory gconfig  Normally it is not necessary to change these settings  Geant3  g3Config.C and SetCuts.C  Geant4  g4Config.C and SetCuts.C  One has do define physics lists. There are no default settings which cover 90% of all cases

Special physics settings  If you need special settings for a material dedicated to your detector, don’t change the default settings  Each Detector class can implement a function SetSpecialCuts void CbmTrd::SetSpecialPhysicsCuts(){ FairRun* fRun = FairRun::Instance(); if (strcmp(fRun->GetName(),"TGeant3") == 0) { // Get Material Id and some material properties from the geomanager Int_t mat = gGeoManager->GetMaterialIndex("TRDgas"); // search by name TGeoMaterial *trdgas = gGeoManager->GetMaterial(mat); // Get the material properties for material with id+1 // (of-by-one problem) from the Virtual Monte Carlo Int_t matIdVMC = mat+1; // Set new properties, physics cuts etc. for the TRDgas gMC->Gstpar(matIdVMC,"STRA",1.0); }

HowTo use example implementation  Full running implementation of the example detector  /version1 /version1  The torinoDetector directory contain the source code  The macro directory contain the macros, geometries, etc.  Use my version of the torinoDetector source code  svn switch etector torinoDetector etector  Use my version of the macros  cd macro  svn propedit svn:externals.  Add there torinoDetector sion1/macro/torinoDetector

Useful SVN command  Get help  svn help  Get detailed help about a specific command  svn help  Get info about the status of your local working copy (WC). Which files have been changed, deleted, …  Differences between the state of your WC and the state of the last svn revision you checked out svn stat  Differences between the state of your WC and the state of the head revision on the central server svn stat –u

Useful SVN commands (cont.)  See differences between different versions of the code  svn diff  Create a directory  svn mkdir  Move/Rename a file or directory  svn mv  Put files and directories under version control. They will be added in next commit.  svn add

Useful SVN command (cont.)  Send changes from your working copy to the repository  svn commit -m”Useful comment”  Bring changes from the repository into the working copy  svn update