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 13 of file TestTasks.h.

Constructor & Destructor Documentation

◆ TestInTask()

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

Definition at line 19 of file TestTasks.h.

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

◆ ~TestInTask()

virtual TestInTask::~TestInTask ( )
inlinevirtual

Definition at line 20 of file TestTasks.h.

20 {};

Member Function Documentation

◆ Exec()

virtual void TestInTask::Exec ( Option_t *  )
inlinevirtual

Definition at line 81 of file TestTasks.h.

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

82  {
83  ASSERT_EQ(fInCont.GetSize(), 1);
84  EXPECT_EQ(fInCont.GetConstElementPtr(0)->GetTimeStamp(), fgNumber--);
85  };
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 48 of file TestTasks.h.

References PndContainerBaseI::SetBranchName().

Referenced by Init().

49  {
50  PndSTDConstContainer<FairTimeStamp> *container{nullptr};
51  if (FairRootManager::Instance()->CheckBranch(t_branchname) ==
52  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
53  return container;
54  }
55  std::vector<FairTimeStamp> const *data = FairRootManager::Instance()->InitObjectAs<std::vector<FairTimeStamp> const *>(t_branchname);
56  if (data != nullptr) {
57  container = new PndSTDConstContainer<FairTimeStamp>{};
58  container->SetBranchName(t_branchname);
59  container->SetData(data);
60  }
61 
62  return container;
63  }
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 28 of file TestTasks.h.

References PndContainerBaseI::SetBranchName().

Referenced by Init().

29  {
30  PndTCAConstContainer<FairTimeStamp> *container{nullptr};
31 
32  if (FairRootManager::Instance()->CheckBranch(t_branchname) ==
33  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
34  return container;
35  }
36  container = new PndTCAConstContainer<FairTimeStamp>{};
37  container->SetBranchName(t_branchname);
38  container->SetTCA(dynamic_cast<TClonesArray *>(FairRootManager::Instance()->GetObject(t_branchname)));
39  return container;
40  }
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 65 of file TestTasks.h.

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

66  {
67  fInCont.SetBranchName(fBranchName);
68  PndConstContainerI<FairTimeStamp> *container = GetTCA(fBranchName);
69  if (container != nullptr) {
70  fInCont.SetConstContainer(container);
71  return kSUCCESS;
72  }
73  container = GetSTD(fBranchName);
74  if (container != nullptr) {
75  fInCont.SetConstContainer(container);
76  return kSUCCESS;
77  }
78  return kFATAL;
79  };
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:48
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:28

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