Date post: | 30-Dec-2015 |
Category: |
Documents |
Upload: | juliet-gordon |
View: | 216 times |
Download: | 3 times |
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
ROME
Root based Object oriented Midas Extension
Presented by Matthias Schneebeli
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Index
• Introduction to the ROME Environment
o Objects inside ROME Projects
o ROMEBuilder
o Data Stream
o Installation
• Sample Application within the ROME
Environment
o Project Sample
o MEG Experiment
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Introduction to ROMEIntroduction to ROME
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Features• Tool for Event based Data Analysis
• Fully Object Oriented
• Root based
• Full connection to the Midas Environment
• Online and Offline
• Based on Tasks and Folders for a good Data and Program Structure
• Experiment independent Base Classes
• Experiment dependent Classes are generated out of simple XML-Files
• The Users write only experiment specific code (physics)
• Administrative code is implemented in the generated code
• Self Documenting Code
• Self Linking Project
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Objects
Folders
•Objects, where data is stored in
•Stores the data of one detector (or sub detector) component
•Hierarchically arranged
•Data inside of Folders is structured
Tasks
•Tasks are objects, which provides actions
•They make calculations
•Store and read data in folders
•Fill trees and histograms
•Hierarchically arranged.
•Task also own histograms
Trees
•Data Objects : only written, never read
•Used to write data on files
Histograms
•Graphical Data Objects : only written
•Belong to one Task
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Interconnections
Folders
TasksTasksTasksFill
Read
TreesTreesTreesRead
Flag
HistogramsHistogramsHistograms
HistogramsHistogramsHistograms
HistogramsHistogramsHistograms
Fill
Fill
Disk (Output)Write (ROOT)
Disk (Input)
Read (any Format)
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
The ROME Environment• 5 experiment independent ‘ROME’-Classes
o Base classes for the generated, experiment dependent classes.
• ROMEBuilder
o Builds all experiment dependent classes out of simple XML Files
o XML files describe Tasks, Folders, Trees, Histos and the Database.
o Links the generated project
o Documents the generated project
ROME classesROME classesROME classes
XML File
ROME classesROME classesExp. classes
ROMEBuilder Executable
Documentation
Project
ROME Environment
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
ROME classesROME classesTasks
Classes in the Generated ProjectThe generated project consists of
• Task classes
o Implement 5 user methods : Init(), BeginOfRun(), Event(), EndOfRun(), Terminate().
• Folder classes
o Define the data structure of the folders.
• Analyzer class
o Main class. Contains the folders, the trees and the data base.
• EventLoop class
o Implements the event loop. The event loop calls the user methods of the tasks.
ROME classesROME classesFolders
EventLoop
Analyzer• Folder Handles• Trees• Data base
• fAnalyzer
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
XML Project Definition File
<Experiment Shortcut><Author Name=“Author”/><Programname Name=“Program Name”/><Folder>
Folder definitions…</Folder><Task>
Task definitions…</Task><Trees>
Tree definitions…</Trees>
</Experiment Shortcut>
Folder Classes
Analyzer and EventLoop Class
Task Classes
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Folders<Experiment Shortcut>
<Folder><SubFolder FolderName=“Folder Name" FolderTitle="Folder Title“ Array=“yes/[no]” DataBase=“yes/[no]”>
<Author Name=“Author”/><Version Number=“Version Number”/><ClassDescription Text=“Class Description”/><Fields>
<Field Name 1 Type=“Variable Type 1” Initialisation=“Initial Value 1” Comment=“Comment 1”/>
</Fields></SubFolder>
</Folder></Experiment Shortcut>
XML File
[Experiment Shortcut][Folder Name]* Get[Folder Name]At(int index)TClonesArray* Get[Folder Name]Objects()Void Set[Folder Name]Object(int index,[Variable Type 1] [Field 1],…)
[Experiment Shortcut][Folder Name]* Get[Folder Name]Object()Void Set[Folder Name]Object([Variable Type 1] [Field 1],…)
Code
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Tasks<Experiment Shortcut>
<Task><SubTask Name=“Task Name”>
<Histos><Histo Name Type=“Variable Type” ArraySize=“Array Size” Title=“Title” FolderName=”Histo Folder Name” FolderTitle=”Histo Folder Title” NumberOfBinsX=“# of X bins” XMin=“X min” XMax=“X max”/>
</Histos></SubTask>
</Task></Experiment Shortcut>
void [Experiment Shortcut]T[Task Name]::Init() { }void [Experiment Shortcut]T[Task Name]::BeginOfRun() { }void [Experiment Shortcut]T[Task Name]::Event() { }void [Experiment Shortcut]T[Task Name]::EndOfRun() { }void [Experiment Shortcut]T[Task Name]::Terminate() { }
Fill[Histo Name](double value,double weight)Get[Histo Name]Handle()
Fill[Histo Name]At(int index,double value,double weight)Get[Histo Name]HandleAt(int index)
Histogram Arrays
Single Histograms
XML File
Code
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Trees
<Experiment Shortcut><Trees>
<Tree Name=“Tree Name” Title=“Title”><Branch Name=“Branch Name” Folder=“Folder”>
</Tree></Trees>
</Experiment Shortcut>
Bool_t is[Tree Name]FillEvent()void Set[Tree Name]FillEvent(true/false)
XML File
Code
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Data base
• XML Data base
• Run table contains the history of the experiment
• XML Files contain one data base entry of one folder
<RunTable><Entry TimeStamp=“Time” RunNumber=“Run” RunDescription=“Desc.”
[Folder Name 1]File=“File 1” [Folder Name 2]File=“File 2” …><…>
</RunTable>
Run Table
<[Folder Name]s TimeStamp=“Time” RunNumber=“Run” RunDescription=“Desc.”><[Folder Name] Number=“#”>
<Field 1>Value 1</Field 1><…>
</[Folder Name]><…>
</[Folder Name]s>
Data Base
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
XML Editors
• XMLSpy- Table Format- Commercial Software (50 Euro)- Only for Windows
• EditiX- Nice Tree Format- Commercial Software (30 Euro)- Windows, Linux, Mac
• ROME works with any Editor
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Read and Write Data
• Input Data
o Root files
o Midas files
o Online buffer
o Data base
• Output Data
o Root files
o Database
Read by the Framework. Data accessed via :(void*) fAnalyzer->GetMidasEvent();
Read and filled to the Folder by the Framework
Read and filled to the Folder by the Framework
Written by the Framework, can be flagged
Written with : fAnalyzer->Write[Folder]DataBase(this);
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Installation• Installation of Cygwin (only Windows)• Installation of ROOT• Installation of LIBXML2 (only Linux)• Installation of MIDAS (only online,
Linux)
[~]$ setenv ROMESYS ~/ROME[~]$ setenv PATH $ROMESYS/bin:$PATH[~]$ cvs checkout ROME[~/ROME]$ make[../MyExp]$ romebuilder myExp.xml –v [-o Output Path][~/MyExp]$ progname
Linux
• CVS checkout of ROME• Define environment variable
ROMESYS• Define environment variable ‘Path’
C:\> set ROMESYS=C:/ROMEC:\> set Path=%Path%;%ROMESYS%/binC:\> cvs checkout ROMEC:\ROME> nmake –f Makefile.winC:\MyExp> ROMEBuilder.exe myExp.xml –v [–o Output Path]C:\MyExp> progname
Windows
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Sample ExperimentSample Experiment
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Sample Overview
• 2 Taskso ReadMidaso ADCCalib
• 4 Folderso CMPMTDatao CMCalib (Data base)o CMPMTInfo (Data base)o Trigger
• 1 Treeo Data
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
XML Configuration File I<Folder>
<SubFolder FolderName="CMPMTData" Array="yes"/><Fields>
<ADC0Data Type="Float_t" Initialisation="0" Comment="// ADC Data"/></Fields>
</SubFolder><SubFolder FolderName="CMCalib" Array="yes" DataBase="yes"/>
<Fields><RunNumber Type="Int_t" Initialisation="0" Comment="// Run Number"/><TimeStamp Type="Int_t" Initialisation="0" Comment="// Time Stamp"/><RunDescription Type="TString" Initialisation="0" Comment="// Run Description"/><ADCPedestal Type="Float_t" Initialisation="0" Comment="// ADC Pedestal"/>
</Fields></SubFolder><SubFolder FolderName="CMPMTInfo" Array="yes" DataBase="yes"/>
<Fields><RunNumber>; <TimeStamp>; <RunDescription>; (see CMCalib)<PMID Type="Int_t" Initialisation="0" Comment="// Photo Multiplier ID"/><ADCID Type="Int_t" Initialisation="0" Comment="// ADC Number"/>
</Fields></SubFolder><SubFolder FolderName="Trigger"/>
<Fields><ID Type="Int_t" Initialisation="0" Comment="// event ID"/><EventNumber Type="Int_t" Initialisation="0" Comment="// Event Number"/>
</Fields></SubFolder>
</Folder>
sample.xml
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
XML Configuration File II<Task>
<SubTask Name="ReadMidas"></SubTask><SubTask Name="ADCCalib">
<Histos><ADC0Histo Type="TH1F" ArraySize="257" FolderName="adc0" Title="ADC0" NumberOfBinsX="4096" XMin="0" XMax="4096"/>
</Histos></SubTask>
</Task><Trees>
<Tree Name="Data" Title="Calorimeter PMT Data"><Branch Name="PMTData" Folder="CMPMTData"/>
</Tree></Trees>
sample.xml
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Read Midas Taskvoid XXXTReadMidas::Event(){ EVENT_HEADER *pevent = (EVENT_HEADER*)fAnalyzer->GetMidasEvent();
fAnalyzer->SetTriggerObject(pevent->event_id,pevent->serial_number);
if (pevent->event_id== EVENTID_EOR) fAnalyzer->EndOfRun(); if (pevent->event_id< 0 || pevent->event_id== EVENTID_EOR) { fAnalyzer->SetDataFillEvent(false); return; } pevent++;
float fADC[gNumberOfPMT],*pADC; if (ROMEStatic::bk_locate(pevent, "ADC0", &pADC)) { for (int i=0;i<gNumberOfPMT;i++) fADC[i] = (Float_t)pADC[i]; } else { fAnalyzer->SetDataFillEvent(false); return; }
for (int i=0;i<gNumberOfPMT;i++) { int iadc = fAnalyzer->GetCMPMTInfoAt(i)->GetADCID(); fAnalyzer->SetCMPMTDataObject(i,fADC[iadc]); }}
XXXTReadMidas.cpp
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
ADC Calibration Task
void XXXTADCCalib::Event(){ if (fAnalyzer->GetTriggerObject()->GetID()!=1) return; for (int i=0;i<gNumberOfPMT;i++) { float pmtData = fAnalyzer->GetCMPMTDataAt(i)->GetADC0Data(); float pedestal = fAnalyzer->GetCMCalibAt(i)->GetADCPedestal(); int ipmt = fAnalyzer->GetCMPMTInfoAt(i)->GetADCID(); FillADC0HistoAt(ipmt,pmtData - pedestal); }}
XXXTADCCalib.cpp
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Run Program
C:\Sample> ROMEBuilder.exe sample.xml –v
link messages
C:\Sample> XXXSample –r 06625 –db …/database/
-i …/data/ –o …/out/ –ta 1,1 –tr 0,1,1,0
12005 events processed Task 'ReadMidas' : run time = 00:00:00 Task 'ADCPedestal' : run time = 00:00:02
Windows
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
The MEG ExperimentThe MEG Experiment
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
MEG Experiment
CMDC TC
CMScaler
Scaler
CMHV
HV
EnvironmentEnv
Trigger
Trigger
MEG
CMHit
Hit
Hit Tree
CMRefCMPMTData
Ref
PMT Data Tree
PMT Data
CMPMTInfo
Info
Data base
CMCalib
Calib
Data base
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Referencies
CMHit
Hit
CMPMTInfo
Info
CMCalib
Calib
CMScaler
Scaler
CMHV
HV
EnvironmentEnv
Trigger
Trigger
MEG
PMT Data
CMPMTData
ADC0
ADC1
TDC
Info
CMRef
Scaler
HV
Env
Trigger
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
Detailed Introduction to ROME
Detailed Introduction to ROME
Paul Scherrer Institut • 5232 Villigen PSI ROME / 11.5.2004 / Matthias Schneebeli
ROME Classes
• ROMEAnalyzer
o Main Class
o Provides general steering methods
• ROMEEventLoop
o Implements the event loop
• ROMETask
• ROMETree
• ROMERunTable