2#include "include/fun.h"
11 cout <<
"Alignment type: ResiAlign" << endl;
20 m_hnTrk =
new TH1F(
"mHNtrack",
"", 10, -0.5, 9.5);
23 m_hnHit =
new TH1F(
"mHNhit",
"", 100, -0.5, 99.5);
26 m_hlayHitmap =
new TH1F(
"mHitmap",
"", 43, -0.5, 42.5);
29 m_hresAll =
new TH1F(
"mHResAllInc",
"", 200, -1.0, 1.0);
30 hlist->Add(m_hresAll);
32 m_hresInn =
new TH1F(
"mHResInnInc",
"", 200, -1.0, 1.0);
33 hlist->Add(m_hresInn);
35 m_hresStp =
new TH1F(
"mHResStpInc",
"", 200, -1.0, 1.0);
36 hlist->Add(m_hresStp);
38 m_hresOut =
new TH1F(
"mHResOutInc",
"", 200, -1.0, 1.0);
39 hlist->Add(m_hresOut);
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]);
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]);
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]);
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]);
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]);
79 hist = (TH1F*)fhist->Get(
"HNtrack");
82 hist = (TH1F*)fhist->Get(
"HNhit");
85 hist = (TH1F*)fhist->Get(
"Hitmap");
86 m_hlayHitmap->Add(hist);
88 hist = (TH1F*)fhist->Get(
"HResAllInc");
91 hist = (TH1F*)fhist->Get(
"HResInnInc");
94 hist = (TH1F*)fhist->Get(
"HResStpInc");
97 hist = (TH1F*)fhist->Get(
"HResOutInc");
101 sprintf(hname,
"Res_Layer%02d", lay);
102 hist = (TH1F*)fhist->Get(hname);
103 m_hresLay[lay]->Add(hist);
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);
115 for(
int iEP=0; iEP<
NEP; iEP++){
116 sprintf(hname,
"grResi%02d", iEP);
117 TGraph*
gr = (TGraph*)fhist->Get(hname);
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);
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 };
141 TCanvas c1(
"c1",
"c1", 10, 10, 700, 500);
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);
149 for(iEP=0; iEP<
NEP; iEP++){
150 if((m_gr[iEP]->GetN()) > 500){
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);
180 rz = par[0] / rLayer[iEP];
182 if (7==iEP || 15==iEP) {
196 alignPar->
setErrRz(iEP, err[0]/rLayer[iEP]);
203void ResiAlign::renameHist(){
205 m_hnTrk->SetName(
"HNtrack");
206 m_hnHit->SetName(
"HNhit");
207 m_hlayHitmap->SetName(
"Hitmap");
208 m_hresAll->SetName(
"HResAllInc");
209 m_hresInn->SetName(
"HResInnInc");
210 m_hresStp->SetName(
"HResStpInc");
211 m_hresOut->SetName(
"HResOutInc");
213 sprintf(hname,
"Res_Layer%02d", lay);
214 m_hresLay[lay]->SetName(hname);
216 for(
int i=0; i<4; i++){
217 if(0==i)
sprintf(hname,
"Resi_Lay%02d_Up_L", lay);
218 else if(1==i)
sprintf(hname,
"Resi_Lay%02d_Up_R", lay);
219 else if(2==i)
sprintf(hname,
"Resi_Lay%02d_Dw_L", lay);
220 else sprintf(hname,
"Resi_Lay%02d_Dw_R", lay);
221 m_hresLay_LR[lay][i]->SetName(hname);
224 for(
int iEP=0; iEP<
NEP; iEP++){
225 sprintf(hname,
"grResi%02d", iEP);
226 m_gr[iEP]->SetName(hname);
228 sprintf(hname,
"grResi_sinPhi%02d", iEP);
229 m_grSinPhi[iEP]->SetName(hname);
231 sprintf(hname,
"grResi_cosPhi%02d", iEP);
232 m_grCosPhi[iEP]->SetName(hname);
238 val = par[0] + par[1]*
sin(x[0]) + par[2]*
cos(x[0]);
double sin(const BesAngle a)
double cos(const BesAngle a)
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)
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)
void mergeHist(TFile *fhist)
void align(MdcAlignPar *alignPar)
void init(TObjArray *hlist, MdcCosGeom *pGeom)