BOSS 8.0.0
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 ()

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 {
14 m_tbinWid[lay][0] = 5.0;
15 m_tbinWid[lay][1] = 10.0;
16 m_tbinWid[lay][2] = 20.0;
17
18 m_tbinLim[lay][0] = -10.0;
19 m_tbinLim[lay][1] = 30.0;
20 if ( lay < 8 ) m_tbinLim[lay][2] = 210.0;
21 else m_tbinLim[lay][2] = 350.0;
22 m_tbinLim[lay][3] = 990.0;
23 }
24 cout << "Calibration type: XtInteCalib" << endl;
25}

◆ ~XtInteCalib()

XtInteCalib::~XtInteCalib ( )

Definition at line 27 of file XtInteCalib.cpp.

27{}

Member Function Documentation

◆ calib()

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

Implements CalibBase.

Definition at line 118 of file XtInteCalib.cpp.

118 {
119 CalibBase::calib( calconst, newXtList, r2tList );
120 bool fgOldXt = saveOldXt( newXtList );
121 newXtList->Clear();
122
123 TGraph* grXtfit[NLAYER][NENTRXT][2];
124 char hname[200];
125 for ( int lay = 0; lay < NLAYER; lay++ )
126 {
127 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
128 {
129 for ( int lr = 0; lr < 2; lr++ )
130 {
131 m_vt.clear();
132 m_vd.clear();
133 m_entries.clear();
134 for ( int iPf = 0; iPf < 3; iPf++ )
135 {
136 TProfile* pro;
137 if ( 0 == iPf ) pro = m_pfNear[lay][iEntr][lr];
138 else if ( 1 == iPf ) pro = m_pfMid[lay][iEntr][lr];
139 else pro = m_pfFar[lay][iEntr][lr];
140
141 int nbin = pro->GetNbinsX();
142 for ( int i = 0; i < nbin; i++ )
143 {
144 double tt = pro->GetBinCenter( i + 1 );
145 double dd = pro->GetBinContent( i + 1 );
146 double entries = pro->GetBinEntries( i + 1 );
147 if ( entries > 10 )
148 {
149 m_vt.push_back( tt );
150 m_vd.push_back( dd );
151 m_entries.push_back( entries );
152 }
153 }
154 }
155 unsigned vsize = m_vt.size();
156 if ( vsize > 10 )
157 {
158 for ( int i = 0; i < 2; i++ )
159 {
160 double slope =
161 ( m_vd[vsize - 1] - m_vd[vsize - 2] ) / ( m_vt[vsize - 1] - m_vt[vsize - 2] );
162 if ( fabs( slope ) > 0.04 )
163 { // 0.8mm/20ns
164 m_vt.pop_back();
165 m_vd.pop_back();
166 m_entries.pop_back();
167 vsize = m_vt.size();
168 }
169 }
170 }
171 sprintf( hname, "grXtFit%02d_%02d_%d", lay, iEntr, lr );
172 grXtfit[lay][iEntr][lr] = new TGraph();
173 grXtfit[lay][iEntr][lr]->SetName( hname );
174 grXtfit[lay][iEntr][lr]->SetMarkerStyle( 20 );
175 m_fgFit[lay][iEntr][lr] = getXt( lay, iEntr, lr, grXtfit[lay][iEntr][lr] );
176 }
177 }
178 }
179
180 double tdr, doca;
181 for ( int lay = 0; lay < NLAYER; lay++ )
182 {
183 double tCut = 500.0;
184 if ( lay < 8 ) tCut = 400.0;
185 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
186 {
187 for ( int lr = 0; lr < 2; lr++ )
188 {
189 if ( !m_fgFit[lay][iEntr][lr] )
190 {
191 int iEntrNew = findXtEntr( lay, iEntr, lr );
192 if ( -1 != iEntrNew )
193 {
194 int npoint = grXtfit[lay][iEntrNew][lr]->GetN();
195 for ( int i = 0; i < npoint; i++ )
196 {
197 grXtfit[lay][iEntrNew][lr]->GetPoint( i, tdr, doca );
198 grXtfit[lay][iEntr][lr]->SetPoint( i, tdr, doca );
199 }
200 }
201 else if ( fgOldXt )
202 {
203 cout << grXtfit[lay][iEntr][lr]->GetName() << " use old x-t" << endl;
204 int npoint = m_grXtOld[lay][iEntr][lr]->GetN();
205 for ( int i = 0; i < npoint; i++ )
206 {
207 m_grXtOld[lay][iEntr][lr]->GetPoint( i, tdr, doca );
208 grXtfit[lay][iEntr][lr]->SetPoint( i, tdr, doca );
209 }
210 }
211 }
212 int nn = grXtfit[lay][iEntr][lr]->GetN();
213 double tmax, dmax;
214 grXtfit[lay][iEntr][lr]->GetPoint( nn - 1, tmax, dmax );
215 if ( tmax > tCut ) m_fgEdge[lay][iEntr][lr] = true;
216 else m_fgEdge[lay][iEntr][lr] = false;
217 }
218 }
219 }
220
221 for ( int lay = 0; lay < NLAYER; lay++ )
222 {
223 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
224 {
225 for ( int lr = 0; lr < 2; lr++ )
226 {
227 if ( !m_fgEdge[lay][iEntr][lr] )
228 {
229 int iEntrNew = findXtEntrEdge( lay, iEntr, lr );
230 if ( -1 != iEntrNew )
231 {
232 double t1, d1;
233 int n1 = grXtfit[lay][iEntr][lr]->GetN();
234 grXtfit[lay][iEntr][lr]->GetPoint( n1 - 1, t1, d1 );
235 double t2, d2;
236 int n2 = grXtfit[lay][iEntrNew][lr]->GetN();
237 for ( int i = 0; i < n2; i++ )
238 {
239 grXtfit[lay][iEntrNew][lr]->GetPoint( i, t2, d2 );
240 if ( t2 > t1 )
241 {
242 grXtfit[lay][iEntr][lr]->SetPoint( n1, t2, d2 );
243 n1++;
244 }
245 }
246 }
247 }
248 }
249 }
250 }
251
252 TTree* xttr[NLAYER][NENTRXT][2];
253 for ( int lay = 0; lay < NLAYER; lay++ )
254 {
255 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
256 {
257 for ( int lr = 0; lr < 2; lr++ )
258 {
259 sprintf( hname, "trNewXt%02d_%02d_%d", lay, iEntr, lr );
260 xttr[lay][iEntr][lr] = new TTree( hname, hname );
261 xttr[lay][iEntr][lr]->Branch( "t", &tdr, "t/D" );
262 xttr[lay][iEntr][lr]->Branch( "d", &doca, "d/D" );
263 if ( 0 == gFgCalib[lay] )
264 {
265 int npoint = m_grXtOld[lay][iEntr][lr]->GetN();
266 for ( int i = 0; i < npoint; i++ )
267 {
268 m_grXtOld[lay][iEntr][lr]->GetPoint( i, tdr, doca );
269 xttr[lay][iEntr][lr]->Fill();
270 }
271 }
272 else
273 {
274 int npoint = grXtfit[lay][iEntr][lr]->GetN();
275 for ( int i = 0; i < npoint; i++ )
276 {
277 grXtfit[lay][iEntr][lr]->GetPoint( i, tdr, doca );
278 xttr[lay][iEntr][lr]->Fill();
279 }
280 }
281 newXtList->Add( xttr[lay][iEntr][lr] );
282 }
283 }
284 }
285
286 for ( int lay = 0; lay < NLAYER; lay++ )
287 {
288 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
289 {
290 for ( int lr = 0; lr < 2; lr++ ) { delete grXtfit[lay][iEntr][lr]; }
291 }
292 }
293
294 // fnewXt.Close();
295 renameHist();
296}
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)
#define dmax(a, b)
int n2
Definition SD0Tag.cxx:59
int n1
Definition SD0Tag.cxx:58
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0

