11.05.2004CBM Software week- M. Al-Turany 1 CBM Simulation & Analysis Framework Simulation Part M. Al-Turany, D. Bertini.

Slides:



Advertisements
Similar presentations
CBM Simulation & Analysis Framework Cbmroot
Advertisements

Status of software development for MPD Oleg Rogachevsky for MPD collaboration Round Table discussion III 5 November 2008 Dubna.
Virtual Monte Carlo I. Hrivnacova, IPN Orsay
O. Stézowski IPN Lyon AGATA Week September 2003 Legnaro Data Analysis – Team #3 ROOT as a framework for AGATA.
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.
FULL CHAIN SIMULATION of CMS DETECTOR Ijaz Ahmed National centre for Physics, Islamabad.
CBM Software Meeting 1 CBM Simulation & Analysis Framework M. Al-Turany, D. Bertini.
CBM Simulation&Analysis Framework Cbmroot Mohammad Al-Turany & Denis Bertini.
Introduction to Hall-D Software February 27, 2009 David Lawrence - JLab.
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.
CBM Collaboration Meeting 1 Simulation Status V. Friese.
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.
IFluka : a C++ interface between Fairroot and Fluka Motivations Design The CBM case: –Geometry implementation –Settings for radiation studies –Global diagnosis.
I3PropagatorMMC module Dmitry Chirkin, LBNL IceCube meeting, Uppsala, 2004.
Implementing a dual readout calorimeter in SLIC and testing Geant4 Physics Hans Wenzel Fermilab Friday, 2 nd October 2009 ALCPG 2009.
As of 28 Juni 2005Getting Starged with GEM - Shuei Yamada 1 Getting Started with GEM Shuei YAMADA ICEPP, University of Tokyo What is GEM? Before you start.
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.
SoLID simulation Zhiwen Zhao Uva SoLID Collaboration Meeting 2011/6/2 1.
ALICE Simulation Framework Ivana Hrivnacova 1 and Andreas Morsch 2 1 NPI ASCR, Rez, Czech Republic 2 CERN, Geneva, Switzerland For the ALICE Collaboration.
BeamCal Simulations with Mokka Madalina Stanescu-Bellu West University Timisoara, Romania Desy, Zeuthen 30 Jun 2009 – FCAL Meeting.
CBM Software Workshop for Future Challenges in Tracking and Trigger Concepts, GSI, 9 June 2010 Volker Friese.
LAV Software Status Emanuele Leonardi – Tommaso Spadaro Photon Veto WG meeting – 2015/03/24.
Experience With CBM Muon Simulation Partha Pratim Bhaduri.
G4MICE Status and Plans 1M.Ellis - CM24 - RAL - 31st May 2009  Firstly, a correction to the agenda:  I failed to spot a mistake in the agenda that I.
FLUKA dose and fluence simulations for CBM experiment I.Kadenko, O.Bezshyyko, V.Pluyko, V.Shevchenko National Taras Shevchenko University of Kiev.
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
Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.
1 Software tools for GLC studies Akiya Miyamoto KEK 20 April, 2004 Representing ACFA-Sim Group
CBM Simulation&Analysis Framework Cbmroot Mohammad Al-Turany Denis Bertini Ilse König.
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.
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.
RPC Design Studies Gabriel Stoicea, NIPNE-HH, Bucharest CBM Software Week GSI-Darmstadt May 10, 2004.
ROOT Data bases access1 LCG Data base deployment workshop 11 October Ren é Brun CERN.
Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, May 2005.
ECAL software development Yuri Kharlov IHEP Protvino.
March, PROOF - Parallel ROOT Facility Maarten Ballintijn Bring the KB to the PB not the PB to the KB.
03/06/08Gustavo Conesa PWG4 1/14 Particle identification and Hadron/Jet correlations analysis framework Description, Status, HOW TO use and.
StEvent I/O Model And Writing a Maker Or How to Add a New Detector Akio Ogawa BNL 2003 Nov Dubna.
STAR Simulation. Status and plans V. Perevoztchikov Brookhaven National Laboratory,USA.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
AliRoot Classes for access to Calibration and Alignment objects Magali Gruwé CERN PH/AIP ALICE Offline Meeting February 17 th 2005 To be presented to detector.
1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.
Axel Naumann, DØ University of Nijmegen, The Netherlands 6/20/2001 Dutch Morning Meeting 1 From n-Tuples to b-Tags ?
FAIRROOT SIMULATION Panda Computing Week 2012, Torino.
Status of PSD simulation in Shine Oleg Petukhov Institute for Nuclear Research, Moscow NA61 Analysis/Software/Calibration meeting , Warsaw.
MONTE CARLO TRANSPORT SIMULATION Panda Computing Week 2012, Torino.
Joe Foster 1 This talk extends the one I gave in 2006 called Visualizing Data with ROOT. –
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.
V4-18-Release P. Hristov 21/06/2010.
Simulation Tools for Test Beam
Current Status of the Geometry Database for the CBM Experiment
L. Pandola INFN, Gran Sasso National Laboratories
A Virtual Montecarlo (VMC) Application for AMS-01
EicRoot: a brief overview
Huagen Xu IKP: T. Randriamalala, J. Ritman and T. Stockmanns
Software development status in Rome
FAIR Simulation&Analysis Framework FairRoot
Bonn Test Station data analysis with PandaRoot
SoLID simulation with GEMC
Use of Geant4 in experiment interactive frameworks AliRoot
Templates CMSC 202, Version 4/02.
Presentation transcript:

