PandaRoot
TestInTask Class Reference

#include <TestTasks.h>

Inheritance diagram for TestInTask:

Public Member Functions

 TestInTask (const TString &t_branch="TestBranch")
 
virtual ~TestInTask ()
 
PndTCAConstContainer< FairTimeStamp > * GetTCA (const TString &t_branchname)
 Tries to find a registered TClonesArray with name t_branchname. Returns kTRUE on success. More...
 
PndSTDConstContainer< FairTimeStamp > * GetSTD (const TString &t_branchname)
 Tries to find a registered const std::vector<T>* with name t_branchname. Returns kTRUE on success. More...
 
virtual InitStatus Init () final
 
virtual void Exec (Option_t *)
 

Detailed Description

Definition at line 25 of file TestTasks.h.

Constructor & Destructor Documentation

◆ TestInTask()

TestInTask::TestInTask ( const TString &  t_branch = "TestBranch")
inline

Definition at line 31 of file TestTasks.h.

31 : FairTask(), fBranchName(t_branch){};

◆ ~TestInTask()

virtual TestInTask::~TestInTask ( )
inlinevirtual

Definition at line 32 of file TestTasks.h.

32 {};

Member Function Documentation

◆ Exec()

virtual void TestInTask::Exec ( Option_t *  )
inlinevirtual

Definition at line 93 of file TestTasks.h.

References PndConstContainerI< T >::GetConstElementPtr(), and PndConstContainer< T >::GetSize().

94  {
95  ASSERT_EQ(fInCont.GetSize(), 1);
96  EXPECT_EQ(fInCont.GetConstElementPtr(0)->GetTimeStamp(), fgNumber--);
97  };
virtual T const * GetConstElementPtr(Int_t t_index) const
Get the Element object at t_index.
virtual ssize_t GetSize() const final
Get the number of members in internal data.

◆ GetSTD()

PndSTDConstContainer<FairTimeStamp>* TestInTask::GetSTD ( const TString &  t_branchname)
inline

Tries to find a registered const std::vector<T>* with name t_branchname. Returns kTRUE on success.

Parameters
t_branchname
Returns
Bool_t

Definition at line 60 of file TestTasks.h.

References PndContainerBaseI::SetBranchName().

Referenced by Init().

61  {
62  PndSTDConstContainer<FairTimeStamp> *container{nullptr};
63  if (FairRootManager::Instance()->CheckBranch(t_branchname) ==
64  0) { // This test is required here, as you get a segmentation violation if you try to access a not existing branch t_branchname via std
65  return container;
66  }
67  std::vector<FairTimeStamp> const *data = FairRootManager::Instance()->InitObjectAs<std::vector<FairTimeStamp> const *>(t_branchname);
68  if (data != nullptr) {
69  container = new PndSTDConstContainer<FairTimeStamp>{};
70  container->SetBranchName(t_branchname);
71  container->SetData(data);
72  }
73 
74  return container;
75  }
PndSTDConstContainer implementation of PndConstContainerI<T> for FairRootManager and std::vector<T> ...
void SetBranchName(const TString &t_branchname)
Set the Branch Name.

◆ GetTCA()

PndTCAConstContainer<FairTimeStamp>* TestInTask::GetTCA ( const TString &  t_branchname)
inline

Tries to find a registered TClonesArray with name t_branchname. Returns kTRUE on success.

Parameters
t_branchname
Returns
Bool_t

Definition at line 40 of file TestTasks.h.

References PndContainerBaseI::SetBranchName().

Referenced by Init().

41  {
42  PndTCAConstContainer<FairTimeStamp> *container{nullptr};
43 
44  if (FairRootManager::Instance()->CheckBranch(t_branchname) ==
45  0) { // This test is required here, as you get a segmentation violation if you try to access a not existing branch t_branchname via std
46  return container;
47  }
48  container = new PndTCAConstContainer<FairTimeStamp>{};
49  container->SetBranchName(t_branchname);
50  container->SetTCA(dynamic_cast<TClonesArray *>(FairRootManager::Instance()->GetObject(t_branchname)));
51  return container;
52  }
void SetBranchName(const TString &t_branchname)
Set the Branch Name.
PndTCAConstContainer implementation of PndConstContainerI<T> for FairRootManager and TClonesArray...

◆ Init()

virtual InitStatus TestInTask::Init ( )
inlinefinalvirtual

Definition at line 77 of file TestTasks.h.

References GetSTD(), GetTCA(), PndContainerBaseI::SetBranchName(), and PndConstContainer< T >::SetConstContainer().

78  {
79  fInCont.SetBranchName(fBranchName);
80  PndConstContainerI<FairTimeStamp> *container = GetTCA(fBranchName);
81  if (container != nullptr) {
82  fInCont.SetConstContainer(container);
83  return kSUCCESS;
84  }
85  container = GetSTD(fBranchName);
86  if (container != nullptr) {
87  fInCont.SetConstContainer(container);
88  return kSUCCESS;
89  }
90  return kFATAL;
91  };
PndSTDConstContainer< FairTimeStamp > * GetSTD(const TString &t_branchname)
Tries to find a registered const std::vector<T>* with name t_branchname. Returns kTRUE on success...
Definition: TestTasks.h:60
void SetConstContainer(PndConstContainerI< T > *t_container)
Set the Input Container object.
void SetBranchName(const TString &t_branchname)
Set the Branch Name.
PndTCAConstContainer< FairTimeStamp > * GetTCA(const TString &t_branchname)
Tries to find a registered TClonesArray with name t_branchname. Returns kTRUE on success.
Definition: TestTasks.h:40

The documentation for this class was generated from the following file: