SlideShare a Scribd company logo
José Luis Rodríguez-Sánchez
University of Coruña
22nd
February 2023
Working with tasks in R3BRoot
tasks
2
Working with tasks in R3BRoot
J.L. Rodríguez-Sánchez
FairRoot and R3BRoot are based on Tasks (classes) that help us to move data between
different data level, which are also combined with parameter containers to calibrate the
detectors and perform particle and fragment tracking
Raw data
Calibrated
data
Hit data
Tracking data
Task: Mapped2Cal
Task: Cal2Hit
Task: Mapped2Cal
Task: Tracking
Time in channels
Time in ns
Combine different times
to get physical observables:
Time-of-flight
Momentum, masses, ...
3
Working with tasks in R3BRoot
J.L. Rodríguez-Sánchez
FairRoot and R3BRoot are based on Tasks (classes) that help us to move data between
different data level, which are also combined with parameter containers to calibrate the
detectors and perform particle and fragment tracking
Other tasks and data
levels could be created
for specific calibrations
Raw data
Calibrated
data
Hit data
Tracking data
Task: Mapped2Cal
Task: Cal2Hit
Task: Mapped2Cal
Task: Tracking
Time in channels
Time in ns
Combine different times
to get physical observables:
Time-of-flight
Momentum, masses, ...
4
R3BRoot folder scheme for detectors
J.L. Rodríguez-Sánchez
R3BRoot
Detector
califa
neuland
music
mwpc
fiber
tofd
los
ssd
glad
5
R3BRoot folder scheme for detectors
J.L. Rodríguez-Sánchez
R3BRoot
Detector
califa
neuland
music
mwpc
fiber
tofd
los
ssd
calibration
pars
sim
digi
geobase
test
glad
Others...
CMakeLists.txt
DetectorLinkDef.h
6
R3BRoot folder scheme for detectors
J.L. Rodríguez-Sánchez
R3BRoot
Detector
califa
neuland
music
mwpc
fiber
tofd
los
ssd
calibration
pars
sim
digi
geobase
test
R3BDetector
R3BDetectorDigitizer
create_detector_geo.C (ROOT geometries)
R3BDetectorDataLevelPar
R3BDetectorDataLevelA2DataLevelB
R3BDetectorDataLevelA2DataLevelBPar
Macros for tests
Files used for compilation
glad
Others...
CMakeLists.txt
DetectorLinkDef.h
In red common names DataLevel: Mapped, Cal, Hit, ...
Only for simulation
7
R3BRoot folder scheme for “data structures”
J.L. Rodríguez-Sánchez
R3BRoot
Detector
r3bdata
8
R3BRoot folder scheme for “data structures”
J.L. Rodríguez-Sánchez
R3BRoot
Detector
r3bdata detectorData
CMakeLists.txt
DataLinkDef.h
califaData
tofdData
Others...
R3BDetectorPoint
R3BDetectorMappedData
R3BDetectorCalData
R3BDetectorHitData
Files used for compilation
Only for simulation
In red common names
9
General scheme for analysis
J.L. Rodríguez-Sánchez
FairRun Manager
R3BMusicReader
R3BReader
FairRunAna
FairSource IO Manager
FairTasks
FairRunOnline
R3BCalifaFebexReader
RunTime
DataBase
Root files
Configuration,
Parameters,
Geometry
Root files
ASCII files
R3BAmsReader
R3BFootReader
R3BTofDReader
R3BDetectorCal2Hit
FairRoot
R3BParams
R3BRoot
R3BDetectorDataLevelPar
FairSource
UCESB&upexps
(lmd files)
R3BUcesbSource
R3BFileSource
R3BDetectorMapped2Cal
ROOT file
R3BTrackingMethod
Gabriel’s talk
10
General R3BRoot protocol for detector calibrations
J.L. Rodríguez-Sánchez
Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis
This first stage will reduce the computing time during the next detector calibration steps
Calibration step: Use data to obtain calibration parameters for a specific data level & detector
ROOT file with Raw data R3BFileSource FairRunAna
R3BDetectorLevelA2LevelBPar
ROOT file with some data(optional)
R3BParams
Root file
ASCII file
R3BDetectorLevelBPar
UCESB
(lmd files)
R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data
11
General R3BRoot protocol for analysis
J.L. Rodríguez-Sánchez
UCESB
(lmd files)
R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data
Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis
12
General R3BRoot protocol for analysis
J.L. Rodríguez-Sánchez
UCESB
(lmd files)
R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data
Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis
Calibration stage: Convert Raw data in Cal&Hit data for all the detectors
ROOT file with Raw data R3BFileSource FairRunAna
R3BDetectorCal2Hit
R3BDetectorMapped2Cal
ROOT file with Cal&Hit data
R3BParams
R3BDetectorCalPar R3BDetectorHitPar
13
General R3BRoot protocol for analysis
J.L. Rodríguez-Sánchez
UCESB
(lmd files)
R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data
Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis
Calibration stage: Convert Raw data in Cal&Hit data for all the detectors
ROOT file with Raw data R3BFileSource FairRunAna
R3BDetectorCal2Hit
R3BDetectorMapped2Cal
ROOT file with Cal&Hit data
R3BParams
R3BDetectorCalPar R3BDetectorHitPar
Tracking stage: Convert Cal&Hit data in physical observables
ROOT file with Cal&Hit data R3BFileSource FairRunAna
R3BParams R3BTrackingPar
ROOT file with tracking data
R3BTrackingMethod
Physics
14
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
More methods can be found:
https://github.com/FairRootGroup/FairRoot/blob/dev/base/steer/FairTask.h
15
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
Constructors
R3BDetectorMapped2Cal::R3BDetectorMapped2Cal()
: R3BDetectorMapped2Cal("R3BDetectorMapped2Cal", 1)
{
}
R3BDetectorMapped2Cal.cxx
16
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
Constructors
R3BDetectorMapped2Cal::R3BDetectorMapped2Cal(const TString& name, int verbose)
: FairTask(name, verbose)
, fMappedData(nullptr)
, fCalData(nullptr)
{
}
R3BDetectorMapped2Cal.cxx
TClonesArray* fMappedData;
TClonesArray* fCalData;
17
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
Initialization of TCloneArrays and register new data levels
// ---- Public method Init
InitStatus R3BDetectorMapped2Cal::Init()
{
R3BLOG(info, "");
auto *frm = FairRootManager::Instance();
R3BLOG_IF(fatal, !frm, "FairRootManager not found.");
// Get input
fDetPrevLevel = dynamic_cast<TClonesArray*>(frm->GetObject("DetLevelData"));
R3BLOG_IF(fatal, !fDetPrevLevel, "DetLevelData not found.");
// Register output
fDetNextLevel = new TClonesArray("R3BDetectorLevelData");
frm->Register("DetNameNextLevelData", "Comments", fDetNextLevel, kTRUE);
return kSUCCESS;
} Name for the branch in the output ROOT file
R3BDetectorMapped2Cal.cxx
18
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
// ---- Public method Exec
void R3BDetectorMapped2Cal::Exec(Option_t*)
{
// Reset output arrays
Reset();
// Reading the Input
int nHits = fDetPrevLevel->GetEntriesFast();
if (nHits == 0)
return;
for (int i = 0; i < nHits; i++)
{
auto Data = dynamic_cast<R3BFooData*>(fDetPrevLevel->At(i));
auto val1 = Data->GetVar();
auto val2 = Data->GetVar();
AddData(val1,val2,...);
}
return;
}
R3BDetectorMapped2Cal.cxx
19
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
// ----- Private method Reset
void R3BDetectorMapped2Cal::Reset()
{
R3BLOG(debug1, "");
if (fDetNextLevel)
{
fdetNextLevel->Clear();
}
return;
}
R3BDetectorMapped2Cal.cxx
20
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class
class R3BDetectorMapped2Cal : public FairTask
{
public:
/** Default constructor **/
R3BDetectorMapped2Cal();
/** Standard constructor **/
R3BDetectorMapped2Cal(const TString name, int verbose = 1);
/** Destructor **/
~R3BDetectorMapped2Cal() override = default;
/** Method Exec **/
void Exec(Option_t*) override;
/** Method Init **/
InitStatus Init() override;
/** Method ReInit **/
InitStatus ReInit() override;
private:
/** Method Reset **/
void Reset();
/** Private method AddData **/
R3BFooData* AddData(int val1, ...);
public:
// Class definition
ClassDefOverride(R3BDetectorMapped2Cal, 1)
};
// ----- Private method AddData
R3BFooData* R3BDetectorMapped2Cal::AddData(int val1,...)
{
R3BLOG(debug1, "");
// Fill R3BFooData
TClonesArray& clref = *fDetNextLevel;
int size = clref.GetEntriesFast();
return new (clref[size]) R3BFooData(val1, ...);
}
R3BDetectorMapped2Cal.cxx
21
Definition of FairTask in R3BRoot
J.L. Rodríguez-Sánchez
Finally, add the new task/class to the DetectorLinkDef.h file
// clang-format off
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class R3BDetector+;
#pragma link C++ class R3BDetectorDigitizer+;
#pragma link C++ class R3BDetectorMapped2Cal+;
#endif
Note that for some detectors (no updated yet) you could also need to add the new task/class
to the CMakeLists.txt file
22
Your tasks: Create a new task in R3BRoot and use it
J.L. Rodríguez-Sánchez
Prepare your R3BRoot
a)Open a terminal at GSI (lxir136, …)
b)Go into your R3BRoot
if your code is not updated
git fetch --all
in case of modifications in your current branch: git add “file”
git commit -m ‘Comment’
git push
git checkout -b r3b_s1 mainrepo/dev
git push -u origin r3b_s1
c) source /u/land/fake_cvmfs/sourceme.sh
d)source build_thisr3broot.sh (this will do the configuration & compilation for you!,
please, delete the folder build before running it)
23
Your tasks: Create a new task in R3BRoot
J.L. Rodríguez-Sánchez
Create a new task for CALIFA
a)Create a new task for califa, named R3BCalifaMapped2SuperCal with the basic methods
b)Register the new data level as a TClonesArray of the class R3BCalifaCalData, storing it in the
main tree with the name “CalifaSuperCalData”
c) Use the Exec() method to read the CalifaMappedData and save in the new data level
“CalifaSuperCalData” the energy of the mapped level multiplied by a factor 0.00123
d)Include the new task/class in the CalifaLinkDef.h file for compilation
e)Compile the code from the folder build and solve the problems if exist
24
Creating a new steering macro for analysis
J.L. Rodríguez-Sánchez
void macro_name(const int nev = -1, const int fRunId = 1)
{
TString filename = “/path_to_root_file/input_name.root”;
TString outputfilename = “output_name.root”;
// Create run
auto *run = new FairRunAna();
// Set up R3BEventHeader
auto *reh = new R3BEventHeader();
run->SetEventHeader(reh);
// Define the output root file
run->SetSink(new FairRootFileSink(outputfilename));
// Create source using root files for input
auto *source = new R3BFileSource(filename);
source->SetRunId(fRunId);
run->SetSource(source);
// Runtime data base (optional, only if you need to load calibration parameters)
auto *rtdb = run->GetRuntimeDb();
// Add task for the propagation of the EventHeader timestamp
auto *rehp = new R3BEventHeaderPropagator();
run->AddTask(rehp);
// Add task for the propagation of the previous data levels (optional)
auto *rdp = new R3BDataPropagator("FooDataPropagator", 1, "FooData");
run->AddTask(rdp); Foo: CalifaMapped, MusicMapped, ...
25
Creating a new steering macro for analysis
J.L. Rodríguez-Sánchez
// Add tasks to get new data levels
auto *detmap2cal = new R3BDetectorMapped2Cal();
run->AddTask(detmap2cal);
auto *detcal2hit = new R3BDetectorCal2Hit();
run->AddTask(detcal2hit);
// Initialize tasks
run->Init();
// Run code
if (nev > -1)
{
run->Run(nev);
}
else
{
run→Run();
}
}
26
Visualization from the output root file
J.L. Rodríguez-Sánchez
27
Your tasks: Create a new task in R3BRoot and use it
J.L. Rodríguez-Sánchez
Do a steering macro to read “CalifaMappedData” and fill the new data level “CalifaSuperCalData”
with the previous task
a)Create a steering macro based on FairRunAna
b)Call the new task “R3BCalifaMapped2SuperCal()”
c) Execute it with root to produce an output root file with the new data structure and check that the
data is in the root file!
Note, there is a root file at the land account: workshop23/workshop_file1.root
28
The end
J.L. Rodríguez-Sánchez