CBM Software week- M. Al-Turany 1 CBM Simulation & Analysis Framework Simulation Part M. Al-Turany, D. Bertini

CBM Software week- M. Al-Turany 2 Outline Software distribution Adding Modules and Detectors –What to implement ? –Creating the library –Creating the simulation Macro –The output file structure

CBM Software week- M. Al-Turany 3 Software distribution The CBM software is distributed via anonymous CVS CVS login cvs -d login password: Please type nothing just press enter CVS Checkout cvs -d checkout cbm_vmc CVS Update cvs -d update

CBM Software week- M. Al-Turany 4 Building the software make: –in the cbm_vmc directory will build everything –in sub-directory will build only the corresponding library make analysis This will build only the Geant3 part of the software for the simulation and the analysis part which is independent of the MC engine. After a CVS update it is recommoneded to use make clean first and then make.

CBM Software week- M. Al-Turany 5 ROOT Run Manager Virtual MC G3G4FLUKA Pluto Ion Generator Particle Generator ASCII PIPE Target STS TRD Cave TOF Magnet RICH Generators Mixed Generator Urqmd Magnetic Field Module Detector Geometry Manager IO Manager Tasks List Delta Tracking Field Map CBM Analysis and Simulation Framework digitizers

CBM Software week- M. Al-Turany 6 What is needed to add a detector or a Module ? Material definitions Geometry definitions Create a detector (or Module) class Create the library Create a ROOT macro Run the Simulation macro

CBM Software week- M. Al-Turany 7 Material Definition carbondioxide COMPONENTS e-3 2 elC 0.27 elO 0.73 #fi TRDgas COMPONENTS e-3 2 elXe 0.85 carbondioxide 0.15 Material name Composition Density Single element Fractional mass Mixture of Composite

CBM Software week- M. Al-Turany 8 Geometry definition AlPlate1S3R 0 world aluminium BOX #fi Volume name Sensitivity flag (0,1) Mother volume Transformations Material Shape name Shape parameters

CBM Software week- M. Al-Turany 9 Creating a Module class – definition #ifndef MABGNET_H #define MABGNET_H #include "CBMModule.h" class CBMMagnet : public CBMModule { public: CBMMagnet(const char * name, const char *Title="CBM Magnet"); CBMMagnet(); virtual ~CBMMagnet(); ClassDef(CBMMagnet,1) //CBMMagnet }; #endif //MABGNET_H

