FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMultiLinkedData_Interface.h
Go to the documentation of this file.
1 
8 #ifndef FairMultiLinkedData_Interface_H_
9 #define FairMultiLinkedData_Interface_H_
10 
11 #include "FairLink.h" // for FairLink
12 #include "FairMultiLinkedData.h"
13 
14 #include <Rtypes.h> // for Int_t, Bool_t, kFALSE, etc
15 #include <TObject.h> // for TObject
16 #include <TString.h> // for TString
17 #include <iostream> // for operator<<, ostream, cout
18 #include <memory> // for std::unique_ptr
19 #include <set> // for set
20 #include <vector> // for vector
21 
22 class FairMultiLinkedData_Interface : public TObject
23 {
24  public:
25  FairMultiLinkedData_Interface() = default;
26  FairMultiLinkedData_Interface(FairMultiLinkedData& links, Bool_t persistanceCheck = kTRUE);
27  FairMultiLinkedData_Interface(TString dataType,
28  std::vector<Int_t> links,
29  Int_t fileId = -1,
30  Int_t evtId = -1,
31  Bool_t persistanceCheck = kTRUE,
32  Bool_t bypass = kFALSE,
33  Float_t mult = 1.0);
34  FairMultiLinkedData_Interface(Int_t dataType,
35  std::vector<Int_t> links,
36  Int_t fileId = -1,
37  Int_t evtId = -1,
38  Bool_t persistanceCheck = kTRUE,
39  Bool_t bypass = kFALSE,
40  Float_t mult = 1.0);
42 
44 
46 
47  std::set<FairLink> GetLinks() const;
48  Int_t GetNLinks() const;
49  FairLink GetLink(Int_t pos) const;
50  FairMultiLinkedData GetLinksWithType(Int_t type) const;
51  FairLink GetEntryNr() const;
52  FairMultiLinkedData* GetPointerToLinks() const { return fLink.get(); }
53 
54  std::vector<FairLink> GetSortedMCTracks();
55 
56  void SetLinks(FairMultiLinkedData links);
57  void SetLink(FairLink link);
58  void SetInsertHistory(Bool_t val);
59  void SetEntryNr(FairLink val);
61  void SetPointerToLinks(FairMultiLinkedData* links) { fLink.reset(links); }
62  void SetPointerToLinks(std::unique_ptr<FairMultiLinkedData> links) { fLink = std::move(links); }
63 
64  void AddLinks(FairMultiLinkedData links,
65  Float_t mult = 1.0);
66  void AddLink(FairLink link);
69 
70  void ResetLinks();
71 
72  std::ostream& PrintLinkInfo(std::ostream& out = std::cout) const
73  {
74  if (GetPointerToLinks() != 0)
76  return out;
77  }
78 
79  friend std::ostream& operator<<(std::ostream& out, const FairMultiLinkedData_Interface& data)
80  {
81  data.PrintLinkInfo(out);
82  return out;
83  }
84 
85  protected:
86  std::unique_ptr<FairMultiLinkedData> fLink;
88 
90 };
91 
104 #endif /* FairMultiLinkedData_Interface_H_ */
void SetLinks(FairMultiLinkedData links)
Sets the links as vector of FairLink.
FairMultiLinkedData_Interface()=default
Default constructor.
FairMultiLinkedData_Interface & operator=(const FairMultiLinkedData_Interface &rhs)
Int_t GetNLinks() const
returns the number of stored links
FairMultiLinkedData GetLinksWithType(Int_t type) const
returns all FairLinks with the corresponding type
void SetPointerToLinks(FairMultiLinkedData *links)
void SetLink(FairLink link)
Sets the Links with a single FairLink.
ClassDef(FairMultiLinkedData_Interface, 6)
std::set< FairLink > GetLinks() const
returns stored links as FairLinks
friend std::ostream & operator<<(std::ostream &out, const FairMultiLinkedData_Interface &data)
Output.
FairLink GetLink(Int_t pos) const
returns the FairLink at the given position
FairMultiLinkedData * GetPointerToLinks() const
returns non-owning pointer
std::unique_ptr< FairMultiLinkedData > fLink
std::ostream & PrintLinkInfo(std::ostream &out=std::cout) const
Output.
void SetPointerToLinks(std::unique_ptr< FairMultiLinkedData > links)
void AddLinks(FairMultiLinkedData links, Float_t mult=1.0)
Adds a List of FairLinks (FairMultiLinkedData_Interface) to fLinks.
FairMultiLinkedData * CreateFairMultiLinkedData()
returns non-owning pointer
std::ostream & PrintLinkInfo(std::ostream &out=std::cout) const
Output.
void AddInterfaceData(FairMultiLinkedData_Interface *data)