EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairMultiLinkedData.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairMultiLinkedData.h
1 
8 #ifndef FAIRMULTILINKEDDATA_H_
9 #define FAIRMULTILINKEDDATA_H_
10 
11 //#include "FairLinkedData.h"
12 #include "FairLink.h"
13 #include "FairRootManager.h"
14 #include "TClonesArray.h"
15 #include "TObject.h"
16 #include <set>
17 #include <utility>
18 
20 {
21  public:
23  FairMultiLinkedData(std::set<FairLink> links, Bool_t persistanceCheck = kTRUE);
24  FairMultiLinkedData(TString dataType, std::vector<Int_t> links, Int_t fileId = -1, Int_t evtId = -1,Bool_t persistanceCheck = kTRUE, Bool_t bypass = kFALSE, Float_t mult = 1.0);
25  FairMultiLinkedData(Int_t dataType, std::vector<Int_t> links, Int_t fileId = -1, Int_t evtId = -1, Bool_t persistanceCheck = kTRUE, Bool_t bypass = kFALSE, Float_t mult = 1.0);
26 
27  virtual ~FairMultiLinkedData() {};
28 
29  virtual std::set<FairLink> GetLinks() const { return fLinks;}
30  virtual Int_t GetNLinks() const { return fLinks.size(); }
31  virtual FairLink GetLink(Int_t pos) const;
32  virtual FairMultiLinkedData GetLinksWithType(Int_t type) const;
33  TObject* GetData(FairLink& myLink);
34  virtual Int_t GetDefaultType() { return fDefaultType;}
36  Int_t GetVerbose() {return fVerbose;}
37  virtual void SetDefaultType(Int_t type) { fDefaultType = type;}
38  virtual void SetPersistanceCheck(Bool_t check) {fPersistanceCheck = check;}
39  virtual void SetVerbose(Int_t level) {fVerbose = level;}
40 
41  virtual void SetLinks(FairMultiLinkedData links, Float_t mult = 1.0);
42  virtual void SetLink(FairLink link, Bool_t bypass = kFALSE, Float_t mult = 1.0);
43 
44  virtual void AddLinks(FairMultiLinkedData links, Float_t mult = 1.0);
45  virtual void AddLink(FairLink link, Bool_t bypass = kFALSE, Float_t mult = 1.0);
46 
47  virtual void InsertLink(FairLink link);
48 
49 
50 
51  virtual void AddAllWeights(Double_t weight);
52  virtual void SetAllWeights(Double_t weight);
53  virtual void MultiplyAllWeights(Double_t weight);
54 
55 
56  virtual Bool_t IsLinkInList(FairLink link) {return IsLinkInList(link.GetType(), link.GetIndex());}
57  virtual Bool_t IsLinkInList(Int_t type, Int_t index);
58  virtual Int_t LinkPosInList(FairLink link) {return LinkPosInList(link.GetType(), link.GetIndex());}
59  virtual Int_t LinkPosInList(Int_t type, Int_t index);
60 
61  virtual void DeleteLink(FairLink link) {DeleteLink(link.GetType(), link.GetIndex());}
62  virtual void DeleteLink(Int_t type, Int_t index);
63 
64  virtual void Reset() {ResetLinks();}
65  virtual void ResetLinks() {fLinks.clear();}
66 
67 
68  void Print(std::ostream& out = std::cout) const {
69  out << "[";
70  for (Int_t i = 0; i < GetNLinks(); i++) {
71  GetLink(i).Print(out);
72  out << " ";
73  }
74  out << "]";
75  }
76 
77  friend std::ostream& operator<< (std::ostream& out, const FairMultiLinkedData& data) {
78  data.Print(out);
79  return out;
80  }
81 
82  protected:
83  std::set<FairLink> fLinks;
85  Int_t fVerbose;
86 
87  virtual void SimpleAddLinks(Int_t fileId, Int_t evtId, Int_t dataType, std::vector<Int_t> links, Bool_t bypass, Float_t mult) {
88  for (UInt_t i = 0; i < links.size(); i++) {
89  AddLink(FairLink(fileId, evtId, dataType, links[i]), bypass, mult);
90  }
91  }
92  Int_t fDefaultType;
93 
94 
96 };
97 
109 #endif /* FAIRMULTILinkedData_H_ */