CBM Software week- M. Al-Turany 10 Creating a Module class – Implementation #include "CBMMagnet.h" CBMMagnet::CBMMagnet(const char * name, const char *Title) :CBMModule(name,Title) { } CBMMagnet::~CBMMagnet(){} CBMMagnet::CBMMagnet(){} ClassImp(CBMMagnet)

CBM Software week- M. Al-Turany 11 Creating a detector class – definition (1) Class Definition for MyDet Class #ifndef MYDET_H #define MYDET_H #include "CBMDetector.h" class CBMVolume; class CBMMyDet : public CBMDetector { CBMMyDet(); CBMMyDet(const char * name, Bool_t Active); virtual ~CBMMyDet();

CBM Software week- M. Al-Turany 12 Creating a detector class – definition (2) virtualConstructGeometry(); virtual void Initialize(); virtual void Register(); virtual Bool_t ProcessHits(CBMVolume *v=0); virtual void EndOfEvent(); virtual void Print() const; virtual void Reset(); ClassDef(CBMMyDet,1) //CBMMyDet private: TClonesArray *MyDetPoint; }; // #endif //RICH_H

CBM Software week- M. Al-Turany 13 Detector Constructor CBMTracker::CBMTracker(const char * name, Bool_t Active) : CBMDetector(name,Active), { fTrackerCollection = new TClonesArray("CBMSTSPoint"); }

CBM Software week- M. Al-Turany 14 ConstructGeometry() If the CBM standard ASCII format for detector or module description is used, you do not need to implements this function If you use another format or need additional information to be added, then you have to overwrite this function, e.g. TRD and RICH

CBM Software week- M. Al-Turany 15 ConstructGeometry() - Example 1 void CBMCave::ConstructGeometry() { TGeoMCGeometry *vmcGeo=(TGeoMCGeometry *) TGeoMCGeometry::Instance(); if(vmcGeo==0) vmcGeo = new TGeoMCGeometry("CBM Geometry", "cbm"); world[0] = 2000; world[1] = 2000; world[2] = 2000; TString Name="air"; TGeoMedium * air = 0; Int_t nair = 0 ; if ( (air = gGeoManager->GetMedium(Name.Data())) ) nair = air->GetId(); TString name("world"); Int_t VolId= vmcGeo->Gsvolu(name.Data(), "BOX", nair, world, 3); CBMVolume *aVol=new CBMVolume(name,0,1); CBMDetector::vList->addVolume( aVol ); TGeoVolume *vol=gGeoManager->GetVolume(VolId); gGeoManager->SetTopVolume(vol); }