More Related Content

PPTX
Monotone Conformance Checking for Partially Matching Designed and Observed Pr...
PDF
Graph Analysis Beyond Linear Algebra
PPTX
Incremental and Interactive Process Model Repair
PDF
Connected Components Labeling
PDF
ODP
ODT
Osss manual-5-extract data
PDF
Monotone Conformance Checking for Partially Matching Designed and Observed Pr...
Graph Analysis Beyond Linear Algebra
Incremental and Interactive Process Model Repair
Connected Components Labeling
Osss manual-5-extract data

Similar to Presentation about the use of R3BRoot for data analysis (6)

PPTX
Complete and Interpretable Conformance Checking of Business Processes
PDF
Redundancy elimination of_big_sensor_data_using_bayesian_networks (1)
PPTX
Data acquisition and storage in Wireless Sensor Network
PDF
Process Mining and Predictive Monitoring: an overview
PPTX
Reverse Architecting of a Medical Device Software
PPTX
Earth Movers’ Stochastic Conformance Checking
Complete and Interpretable Conformance Checking of Business Processes
Redundancy elimination of_big_sensor_data_using_bayesian_networks (1)
Data acquisition and storage in Wireless Sensor Network
Process Mining and Predictive Monitoring: an overview
Reverse Architecting of a Medical Device Software
Earth Movers’ Stochastic Conformance Checking
Ad

