CbmRoot
Loading...
Searching...
No Matches
HalCbmSource.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Daniel Wielanek [committer] */
4#include "HalCbmSource.h"
5
7
8#include <TBranch.h>
9#include <TNamed.h>
10#include <TObjArray.h>
11
12#include <Hal/RootIOManager.h>
13
14HalCbmSource::HalCbmSource(TString filename) : Source(filename) { fManager = new HalCbmATIOManager(filename); }
15
16void HalCbmSource::AddFile(TString fileName) { fManager->AddFile(fileName); }
17
18void HalCbmSource::AddFriend(TString friendName, Int_t level) { fManager->AddFriend(friendName, level); }
19
21
23{
24 auto inchain = GetInChain();
27 Bool_t recoAvail = fRecoContainer->ConnectToTree(inchain[0]);
28 Bool_t simAvail = fSimContainer->ConnectToTree(inchain[0]);
29 fRecoContainer->LoadFields(GetInputFileName());
30 fSimContainer->LoadFields(GetInputFileName());
31 int count = -1;
32 for (auto chain : inchain) {
33 count++;
34 if (count == 0) {
35 if (recoAvail) {
36 AddBranch("CbmAnaTreeSourceContainer.", fRecoContainer, Hal::BranchInfo::EFlag::kInActive);
37 }
38 if (simAvail) {
39 AddBranch("CbmAnaTreeMcSourceContainer.", fSimContainer, Hal::BranchInfo::EFlag::kInActive);
40 }
41 continue; //skip first chain - we are looking for AT data
42 }
43 TObjArray* list_branch = chain->GetListOfBranches();
44 for (int i = 0; i < list_branch->GetEntries(); i++) {
45 TBranch* branch = (TBranch*) list_branch->At(i);
46 TString name = branch->GetName();
47 TObject** obj = new TObject*();
48 PushTObject(obj);
49 chain->SetBranchAddress(name, obj);
50 AddBranch(branch->GetName(), obj[0], Hal::BranchInfo::EFlag::kInActive);
51 }
52 }
53}
54
CbmAnaTreeRecoSourceContainer * fRecoContainer
virtual void FillBranches()
virtual ~HalCbmATIOManager()
CbmAnaTreeMcSourceContainer * fSimContainer
HalCbmSource(TString filename="")
HalCbmATIOManager * fManager
virtual void AddFriend(TString friendName="", Int_t level=0)
virtual void AddFile(TString fileName="")
virtual ~HalCbmSource()