CbmRoot
Loading...
Searching...
No Matches
RootManager.cxx
Go to the documentation of this file.
1
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Daniel Wielanek [committer] */
4
#include "
RootManager.h
"
5
6
#include <FairRootManager.h>
7
8
#include <RtypesCore.h>
9
#include <TCollection.h>
10
#include <TFile.h>
11
#include <TList.h>
12
#include <TObjString.h>
13
14
#include <Hal/InputDataInfo.h>
15
16
namespace
Hal
17
{
18
namespace
Fair
19
{
20
RootManager::RootManager
()
21
:
Hal
::IOManager(new
Hal
::InputDataInfo(FairRootManager::Instance()->
GetInFile
()->GetName()))
22
{
23
fFairManager
= FairRootManager::Instance();
24
if
(
fFairManager
->GetInFile()) {
25
fDataInfo->OverwriteSourceName(
fFairManager
->GetInFile()->GetName());
26
}
27
}
28
29
TObject*
RootManager::GetObject
(
const
char
* BrName) {
return
fFairManager
->GetObject(BrName); }
30
31
TFile*
RootManager::GetInFile
() {
return
fFairManager
->GetInFile(); }
32
33
void
RootManager::UpdateBranches
() {
fFairManager
->UpdateBranches(); }
34
35
void
RootManager::SetInChain
(TChain* tempChain,
Int_t
ident) {
fFairManager
->SetInChain(tempChain, ident); }
36
37
void
RootManager::RegisterInternal
(
const
char
* name,
const
char
* folderName, TNamed* obj,
Bool_t
toFile)
38
{
39
fFairManager
->Register(name, folderName, obj, toFile);
40
}
41
42
void
RootManager::RegisterInternal
(
const
char
* name,
const
char
* Foldername, TCollection* obj,
Bool_t
toFile)
43
{
44
fFairManager
->Register(name, Foldername, obj, toFile);
45
}
46
47
void
RootManager::RefreshBranchList
()
48
{
49
fFairManager
= FairRootManager::Instance();
50
TList* l =
fFairManager
->GetBranchNameList();
51
for
(
int
i = 0; i < l->GetEntries(); i++) {
52
TString name = ((TObjString*) l->At(i))->GetString();
53
Int_t
stat =
fFairManager
->CheckBranch(name);
54
TObject* obj =
fFairManager
->GetObject(name);
55
switch
(stat) {
56
case
0:
// not exist
57
break
;
58
case
1:
// in file
59
AddBranch(name, obj, BranchInfo::EFlag::kInActive);
60
break
;
61
case
2:
// memory
62
AddBranch(name, obj, BranchInfo::EFlag::kVirtual);
63
break
;
64
}
65
}
66
}
67
68
Bool_t
RootManager::InitInternal
()
69
{
70
if
(
fFairManager
==
nullptr
) {
71
fFairManager
= FairRootManager::Instance();
72
if
(
fFairManager
->GetInFile()) {
73
fDataInfo->OverwriteSourceName(
fFairManager
->GetInFile()->GetName());
74
}
75
}
76
RefreshBranchList
();
77
return
kTRUE;
78
}
79
80
void
RootManager::CdToOutput
()
81
{
82
if
(!
fFairManager
)
return
;
83
auto
file =
fFairManager
->GetOutFile();
84
if
(file) file->cd();
85
}
86
87
}
// namespace Fair
88
}
// namespace Hal
RootManager.h
Int_t
int Int_t
Definition
RootTypesDef.h:16
Bool_t
bool Bool_t
Definition
RootTypesDef.h:15
Hal::Fair::RootManager::fFairManager
FairRootManager * fFairManager
Definition
RootManager.h:24
Hal::Fair::RootManager::RegisterInternal
virtual void RegisterInternal(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)
Definition
RootManager.cxx:37
Hal::Fair::RootManager::UpdateBranches
void UpdateBranches()
Definition
RootManager.cxx:33
Hal::Fair::RootManager::CdToOutput
void CdToOutput()
Definition
RootManager.cxx:80
Hal::Fair::RootManager::RootManager
RootManager()
Definition
RootManager.cxx:20
Hal::Fair::RootManager::SetInChain
void SetInChain(TChain *tempChain, Int_t ident=-1)
Definition
RootManager.cxx:35
Hal::Fair::RootManager::GetObject
TObject * GetObject(const char *BrName)
Definition
RootManager.cxx:29
Hal::Fair::RootManager::GetInFile
TFile * GetInFile()
Definition
RootManager.cxx:31
Hal::Fair::RootManager::InitInternal
virtual Bool_t InitInternal()
Definition
RootManager.cxx:68
Hal::Fair::RootManager::RefreshBranchList
virtual void RefreshBranchList()
Definition
RootManager.cxx:47
Hal::Fair
Definition
Field.cxx:11
Hal
Definition
HalCbmPairSeparationCut2D.h:11
analysis
PWGC2F
femtoscopy
hal
helpers
fair
RootManager.cxx
Generated on Fri Jan 30 2026 23:05:19 for CbmRoot by
1.13.2