Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TpcDigitizer.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TpcDigitizer.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4TPC_PHG4TPCDIGITIZER_H
4 #define G4TPC_PHG4TPCDIGITIZER_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <trackbase/TrkrDefs.h>
9 #include <trackbase/TrkrHitSet.h>
10 
11 #include <map>
12 #include <string> // for string
13 #include <utility> // for pair, make_pair
14 #include <vector>
15 
16 #include <gsl/gsl_rng.h>
17 
18 class PHCompositeNode;
19 
21 {
22  public:
23  PHG4TpcDigitizer(const std::string &name = "PHG4TpcDigitizer");
24  ~PHG4TpcDigitizer() override;
25 
27  int Init(PHCompositeNode * /*topNode*/) override { return 0; }
28 
30  int InitRun(PHCompositeNode *topNode) override;
31 
33  int process_event(PHCompositeNode *topNode) override;
34 
36  int End(PHCompositeNode * /*topNode*/) override { return 0; };
37 
38  void set_adc_scale(const int layer, const unsigned int max_adc, const float energy_per_adc)
39  {
40  _max_adc.insert(std::make_pair(layer, max_adc));
41  _energy_scale.insert(std::make_pair(layer, energy_per_adc));
42  }
43 
44  void SetTpcMinLayer(const int minlayer) { TpcMinLayer = minlayer; };
45  void SetADCThreshold(const float thresh) { ADCThreshold = thresh; };
46  void SetENC(const float enc) { TpcEnc = enc; };
47  void set_drift_velocity(float vd) {_drift_velocity = vd;}
48  void set_skip_noise_flag(const bool skip) {skip_noise = skip;}
49 
50  private:
53  float added_noise();
54  float add_noise_to_bin(float signal);
55 
56  unsigned int TpcMinLayer;
57  unsigned int TpcNLayers;
58  float ADCThreshold;
59  float ADCThreshold_mV = 0;
60  float TpcEnc;
61  float Pedestal;
63  float _drift_velocity = 8.0e-3; // override from macro with simulation drift velocity
64 
67 
68  bool skip_noise = false;
69 
70  std::vector<std::vector<TrkrHitSet::ConstIterator> > phi_sorted_hits;
71  std::vector<std::vector<TrkrHitSet::ConstIterator> > t_sorted_hits;
72 
73  std::vector<float> adc_input;
74  std::vector<TrkrDefs::hitkey> adc_hitid;
75  std::vector<int> is_populated;
76 
77  // settings
78  std::map<int, unsigned int> _max_adc;
79  std::map<int, float> _energy_scale;
80 
82  gsl_rng *RandomGenerator;
83 };
84 
85 #endif