BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ResiAlign Class Reference

#include <ResiAlign.h>

Inheritance diagram for ResiAlign:

Public Member Functions

 ResiAlign ()
 ~ResiAlign ()
void clear ()
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
void setParam (MdcAliParams &param)
bool fillHist (MdcAliEvent *event)
void updateConst (MdcAlignPar *alignPar)
 ResiAlign ()
 ~ResiAlign ()
void init (TObjArray *hlist, MdcCosGeom *pGeom)
void mergeHist (TFile *fhist)
void align (MdcAlignPar *alignPar)
Public Member Functions inherited from MdcAlign
 MdcAlign ()
virtual ~MdcAlign ()
Public Member Functions inherited from AlignBase
 AlignBase ()
virtual ~AlignBase ()

Static Public Member Functions

static Double_t funResi (double *x, double *par)

Additional Inherited Members

Public Attributes inherited from MdcAlign
std::string fixMomLab

Detailed Description

Definition at line 19 of file include/MdcAlignAlg/ResiAlign.h.

Constructor & Destructor Documentation

◆ ResiAlign() [1/2]

ResiAlign::ResiAlign ( )

Definition at line 10 of file ResiAlign.cpp.

10{ cout << "Alignment type: ResiAlign" << endl; }

◆ ~ResiAlign() [1/2]

ResiAlign::~ResiAlign ( )

Definition at line 12 of file ResiAlign.cpp.

12{}

◆ ResiAlign() [2/2]

ResiAlign::ResiAlign ( )

◆ ~ResiAlign() [2/2]

ResiAlign::~ResiAlign ( )

Member Function Documentation

◆ align()

void ResiAlign::align ( MdcAlignPar * alignPar)
virtual

Implements AlignBase.

Definition at line 135 of file ResiAlign.cpp.

135 {
136 int iEP;
137 double par[3];
138 double err[3];
139 double dx;
140 double dy;
141 double rz;
142 double rLayer[] = { 120.225, 205.0, 237.55, 270.175, 302.625, 334.775, 366.65, 500.0,
143 120.225, 205.0, 237.55, 270.175, 302.625, 334.775, 366.65, 500.0 };
144
145 TCanvas c1( "c1", "c1", 10, 10, 700, 500 );
146 c1.SetFillColor( 10 );
147
148 TF1* fResPhi = new TF1( "fResPhi", funResi, 0, PI2, 3 );
149 fResPhi->SetParameter( 0, 0.0 );
150 fResPhi->SetParameter( 1, 0.0 );
151 fResPhi->SetParameter( 2, 0.0 );
152
153 for ( iEP = 0; iEP < NEP; iEP++ )
154 {
155 if ( ( m_gr[iEP]->GetN() ) > 500 )
156 {
157 // align dx, dy, rz
158 m_gr[iEP]->Fit( "fResPhi", "V" );
159 par[0] = fResPhi->GetParameter( 0 );
160 par[1] = fResPhi->GetParameter( 1 );
161 par[2] = fResPhi->GetParameter( 2 );
162 err[0] = fResPhi->GetParError( 0 );
163 err[1] = fResPhi->GetParError( 1 );
164 err[2] = fResPhi->GetParError( 2 );
165
166 // align dx and rz
167 // m_grSinPhi[iEP]->Fit("pol1");
168 // par[0] = m_grSinPhi[iEP]->GetFunction("pol1")->GetParameter(0);
169 // par[1] = m_grSinPhi[iEP]->GetFunction("pol1")->GetParameter(1);
170 // par[2] = 0.0;
171 // err[0] = m_grSinPhi[iEP]->GetFunction("pol1")->GetParError(0);
172 // err[1] = m_grSinPhi[iEP]->GetFunction("pol1")->GetParError(1);
173 // err[2] = 0.0;
174
175 // align dy
176 // m_grCosPhi[iEP]->Fit("pol1");
177 // par[0] = 0.0;
178 // par[1] = 0.0;
179 // par[2] = m_grCosPhi[iEP]->GetFunction("pol1")->GetParameter(1);
180 // err[0] = 0.0;
181 // err[1] = 0.0;
182 // err[2] = m_grCosPhi[iEP]->GetFunction("pol1")->GetParError(1);
183
184 dx = -1.0 * par[1];
185 dy = par[2];
186 rz = par[0] / rLayer[iEP];
187
188 if ( 7 == iEP || 15 == iEP )
189 {
190 dx = 0.0;
191 dy = 0.0;
192 rz = 0.0;
193 par[0] = 0.0;
194 par[1] = 0.0;
195 par[2] = 0.0;
196 }
197 alignPar->setDelDx( iEP, dx );
198 alignPar->setDelDy( iEP, dy );
199 alignPar->setDelRz( iEP, rz );
200
201 alignPar->setErrDx( iEP, err[1] );
202 alignPar->setErrDy( iEP, err[2] );
203 alignPar->setErrRz( iEP, err[0] / rLayer[iEP] );
204 }
205 }
206 renameHist();
207 delete fResPhi;
208}
void setErrRz(int iEP, double val)
void setDelDy(int iEP, double val)
void setDelRz(int iEP, double val)
void setErrDx(int iEP, double val)
void setDelDx(int iEP, double val)
void setErrDy(int iEP, double val)
static Double_t funResi(double *x, double *par)

◆ clear()

void ResiAlign::clear ( )
virtual

Implements MdcAlign.

Definition at line 73 of file ResiAlign.cxx.

73 {
74 delete m_hresAll;
75 delete m_hresInn;
76 delete m_hresStp;
77 delete m_hresOut;
78 for ( int lay = 0; lay < LAYERNMAX; lay++ )
79 {
80 delete m_hresLay[lay];
81 for ( int i = 0; i < 4; i++ ) delete m_hresLay_LR[lay][i];
82 }
83 for ( int i = 0; i < NEP; i++ ) delete m_gr[i];
84}
const int LAYERNMAX
Definition Alignment.h:43
const int NEP
Definition Alignment.h:46

◆ fillHist()

bool ResiAlign::fillHist ( MdcAliEvent * event)
virtual

Implements MdcAlign.

Definition at line 198 of file ResiAlign.cxx.

198 {
199 IMessageSvc* msgSvc;
200 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
201 MsgStream log( msgSvc, "ResiAlign" );
202 log << MSG::DEBUG << "ResiAlign::fillHist()" << endmsg;
203
204 bool esCutFg = event->getEsCutFlag();
205 if ( !esCutFg )
206 {
207 m_ncut1++;
208 return true;
209 }
210
211 int i = 0;
212 int k;
213
214 int trkStat;
215 double dr;
216 double phi0;
217 double kappa;
218 double dz;
219 double tanl;
220 double chisq;
221 double p;
222 double pt;
223
224 int nhits;
225 int lay;
226 int cel;
227 int wir;
228 int lr;
229 int iEnd;
230 int iEP;
231
232 double doca;
233 double resi;
234 double zhit;
235 double wphi;
236 double dphi;
237 double hitPhi;
238 double xx;
239 double yy;
240 double rr;
241 int stat;
242 MdcAliRecTrk* rectrk;
243 MdcAliRecHit* rechit;
244 int nhitlay;
245 bool fgHitLay[LAYERNMAX];
246
247 IDataProviderSvc* eventSvc = NULL;
248 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc );
249 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc, "/Event/EventHeader" );
250 if ( !eventHeader )
251 {
252 log << MSG::FATAL << "Could not find Event Header" << endmsg;
253 m_ncut3++;
254 return ( StatusCode::FAILURE );
255 }
256 int iEvt = eventHeader->eventNumber();
257 int iRun = eventHeader->runNumber();
258
259 int nTrk = event->getNTrk();
260 m_hnTrk->Fill( nTrk );
261 m_fevt << setw( 10 ) << iRun << setw( 10 ) << iEvt << setw( 10 ) << nTrk << endl;
262 if ( ( nTrk < m_param.nTrkCut[0] ) || ( nTrk > m_param.nTrkCut[1] ) )
263 {
264 m_ncut2++;
265 return true;
266 }
267
268 for ( i = 0; i < nTrk; i++ )
269 {
270 rectrk = event->getRecTrk( i );
271 nhits = rectrk->getNHits();
272 trkStat = rectrk->getStat();
273 // if (0 != trkStat) continue;
274
275 // dr cut
276 dr = rectrk->getDr();
277 if ( fabs( dr ) > m_param.drCut )
278 {
279 m_ncut4++;
280 continue;
281 }
282
283 phi0 = rectrk->getPhi0();
284 kappa = rectrk->getKappa();
285
286 // dz cut
287 dz = rectrk->getDz();
288 if ( fabs( dz ) > m_param.dzCut )
289 {
290 m_ncut5++;
291 continue;
292 }
293
294 for ( lay = 0; lay < LAYERNMAX; lay++ ) { fgHitLay[lay] = false; }
295
296 m_hnHit->Fill( nhits );
297 for ( k = 0; k < nhits; k++ )
298 {
299 rechit = rectrk->getRecHit( k );
300 lay = rechit->getLayid();
301 fgHitLay[lay] = true;
302 }
303
304 nhitlay = 0;
305 for ( lay = 0; lay < LAYERNMAX; lay++ )
306 {
307 if ( fgHitLay[lay] ) nhitlay++;
308 }
309 // cout << "hitlay " << nhitlay << endl;
310 if ( nhitlay < m_param.nHitLayCut )
311 {
312 m_ncut6++;
313 continue;
314 }
315
316 tanl = rectrk->getTanLamda();
317 chisq = rectrk->getChisq();
318 p = rectrk->getP();
319 pt = rectrk->getPt();
320
321 if ( ( fabs( pt ) < m_param.ptCut[0] ) || ( fabs( pt ) > m_param.ptCut[1] ) )
322 {
323 m_ncut7++;
324 continue;
325 }
326
327 HepVector helix = rectrk->getHelix();
328 for ( k = 0; k < nhits; k++ )
329 {
330 rechit = rectrk->getRecHit( k );
331 lay = rechit->getLayid();
332 cel = rechit->getCellid();
333 lr = rechit->getLR();
334 doca = rechit->getDocaInc();
335 zhit = rechit->getZhit();
336
337 stat = rechit->getStat();
338 if ( ( 1 == m_param.hitStatCut ) && ( 1 != stat ) )
339 {
340 m_ncut8++;
341 continue;
342 }
343
344 if ( 1 == m_param.resiType ) { resi = rechit->getResiExcLR(); }
345 else { resi = rechit->getResiIncLR(); }
346 resi *= -1.0;
347 // maqm if( (1==isnan(resi)) || (fabs(resi) > m_resiCut) ||
348 if ( ( 1 == std::isnan( resi ) ) || ( fabs( resi ) > m_resiCut ) ||
349 ( fabs( doca ) > m_docaMax[lay] ) || ( fabs( doca ) < m_docaMin[lay] ) )
350 {
351 m_ncut9++;
352 continue;
353 }
354
355 if ( m_param.fgAdjacLayerCut )
356 {
357 if ( 0 == lay )
358 {
359 if ( !fgHitLay[1] )
360 {
361 m_ncut10++;
362 continue;
363 }
364 }
365 else if ( 42 == lay )
366 {
367 if ( !fgHitLay[41] )
368 {
369 m_ncut11++;
370 continue;
371 }
372 }
373 else
374 {
375 if ( ( !fgHitLay[lay - 1] ) && ( !fgHitLay[lay + 1] ) )
376 {
377 m_ncut12++;
378 continue;
379 }
380 // for boundary layers
381 if ( m_param.fgBoundLayerCut && m_layBound[lay] &&
382 ( ( !fgHitLay[lay - 1] ) || ( !fgHitLay[lay + 1] ) ) )
383 {
384 m_ncut13++;
385 continue;
386 }
387 }
388 }
389 m_hlayHitmap->Fill( lay );
390
391 // fill alignment trees
392 if ( ( zhit < m_zrange[lay][0] ) || ( zhit > m_zrange[lay][1] ) )
393 {
394 wir = m_mdcGeomSvc->Wire( lay, cel )->Id();
395 xx = ( zhit - m_zw[wir] ) * ( m_xe[wir] - m_xw[wir] ) / ( m_ze[wir] - m_zw[wir] ) +
396 m_xw[wir];
397 yy = ( zhit - m_zw[wir] ) * ( m_ye[wir] - m_yw[wir] ) / ( m_ze[wir] - m_zw[wir] ) +
398 m_yw[wir];
399 rr = sqrt( ( xx * xx ) + ( yy * yy ) );
400 dphi = fabs( doca ) / m_radii[lay];
401
402 if ( yy >= 0 ) wphi = acos( xx / rr );
403 else wphi = PI2 - acos( xx / rr );
404 if ( 1 == lr ) hitPhi = wphi + dphi;
405 else hitPhi = wphi - dphi;
406 if ( hitPhi < 0 ) hitPhi += PI2;
407 else if ( hitPhi > PI2 ) hitPhi -= PI2;
408
409 if ( zhit < m_zrange[lay][0] ) iEnd = 0; // west
410 else iEnd = 1; // east
411 iEP = Alignment::getEpId( lay, iEnd );
412
413 m_iRun[iEP] = iRun;
414 m_iEvt[iEP] = iEvt;
415 m_resi[iEP] = resi;
416 m_p[iEP] = p;
417 m_pt[iEP] = pt;
418 m_phi[iEP] = hitPhi;
419 m_lay[iEP] = lay;
420 m_lr[iEP] = lr;
421 m_cel[iEP] = cel;
422 m_tuple[iEP]->write();
423
424 m_resi[NEP] = resi;
425 m_p[NEP] = p;
426 m_pt[NEP] = pt;
427 m_phi[NEP] = hitPhi;
428 m_lay[NEP] = lay;
429 m_lr[NEP] = lr;
430 m_cel[NEP] = cel;
431 m_tuple[NEP]->write();
432
433 m_hresAll->Fill( resi );
434 if ( lay < 8 ) m_hresInn->Fill( resi );
435 else if ( lay < 20 ) m_hresStp->Fill( resi );
436 else m_hresOut->Fill( resi );
437 m_hresLay[lay]->Fill( resi );
438 if ( 0 == lr )
439 {
440 if ( hitPhi < 3.14 ) m_hresLay_LR[lay][0]->Fill( resi ); // up L
441 else m_hresLay_LR[lay][2]->Fill( resi ); // down L
442 }
443 else
444 {
445 if ( hitPhi < 3.14 ) m_hresLay_LR[lay][1]->Fill( resi ); // up R
446 else m_hresLay_LR[lay][3]->Fill( resi ); // down R
447 }
448
449 m_gr[iEP]->SetPoint( m_npoint[iEP], hitPhi, resi );
450 m_npoint[iEP]++;
451 }
452 }
453 }
454
455 return true;
456}
IMessageSvc * msgSvc()
int getCellid() const
int getLR() const
double getResiExcLR() const
int getLayid() const
double getZhit() const
int getStat() const
double getResiIncLR() const
double getDocaInc() const
double getPt() const
double getDz() const
double getDr() const
double getChisq() const
MdcAliRecHit * getRecHit(int index) const
double getKappa() const
int getStat() const
double getP() const
int getNHits() const
double getPhi0() const
HepVector getHelix() const
double getTanLamda() const
const double PI2
Definition Alignment.h:39
int getEpId(int lay, int iEnd)
Definition Alignment.cxx:18

◆ funResi()

Double_t ResiAlign::funResi ( double * x,
double * par )
static

Referenced by align(), and updateConst().

◆ init()

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

Implements AlignBase.

Definition at line 14 of file ResiAlign.cpp.

14 {
15 m_pGeom = pGeom;
16 char hname[200];
17 m_hnTrk = new TH1F( "mHNtrack", "", 10, -0.5, 9.5 );
18 hlist->Add( m_hnTrk );
19
20 m_hnHit = new TH1F( "mHNhit", "", 100, -0.5, 99.5 );
21 hlist->Add( m_hnHit );
22
23 m_hlayHitmap = new TH1F( "mHitmap", "", 43, -0.5, 42.5 );
24 hlist->Add( m_hnHit );
25
26 m_hresAll = new TH1F( "mHResAllInc", "", 200, -1.0, 1.0 );
27 hlist->Add( m_hresAll );
28
29 m_hresInn = new TH1F( "mHResInnInc", "", 200, -1.0, 1.0 );
30 hlist->Add( m_hresInn );
31
32 m_hresStp = new TH1F( "mHResStpInc", "", 200, -1.0, 1.0 );
33 hlist->Add( m_hresStp );
34
35 m_hresOut = new TH1F( "mHResOutInc", "", 200, -1.0, 1.0 );
36 hlist->Add( m_hresOut );
37
38 for ( int lay = 0; lay < LAYERNMAX; lay++ )
39 {
40 sprintf( hname, "mRes_Layer%02d", lay );
41 m_hresLay[lay] = new TH1F( hname, "", 200, -1.0, 1.0 );
42 hlist->Add( m_hresLay[lay] );
43
44 for ( int i = 0; i < 4; i++ )
45 {
46 if ( 0 == i ) sprintf( hname, "mResi_Lay%02d_Up_L", lay );
47 else if ( 1 == i ) sprintf( hname, "mResi_Lay%02d_Up_R", lay );
48 else if ( 2 == i ) sprintf( hname, "mResi_Lay%02d_Dw_L", lay );
49 else sprintf( hname, "mResi_Lay%02d_Dw_R", lay );
50 m_hresLay_LR[lay][i] = new TH1F( hname, "", 200, -1.0, 1.0 );
51 hlist->Add( m_hresLay_LR[lay][i] );
52 }
53 }
54
55 for ( int iEP = 0; iEP < NEP; iEP++ )
56 {
57 m_gr[iEP] = new TGraph();
58 sprintf( hname, "mgrResi%02d", iEP );
59 m_gr[iEP]->SetName( hname );
60 hlist->Add( m_gr[iEP] );
61
62 m_grSinPhi[iEP] = new TGraph();
63 sprintf( hname, "mgrResi_sinPhi%02d", iEP );
64 m_grSinPhi[iEP]->SetName( hname );
65 hlist->Add( m_grSinPhi[iEP] );
66
67 m_grCosPhi[iEP] = new TGraph();
68 sprintf( hname, "mgrResi_cosPhi%02d", iEP );
69 m_grCosPhi[iEP]->SetName( hname );
70 hlist->Add( m_grCosPhi[iEP] );
71
72 m_npoint[iEP] = 0;
73 }
74}
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)

◆ initialize()

void ResiAlign::initialize ( TObjArray * hlist,
IMdcGeomSvc * mdcGeomSvc,
IMdcCalibFunSvc * mdcFunSvc,
IMdcUtilitySvc * mdcUtilitySvc )
virtual

Implements MdcAlign.

Definition at line 86 of file ResiAlign.cxx.

87 {
88 IMessageSvc* msgSvc;
89 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
90 MsgStream log( msgSvc, "ResiAlign" );
91 log << MSG::INFO << "ResiAlign::initialize()" << endmsg;
92
93 m_hlist = hlist;
94 m_mdcGeomSvc = mdcGeomSvc;
95 m_mdcFunSvc = mdcFunSvc;
96 m_mdcUtilitySvc = mdcUtilitySvc;
97
98 double zeast;
99 for ( int lay = 0; lay < 43; lay++ )
100 {
101 zeast = m_mdcGeomSvc->Wire( lay, 0 )->Backward().z();
102 m_zrange[lay][1] = 2.0 * fabs( zeast ) / (double)m_ndiv;
103 m_zrange[lay][0] = -1.0 * m_zrange[lay][1];
104
105 m_radii[lay] = m_mdcGeomSvc->Layer( lay )->Radius();
106 }
107
108 for ( int wir = 0; wir < WIRENMAX; wir++ )
109 {
110 m_xe[wir] = m_mdcGeomSvc->Wire( wir )->Backward().x();
111 m_ye[wir] = m_mdcGeomSvc->Wire( wir )->Backward().y();
112 m_ze[wir] = m_mdcGeomSvc->Wire( wir )->Backward().z();
113 m_xw[wir] = m_mdcGeomSvc->Wire( wir )->Forward().x();
114 m_yw[wir] = m_mdcGeomSvc->Wire( wir )->Forward().y();
115 m_zw[wir] = m_mdcGeomSvc->Wire( wir )->Forward().z();
116 }
117
118 char hname[200];
119 int iEP;
120
121 INTupleSvc* ntupleSvc;
122 Gaudi::svcLocator()->service( "NTupleSvc", ntupleSvc );
123 for ( iEP = 0; iEP <= NEP; iEP++ )
124 {
125 if ( iEP < NEP ) sprintf( hname, "FILE137/align%02d", iEP );
126 else sprintf( hname, "FILE137/alignAll" );
127
128 NTuplePtr nt( ntupleSvc, hname );
129 if ( nt ) m_tuple[iEP] = nt;
130 else
131 {
132 m_tuple[iEP] = ntupleSvc->book( hname, CLID_ColumnWiseTuple, "align" );
133 if ( m_tuple[iEP] )
134 {
135 m_tuple[iEP]->addItem( "run", m_iRun[iEP] );
136 m_tuple[iEP]->addItem( "evt", m_iEvt[iEP] );
137 m_tuple[iEP]->addItem( "resi", m_resi[iEP] );
138 m_tuple[iEP]->addItem( "p", m_p[iEP] );
139 m_tuple[iEP]->addItem( "pt", m_pt[iEP] );
140 m_tuple[iEP]->addItem( "phi", m_phi[iEP] );
141 m_tuple[iEP]->addItem( "lay", m_lay[iEP] );
142 m_tuple[iEP]->addItem( "lr", m_lr[iEP] );
143 m_tuple[iEP]->addItem( "cel", m_cel[iEP] );
144 }
145 else { log << MSG::FATAL << "Cannot book N-tuple:" << long( m_tuple[iEP] ) << endmsg; }
146 }
147 }
148
149 m_hnTrk = new TH1F( "HNtrack", "", 10, -0.5, 9.5 );
150 m_hlist->Add( m_hnTrk );
151
152 m_hnHit = new TH1F( "HNhit", "", 100, -0.5, 99.5 );
153 m_hlist->Add( m_hnHit );
154
155 m_hlayHitmap = new TH1F( "Hitmap", "", 43, -0.5, 42.5 );
156 m_hlist->Add( m_hlayHitmap );
157
158 m_hresAll = new TH1F( "HResAllInc", "", 200, -1.0, 1.0 );
159 m_hlist->Add( m_hresAll );
160
161 m_hresInn = new TH1F( "HResInnInc", "", 200, -1.0, 1.0 );
162 m_hlist->Add( m_hresInn );
163
164 m_hresStp = new TH1F( "HResStpInc", "", 200, -1.0, 1.0 );
165 m_hlist->Add( m_hresStp );
166
167 m_hresOut = new TH1F( "HResOutInc", "", 200, -1.0, 1.0 );
168 m_hlist->Add( m_hresOut );
169
170 int lay;
171 for ( lay = 0; lay < LAYERNMAX; lay++ )
172 {
173 sprintf( hname, "Res_Layer%02d", lay );
174 m_hresLay[lay] = new TH1F( hname, "", 200, -1.0, 1.0 );
175 m_hlist->Add( m_hresLay[lay] );
176
177 for ( int i = 0; i < 4; i++ )
178 {
179 if ( 0 == i ) sprintf( hname, "Resi_Lay%02d_Up_L", lay );
180 else if ( 1 == i ) sprintf( hname, "Resi_Lay%02d_Up_R", lay );
181 else if ( 2 == i ) sprintf( hname, "Resi_Lay%02d_Dw_L", lay );
182 else sprintf( hname, "Resi_Lay%02d_Dw_R", lay );
183 m_hresLay_LR[lay][i] = new TH1F( hname, "", 200, -1.0, 1.0 );
184 m_hlist->Add( m_hresLay_LR[lay][i] );
185 }
186 }
187
188 for ( iEP = 0; iEP < NEP; iEP++ )
189 {
190 m_gr[iEP] = new TGraph();
191 sprintf( hname, "grResi%02d", iEP );
192 m_gr[iEP]->SetName( hname );
193 m_hlist->Add( m_gr[iEP] );
194 }
195 m_fevt.open( "evt.txt" );
196}
const int WIRENMAX
Definition Alignment.h:42

◆ mergeHist()

void ResiAlign::mergeHist ( TFile * fhist)
virtual

Implements AlignBase.

Definition at line 76 of file ResiAlign.cpp.

76 {
77 char hname[200];
78 TH1F* hist;
79 hist = (TH1F*)fhist->Get( "HNtrack" );
80 m_hnTrk->Add( hist );
81
82 hist = (TH1F*)fhist->Get( "HNhit" );
83 m_hnHit->Add( hist );
84
85 hist = (TH1F*)fhist->Get( "Hitmap" );
86 m_hlayHitmap->Add( hist );
87
88 hist = (TH1F*)fhist->Get( "HResAllInc" );
89 m_hresAll->Add( hist );
90
91 hist = (TH1F*)fhist->Get( "HResInnInc" );
92 m_hresInn->Add( hist );
93
94 hist = (TH1F*)fhist->Get( "HResStpInc" );
95 m_hresStp->Add( hist );
96
97 hist = (TH1F*)fhist->Get( "HResOutInc" );
98 m_hresOut->Add( hist );
99
100 for ( int lay = 0; lay < LAYERNMAX; lay++ )
101 {
102 sprintf( hname, "Res_Layer%02d", lay );
103 hist = (TH1F*)fhist->Get( hname );
104 m_hresLay[lay]->Add( hist );
105
106 for ( int i = 0; i < 4; i++ )
107 {
108 if ( 0 == i ) sprintf( hname, "Resi_Lay%02d_Up_L", lay );
109 else if ( 1 == i ) sprintf( hname, "Resi_Lay%02d_Up_R", lay );
110 else if ( 2 == i ) sprintf( hname, "Resi_Lay%02d_Dw_L", lay );
111 else sprintf( hname, "Resi_Lay%02d_Dw_R", lay );
112 hist = (TH1F*)fhist->Get( hname );
113 m_hresLay_LR[lay][i]->Add( hist );
114 }
115 }
116
117 for ( int iEP = 0; iEP < NEP; iEP++ )
118 {
119 sprintf( hname, "grResi%02d", iEP );
120 TGraph* gr = (TGraph*)fhist->Get( hname );
121 int np = gr->GetN();
122 double xx;
123 double yy;
124 for ( int i = 0; i < np; i++ )
125 {
126 gr->GetPoint( i, xx, yy );
127 m_gr[iEP]->SetPoint( m_npoint[iEP], xx, yy );
128 m_grSinPhi[iEP]->SetPoint( m_npoint[iEP], sin( xx ), yy );
129 m_grCosPhi[iEP]->SetPoint( m_npoint[iEP], cos( xx ), yy );
130 m_npoint[iEP]++;
131 }
132 }
133}
TGraph * gr

