CbmRoot
Settings.h
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
7 /*
8  * File: Settings.h
9  * Author: tablyaz
10  *
11  * Created on October 4, 2017, 12:57 PM
12  */
13 
14 #ifndef CBM_BINNED_SETTINGS_H
15 #define CBM_BINNED_SETTINGS_H
16 
17 #include "CbmDefs.h"
18 #include "CbmSetup.h"
19 #include "FairParGenericSet.h"
20 #include "FairParamList.h"
21 #include "TArrayD.h"
22 #include <list>
23 #include <tuple>
24 
26 
27 class CbmBinnedSettings : public FairParGenericSet {
28 public:
30  static CbmBinnedSettings* theInstance = 0;
31 
32  if (0 == theInstance) theInstance = new CbmBinnedSettings;
33 
34  return theInstance;
35  }
36 
37 public:
39  : FairParGenericSet("CbmBinnedSettings",
40  "Binned tracker reconstruction parameters",
41  "Default")
42  , fIsConfiguring(false)
43  , fIsOnlyPrimary(true)
44  , fNofStsStations(0)
45  , fNofMuchStations(0)
46  , fNofTrdStations(0) /*, fStationErrors()*/
47  , fNofStations(0)
48  , fXScats()
49  , fYScats()
51  std::fill_n(fUseModules, int(ECbmModuleId::kLastModule), true);
52  fPrimaryParticleIds.push_back(ppiNone);
53  }
54 
57 
58  void clear() {
59  status = kFALSE;
60  resetInputVersions();
61  }
62 
63  // Overridden virtual methods
64  void putParams(FairParamList* l) {
65  if (0 == l) return;
66 
67  l->add("OnlyPrimary", fIsOnlyPrimary);
68 
69  TArrayC detFlags(ToIntegralType(ECbmModuleId::kLastModule));
70 
71  for (int i = 0; i < ToIntegralType(ECbmModuleId::kLastModule); ++i)
72  detFlags[i] = fUseModules[i];
73 
74  l->add("UseModules", detFlags);
75  l->add("NofStsStations", fNofStsStations);
76  l->add("NofMuchStations", fNofMuchStations);
77  l->add("NofTrdStations", fNofTrdStations);
78 
79  /*Int_t nofStations = fStationErrors.size();
80  l->add("NofStations", nofStations);
81  TArrayD stationErrorArray(3 * nofStations);
82 
83  for (int i = 0; i < nofStations; ++i)
84  {
85  stationErrorArray[3 * i] = std::get<0> (fStationErrors[i]);
86  stationErrorArray[3 * i + 1] = std::get<1> (fStationErrors[i]);
87  stationErrorArray[3 * i + 2] = std::get<2> (fStationErrors[i]);
88  }
89 
90  l->add("StationErrors", stationErrorArray);*/
91 
92  l->add("NofStations", fNofStations);
93  TArrayD stationXScatArray(fNofStations);
94  TArrayD stationYScatArray(fNofStations);
95 
96  for (int i = 0; i < fNofStations; ++i) {
97  stationXScatArray[i] = fXScats[i];
98  stationYScatArray[i] = fYScats[i];
99  }
100 
101  l->add("StationXScats", stationXScatArray);
102  l->add("StationYScats", stationYScatArray);
103  }
104 
105  Bool_t getParams(FairParamList* l) {
106  if (0 == l) return kFALSE;
107 
108  Int_t op = 0;
109 
110  if (!l->fill("OnlyPrimary", &op)) return kFALSE;
111 
112  fIsOnlyPrimary = op != 0;
113 
114  TArrayC detFlags(ToIntegralType(ECbmModuleId::kLastModule));
115 
116  if (!l->fill("UseModules", &detFlags)) return kFALSE;
117 
118  for (int i = 0; i < ToIntegralType(ECbmModuleId::kLastModule); ++i)
119  fUseModules[i] = detFlags[i];
120 
121  if (!l->fill("NofStsStations", &fNofStsStations)) return kFALSE;
122 
123  if (!l->fill("NofMuchStations", &fNofMuchStations)) return kFALSE;
124 
125  if (!l->fill("NofTrdStations", &fNofTrdStations)) return kFALSE;
126 
127  if (!l->fill("NofStations", &fNofStations)) return kFALSE;
128 
129  /*TArrayD stationErrorArray(3 * nofStations);
130 
131  if (!l->fill("StationErrors", &stationErrorArray))
132  return kFALSE;
133 
134  fStationErrors.resize(nofStations);
135 
136  for (int i = 0; i < nofStations; ++i)
137  {
138  std::get<0> (fStationErrors[i]) = stationErrorArray[3 * i];
139  std::get<1> (fStationErrors[i]) = stationErrorArray[3 * i + 1];
140  std::get<2> (fStationErrors[i]) = stationErrorArray[3 * i + 2];
141  }*/
142 
143  TArrayD stationXScats(fNofStations);
144 
145  if (!l->fill("StationXScats", &stationXScats)) return kFALSE;
146 
147  TArrayD stationYScats(fNofStations);
148 
149  if (!l->fill("StationYScats", &stationYScats)) return kFALSE;
150 
151  for (int i = 0; i < fNofStations; ++i) {
152  fXScats[i] = stationXScats[i];
153  fYScats[i] = stationYScats[i];
154  }
155 
156  return kTRUE;
157  }
158  // ~Overridded virtual methods
159 
160  bool IsConfiguring() const { return fIsConfiguring; }
161  void SetConfiguring(bool v) { fIsConfiguring = v; }
162  bool IsOnlyPrimary() const { return fIsOnlyPrimary; }
163  void SetOnlyPrimary(bool v) { fIsOnlyPrimary = v; }
164  bool Use(ECbmModuleId m) const {
166  }
167  void SetUse(Int_t m, bool v) { fUseModules[m] = v; }
168  void SetUse(bool v) {
169  std::fill_n(fUseModules, int(ECbmModuleId::kLastModule), v);
170  }
172  std::copy(useModules,
174  fUseModules);
175  }
176  Int_t GetNofStsStations() const { return fNofStsStations; }
178  Int_t GetNofMuchStations() const { return fNofMuchStations; }
180  Int_t GetNofTrdStations() const { return fNofTrdStations; }
182  Int_t GetNofStations() const { return fNofStations; }
183  void SetNofStations(Int_t v) { fNofStations = v; }
184  /*void AddStationErrors(Double_t xErr, Double_t yErr, Double_t tErr) { fStationErrors.push_back(std::make_tuple(xErr, yErr, tErr)); }
185  Int_t GetNofStations() const { return fStationErrors.size(); }
186  Double_t GetXError(int stationNumber) const { return std::get<0> (fStationErrors[stationNumber]); }
187  Double_t GetYError(int stationNumber) const { return std::get<1> (fStationErrors[stationNumber]); }
188  Double_t GetTError(int stationNumber) const { return std::get<2> (fStationErrors[stationNumber]); }*/
189 
190  void AddStationScats(Double_t x, Double_t y) {
191  fXScats.push_back(x);
192  fYScats.push_back(y);
193  ++fNofStations;
194  }
195 
196  Double_t GetXScat(size_t stationNumber) const {
197  return stationNumber < fXScats.size() ? fXScats[stationNumber] : 0;
198  }
199  Double_t GetYScat(size_t stationNumber) const {
200  return stationNumber < fYScats.size() ? fYScats[stationNumber] : 0;
201  }
202 
203  void ResetScats() {
204  fXScats.clear();
205  fYScats.clear();
206  }
207 
208  const std::list<EPrimaryParticleId> GetPrimaryParticles() const {
209  return fPrimaryParticleIds;
210  }
211 
213  fPrimaryParticleIds.clear();
214  fPrimaryParticleIds.push_back(v);
215  }
216 
218  fPrimaryParticleIds.push_back(v);
219  }
220 
221  void SetPrimaryParticles(const std::list<EPrimaryParticleId> v) {
223  }
224  void AddPrimaryParticles(const std::list<EPrimaryParticleId> v) {
225  fPrimaryParticleIds.insert(fPrimaryParticleIds.end(), v.begin(), v.end());
226  }
227 
228 private:
235  //std::vector<std::tuple<Double_t, Double_t, Double_t> > fStationErrors;
237  std::vector<Double_t> fXScats;
238  std::vector<Double_t> fYScats;
239  std::list<EPrimaryParticleId> fPrimaryParticleIds;
240 
241  ClassDef(CbmBinnedSettings, 8)
242 };
243 
244 #endif /* CBM_BINNED_SETTINGS_H */
CbmBinnedSettings::SetPrimaryParticles
void SetPrimaryParticles(const std::list< EPrimaryParticleId > v)
Definition: Settings.h:221
CbmBinnedSettings::fPrimaryParticleIds
std::list< EPrimaryParticleId > fPrimaryParticleIds
Definition: Settings.h:239
CbmBinnedSettings::SetPrimaryParticle
void SetPrimaryParticle(EPrimaryParticleId v)
Definition: Settings.h:212
CbmBinnedSettings::GetNofStsStations
Int_t GetNofStsStations() const
Definition: Settings.h:176
CbmBinnedSettings::operator=
CbmBinnedSettings & operator=(const CbmBinnedSettings &)=delete
CbmBinnedSettings::SetNofTrdStations
void SetNofTrdStations(Int_t v)
Definition: Settings.h:181
CbmBinnedSettings::Use
bool Use(ECbmModuleId m) const
Definition: Settings.h:164
CbmSetup::IsActive
Bool_t IsActive(ECbmModuleId moduleId)
Definition: CbmSetup.cxx:123
CbmBinnedSettings::putParams
void putParams(FairParamList *l)
Definition: Settings.h:64
CbmBinnedSettings::SetNofStsStations
void SetNofStsStations(Int_t v)
Definition: Settings.h:177
CbmBinnedSettings::GetYScat
Double_t GetYScat(size_t stationNumber) const
Definition: Settings.h:199
CbmBinnedSettings::SetConfiguring
void SetConfiguring(bool v)
Definition: Settings.h:161
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmBinnedSettings::fUseModules
bool fUseModules[ToIntegralType(ECbmModuleId::kLastModule)]
Definition: Settings.h:231
CbmBinnedSettings::fYScats
std::vector< Double_t > fYScats
Definition: Settings.h:238
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
ppiNone
@ ppiNone
Definition: Settings.h:25
ppiJpsi
@ ppiJpsi
Definition: Settings.h:25
CbmBinnedSettings::CbmBinnedSettings
CbmBinnedSettings()
Definition: Settings.h:38
CbmBinnedSettings::GetPrimaryParticles
const std::list< EPrimaryParticleId > GetPrimaryParticles() const
Definition: Settings.h:208
CbmBinnedSettings::AddPrimaryParticle
void AddPrimaryParticle(EPrimaryParticleId v)
Definition: Settings.h:217
CbmBinnedSettings::fNofMuchStations
Int_t fNofMuchStations
Definition: Settings.h:233
CbmSetup.h
CbmBinnedSettings::GetNofMuchStations
Int_t GetNofMuchStations() const
Definition: Settings.h:178
CbmBinnedSettings::IsOnlyPrimary
bool IsOnlyPrimary() const
Definition: Settings.h:162
CbmBinnedSettings::AddStationScats
void AddStationScats(Double_t x, Double_t y)
Definition: Settings.h:190
CbmSetup::Instance
static CbmSetup * Instance()
Definition: CbmSetup.cxx:115
CbmBinnedSettings::GetNofTrdStations
Int_t GetNofTrdStations() const
Definition: Settings.h:180
CbmBinnedSettings::Instance
static CbmBinnedSettings * Instance()
Definition: Settings.h:29
CbmBinnedSettings::IsConfiguring
bool IsConfiguring() const
Definition: Settings.h:160
CbmBinnedSettings::fNofTrdStations
Int_t fNofTrdStations
Definition: Settings.h:234
CbmBinnedSettings::SetOnlyPrimary
void SetOnlyPrimary(bool v)
Definition: Settings.h:163
CbmBinnedSettings::CbmBinnedSettings
CbmBinnedSettings(const CbmBinnedSettings &)=delete
CbmBinnedSettings::SetNofStations
void SetNofStations(Int_t v)
Definition: Settings.h:183
CbmBinnedSettings::SetUse
void SetUse(bool useModules[ToIntegralType(ECbmModuleId::kLastModule)])
Definition: Settings.h:171
CbmBinnedSettings::ResetScats
void ResetScats()
Definition: Settings.h:203
CbmBinnedSettings::SetUse
void SetUse(Int_t m, bool v)
Definition: Settings.h:167
CbmBinnedSettings::clear
void clear()
Definition: Settings.h:58
CbmBinnedSettings::GetXScat
Double_t GetXScat(size_t stationNumber) const
Definition: Settings.h:196
CbmBinnedSettings::SetUse
void SetUse(bool v)
Definition: Settings.h:168
ECbmModuleId::kLastModule
@ kLastModule
For loops over all modules.
v
__m128 v
Definition: L1/vectors/P4_F32vec4.h:1
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
ToIntegralType
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition: CbmDefs.h:24
CbmBinnedSettings::fNofStations
Int_t fNofStations
Definition: Settings.h:236
m
__m128 m
Definition: L1/vectors/P4_F32vec4.h:26
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmBinnedSettings::fIsConfiguring
bool fIsConfiguring
Definition: Settings.h:229
CbmBinnedSettings::AddPrimaryParticles
void AddPrimaryParticles(const std::list< EPrimaryParticleId > v)
Definition: Settings.h:224
CbmBinnedSettings::fNofStsStations
Int_t fNofStsStations
Definition: Settings.h:232
CbmBinnedSettings
Definition: Settings.h:27
CbmBinnedSettings::fIsOnlyPrimary
bool fIsOnlyPrimary
Definition: Settings.h:230
EPrimaryParticleId
EPrimaryParticleId
Definition: Settings.h:25
CbmBinnedSettings::GetNofStations
Int_t GetNofStations() const
Definition: Settings.h:182
CbmBinnedSettings::getParams
Bool_t getParams(FairParamList *l)
Definition: Settings.h:105
CbmBinnedSettings::SetNofMuchStations
void SetNofMuchStations(Int_t v)
Definition: Settings.h:179
CbmBinnedSettings::fXScats
std::vector< Double_t > fXScats
Definition: Settings.h:237
CbmDefs.h