BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
XtInteCalib Class Reference

#include <XtInteCalib.h>

+ Inheritance diagram for XtInteCalib:

Public Member Functions

 XtInteCalib ()
 
 ~XtInteCalib ()
 
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 12 of file XtInteCalib.h.

Constructor & Destructor Documentation

◆ XtInteCalib()

XtInteCalib::XtInteCalib ( )

Definition at line 10 of file XtInteCalib.cpp.

10 {
11 m_nMaxGrPoint = 5000;
12 for(int lay=0; lay<NLAYER; lay++){
13 m_tbinWid[lay][0] = 5.0;
14 m_tbinWid[lay][1] = 10.0;
15 m_tbinWid[lay][2] = 20.0;
16
17 m_tbinLim[lay][0] = -10.0;
18 m_tbinLim[lay][1] = 30.0;
19 if(lay < 8) m_tbinLim[lay][2] = 210.0;
20 else m_tbinLim[lay][2] = 350.0;
21 m_tbinLim[lay][3] = 990.0;
22 }
23 cout << "Calibration type: XtInteCalib" << endl;
24}

◆ ~XtInteCalib()

XtInteCalib::~XtInteCalib ( )

Definition at line 26 of file XtInteCalib.cpp.

26 {
27}

Member Function Documentation

◆ calib()

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

Implements CalibBase.

Definition at line 104 of file XtInteCalib.cpp.

