BOSS 7.1.1
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 MdcAlignAlg/ResiAlign.h.

Constructor & Destructor Documentation

◆ ResiAlign() [1/2]

ResiAlign::ResiAlign ( )

Definition at line 10 of file ResiAlign.cpp.

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

◆ ~ResiAlign() [1/2]

ResiAlign::~ResiAlign ( )

Definition at line 14 of file ResiAlign.cpp.

14 {
15}

◆ 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 131 of file ResiAlign.cpp.

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

68 {
69 delete m_hresAll;
70 delete m_hresInn;
71 delete m_hresStp;
72 delete m_hresOut;
73 for(int lay=0; lay<LAYERNMAX; lay++){
74 delete m_hresLay[lay];
75 for(int i=0; i<4; i++) delete m_hresLay_LR[lay][i];
76 }
77 for(int i=0; i<NEP; i++) delete m_gr[i];
78}
const int LAYERNMAX
Definition Alignment.h:45
const int NEP
Definition Alignment.h:48

◆ fillHist()

bool ResiAlign::fillHist ( MdcAliEvent * event)
virtual

Implements MdcAlign.

Definition at line 187 of file ResiAlign.cxx.

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

◆ funResi()

static 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 17 of file ResiAlign.cpp.

17 {
18 m_pGeom = pGeom;
19 char hname[200];
20 m_hnTrk = new TH1F("mHNtrack", "", 10, -0.5, 9.5);
21 hlist->Add(m_hnTrk);
22
23 m_hnHit = new TH1F("mHNhit", "", 100, -0.5, 99.5);
24 hlist->Add(m_hnHit);
25
26 m_hlayHitmap = new TH1F("mHitmap", "", 43, -0.5, 42.5);
27 hlist->Add(m_hnHit);
28
29 m_hresAll = new TH1F("mHResAllInc", "", 200, -1.0, 1.0);
30 hlist->Add(m_hresAll);
31
32 m_hresInn = new TH1F("mHResInnInc", "", 200, -1.0, 1.0);
33 hlist->Add(m_hresInn);
34
35 m_hresStp = new TH1F("mHResStpInc", "", 200, -1.0, 1.0);
36 hlist->Add(m_hresStp);
37
38 m_hresOut = new TH1F("mHResOutInc", "", 200, -1.0, 1.0);
39 hlist->Add(m_hresOut);
40
41 for(int lay=0; lay<LAYERNMAX; lay++){
42 sprintf(hname, "mRes_Layer%02d", lay);
43 m_hresLay[lay] = new TH1F(hname, "", 200, -1.0, 1.0);
44 hlist->Add(m_hresLay[lay]);
45
46 for(int i=0; i<4; i++){
47 if(0==i) sprintf(hname, "mResi_Lay%02d_Up_L", lay);
48 else if(1==i) sprintf(hname, "mResi_Lay%02d_Up_R", lay);
49 else if(2==i) sprintf(hname, "mResi_Lay%02d_Dw_L", lay);
50 else sprintf(hname, "mResi_Lay%02d_Dw_R", lay);
51 m_hresLay_LR[lay][i] = new TH1F(hname, "", 200, -1.0, 1.0);
52 hlist->Add(m_hresLay_LR[lay][i]);
53 }
54 }
55
56 for(int iEP=0; iEP<NEP; iEP++){
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)

Referenced by ~ResiAlign().

◆ initialize()

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

Implements MdcAlign.

Definition at line 80 of file ResiAlign.cxx.

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

◆ 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 sprintf(hname, "Res_Layer%02d", lay);
102 hist = (TH1F*)fhist->Get(hname);
103 m_hresLay[lay]->Add(hist);
104
105 for(int i=0; i<4; i++){
106 if(0==i) sprintf(hname, "Resi_Lay%02d_Up_L", lay);
107 else if(1==i) sprintf(hname, "Resi_Lay%02d_Up_R", lay);
108 else if(2==i) sprintf(hname, "Resi_Lay%02d_Dw_L", lay);
109 else sprintf(hname, "Resi_Lay%02d_Dw_R", lay);
110 hist = (TH1F*)fhist->Get(hname);
111 m_hresLay_LR[lay][i]->Add(hist);
112 }
113 }
114
115 for(int iEP=0; iEP<NEP; iEP++){
116 sprintf(hname, "grResi%02d", iEP);
117 TGraph* gr = (TGraph*)fhist->Get(hname);
118 int np = gr->GetN();
119 double xx;
120 double yy;
121 for(int i=0; i<np; i++){
122 gr->GetPoint(i, xx, yy);
123 m_gr[iEP]->SetPoint(m_npoint[iEP], xx, yy);
124 m_grSinPhi[iEP]->SetPoint(m_npoint[iEP], sin(xx), yy);
125 m_grCosPhi[iEP]->SetPoint(m_npoint[iEP], cos(xx), yy);
126 m_npoint[iEP]++;
127 }
128 }
129}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
TGraph * gr

