KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVZDependentCalibratedSignal.h
Go to the documentation of this file.
1 
4 #ifndef __KVZDEPENDENTCALIBRATEDSIGNAL_H
5 #define __KVZDEPENDENTCALIBRATEDSIGNAL_H
6 
7 #include "KVCalibratedSignal.h"
8 
31 #include <map>
32 
34  mutable std::map<int, KVCalibratedSignal*> fSignalMap;
36 
37 public:
40  : KVCalibratedSignal(input, output)
41  {}
43 
44  void AddSignal(KVCalibratedSignal* sig, const KVNumberList& zrange);
45 
46  Double_t GetValue(const KVNameValueList& params = "") const
47  {
48  KVCalibratedSignal* sig = GetSignal(params);
49  return (sig ? sig->GetValue(params) : -1);
50  }
51  Double_t GetInverseValue(Double_t out_val, const TString& in_sig, const KVNameValueList& params = "") const
52  {
53  KVCalibratedSignal* sig = GetSignal(params);
54  return (sig ? sig->GetInverseValue(out_val, in_sig, params) : -1);
55  }
56 
58  {
61 
62  if (!params.HasIntParameter("Z")) {
63  Error("GetSignal", "%s: No Z parameter given in KVNameValueList!", GetName());
64  return nullptr;
65  }
66  KVCalibratedSignal* sig = fSignalMap[params.GetIntValue("Z")];
67  if (!sig) {
69  }
70  return sig;
71  }
72 
73  Bool_t IsAvailableFor(const KVNameValueList& params) const
74  {
76 
77  if (!params.HasIntParameter("Z")) return false;
78  KVCalibratedSignal* ds = fSignalMap[params.GetIntValue("Z")];
79  if (ds) return ds->IsAvailableFor(params);
80  return kFALSE;
81  }
82 
84  {
85  return kTRUE;
86  }
87 
88  ClassDef(KVZDependentCalibratedSignal, 1) //Handle several calibrations valid for different Z ranges
89 };
90 
91 #endif
const Bool_t kFALSE
bool Bool_t
double Double_t
const Bool_t kTRUE
#define ClassDef(name, id)
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:27
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:83
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
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
virtual const char * GetName() const
virtual void Error(const char *method, const char *msgfmt,...) const