104 {
105 CalibBase::calib(calconst, newXtList, r2tList);
106 bool fgOldXt = saveOldXt(newXtList);
107 newXtList->Clear();
108
109 TGraph* grXtfit[NLAYER][NENTRXT][2];
110 char hname[200];
111 for(int lay=0; lay<NLAYER; lay++){
112 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
113 for(int lr=0; lr<2; lr++){
114 m_vt.clear();
115 m_vd.clear();
116 m_entries.clear();
117 for(int iPf=0; iPf<3; iPf++){
118 TProfile* pro;
119 if(0==iPf) pro = m_pfNear[lay][iEntr][lr];
120 else if(1==iPf) pro = m_pfMid[lay][iEntr][lr];
121 else pro = m_pfFar[lay][iEntr][lr];
122
123 int nbin = pro->GetNbinsX();
124 for(int i=0; i<nbin; i++){
125 double tt = pro->GetBinCenter(i+1);
126 double dd = pro->GetBinContent(i+1);
127 double entries = pro->GetBinEntries(i+1);
128 if(entries > 10){
129 m_vt.push_back(tt);
130 m_vd.push_back(dd);
131 m_entries.push_back(entries);
132 }
133 }
134 }
135 unsigned vsize = m_vt.size();
136 if(vsize > 10){
137 for(int i=0; i<2; i++){
138 double slope = (m_vd[vsize-1]-m_vd[vsize-2])/(m_vt[vsize-1]-m_vt[vsize-2]);
139 if(fabs(slope)>0.04){ // 0.8mm/20ns
140 m_vt.pop_back();
141 m_vd.pop_back();
142 m_entries.pop_back();
143 vsize = m_vt.size();
144 }
145 }
146 }
147 sprintf(hname, "grXtFit%02d_%02d_%d", lay, iEntr, lr);
148 grXtfit[lay][iEntr][lr] = new TGraph();
149 grXtfit[lay][iEntr][lr]->SetName(hname);
150 grXtfit[lay][iEntr][lr]->SetMarkerStyle(20);
151 m_fgFit[lay][iEntr][lr] = getXt(lay, iEntr, lr, grXtfit[lay][iEntr][lr]);
152 }
153 }
154 }
155
156 double tdr, doca;
157 for(int lay=0; lay<NLAYER; lay++){
158 double tCut = 500.0;
159 if(lay<8) tCut = 400.0;
160 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
161 for(int lr=0; lr<2; lr++){
162 if(!m_fgFit[lay][iEntr][lr]){
163 int iEntrNew = findXtEntr(lay, iEntr, lr);
164 if(-1 != iEntrNew){
165 int npoint = grXtfit[lay][iEntrNew][lr]->GetN();
166 for(int i=0; i<npoint; i++){
167 grXtfit[lay][iEntrNew][lr]->GetPoint(i, tdr, doca);
168 grXtfit[lay][iEntr][lr]->SetPoint(i, tdr, doca);
169 }
170 } else if(fgOldXt) {
171 cout << grXtfit[lay][iEntr][lr]->GetName() << " use old x-t" << endl;
172 int npoint = m_grXtOld[lay][iEntr][lr]->GetN();
173 for(int i=0; i<npoint; i++){
174 m_grXtOld[lay][iEntr][lr]->GetPoint(i, tdr, doca);
175 grXtfit[lay][iEntr][lr]->SetPoint(i, tdr, doca);
176 }
177 }
178 }
179 int nn = grXtfit[lay][iEntr][lr]->GetN();
180 double tmax, dmax;
181 grXtfit[lay][iEntr][lr]->GetPoint(nn-1, tmax, dmax);
182 if(tmax > tCut) m_fgEdge[lay][iEntr][lr] = true;
183 else m_fgEdge[lay][iEntr][lr] = false;
184 }
185 }
186 }
187
188 for(int lay=0; lay<NLAYER; lay++){
189 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
190 for(int lr=0; lr<2; lr++){
191 if(!m_fgEdge[lay][iEntr][lr]){
192 int iEntrNew = findXtEntrEdge(lay, iEntr, lr);
193 if(-1 != iEntrNew){
194 double t1, d1;
195 int n1 = grXtfit[lay][iEntr][lr]->GetN();
196 grXtfit[lay][iEntr][lr]->GetPoint(n1-1, t1, d1);
197 double t2, d2;
198 int n2 = grXtfit[lay][iEntrNew][lr]->GetN();
199 for(int i=0; i<n2; i++){
200 grXtfit[lay][iEntrNew][lr]->GetPoint(i, t2, d2);
201 if(t2 > t1){
202 grXtfit[lay][iEntr][lr]->SetPoint(n1, t2, d2);
203 n1++;
204 }
205 }
206 }
207 }
208 }
209 }
210 }
211
212 TTree* xttr[NLAYER][NENTRXT][2];
213 for(int lay=0; lay<NLAYER; lay++){
214 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
215 for(int lr=0; lr<2; lr++){
216 sprintf(hname, "trNewXt%02d_%02d_%d", lay, iEntr, lr);
217 xttr[lay][iEntr][lr] = new TTree(hname, hname);
218 xttr[lay][iEntr][lr]->Branch("t", &tdr, "t/D");
219 xttr[lay][iEntr][lr]->Branch("d", &doca, "d/D");
220 if(0 == gFgCalib[lay]){
221 int npoint = m_grXtOld[lay][iEntr][lr]->GetN();
222 for(int i=0; i<npoint; i++){
223 m_grXtOld[lay][iEntr][lr]->GetPoint(i, tdr, doca);
224 xttr[lay][iEntr][lr]->Fill();
225 }
226 } else{
227 int npoint = grXtfit[lay][iEntr][lr]->GetN();
228 for(int i=0; i<npoint; i++){
229 grXtfit[lay][iEntr][lr]->GetPoint(i, tdr, doca);
230 xttr[lay][iEntr][lr]->Fill();
231 }
232 }
233 newXtList->Add(xttr[lay][iEntr][lr]);
234 }
235 }
236 }
237
238 for(int lay=0; lay<NLAYER; lay++){
239 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
240 for(int lr=0; lr<2; lr++){
241 delete grXtfit[lay][iEntr][lr];
242 }
243 }
244 }
245
246// fnewXt.Close();
247 renameHist();
248}
int n2
Definition: SD0Tag.cxx:55
int n1
Definition: SD0Tag.cxx:54
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
Definition: CalibBase.cpp:711
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)

◆ init()

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

Implements CalibBase.

Definition at line 29 of file XtInteCalib.cpp.