◆ setParam()

void ResiAlign::setParam ( MdcAliParams & param)
inlinevirtual

Implements MdcAlign.

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

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

◆ updateConst()

void ResiAlign::updateConst ( MdcAlignPar * alignPar)
virtual

Implements MdcAlign.

Definition at line 401 of file ResiAlign.cxx.

401 {
402 IMessageSvc* msgSvc;
403 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
404 MsgStream log(msgSvc, "ResiAlign");
405 log << MSG::INFO << "ResiAlign::updateConst()" << endreq;
406 m_fevt.close();
407
408 int iEP;
409 double par[3];
410 double err[3];
411 double dx;
412 double dy;
413 double rz;
414 double rLayer[] = { 120.225, 205.0, 237.55, 270.175,
415 302.625, 334.775, 366.65, 500.0,
416 120.225, 205.0, 237.55, 270.175,
417 302.625, 334.775, 366.65, 500.0 };
418
419 TCanvas c1("c1", "c1", 10, 10, 700, 500);
420
421 TF1* fResPhi = new TF1("fResPhi", funResi, 0, PI2, 3);
422 fResPhi->SetParameter(0, 0.0);
423 fResPhi->SetParameter(1, 0.0);
424 fResPhi->SetParameter(2, 0.0);
425
426 for(iEP=0; iEP<NEP; iEP++){
427 if((m_gr[iEP]->GetN()) > 500){
428 m_gr[iEP]->Fit("fResPhi", "V");
429 par[0] = fResPhi->GetParameter(0);
430 par[1] = fResPhi->GetParameter(1);
431 par[2] = fResPhi->GetParameter(2);
432
433 err[0] = fResPhi->GetParError(0);
434 err[1] = fResPhi->GetParError(1);
435 err[2] = fResPhi->GetParError(2);
436
437 dx = -1.0 * par[1];
438 dy = par[2];
439 rz = par[0] / rLayer[iEP];
440
441 // assume the shift of the outer section is 0
442 if (7==iEP || 15==iEP) {
443 dx = 0.0;
444 dy = 0.0;
445 rz = 0.0;
446 par[0] = 0.0;
447 par[1] = 0.0;
448 par[2] = 0.0;
449 }
450 alignPar->setDelDx(iEP, dx);
451 alignPar->setDelDy(iEP, dy);
452 alignPar->setDelRz(iEP, rz);
453
454 alignPar->setErrDx(iEP, err[1]);
455 alignPar->setErrDy(iEP, err[2]);
456 alignPar->setErrRz(iEP, err[0]/rLayer[iEP]);
457 }
458 }
459
460 cout << "TrackCut: cut1: " << m_ncut1 << ", cut2: " << m_ncut2 << ", cut3: " << m_ncut3
461 << ", cut4: " << m_ncut4 << ", cut5: " << m_ncut5 << ", cut6: " << m_ncut6
462 << ", cut7: " << m_ncut7 << endl;
463 cout << "HitCut: cut8: " << m_ncut8 << ", cut9: " << m_ncut9 << ", cut10: " << m_ncut10
464 << ", cut11: " << m_ncut11 << ", cut12: " << m_ncut12 << ", cut13: " << m_ncut13 << endl;
465
466 delete fResPhi;
467}

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