◆ setParam()

void ResiAlign::setParam ( MdcAliParams & param)
inlinevirtual

Implements MdcAlign.

Definition at line 96 of file include/MdcAlignAlg/ResiAlign.h.

96 {
97 MdcAlign::setParam( param );
98 m_param = param;
99}
virtual void setParam(MdcAliParams &param)=0
Definition MdcAlign.h:37

◆ updateConst()

void ResiAlign::updateConst ( MdcAlignPar * alignPar)
virtual

Implements MdcAlign.

Definition at line 458 of file ResiAlign.cxx.

458 {
459 IMessageSvc* msgSvc;
460 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
461 MsgStream log( msgSvc, "ResiAlign" );
462 log << MSG::INFO << "ResiAlign::updateConst()" << endmsg;
463 m_fevt.close();
464
465 int iEP;
466 double par[3];
467 double err[3];
468 double dx;
469 double dy;
470 double rz;
471 double rLayer[] = { 120.225, 205.0, 237.55, 270.175, 302.625, 334.775, 366.65, 500.0,
472 120.225, 205.0, 237.55, 270.175, 302.625, 334.775, 366.65, 500.0 };
473
474 TCanvas c1( "c1", "c1", 10, 10, 700, 500 );
475
476 TF1* fResPhi = new TF1( "fResPhi", funResi, 0, PI2, 3 );
477 fResPhi->SetParameter( 0, 0.0 );
478 fResPhi->SetParameter( 1, 0.0 );
479 fResPhi->SetParameter( 2, 0.0 );
480
481 for ( iEP = 0; iEP < NEP; iEP++ )
482 {
483 if ( ( m_gr[iEP]->GetN() ) > 500 )
484 {
485 m_gr[iEP]->Fit( "fResPhi", "V" );
486 par[0] = fResPhi->GetParameter( 0 );
487 par[1] = fResPhi->GetParameter( 1 );
488 par[2] = fResPhi->GetParameter( 2 );
489
490 err[0] = fResPhi->GetParError( 0 );
491 err[1] = fResPhi->GetParError( 1 );
492 err[2] = fResPhi->GetParError( 2 );
493
494 dx = -1.0 * par[1];
495 dy = par[2];
496 rz = par[0] / rLayer[iEP];
497
498 // assume the shift of the outer section is 0
499 if ( 7 == iEP || 15 == iEP )
500 {
501 dx = 0.0;
502 dy = 0.0;
503 rz = 0.0;
504 par[0] = 0.0;
505 par[1] = 0.0;
506 par[2] = 0.0;
507 }
508 alignPar->setDelDx( iEP, dx );
509 alignPar->setDelDy( iEP, dy );
510 alignPar->setDelRz( iEP, rz );
511
512 alignPar->setErrDx( iEP, err[1] );
513 alignPar->setErrDy( iEP, err[2] );
514 alignPar->setErrRz( iEP, err[0] / rLayer[iEP] );
515 }
516 }
517
518 cout << "TrackCut: cut1: " << m_ncut1 << ", cut2: " << m_ncut2 << ", cut3: " << m_ncut3
519 << ", cut4: " << m_ncut4 << ", cut5: " << m_ncut5 << ", cut6: " << m_ncut6
520 << ", cut7: " << m_ncut7 << endl;
521 cout << "HitCut: cut8: " << m_ncut8 << ", cut9: " << m_ncut9 << ", cut10: " << m_ncut10
522 << ", cut11: " << m_ncut11 << ", cut12: " << m_ncut12 << ", cut13: " << m_ncut13
523 << endl;
524
525 delete fResPhi;
526}

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