Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
readDigitalCurrents.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file readDigitalCurrents.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef READDIGITALCURRENTS_READDIGITALCURRENTS_H
4 #define READDIGITALCURRENTS_READDIGITALCURRENTS_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 #include <fstream>
12 
13 #include <cmath> // for sin, asin, cos, floor, M_PI
14 
16 class PHCompositeNode;
17 
18 //class PHG4CylinderCellGeom;
19 
20 //class TFile;
21 class TH1;
22 class TH2;
23 class TH3;
24 
25 
27 {
28  public:
29 
30  readDigitalCurrents(const std::string &name = "readDigitalCurrents", const std::string &filename = "DC_Hist_OnPlane_WIBF.root");
31 
32  virtual ~readDigitalCurrents();
33 
39  int Init(PHCompositeNode *topNode) override;
40 
46  int InitRun(PHCompositeNode *topNode) override;
47 
51  int process_event(PHCompositeNode *topNode) override;
52 
54  int ResetEvent(PHCompositeNode *topNode) override;
55 
57  int EndRun(const int runnumber) override;
58 
60  int End(PHCompositeNode *topNode) override;
61 
63  int Reset(PHCompositeNode * /*topNode*/) override;
64 
65  void Print(const std::string &what = "ALL") const override;
66 
67  void SetBeamXing(const std::vector<int> &beamXs);
68  void SetEvtStart(int newEvtStart);
69  void FillCSV(int fillCSVFile);
70  void SetCollSyst(int coll_syst=0);
71  void SetIBF(float ampIBFfrac=0.004);
72  void SetCCGC(float f_ccgc=0);
73 
74  //double pi = 3.14159265358979323846;//2 * acos(0.0);
75 
76  protected:
77  Fun4AllHistoManager *hm = nullptr;
79  //TFile *outfile = nullptr;
80  std::map<int,int> _timestamps;
81  std::vector<int> _keys;
82  float _ampIBFfrac = 0.02;
83  int _collSyst = 0;
84  std::ofstream myCSVFile;
85 
86  private:
87  std::vector<int> _beamxing;
88  int _evtstart = 0;
89 
90  int _fillCSVFile = 0;
91 
92  int _f_ccgc = 0;
93 
94  TH2* _h_modules_measuredibf = nullptr;
95 
96  TH1* _h_R = nullptr;
97  TH1* _h_hits = nullptr;
98  TH3* _h_DC_SC = nullptr;
99  TH2* _h_DC_SC_XY = nullptr;
100  TH2* _h_hit_XY = nullptr;
101  TH2* _h_DC_E = nullptr;
102  //TH3* _h_SC_ibf = nullptr;
103  static const int nFrames = 30;
104  TH3 *_h_SC_ibf[nFrames] = {nullptr};
105 
106  float _event_timestamp = 0;
107  float _event_bunchXing = 0;
108 
109  //double pi = 2 * acos(0.0);
110  double adc_pedestal=0.;//74.4;
111  double cm=1e1,m=1e3, mm=1; //changed to make 'm' 1.0, for convenience.
112  float ns=1e-9,us=1e-6,ms=1e-3,s=1;
113  float V=1;
114  //float ionMobility=3.37*cm*cm/V/s;
115  float ionMobility=1.65*cm*cm/V/s;
116  float vIon=ionMobility*400*V/cm;
117 
118  float f=0.5;//for now, just pick the middle of the hit. Do better later.
119 };
120 
121 #endif // READDIGITALCURRENTS_H