29 {
30 CalibBase::init(hlist, pGeom);
31
32 m_fdPf = new TFolder("mfdProfile", "fdProfile");
33 hlist -> Add(m_fdPf);
34
35 m_haxis = new TH2F("axis", "", 200, -50, 1000, 50, 0, 10);
36 m_haxis -> SetStats(0);
37 m_fdPf -> Add(m_haxis);
38
39 char hname[200];
40 for(int lay=0; lay<NLAYER; lay++){
41 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
42 for(int lr=0; lr<2; lr++){
43 sprintf(hname, "mxt%02d_%02d_%d_gr", lay, iEntr, lr);
44 m_grXt[lay][iEntr][lr] = new TGraph();
45 m_grXt[lay][iEntr][lr]->SetName(hname);
46 m_grXt[lay][iEntr][lr]->SetMarkerColor(2);
47 m_fdPf->Add(m_grXt[lay][iEntr][lr]);
48
49 int xbinN = (int)((m_tbinLim[lay][1] - m_tbinLim[lay][0])/m_tbinWid[lay][0] + 0.5);
50 sprintf(hname, "mxt%02d_%02d_%d_near", lay, iEntr, lr);
51 m_pfNear[lay][iEntr][lr] = new TProfile(hname, hname, xbinN, m_tbinLim[lay][0], m_tbinLim[lay][1]);
52 m_fdPf->Add(m_pfNear[lay][iEntr][lr]);
53
54 int xbinM = (int)((m_tbinLim[lay][2] - m_tbinLim[lay][1])/m_tbinWid[lay][1] + 0.5);
55 sprintf(hname, "mxt%02d_%02d_%d_mid", lay, iEntr, lr);
56 m_pfMid[lay][iEntr][lr] = new TProfile(hname, hname, xbinM, m_tbinLim[lay][1], m_tbinLim[lay][2]);
57 m_fdPf->Add(m_pfMid[lay][iEntr][lr]);
58
59 int xbinF = (int)((m_tbinLim[lay][3] - m_tbinLim[lay][2])/m_tbinWid[lay][2] + 0.5);
60 sprintf(hname, "mxt%02d_%02d_%d_far", lay, iEntr, lr);
61 m_pfFar[lay][iEntr][lr] = new TProfile(hname, hname, xbinF, m_tbinLim[lay][2], m_tbinLim[lay][3]);
62 m_fdPf->Add(m_pfFar[lay][iEntr][lr]);
63 }
64 }
65 }
66}
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
Definition: CalibBase.cpp:14
mg Add(gr3)

◆ mergeHist()

void XtInteCalib::mergeHist ( TFile *  fhist)
virtual

Implements CalibBase.

Definition at line 68 of file XtInteCalib.cpp.

68 {
70
71 double tdr, doca;
72 char hname[200];
73 TProfile* pr;
74 TFolder* fd = (TFolder*)fhist->Get("fdProfile");
75 for(int lay=0; lay<NLAYER; lay++){
76 for(int iEntr=0; iEntr<NENTRXT; iEntr++){
77 for(int lr=0; lr<2; lr++){
78 if((m_grXt[lay][iEntr][lr]->GetN()) < m_nMaxGrPoint){
79 sprintf(hname, "xt%02d_%02d_%d_gr", lay, iEntr, lr);
80 TGraph* gr = (TGraph*)fd->FindObjectAny(hname);
81 int nPoint = gr->GetN();
82 for(int i=0; i<nPoint; i++){
83 gr->GetPoint(i, tdr, doca);
84 int np = m_grXt[lay][iEntr][lr]->GetN();
85 m_grXt[lay][iEntr][lr]->SetPoint(np, tdr, doca);
86 }
87 }
88 sprintf(hname, "xt%02d_%02d_%d_near", lay, iEntr, lr);
89 pr = (TProfile*)fd->FindObjectAny(hname);
90 m_pfNear[lay][iEntr][lr]->Add(pr);
91
92 sprintf(hname, "xt%02d_%02d_%d_mid", lay, iEntr, lr);
93 pr = (TProfile*)fd->FindObjectAny(hname);
94 m_pfMid[lay][iEntr][lr]->Add(pr);
95
96 sprintf(hname, "xt%02d_%02d_%d_far", lay, iEntr, lr);
97 pr = (TProfile*)fd->FindObjectAny(hname);
98 m_pfFar[lay][iEntr][lr]->Add(pr);
99 }
100 }
101 }
102}
TGraph * gr
virtual void mergeHist(TFile *fhist)=0
Definition: CalibBase.cpp:365

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