More from JoseLuisRodriguezSan16 (14)

PDF
Study of shell effects in fission of neutron-deficient isotopes of Th, Ac and...
PDF
Commissioning of the new Si-recoil tracker based on ALPIDE sensors
PDF
Isobaric charge-exchange reactions: a tool to study the excitation of baryoni...
PDF
Nuclear fission studies in inverse kinematics with the R3B setup at the GSI-F...
PDF
Comprehensive investigation of fission yields by using (p,2p)-induced fission...
PDF
Fragmentation-induced fission reactions of 236U in inverse kinematics to inve...
PDF
Nucleon knockout reactions within the intranuclear cascade model INCL
PDF
Short-Range Correlations in Dynamical Intranuclear Cascade Models for Describ...
PDF
Complete kinematics studies of fission reactions induced by quasi-free nucleo...
PDF
Study of nuclear fission barriers and fission yields of exotic nuclei using t...
PDF
Si-tracker for study of nuclear reactions at R3B
PDF
Complete kinematics studies of fission reactions induced by quasi-free nucleo...
PDF
Study of nuclear fission barriers and fission yields of exotic nuclei using t...
PDF
Presentation about the use of R3BRoot for simulation
Study of shell effects in fission of neutron-deficient isotopes of Th, Ac and...
Commissioning of the new Si-recoil tracker based on ALPIDE sensors
Isobaric charge-exchange reactions: a tool to study the excitation of baryoni...
Nuclear fission studies in inverse kinematics with the R3B setup at the GSI-F...
Comprehensive investigation of fission yields by using (p,2p)-induced fission...
Fragmentation-induced fission reactions of 236U in inverse kinematics to inve...
Nucleon knockout reactions within the intranuclear cascade model INCL
Short-Range Correlations in Dynamical Intranuclear Cascade Models for Describ...
Complete kinematics studies of fission reactions induced by quasi-free nucleo...
Study of nuclear fission barriers and fission yields of exotic nuclei using t...
Si-tracker for study of nuclear reactions at R3B
Complete kinematics studies of fission reactions induced by quasi-free nucleo...
Study of nuclear fission barriers and fission yields of exotic nuclei using t...
Presentation about the use of R3BRoot for simulation
Ad

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
ai tools demonstartion for schools and inter college
PPT
Introduction Database Management System for Course Database
PPTX
Transform Your Business with a Software ERP System
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
System and Network Administration Chapter 2
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
history of c programming in notes for students .pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
L1 - Introduction to python Backend.pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Softaken Excel to vCard Converter Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
ai tools demonstartion for schools and inter college
Introduction Database Management System for Course Database
Transform Your Business with a Software ERP System
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
System and Network Administration Chapter 2
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
CHAPTER 2 - PM Management and IT Context
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Design an Analysis of Algorithms I-SECS-1021-03
history of c programming in notes for students .pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
L1 - Introduction to python Backend.pptx
Digital Strategies for Manufacturing Companies
Which alternative to Crystal Reports is best for small or large businesses.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Navsoft: AI-Powered Business Solutions & Custom Software Development
Softaken Excel to vCard Converter Software.pdf

