KaliVeda
Toolkit for HIC analysis
KVZDependentCalibratedSignal.h
1 
4 #ifndef __KVZDEPENDENTCALIBRATEDSIGNAL_H
5 #define __KVZDEPENDENTCALIBRATEDSIGNAL_H
6 
7 #include "KVCalibratedSignal.h"
8 
32 #include <map>
33 
35  mutable std::map<int, KVCalibratedSignal*> fSignalMap;
37 
38 public:
41  : KVCalibratedSignal(input, output)
42  {}
44 
45  void AddSignal(KVCalibratedSignal* sig, const KVNumberList& zrange);
46 
47  Double_t GetValue(const KVNameValueList& params = "") const
48  {
49  KVCalibratedSignal* sig = GetSignal(params);
50  return (sig ? sig->GetValue(params) : -1);
51  }
52  Double_t GetInverseValue(Double_t out_val, const TString& in_sig, const KVNameValueList& params = "") const
53  {
54  KVCalibratedSignal* sig = GetSignal(params);
55  return (sig ? sig->GetInverseValue(out_val, in_sig, params) : -1);
56  }
57 
59  {
62 
63  if (!params.HasIntParameter("Z")) {
64  Error("GetSignal", "%s: No Z parameter given in KVNameValueList!", GetName());
65  return nullptr;
66  }
67  KVCalibratedSignal* sig = fSignalMap[params.GetIntValue("Z")];
68  if (!sig) {
70  }
71  return sig;
72  }
73 
74  Bool_t IsAvailableFor(const KVNameValueList& params) const
75  {
77 
78  if (!params.HasIntParameter("Z")) return false;
79  KVCalibratedSignal* ds = fSignalMap[params.GetIntValue("Z")];
80  if (ds) return ds->IsAvailableFor(params);
81  return kFALSE;
82  }
83 
85  {
86  return kTRUE;
87  }
88 
89  ClassDef(KVZDependentCalibratedSignal, 1) //Handle several calibrations valid for different Z ranges
90 };
91 
92 #endif
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Output signal from detector obtained by calibration.
virtual Bool_t IsAvailableFor(const KVNameValueList &params) const
Double_t GetValue(const KVNameValueList &params="") const
Double_t GetInverseValue(Double_t out_val, const TString &in_sig, const KVNameValueList &params="") const
Base class for output signal data produced by a detector.
Extended TList class which owns its objects by default.
Definition: KVList.h:28
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Int_t GetIntValue(const Char_t *name) const
Bool_t HasIntParameter(const Char_t *name) const
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Handle several calibrations valid for different Z ranges.
Bool_t IsAvailableFor(const KVNameValueList &params) const
void AddSignal(KVCalibratedSignal *sig, const KVNumberList &zrange)
Add signal to be used for all values of Z in the number list range.
std::map< int, KVCalibratedSignal * > fSignalMap
Double_t GetValue(const KVNameValueList &params="") const
KVZDependentCalibratedSignal(KVDetectorSignal *input, const KVString &output)
Double_t GetInverseValue(Double_t out_val, const TString &in_sig, const KVNameValueList &params="") const
KVList fSignals
to cleanup signals on delete
KVCalibratedSignal * GetSignal(const KVNameValueList &params) const
const char * GetName() const override
virtual void Error(const char *method, const char *msgfmt,...) const