CBM Software week- M. Al-Turany 16 ConstructGeometry() - Example 2 void CBMRich::ConstructGeometry() { CBMModule::ConstructGeometry(); // optical properties TGeoMedium * richGas = gGeoManager->GetMedium("RICHgas") ; const Int_t NUMENTRIES = 2; Double_t ppckov[NUMENTRIES] = { 4.1E-10, 2.07E-9 }; //rich gas Double_t rindexGas[NUMENTRIES] = { , }; //N2 Double_t absorptionGas[NUMENTRIES] = { 1.0e+03, 1.0e+03 }; Double_t efficiencyGas[NUMENTRIES] = {1.,1.}; gMC->SetCerenkov (richGas->GetId(),NUMENTRIES,ppckov, absorptionGas,efficiencyGas,rindexGas); }

CBM Software week- M. Al-Turany 17 Initialize() If you do not need any special initialization of your detector, then do not implement this method. Otherwise use: MyDet::Initialize() { CBMDetector::Initialize() // Has to be called.....Your Code }

CBM Software week- M. Al-Turany 18 Register() This method is called internally from the initialized function void CBMTracker::Register() { // Registers the hits collection in Root manager. //This will create a branch STSPoint in the output tree CBMRootManager::Instance()->Register("STSPoint","STS", fTrackerCollection); }

CBM Software week- M. Al-Turany 19 AddHit() This method is called usually from the ProcessHit() to add a new object to the container (TClonesArray) CBMSTSPoint* CBMTracker::AddHit() { // Creates a new hit in the TClonesArray. TClonesArray& ref = *fTrackerCollection; Int_t size = ref.GetEntriesFast(); return new(ref[size]) CBMSTSPoint(); }

CBM Software week- M. Al-Turany 20 ProcessHits(CBMVolume *v) (1) This Method is call from the Stepping in each event Bool_t CBMTracker::ProcessHits(CBMVolume *v) { // Creates hits (in stepping). Double_t edep = gMC->Edep(); if (edep==0.0) return kFALSE; // cut on energy if (gMC->Etot() < 0.05 ) return kFALSE; CBMSTSPoint* mcPoint = AddHit(); mcPoint->SetTrackID (gMC->GetStack()->GetCurrentTrackNumber()); // Chamber no mcPoint->SetDetectorID(v->getMCid());

CBM Software week- M. Al-Turany 21 ProcessHits(CBMVolume *v) (2) mcPoint->SetELoss (edep); // Energy deposit mcPoint->SetEtot(gMC->Etot()); // total Energy mcPoint->SetTime( gMC->TrackTime()); mcPoint->SetLength(gMC->TrackLength() ); TLorentzVector pos; // Position gMC->TrackPosition(pos); mcPoint->SetPos (TVector3(pos.X(), pos.Y(), pos.Z())); TLorentzVector mom; // Momentum gMC->TrackMomentum(mom); mcPoint->SetMom (TVector3(mom.X(), mom.Y(), mom.Z())); return kTRUE; }

CBM Software week- M. Al-Turany 22 ProcessHits(CBMVolume *v) Bool_t CBMRich::ProcessHits(CBMVolume *v) { TParticle *part = gMC->GetStack()->GetCurrentTrack(); Int_t gcode = part->GetPdgCode(); if (gcode == ){ //check if a Cerenkov photon return kTRUE; }else{ return kFALSE; }

CBM Software week- M. Al-Turany 23 EndOfEvent() This method is called at the end of processing an event void CBMTracker::EndOfEvent() { // Prints hits collection (if verbose) if (fVerboseLevel>0) Print(); Reset(); }

CBM Software week- M. Al-Turany 24 Reset() This method is called after processing an event void CBMTracker::Reset() { // Reset hits collection fTrackerCollection->Clear(); }

CBM Software week- M. Al-Turany 25 Additional Methods in the CBMDetector These Methods can be overloaded in your detector: virtual void BeginEvent(); virtual void BeginPrimary(); virtual void PreTrack(); virtual void PostTrack(); virtual void FinishPrimary();

CBM Software week- M. Al-Turany 26 Creating the Library Create a directory MyDet In this directory create two other directories src and include download the Makefile from the webpage and copy it to MyDet, put the name of your package (MyDet) in the Makefile ######### geant4vmc Makefile ####### PACKAGE = The name of your package Calling Make will create a libMyDet.so in cbm_vmc/lib directory

CBM Software week- M. Al-Turany 27 Simulation 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

CBM Software week- M. Al-Turany 28 Simulation Macro – loading Libs // Load basic ROOT libraries gROOT->LoadMacro("../basiclibs.C"); basiclibs(); // Load CBM modular libraries gSystem->Load("libCbm"); gSystem->Load("libPassive"); gSystem->Load("libGen"); gSystem->Load("libSTS"); gSystem->Load("libTrd"); gSystem->Load("libTof"); gSystem->Load("libRich"); gSystem->Load("libITrack");

CBM Software week- M. Al-Turany 29 Simulation Macro //create the Run Manager Class CBMRun *fRun = new CBMRun(); // set the MC version used fRun->SetName("TGeant4"); //for G3 use "TGeant3" // chose an output file name fRun->SetOutputFile("test.root");

CBM Software week- M. Al-Turany 30 Simulation Macro- Create Modules CBMModule *Cave= new CBMCave("WORLD"); 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);

CBM Software week- M. Al-Turany 31 Simulation Macro- Create Detectors CBMDetector *STS= new CBMTracker("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);

CBM Software week- M. Al-Turany 32 Simulation Macro-Event Generators CBMUrqmdGenerator *fGen1= new CBMUrqmdGenerator("00-03fm.100ev.f14"); CBMPlutoGenerator *fGen2= new CBMPlutoGenerator("jpsi.root"); CBMParticleGenerator *fGen3= new CBMParticleGenerator(); //use: SetVertex, SetMomentum,... etc, to set the parameters of this Generator //name, z, a, q, e(GeV), m CBMNewIon *fIon= new CBMNewIon("My_Au", 79, 197, 79, 25., ); fRun>AddNewIon(fIon); CBMIonGenerator *fGen4= new CBMIonGenerator(fIon); //use: SetVertex, SetMomentum,... etc, to set the parameters of this Generator CBMAsciiGenerator fGen5= new CBMAsciiGenerator(filename.txt);

CBM Software week- M. Al-Turany 33 Event Generators-Mixing generators CBMMixedGen *fGen= new CBMMixedGen("Mix"); fGen->AddGenerator(fGen1); fGen->AddGenerator(fGen2); fGen->AddGenerator(fGen3); fGen->AddGenerator(fGen4); fGen->AddGenerator(fGen5); fRun->SetGenerator(fGen);

CBM Software week- M. Al-Turany 34 Simulation Macro-Magnetic Field // setting a field map CBMFieldMap *fMagField= new CBMFieldMap("FIELD.v03b.map"); // setting a constant field CBMConstField *fMagField=new CBMConstField(); fMagField->SetFieldXYZ(0, 10,0 ); // values are in kG // MinX=-74, MinY=-39,MinZ=-22,MaxX=74, MaxY=39,MaxZ=160 ); fMagField->SetFieldRegions(-74, -39,-22, 74, 39, 160 ); // values are in cm fRun->SetField(fMagField);

CBM Software week- M. Al-Turany 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

CBM Software week- M. Al-Turany 36 Reading Output files The Simulation output files are ROOT files, the data in the TTree can be accessed in plain ROOT (using TBrowser or Tree Viewer). If you write a macro to read the file you have to load the CBM libraries. if you want to visualize the geometry, you have to load the ROOT TGeo library. i.e. gSystem->Load("libGeom") is needed to be able to browse the geometry

CBM Software week- M. Al-Turany 37 Output File CBMMCApplication Geometry Folder Structure Output Tree

CBM Software week- M. Al-Turany 38 The CBM VMC Application To get the Application from Macro : –Tfile f("test.root"); –CBMMCApplication *fcbm=f.Get("CBM"); To get the Application in compiled code: –CBMMCApplication *fcbm=CBMMCApplication::Instance();

CBM Software week- M. Al-Turany 39 The CBM VMC Application fcbm->GetDetector(const char *DetName); –Returns a pointer to the detector "DetName" fcbm-> CBMMagField* GetField() –Returns the magnetic field used for this simulation fcbm-> CBMGenerator* GetGenerator(); –Returns the event generator used for this simulation

CBM Software week- M. Al-Turany 40 The Magnetic Field To get the Magnetic field: CBMMagField * fMag = fcbm-> CBMMagField* GetField(); Now to reconstruct the field in Memory: –if you a const Field was used in simulation, this will be done automatically. –if a field map was used: CBMFieldMap *fMap = dynamic_cast (fMag) fMap->Init() will reconstruct the field in moemory In both cases you can now use : –fcbm->GetFieldValue( const Double_t Point[3], Double_t *Bfield[3] ) This will get the field value Bfield[3] at Point[3]

CBM Software week- M. Al-Turany 41 The Output Tree Detector Braches Stack

CBM Software week- M. Al-Turany 42 Reading from the Tree To access a branch from the Tree: –Get a pointer to the ROOT Manager: CBMRootManager *fManager= CBMRootManager::Instance(); –Let the ROOT manager activate your branch: fManager->ActivateBranch(const char *BrName) ; BrName : The branch name e.g: TClonesArray * STSpts= (TClonesArray *) fManger->ActivateBranch("STSPoint");