Presentation about the use of R3BRoot for data analysis

  • 1. José Luis Rodríguez-Sánchez University of Coruña 22nd February 2023 Working with tasks in R3BRoot tasks
  • 2. 2 Working with tasks in R3BRoot J.L. Rodríguez-Sánchez FairRoot and R3BRoot are based on Tasks (classes) that help us to move data between different data level, which are also combined with parameter containers to calibrate the detectors and perform particle and fragment tracking Raw data Calibrated data Hit data Tracking data Task: Mapped2Cal Task: Cal2Hit Task: Mapped2Cal Task: Tracking Time in channels Time in ns Combine different times to get physical observables: Time-of-flight Momentum, masses, ...
  • 3. 3 Working with tasks in R3BRoot J.L. Rodríguez-Sánchez FairRoot and R3BRoot are based on Tasks (classes) that help us to move data between different data level, which are also combined with parameter containers to calibrate the detectors and perform particle and fragment tracking Other tasks and data levels could be created for specific calibrations Raw data Calibrated data Hit data Tracking data Task: Mapped2Cal Task: Cal2Hit Task: Mapped2Cal Task: Tracking Time in channels Time in ns Combine different times to get physical observables: Time-of-flight Momentum, masses, ...
  • 4. 4 R3BRoot folder scheme for detectors J.L. Rodríguez-Sánchez R3BRoot Detector califa neuland music mwpc fiber tofd los ssd glad
  • 5. 5 R3BRoot folder scheme for detectors J.L. Rodríguez-Sánchez R3BRoot Detector califa neuland music mwpc fiber tofd los ssd calibration pars sim digi geobase test glad Others... CMakeLists.txt DetectorLinkDef.h
  • 6. 6 R3BRoot folder scheme for detectors J.L. Rodríguez-Sánchez R3BRoot Detector califa neuland music mwpc fiber tofd los ssd calibration pars sim digi geobase test R3BDetector R3BDetectorDigitizer create_detector_geo.C (ROOT geometries) R3BDetectorDataLevelPar R3BDetectorDataLevelA2DataLevelB R3BDetectorDataLevelA2DataLevelBPar Macros for tests Files used for compilation glad Others... CMakeLists.txt DetectorLinkDef.h In red common names DataLevel: Mapped, Cal, Hit, ... Only for simulation
  • 7. 7 R3BRoot folder scheme for “data structures” J.L. Rodríguez-Sánchez R3BRoot Detector r3bdata
  • 8. 8 R3BRoot folder scheme for “data structures” J.L. Rodríguez-Sánchez R3BRoot Detector r3bdata detectorData CMakeLists.txt DataLinkDef.h califaData tofdData Others... R3BDetectorPoint R3BDetectorMappedData R3BDetectorCalData R3BDetectorHitData Files used for compilation Only for simulation In red common names
  • 9. 9 General scheme for analysis J.L. Rodríguez-Sánchez FairRun Manager R3BMusicReader R3BReader FairRunAna FairSource IO Manager FairTasks FairRunOnline R3BCalifaFebexReader RunTime DataBase Root files Configuration, Parameters, Geometry Root files ASCII files R3BAmsReader R3BFootReader R3BTofDReader R3BDetectorCal2Hit FairRoot R3BParams R3BRoot R3BDetectorDataLevelPar FairSource UCESB&upexps (lmd files) R3BUcesbSource R3BFileSource R3BDetectorMapped2Cal ROOT file R3BTrackingMethod Gabriel’s talk
  • 10. 10 General R3BRoot protocol for detector calibrations J.L. Rodríguez-Sánchez Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis This first stage will reduce the computing time during the next detector calibration steps Calibration step: Use data to obtain calibration parameters for a specific data level & detector ROOT file with Raw data R3BFileSource FairRunAna R3BDetectorLevelA2LevelBPar ROOT file with some data(optional) R3BParams Root file ASCII file R3BDetectorLevelBPar UCESB (lmd files) R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data
  • 11. 11 General R3BRoot protocol for analysis J.L. Rodríguez-Sánchez UCESB (lmd files) R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis
  • 12. 12 General R3BRoot protocol for analysis J.L. Rodríguez-Sánchez UCESB (lmd files) R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis Calibration stage: Convert Raw data in Cal&Hit data for all the detectors ROOT file with Raw data R3BFileSource FairRunAna R3BDetectorCal2Hit R3BDetectorMapped2Cal ROOT file with Cal&Hit data R3BParams R3BDetectorCalPar R3BDetectorHitPar
  • 13. 13 General R3BRoot protocol for analysis J.L. Rodríguez-Sánchez UCESB (lmd files) R3BFooReader R3BUcesbSource FairRunOnline ROOT file with Raw data Unpacking stage: Convert the lmd file in Raw data for all the detectors involved in your analysis Calibration stage: Convert Raw data in Cal&Hit data for all the detectors ROOT file with Raw data R3BFileSource FairRunAna R3BDetectorCal2Hit R3BDetectorMapped2Cal ROOT file with Cal&Hit data R3BParams R3BDetectorCalPar R3BDetectorHitPar Tracking stage: Convert Cal&Hit data in physical observables ROOT file with Cal&Hit data R3BFileSource FairRunAna R3BParams R3BTrackingPar ROOT file with tracking data R3BTrackingMethod Physics
  • 14. 14 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; More methods can be found: https://github.com/FairRootGroup/FairRoot/blob/dev/base/steer/FairTask.h
  • 15. 15 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; Constructors R3BDetectorMapped2Cal::R3BDetectorMapped2Cal() : R3BDetectorMapped2Cal("R3BDetectorMapped2Cal", 1) { } R3BDetectorMapped2Cal.cxx
  • 16. 16 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; Constructors R3BDetectorMapped2Cal::R3BDetectorMapped2Cal(const TString& name, int verbose) : FairTask(name, verbose) , fMappedData(nullptr) , fCalData(nullptr) { } R3BDetectorMapped2Cal.cxx TClonesArray* fMappedData; TClonesArray* fCalData;
  • 17. 17 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; Initialization of TCloneArrays and register new data levels // ---- Public method Init InitStatus R3BDetectorMapped2Cal::Init() { R3BLOG(info, ""); auto *frm = FairRootManager::Instance(); R3BLOG_IF(fatal, !frm, "FairRootManager not found."); // Get input fDetPrevLevel = dynamic_cast<TClonesArray*>(frm->GetObject("DetLevelData")); R3BLOG_IF(fatal, !fDetPrevLevel, "DetLevelData not found."); // Register output fDetNextLevel = new TClonesArray("R3BDetectorLevelData"); frm->Register("DetNameNextLevelData", "Comments", fDetNextLevel, kTRUE); return kSUCCESS; } Name for the branch in the output ROOT file R3BDetectorMapped2Cal.cxx
  • 18. 18 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; // ---- Public method Exec void R3BDetectorMapped2Cal::Exec(Option_t*) { // Reset output arrays Reset(); // Reading the Input int nHits = fDetPrevLevel->GetEntriesFast(); if (nHits == 0) return; for (int i = 0; i < nHits; i++) { auto Data = dynamic_cast<R3BFooData*>(fDetPrevLevel->At(i)); auto val1 = Data->GetVar(); auto val2 = Data->GetVar(); AddData(val1,val2,...); } return; } R3BDetectorMapped2Cal.cxx
  • 19. 19 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; // ----- Private method Reset void R3BDetectorMapped2Cal::Reset() { R3BLOG(debug1, ""); if (fDetNextLevel) { fdetNextLevel->Clear(); } return; } R3BDetectorMapped2Cal.cxx
  • 20. 20 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez File R3BDetectorMapped2Cal.h, this represents the minimum number of methods for our class class R3BDetectorMapped2Cal : public FairTask { public: /** Default constructor **/ R3BDetectorMapped2Cal(); /** Standard constructor **/ R3BDetectorMapped2Cal(const TString name, int verbose = 1); /** Destructor **/ ~R3BDetectorMapped2Cal() override = default; /** Method Exec **/ void Exec(Option_t*) override; /** Method Init **/ InitStatus Init() override; /** Method ReInit **/ InitStatus ReInit() override; private: /** Method Reset **/ void Reset(); /** Private method AddData **/ R3BFooData* AddData(int val1, ...); public: // Class definition ClassDefOverride(R3BDetectorMapped2Cal, 1) }; // ----- Private method AddData R3BFooData* R3BDetectorMapped2Cal::AddData(int val1,...) { R3BLOG(debug1, ""); // Fill R3BFooData TClonesArray& clref = *fDetNextLevel; int size = clref.GetEntriesFast(); return new (clref[size]) R3BFooData(val1, ...); } R3BDetectorMapped2Cal.cxx
  • 21. 21 Definition of FairTask in R3BRoot J.L. Rodríguez-Sánchez Finally, add the new task/class to the DetectorLinkDef.h file // clang-format off #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class R3BDetector+; #pragma link C++ class R3BDetectorDigitizer+; #pragma link C++ class R3BDetectorMapped2Cal+; #endif Note that for some detectors (no updated yet) you could also need to add the new task/class to the CMakeLists.txt file
  • 22. 22 Your tasks: Create a new task in R3BRoot and use it J.L. Rodríguez-Sánchez Prepare your R3BRoot a)Open a terminal at GSI (lxir136, …) b)Go into your R3BRoot if your code is not updated git fetch --all in case of modifications in your current branch: git add “file” git commit -m ‘Comment’ git push git checkout -b r3b_s1 mainrepo/dev git push -u origin r3b_s1 c) source /u/land/fake_cvmfs/sourceme.sh d)source build_thisr3broot.sh (this will do the configuration & compilation for you!, please, delete the folder build before running it)
  • 23. 23 Your tasks: Create a new task in R3BRoot J.L. Rodríguez-Sánchez Create a new task for CALIFA a)Create a new task for califa, named R3BCalifaMapped2SuperCal with the basic methods b)Register the new data level as a TClonesArray of the class R3BCalifaCalData, storing it in the main tree with the name “CalifaSuperCalData” c) Use the Exec() method to read the CalifaMappedData and save in the new data level “CalifaSuperCalData” the energy of the mapped level multiplied by a factor 0.00123 d)Include the new task/class in the CalifaLinkDef.h file for compilation e)Compile the code from the folder build and solve the problems if exist
  • 24. 24 Creating a new steering macro for analysis J.L. Rodríguez-Sánchez void macro_name(const int nev = -1, const int fRunId = 1) { TString filename = “/path_to_root_file/input_name.root”; TString outputfilename = “output_name.root”; // Create run auto *run = new FairRunAna(); // Set up R3BEventHeader auto *reh = new R3BEventHeader(); run->SetEventHeader(reh); // Define the output root file run->SetSink(new FairRootFileSink(outputfilename)); // Create source using root files for input auto *source = new R3BFileSource(filename); source->SetRunId(fRunId); run->SetSource(source); // Runtime data base (optional, only if you need to load calibration parameters) auto *rtdb = run->GetRuntimeDb(); // Add task for the propagation of the EventHeader timestamp auto *rehp = new R3BEventHeaderPropagator(); run->AddTask(rehp); // Add task for the propagation of the previous data levels (optional) auto *rdp = new R3BDataPropagator("FooDataPropagator", 1, "FooData"); run->AddTask(rdp); Foo: CalifaMapped, MusicMapped, ...
  • 25. 25 Creating a new steering macro for analysis J.L. Rodríguez-Sánchez // Add tasks to get new data levels auto *detmap2cal = new R3BDetectorMapped2Cal(); run->AddTask(detmap2cal); auto *detcal2hit = new R3BDetectorCal2Hit(); run->AddTask(detcal2hit); // Initialize tasks run->Init(); // Run code if (nev > -1) { run->Run(nev); } else { run→Run(); } }
  • 26. 26 Visualization from the output root file J.L. Rodríguez-Sánchez
  • 27. 27 Your tasks: Create a new task in R3BRoot and use it J.L. Rodríguez-Sánchez Do a steering macro to read “CalifaMappedData” and fill the new data level “CalifaSuperCalData” with the previous task a)Create a steering macro based on FairRunAna b)Call the new task “R3BCalifaMapped2SuperCal()” c) Execute it with root to produce an output root file with the new data structure and check that the data is in the root file! Note, there is a root file at the land account: workshop23/workshop_file1.root