BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
GrXtCalib Class Reference

#include <GrXtCalib.h>

+ Inheritance diagram for GrXtCalib:

Public Member Functions

 GrXtCalib ()
 
 ~GrXtCalib ()
 
void init (TObjArray *hlist, MdcCosGeom *pGeom)
 
void mergeHist (TFile *fhist)
 
void calib (MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)
 
- Public Member Functions inherited from CalibBase
 CalibBase ()
 
virtual ~CalibBase ()
 
virtual void init (TObjArray *hlist, MdcCosGeom *pGeom)=0
 
virtual void mergeHist (TFile *fhist)=0
 
virtual void calib (MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
 

Detailed Description

Definition at line 11 of file GrXtCalib.h.

Constructor & Destructor Documentation

◆ GrXtCalib()

GrXtCalib::GrXtCalib ( )

Definition at line 9 of file GrXtCalib.cpp.

9 {
10 m_maxNhit = 5000;
11 m_nMaxEd = 1000;
12 for(int lay=0; lay<NLAYER; lay++){
13 if(lay<8) m_tEd[lay] = 200.0;
14 else m_tEd[lay] = 300.0;
15 }
16 cout << "Calibration type: GrXtCalib" << endl;
17}

◆ ~GrXtCalib()

GrXtCalib::~GrXtCalib ( )

Definition at line 19 of file GrXtCalib.cpp.

19 {
20}

Member Function Documentation

◆ calib()

void GrXtCalib::calib ( MdcCalibConst calconst,
TObjArray *  newXtList,
TObjArray *  r2tList 
)
virtual

Implements CalibBase.

Definition at line 81 of file GrXtCalib.cpp.

81 {
82 CalibBase::calib(calconst, newXtList, r2tList);
83
84 int ord;
85 double xtpar[NLAYER][NENTRXT][NLR][8];
86 TF1* fxtDr = new TF1("fxtDr", xtFitFun, 0, 300, 6);
87 TF1* fxtEd = new TF1("fxtEd", xtFitEdge, 150, 500, 1);
88 if(1 == gfixXtC0) fxtDr -> FixParameter(0, 0);
89
90 for(int lay=0; lay<NLAYER; lay++){
91 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
92 for(int lr=0; lr<NLR; lr++){
93 m_fgFit[lay][iEntr][lr] = false;
94 if(0 == gFgCalib[lay]) continue;
95
96 if(m_nhitIn[lay][iEntr][lr] > 1000){
97 Tmax = calconst -> getXtpar(lay, iEntr, lr, 6);
98
99 m_grxt[lay][iEntr][lr] -> Fit("fxtDr", "Q+", "", 0, Tmax);
100 for(ord=0; ord<6; ord++){
101 xtpar[lay][iEntr][lr][ord] = fxtDr->GetParameter(ord);
102 }
103 xtpar[lay][iEntr][lr][6] = Tmax;
104
105 Dmax = 0.0;
106 for(ord=0; ord<6; ord++) Dmax += xtpar[lay][iEntr][lr][ord] * pow(Tmax, ord);
107
108 if(m_nhitEd[lay][iEntr][lr] > 300){
109 m_grxt[lay][iEntr][lr] -> Fit("fxtEd", "Q+", "", Tmax, Tmax+300);
110 xtpar[lay][iEntr][lr][7] = fxtEd->GetParameter(0);
111 if(xtpar[lay][iEntr][lr][7] < 0.0) xtpar[lay][iEntr][lr][7] = 0.0;
112 } else{
113 xtpar[lay][iEntr][lr][7] = 0.0;
114 }
115
116 m_fgFit[lay][iEntr][lr] = true;
117 }
118
119 } // end of lr loop
120 } // end of entrance angle loop
121 } // end of layer loop
122
123 ofstream fxtlog("xtlog");
124 for(int lay=0; lay<NLAYER; lay++){
125 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
126 for(int lr=0; lr<NLR; lr++){
127 fxtlog << setw(3) << lay << setw(3) << iEntr << setw(3) << lr;
128
129 int fgUpdate = -1;
130 if(m_fgFit[lay][iEntr][lr]){
131 fgUpdate = 1;
132 for(ord=0; ord<8; ord++) calconst->resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntr][lr][ord]);
133 } else{
134 int iEntrNew = findXtEntr(lay, iEntr, lr);
135 if(-1 != iEntrNew){
136 fgUpdate = 2;
137 for(ord=0; ord<8; ord++){
138 calconst->resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntrNew][lr][ord]);
139 }
140 }
141 }
142 fxtlog << setw(3) << fgUpdate;
143 for(ord=0; ord<8; ord++){
144 double par = calconst -> getXtpar(lay, iEntr, lr, ord);
145 if(6==ord) fxtlog << setw(9) << par;
146 else fxtlog << setw(14) << par;
147 }
148 fxtlog << endl;
149 }
150 }
151 }
152 fxtlog.close();
153
154 cout << "Xt update finished. File xtlog was written." << endl;
155
156 renameHist();
157 delete fxtDr;
158 delete fxtEd;
159}
void Fit()
Definition: Eangle1D/Fit.cxx:3
Double_t xtFitEdge(Double_t *x, Double_t par[])
Double_t xtFitFun(Double_t *x, Double_t par[])
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
Definition: CalibBase.cpp:711
void resetXtpar(int lay, int entr, int lr, int order, double val)

◆ init()

void GrXtCalib::init ( TObjArray *  hlist,
MdcCosGeom pGeom 
)
virtual

Implements CalibBase.

Definition at line 22 of file GrXtCalib.cpp.

22 {
23 CalibBase::init(hlist, pGeom);
24
25 m_fdXt = new TFolder("mfdxt","fdxt");
26 hlist->Add(m_fdXt);
27
28 m_haxis = new TH2F("axis", "", 50, 0, 300, 50, 0, 9);
29 m_haxis -> SetStats(0);
30 m_fdXt -> Add(m_haxis);
31
32 char hname[200];
33 for(int lay=0; lay<NLAYER; lay++){
34 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
35 for(int lr=0; lr<NLR; lr++){
36 m_nhitIn[lay][iEntr][lr] = 0;
37 m_nhitEd[lay][iEntr][lr] = 0;
38
39 sprintf(hname, "mgrXt%02d_%02d_lr%01d", lay, iEntr, lr);
40 m_grxt[lay][iEntr][lr] = new TGraph();
41 m_grxt[lay][iEntr][lr] -> SetName(hname);
42 m_grxt[lay][iEntr][lr] -> SetMarkerStyle(10);
43 m_grxt[lay][iEntr][lr] -> SetLineColor(10);
44 m_fdXt -> Add(m_grxt[lay][iEntr][lr]);
45 }
46 }
47 }
48}
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
Definition: CalibBase.cpp:14
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
gr1 SetLineColor(1)
gr1 SetMarkerStyle(8)
mg Add(gr3)

◆ mergeHist()

void GrXtCalib::mergeHist ( TFile *  fhist)
virtual

Implements CalibBase.

Definition at line 50 of file GrXtCalib.cpp.

50 {
52
53 double tdr, doca;
54 char hname[200];
55 TFolder* fd = (TFolder*)fhist->Get("fdXtGr");
56 for(int lay=0; lay<NLAYER; lay++){
57 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
58 for(int lr=0; lr<NLR; lr++){
59 if((m_nhitIn[lay][iEntr][lr] > m_maxNhit) && (m_nhitEd[lay][iEntr][lr] > m_nMaxEd)) continue;
60
61 sprintf(hname, "grXt%02d_%02d_lr%01d", lay, iEntr, lr);
62 TGraph* gr = (TGraph*)fd->FindObjectAny(hname);
63 int nPoint = gr->GetN();
64 for(int i=0; i<nPoint; i++){
65 gr->GetPoint(i, tdr, doca);
66 if((tdr < m_tEd[lay]) && (m_nhitIn[lay][iEntr][lr] <= m_maxNhit)){
67 int np = m_grxt[lay][iEntr][lr]->GetN();
68 m_grxt[lay][iEntr][lr]->SetPoint(np, tdr, doca);
69 m_nhitIn[lay][iEntr][lr]++;
70 } else if((tdr >= m_tEd[lay]) && (m_nhitEd[lay][iEntr][lr] <= m_nMaxEd)){
71 int np = m_grxt[lay][iEntr][lr]->GetN();
72 m_grxt[lay][iEntr][lr]->SetPoint(np, tdr, doca);
73 m_nhitEd[lay][iEntr][lr]++;
74 }
75 }
76 }
77 }
78 }
79}
TGraph * gr
virtual void mergeHist(TFile *fhist)=0
Definition: CalibBase.cpp:365

The documentation for this class was generated from the following files: