32 m_fdPf =
new TFolder(
"mfdProfile",
"fdProfile");
35 m_haxis =
new TH2F(
"axis",
"", 200, -50, 1000, 50, 0, 10);
36 m_haxis -> SetStats(0);
37 m_fdPf -> Add(m_haxis);
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]);
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]);
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]);
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]);
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);
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);
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);
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);
106 bool fgOldXt = saveOldXt(newXtList);
111 for(
int lay=0; lay<
NLAYER; lay++){
112 for(
int iEntr=0; iEntr<
NENTRXT; iEntr++){
113 for(
int lr=0; lr<2; lr++){
117 for(
int iPf=0; iPf<3; iPf++){
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];
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);
131 m_entries.push_back(entries);
135 unsigned vsize = m_vt.size();
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){
142 m_entries.pop_back();
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]);
157 for(
int lay=0; lay<
NLAYER; lay++){
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);
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);
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);
179 int nn = grXtfit[lay][iEntr][lr]->GetN();
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;
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);
195 int n1 = grXtfit[lay][iEntr][lr]->GetN();
196 grXtfit[lay][iEntr][lr]->GetPoint(
n1-1, t1, d1);
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);
202 grXtfit[lay][iEntr][lr]->SetPoint(
n1, t2, d2);
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");
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();
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();
233 newXtList->Add(xttr[lay][iEntr][lr]);
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];