◆ 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 {
42 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
43 {
44 for ( int lr = 0; lr < 2; lr++ )
45 {
46 sprintf( hname, "mxt%02d_%02d_%d_gr", lay, iEntr, lr );
47 m_grXt[lay][iEntr][lr] = new TGraph();
48 m_grXt[lay][iEntr][lr]->SetName( hname );
49 m_grXt[lay][iEntr][lr]->SetMarkerColor( 2 );
50 m_fdPf->Add( m_grXt[lay][iEntr][lr] );
51
52 int xbinN =
53 (int)( ( m_tbinLim[lay][1] - m_tbinLim[lay][0] ) / m_tbinWid[lay][0] + 0.5 );
54 sprintf( hname, "mxt%02d_%02d_%d_near", lay, iEntr, lr );
55 m_pfNear[lay][iEntr][lr] =
56 new TProfile( hname, hname, xbinN, m_tbinLim[lay][0], m_tbinLim[lay][1] );
57 m_fdPf->Add( m_pfNear[lay][iEntr][lr] );
58
59 int xbinM =
60 (int)( ( m_tbinLim[lay][2] - m_tbinLim[lay][1] ) / m_tbinWid[lay][1] + 0.5 );
61 sprintf( hname, "mxt%02d_%02d_%d_mid", lay, iEntr, lr );
62 m_pfMid[lay][iEntr][lr] =
63 new TProfile( hname, hname, xbinM, m_tbinLim[lay][1], m_tbinLim[lay][2] );
64 m_fdPf->Add( m_pfMid[lay][iEntr][lr] );
65
66 int xbinF =
67 (int)( ( m_tbinLim[lay][3] - m_tbinLim[lay][2] ) / m_tbinWid[lay][2] + 0.5 );
68 sprintf( hname, "mxt%02d_%02d_%d_far", lay, iEntr, lr );
69 m_pfFar[lay][iEntr][lr] =
70 new TProfile( hname, hname, xbinF, m_tbinLim[lay][2], m_tbinLim[lay][3] );
71 m_fdPf->Add( m_pfFar[lay][iEntr][lr] );
72 }
73 }
74 }
75}
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
Definition CalibBase.cpp:12

