StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFcsPointMaker.h
1 // $Id: StFcsPointMaker.h,v 1.1 2021/03/30 13:40:10 akio Exp $
2 
3 #ifndef STROOT_STFCSPOINTMAKER_STFCSPOINTMAKER_H_
4 #define STROOT_STFCSPOINTMAKER_STFCSPOINTMAKER_H_
5 
6 #include "TMinuit.h"
7 #include "StMaker.h"
8 
9 class StFcsCollection;
10 class StFcsHit;
11 class StFcsCluster;
12 class StFcsPoint;
13 class StFcsDb;
14 class StMuDst;
15 
16 class StFcsPointMaker : public StMaker {
17 public:
18 
19  StFcsPointMaker(const char* name = "StFcsPointMaker");
20  ~StFcsPointMaker();
21  int InitRun(int runNumber);
22  int Make();
23  void Clear(Option_t* option = "");
24 
27  //void SetReadMuDst(int v=1) {mReadMuDst=v;}
28 
29  void setDebug(int v) {SetDebug(v);}
30  void setMinuitPrintLevel(int v) {mMinuit.SetPrintLevel(v);}
31 
32  void setShowerShape(int v) {mShowerShape=v;}
33  void setShowerShapeScale(float v) {mShowerShapeScale=v;}
34 
35  //1 photon fit switches and parameters
36  void set_PH1_FixEnergy(int v) {m_PH1_FixEnergy=v;}
37  void set_PH1_Delta_X(double v) {m_PH1_Delta_X=v;}
38  void set_PH1_Delta_E(double v) {m_PH1_Delta_E=v;}
39 
40  //2 photon fit switches and parameters
41  void set_PH2_FixEnergy(int v) {m_PH2_FixEnergy=v;}
42  void set_PH2_FixTheta(int v) {m_PH2_FixTheta=v;}
43  void set_PH2_Delta_X(double v) {m_PH2_Delta_X=v;}
44  void set_PH2_Delta_E(double v) {m_PH2_Delta_E=v;}
45  void set_PH2_Low_Dgg(double v) {m_PH2_Low_Dgg=v;}
46  void set_PH2_High_Dgg(double v) {m_PH2_High_Dgg=v;}
47  void set_PH2_MaxTheta_F(double v){m_PH2_MaxTheta_F=v;}
48  void set_PH2_StartDggFactor(double v) {m_PH2_StartDggFactor=v;}
49 
50  private:
51  void setShowerShapeParameters(int det);
52  void fitClusters(int det); // fitting for a detector
53  double fit1PhotonCluster(StFcsCluster* c, StFcsPoint* p); //fit with 1 photon
54  double fit2PhotonCluster(StFcsCluster* c, StFcsPoint* p1, StFcsPoint* p2); //fit with 2 photon
55 
56  //TMinuit minimization function. This has to be void(*)(int &, double *, double &f, double *, int)
57  static void minimizationFunctionNPhoton(int& npar, double* grad, double& fval, double* par, int flag);
58  static void minimizationFunction2Photon(int& npar, double* grad, double& fval, double* par, int flag);
59  static double energyDepositionInTower(double x, double y,double xun, double yun);
60 
61  StFcsDb* mDb=0;
62  StFcsCollection* mFcsCollection=0;
63 
64  int mShowerShape=0;
65  float mShowerShapeScale=1.0;
66 
67  TMinuit mMinuit;
68 
69  //1 photon fit switch and parameters
70  int m_PH1_FixEnergy=1;
71  double m_PH1_Delta_X=0.5;
72  double m_PH1_Delta_E=1.15;
73 
74  //2 photon fit switch and parameters
75  int m_PH2_FixEnergy=1;
76  int m_PH2_FixTheta=1;
77  double m_PH2_Delta_X=0.2;
78  double m_PH2_Delta_E=1.05;
79  double m_PH2_Low_Dgg=0.8;
80  double m_PH2_High_Dgg=3.0;
81  double m_PH2_MaxTheta_F=TMath::PiOver2();
82  double m_PH2_StartDggFactor=1.1;
83 
84  virtual const Char_t *GetCVS() const {static const Char_t cvs[]="Tag " __DATE__ " " __TIME__ ; return cvs;}
85  ClassDef(StFcsPointMaker, 0)
86 };
87 
88 // single shower shape compornent integral
89 inline double showerShapeComponent(double x, double y, double a, double b) {
90  if(a==0.0) return 0.0;
91  return a * atan(x * y / (b * sqrt(b * b + x * x + y * y)));
92 }
93 
94 // adding 3 compporments of shower shape integrals
95 inline double energyDepositionDistribution(double x, double y, double* parameters){
96  constexpr double ootwopi = 1.0/2.0/3.14159265358979323846;
97  return ( showerShapeComponent(x, y, parameters[1], parameters[4])
98  + showerShapeComponent(x, y, parameters[2], parameters[5])
99  + showerShapeComponent(x, y, parameters[3], parameters[6]) ) * ootwopi;
100 }
101 
102 // getting shower shape integrals to corners and subtract to get integral in a cell
103 inline double energyDepositionInTowerSingleLayer(double x, double y, double* parameters){
104  return energyDepositionDistribution(x-0.5, y-0.5, parameters)
105  - energyDepositionDistribution(x-0.5, y+0.5, parameters)
106  - energyDepositionDistribution(x+0.5, y-0.5, parameters)
107  + energyDepositionDistribution(x+0.5, y+0.5, parameters);
108 }
109 
110 #endif // STROOT_STFCSPOINTMAKER_STFCSPOINTMAKER_H_
111 
void Clear(Option_t *option="")
User defined functions.
void setDebug(int v)