ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtCopyTreeTask.cxx
Go to the documentation of this file.
1 #include "AtCopyTreeTask.h"
2 
3 #include <FairLogger.h> // for LOG
4 #include <FairRootManager.h> // for FairRootManager
5 
6 #include <TClonesArray.h>
7 #include <TList.h> // for TList
8 #include <TObject.h> // for TObject
9 #include <TString.h> // for TString
10 
12 {
13  FairRootManager *ioMan = FairRootManager::Instance();
14  if (ioMan == nullptr) {
15  LOG(fatal) << "Cannot find RootManager!";
16  return kFATAL;
17  }
18 
19  // Loop through the source branch list and grab every branch.
20  for (int i = 0; i < ioMan->GetBranchNameList()->GetSize(); i++) {
21 
22  auto branchName = ioMan->GetBranchName(i);
23  auto branchArray = dynamic_cast<TClonesArray *>(ioMan->GetObject(branchName));
24  if (branchArray == nullptr)
25  continue;
26 
27  if (ioMan->CheckBranch(branchName) == 1)
28  ioMan->Register(branchName, "AtTPC", branchArray, true);
29  }
30  return kSUCCESS;
31 }
AtCopyTreeTask::Init
InitStatus Init() override
Definition: AtCopyTreeTask.cxx:11
AtCopyTreeTask.h