◆ mergeHist()

void XtInteCalib::mergeHist ( TFile * fhist)
virtual

Implements CalibBase.

Definition at line 77 of file XtInteCalib.cpp.

77 {
78 CalibBase::mergeHist( fhist );
79
80 double tdr, doca;
81 char hname[200];
82 TProfile* pr;
83 TFolder* fd = (TFolder*)fhist->Get( "fdProfile" );
84 for ( int lay = 0; lay < NLAYER; lay++ )
85 {
86 for ( int iEntr = 0; iEntr < NENTRXT; iEntr++ )
87 {
88 for ( int lr = 0; lr < 2; lr++ )
89 {
90 if ( ( m_grXt[lay][iEntr][lr]->GetN() ) < m_nMaxGrPoint )
91 {
92 sprintf( hname, "xt%02d_%02d_%d_gr", lay, iEntr, lr );
93 TGraph* gr = (TGraph*)fd->FindObjectAny( hname );
94 int nPoint = gr->GetN();
95 for ( int i = 0; i < nPoint; i++ )
96 {
97 gr->GetPoint( i, tdr, doca );
98 int np = m_grXt[lay][iEntr][lr]->GetN();
99 m_grXt[lay][iEntr][lr]->SetPoint( np, tdr, doca );
100 }
101 }
102 sprintf( hname, "xt%02d_%02d_%d_near", lay, iEntr, lr );
103 pr = (TProfile*)fd->FindObjectAny( hname );
104 m_pfNear[lay][iEntr][lr]->Add( pr );
105
106 sprintf( hname, "xt%02d_%02d_%d_mid", lay, iEntr, lr );
107 pr = (TProfile*)fd->FindObjectAny( hname );
108 m_pfMid[lay][iEntr][lr]->Add( pr );
109
110 sprintf( hname, "xt%02d_%02d_%d_far", lay, iEntr, lr );
111 pr = (TProfile*)fd->FindObjectAny( hname );
112 m_pfFar[lay][iEntr][lr]->Add( pr );
113 }
114 }
115 }
116}
TGraph * gr
virtual void mergeHist(TFile *fhist)=0

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