er  dev
ERSupport.h
1 
2 
3 #ifndef ERSupport_H
4 #define ERSupport_H
5 
6 #include <map>
7 #include <limits>
8 
9 #include "TMatrixD.h"
10 #include "TString.h"
11 
12 #include "FairLogger.h"
13 
14 using ERChannel = ushort;
15 namespace consts {
16  const unsigned short undefined_channel = std::numeric_limits<ERChannel>::max();
17  // Averaged numbers of objects in events. Used as TClonesArray capacitance.
18  // Сan affect the efficiency of calculations in case of an obvious
19  // mismatch with the real numbers of objects.
20  const int approx_beamdet_point_number = 100;
21  const int approx_beamdet_tof_digi_number = 10;
22  const int approx_beamdet_mwpc_digi_number = 100;
23  const int approx_beamdet_track_number = 10;
24  const int approx_beamdet_particle_number = 10;
25  const int approx_telescope_point_number = 100;
26  const int approx_telescope_digi_number = 10;
27  const int approx_telescope_track_number = 10;
28  const int approx_telescope_particle_number = 10;
29 }
30 enum ERDataObjectType {Point, Digi, Track, Particle};
31 inline TString ERDataObjectTypeStr(ERDataObjectType object) {
32  switch(object) {
33  case Point : return "Point";
34  case Digi : return "Digi";
35  case Track : return "Track";
36  case Particle : return "Particle";
37  default : LOG(FATAL) << "Unknown ERDataObject type\n";
38  }
39  return "";
40 }
41 enum ChannelSide {First, Second, None};
42 enum SensetiveType {Si, CsI, LaBr};
43 enum OrientationAroundZ {X, Y, Default};
44 inline TString SensetiveTypeStr(SensetiveType type) {
45  switch(type) {
46  case Si : return "Si";
47  case CsI : return "CsI";
48  case LaBr : return "LaBr";
49  default : LOG(FATAL) << "Unknown telescope sensetive type\n";
50  }
51  return "";
52 }
53 inline TString ChannelSideStr(ChannelSide side) {
54  switch(side) {
55  case First : return "1";
56  case Second : return "2";
57  case None : LOG(FATAL)
58  << "String representation for None channel side is not available\n";
59  default : LOG(FATAL) << "Unknown telescope channel side\n";
60  }
61  return "";
62 }
63 inline TString OrientationAroundZStr(OrientationAroundZ type) {
64  switch(type) {
65  case X : return "X";
66  case Y : return "Y";
67  case Default : LOG(FATAL)
68  << "String representation for Default orientation around Z is not available\n";
69  default : LOG(FATAL) << "Unknown telescope orientation around z\n";
70  }
71  return "";
72 }
73 
74 class G4ParticleDefinition;
75 class G4Material;
76 
77 #define TempNorm 293.16 /* Normal temperature (K) */
78 #define AMU 931.494028 /* atomic mass unit (MeV) */
79 
80 TMatrixD* ReadCalFile(TString fileName);
81 double EiEo(double tableER[][105],double Tp,double Rp);
82 int ReadRint(char* Fname,double Ranges[][105]);
83 int intrp4(double* x,double* y, double* c);
84 
85 Double_t CalcElossIntegralVolStep(Double_t T, const G4ParticleDefinition& ion,
86  const G4Material& mat, const Double_t range,
87  const Double_t intStep=1e-4);
88 
89 Double_t ComputeElossIntegralVolStep(Double_t kineticEnergy, const G4ParticleDefinition& particle,
90  const G4Material& material, const TString& process_name,
91  const Double_t range);
93  public:
94  static double CalcDeDx_long(const TString& material, int pdg, double kineticEnergy,const Double_t range);
95  static double CalcDeDx(const TString& material, int pdg, double kineticEnergy);
96  ClassDef(ElossCalculator,1)
97 };
98 
99 #endif