ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
TInverseMap.h
Go to the documentation of this file.
1 #ifndef TINVERSEMAP_H_
2 #define TINVERSEMAP_H_
3 
4 #include <Rtypes.h>
5 #include <TNamed.h>
6 
7 #include <algorithm>
8 #include <iostream>
9 #include <map>
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 class TBuffer;
15 class TClass;
16 class TMemberInspector;
17 class TSpline3;
18 
19 class TInverseMap : public TNamed {
20 
21 public:
22  TInverseMap(const char *filename);
23  // TInverseMap(std::vector<std::string> &fileList);
24  TInverseMap();
25  static TInverseMap *Get(const char *filename = "");
26  virtual ~TInverseMap();
27 
28  virtual void Print(Option_t *opt = "") const; //{ ; }
29  virtual void Clear(Option_t *opt = "") { ; }
30 
31  float Ata(int degree, double xfp, double afp, double yfp, double bfp) const;
32  float Ata(int degree, double xfp, double afp, double yfp, double bfp, double z);
33  // float Ata(int,const TS800*);
34  float Bta(int degree, double xfp, double afp, double yfp, double bfp) const;
35  float Bta(int degree, double xfp, double afp, double yfp, double bfp, double z);
36  // float Bta(int,const TS800*);
37  float Yta(int degree, double xfp, double afp, double yfp, double bfp) const;
38  float Yta(int degree, double xfp, double afp, double yfp, double bfp, double z);
39  // float Yta(int,const TS800*);
40  float Dta(int degree, double xfp, double afp, double yfp, double bfp) const;
41  float Dta(int degree, double xfp, double afp, double yfp, double bfp, double z);
42  // float Dta(int,const TS800*);
43 
44  float MapCalc(int, int, float *) const;
45  float MapCalc_s(int order, int par, float *input, double z);
46 
47  void SetDistPivotTarget(std::vector<Double_t> vec)
48  {
49  std::cout << "check setDistPivotTarget " << vec.size() << " " << vec.at(2) << std::endl;
50  fMapDist_v = vec;
51  };
52 
53  int Size() { return fMap.size(); }
54 
55  bool ReadMultiMapFile(std::vector<std::string> &str);
56 
57 private:
58  // TInverseMap(const char* filename);
59  static std::unique_ptr<TInverseMap> fInverseMap;
60 
61  bool ReadMapFile(const char *filename);
62  // bool ReadMultiMapFile(std::vector<std::string> &str);
63 
64  struct InvMapRow {
65  double coefficient;
66  int order;
67  int exp[6];
68  };
69 
70  struct InvMapRowS {
71  TSpline3 *coefficient;
72  int order;
73  int exp[6];
74  };
75 
76  // data cleared on reset; i.e. Read new inverse map.
77  std::map<int, std::vector<InvMapRow>> fMap;
78  std::map<int, std::vector<InvMapRowS>> fMap_s;
79  std::vector<std::map<int, std::vector<InvMapRow>>> fMap_v;
80  std::vector<Double_t> fMapDist_v;
81  float fBrho{};
82  int fMass{};
83  int fCharge{};
84  Int_t fsize{};
85  std::string info;
86 
87  ClassDef(TInverseMap, 0)
88 };
89 #endif
TInverseMap::MapCalc_s
float MapCalc_s(int order, int par, float *input, double z)
Definition: TInverseMap.cxx:361
TInverseMap::Print
virtual void Print(Option_t *opt="") const
Definition: TInverseMap.cxx:153
TInverseMap::Bta
float Bta(int degree, double xfp, double afp, double yfp, double bfp) const
Definition: TInverseMap.cxx:209
TInverseMap::SetDistPivotTarget
void SetDistPivotTarget(std::vector< Double_t > vec)
Definition: TInverseMap.h:47
TInverseMap::~TInverseMap
virtual ~TInverseMap()
TInverseMap::Get
static TInverseMap * Get(const char *filename="")
Definition: TInverseMap.cxx:28
TInverseMap
Definition: TInverseMap.h:19
TInverseMap::Yta
float Yta(int degree, double xfp, double afp, double yfp, double bfp) const
Definition: TInverseMap.cxx:221
TInverseMap::Ata
float Ata(int degree, double xfp, double afp, double yfp, double bfp) const
Definition: TInverseMap.cxx:197
TInverseMap::ReadMultiMapFile
bool ReadMultiMapFile(std::vector< std::string > &str)
Definition: TInverseMap.cxx:95
TInverseMap::Size
int Size()
Definition: TInverseMap.h:53
TInverseMap::Dta
float Dta(int degree, double xfp, double afp, double yfp, double bfp) const
Definition: TInverseMap.cxx:233
TInverseMap::Clear
virtual void Clear(Option_t *opt="")
Definition: TInverseMap.h:29
TInverseMap::TInverseMap
TInverseMap()
Definition: TInverseMap.cxx:24
TInverseMap::MapCalc
float MapCalc(int, int, float *) const
Definition: TInverseMap.cxx:343