1 / 25

CBM Simulation & Analysis Framework Analysis Tasks

CBM Simulation & Analysis Framework Analysis Tasks. M. Al-Turany, D. Bertini. CBM Analysis and Simulation Framework. Urqmd. G3. G4. FLUKA. Pluto. Magnet. ROOT. Ion Generator. Geometry Manager. Generators. Target. Virtual MC. Particle Generator. PIPE. ASCII. Cave.

azura
Download Presentation

CBM Simulation & Analysis Framework Analysis Tasks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CBM Simulation & Analysis FrameworkAnalysis Tasks M. Al-Turany, D. Bertini CBM Software week

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

  3. 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 Reading Output files CBM Software week

  4. Output File CBMMCApplication Geometry Folder Structure Output Tree CBM Software week

  5. 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(); The CBM VMC Application CBM Software week

  6. 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 The CBM VMC Application CBM Software week

  7. 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< CBMFieldMap *> (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] The Magnetic Field CBM Software week

  8. The Output Tree Detector Braches Stack CBM Software week

  9. 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"); Reading from the Tree CBM Software week

  10. 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); CBMTasks CBM Software week

  11. 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->Add(Task2) • Task1->Add(Task3) • Task2->Add(Task4) • Task2->Add(Task5) • Task3->Add(Task6) CBM Software week

  12. Tasks CBM Software week

  13. class CBMTask : public TTask { public: /** Initialization of the task. */ virtual void Init(); /** Re-initialization of the task */ virtual void ReInit(); // *MENU* /** Recursive initialization of all subtasks */ virtual void InitTasks(); // *MENU* virtual void Finish(); /** Recursive for all subtasks */ virtual void FinishTasks(); // *MENU* CBMTask CBM Software week

  14. 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 } Creating a Task CBM Software week

  15. void CBMITrack::Init() { // Get a pointer to the ROOT Manager( data store ) CBMRootManager *fManager =CBMRootManager::Instance(); // Get the relevant data for the Task // activate in IO the corresponding TTree branch fListSTSpts=(TClonesArray *)fManager->ActivateBranch("STSPoint"); //Create a new branch in the output file for the results fHitCollection = new TClonesArray("CBMSTSDoubleHit"); fManager->Register("STSDoubleHit","STS", fHitCollection); } Analysis Task- Init example CBM Software week

  16. void CBMITrack::Exec(Option_t * option) { CBMSTSDoublePoint *pt=NULL; CBMSTSDoubleHit *hit=NULL; for (int j=0; j < fListSTSpts->GetEntries(); j++ ) { pt = (CBMSTSDoublePoint*) fListSTSpts->At(j); if (pt && ( pt->GetDetectorID(0) == pt->GetDetectorID(1)) ) { hit =AddHit(); hit->SetDetectorID( pt->GetDetectorID(1)); } else continue; hit->SetPos_in( pt->GetPos_in() ); hit->SetPos_out( pt->GetPos_out() ); } } Analysis Task- Exec example CBM Software week

  17. CBMSTSDoubleHit * CBMITrack::AddHit() { // Creates a new hit in the TClonesArray. TClonesArray& ref = *fTrackerCollection; Int_t size = ref.GetEntriesFast(); return new(ref[size]) CBMSTSDoubleHit(); } AddHit() CBM Software week

  18. void Task1::Init() { // Get a pointer to the ROOT Manager( data store ) CBMRootManager *fManager =CBMRootManager::Instance(); // Get the relevant data for the Task // activate in IO the corresponding TTree branch fListSTSpts=(TClonesArray *)fManager->ActivateBranch("STSPoint"); // Get the data generated from a previous Task fHitCollection=(TClonesArray *) fManager->GetRegisteredObject("STSDoubleHit"); } Analysis Task- Init example CBM Software week

  19. Create a directory MyTask In this directory create two other directories src and include download the Makefile from the webpage and copy it to MyTask, put the name of your package (MyTask) in the Makefile http://www-linux.gsi.de/~cbmsim/cbm_vmc_doc/Makefile_example.htm ######### Makefile #######PACKAGE =  The name of your package Calling Make will create a libMyTask.so in cbm_vmc/lib directory Creating the Library CBM Software week

  20. Load the Libraries Create the Run Manager Choose input and output files Create and add your analysis Tasks Initialize and run the analysis Analysis Macro CBM Software week

  21. gROOT->LoadMacro("../basiclibs.C"); basiclibs(); gSystem->Load("libCbm"); gSystem->Load ("libSTS"); gSystem->Load("libMyTask"); Analysis Macro – Load libraries CBM Software week

  22. CBMRun *fRun= new CBMRun(); fRun->SetInputFile(“STS_AuAu25Gev_Urqmd.root"); fRun->SetOutputFile(“trackOutput.root"); Create the Run Manager CBM Software week

  23. CBMITrack *tr= new CBMITrack("Tracking Algorithm"); fRun->AddTask(tr); Create and add the Task CBM Software week

  24. fRun->Init(); fRun->Run(); fRun->Run(10, 100); Init and Run This will run over all events in the input file CBM Software week

  25. { gROOT->LoadMacro("../basiclibs.C"); basiclibs(); gSystem->Load("libCbm"); gSystem->Load ("libSTS"); gSystem->Load("libITrack"); CBMRun *fRun= new CBMRun(); fRun->SetInputFile(“STS_AuAu25Gev_Urqmd.root"); fRun->SetOutputFile(“trackOutput.root"); CBMITrack *tr= new CBMITrack("Tracking Algorithm"); fRun->AddTask(tr); fRun->Init(); fRun->Run(); } Analysis Macro CBM Software week

More Related