simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TSCategoryDef.h
1 /*
2  * TSCategoryDef.h
3  *
4  * Created on: Sep 24, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  *
9  * Define a Category:
10  *
11  * Category
12  * Member 1
13  * Member 2
14  * .....
15  *
16  *
17  */
18 
19 #ifndef TSCATEGORYDEF_H_
20 #define TSCATEGORYDEF_H_
21 
22 #include <TString.h>
23 #include <TH1F.h>
24 
25 #include "MessageMgr.h"
26 
27 #include "TSNamed.h"
28 
29 /*
30  *
31  *
32  *
33  * TODO: Move HasAll to TSCategory ?
34  * Transfer Hash values via Setters?
35  *
36  *
37  */
38 
39 
40 class TSCategoryDef: public TSNamed {
41 
42 
43 public:
44 
45  TSCategoryDef();
46  TSCategoryDef(TString name, TString label, TString title);
47  virtual ~TSCategoryDef();
48 
49  void AddMember(TString name, TString label="");
50  void AddMembers(TString list, TString labels);
51 
52  void AddMembers(const TSCategoryDef &, TString list="");
53 
54  void Clear();
55  void Copy(const TSCategoryDef &);
56  int GetCategoryNameHash() const;
57  int GetHash() const {return fHash;}
58  TH1F& GetHistogram() {return fHisto;}
59  int GetNumOfMembers() const {return fNumOfMems;}
60  TString GetMemName(int) const;
61  TString GetMemLabel(int) const;
62  TString GetMemBinLabel(int) const;
63  int GetMemHash(int) const;
64  bool HasAll() const {return fHasAllMems;}
65  bool HasMember(TString name) const;
66  void Init();
67  void Print() const;
68  void PrintHashTable() const;
69 
70  void SetName(TString);
71 
72 
73 protected:
74  bool fHasAllMems;
75 
76 private:
77 
78  void fBuildHash();
79  void fBuildHisto();
80  bool fCheckCollisions();
81 
82  int fHash;
83  int fNameHash;
84  int fNumOfMems;
85 
86  //to be Structured
87  std::vector<TString> fMember;
88  std::vector<TString> fMemLabel;
89  std::vector<TString> fMemBinLabel;
90  std::vector<int> fMemHash;
91 
92  int first_ele_idx;
93  TString token_sep;
94 
95  TH1F fHisto;
96 };
97 
98 #endif /* TSCATEGORYDEF_H_ */
Definition: TSCategoryDef.h:40
Definition: TSNamed.h:38
void Copy(const TSCategoryDef &)
Definition: TSCategoryDef.cc:62