PandaRoot
PndSdsChargeConversion.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef PNDSDSCHARGECONVERSION_H
14 #define PNDSDSCHARGECONVERSION_H
15 
18 
19 #include <map>
20 #include "TObject.h"
21 #include "TString.h"
22 #include "PndSdsDigi.h"
23 
25 
26 class PndSdsChargeConversion : public TObject {
27  public:
28  PndSdsChargeConversion(ConvType type) : fParams(), it(), fConvType(type){};
30  virtual void StartExecute(){};
31  virtual void EndExecute(){};
32  virtual Double_t ChargeToDigiValue(Double_t Charge) = 0;
33  virtual Double_t DigiValueToCharge(Double_t digi) = 0;
34  virtual Double_t DigiValueToCharge(PndSdsDigi &digi);
35  virtual Double_t GetRelativeError(Double_t Charge) = 0;
36  virtual Double_t GetTimeStamp(Double_t tof, Double_t charge, Double_t MCEventTime) = 0;
37  virtual Double_t GetTimeWalk(Double_t) { return 0; }; // charge //[R.K.03/2017] unused variable(s) ///< Time between hit in detector and the time stamp assigned to the hit
38  // virtual Double_t GetTimeWalk(Int_t tot){
39  // return GetTimeWalk(DigiValueToCharge(tot));
40  // }
41  virtual Double_t GetTimeStampErrorAfterCorrection() { return 1; }
42 
43  virtual Double_t GetTimeStep() { return 0; };
44 
45  Double_t GetParameter(TString param)
46  {
47  it = fParams.find(param);
48  if (it == fParams.end()) {
49  Error("GetParameter(TString param)", "No parameter named: %s", param.Data());
50  return -1;
51  }
52  return it->second;
53  };
54  void SetParameter(TString param, Double_t value)
55  {
56  if (value < 0)
57  Error("SetParameter(TString param, Double_t value)", "invalid value for param: %s", param.Data());
58  fParams.insert(std::pair<TString, Double_t>(param, value));
59  };
60 
61  private:
62  std::map<TString, Double_t> fParams;
63  std::map<TString, Double_t>::iterator it;
64  ConvType fConvType;
65 
66  ClassDef(PndSdsChargeConversion, 2);
67 };
68 #endif /* PNDSDSCHARGECONVERSION_H */
Base class for Digi information.
Definition: PndSdsDigi.h:43
virtual Double_t GetTimeStep()
virtual Double_t GetRelativeError(Double_t Charge)=0
virtual Double_t GetTimeStamp(Double_t tof, Double_t charge, Double_t MCEventTime)=0
absolute time stamp of a hit in ns (clock is taken into account)
virtual Double_t DigiValueToCharge(Double_t digi)=0
Converts a given digitized charge into charge in electrons.
PndSdsChargeConversion(ConvType type)
Double_t GetParameter(TString param)
virtual Double_t GetTimeStampErrorAfterCorrection()
virtual Double_t ChargeToDigiValue(Double_t Charge)=0
Converts a given charge in electrons into the electronics answer e.g. ToT [ns].
virtual Double_t GetTimeWalk(Double_t)
void SetParameter(TString param, Double_t value)