104 {
106 bool fgOldXt = saveOldXt(newXtList);
107 newXtList->Clear();
108
110 char hname[200];
111 for(
int lay=0; lay<
NLAYER; lay++){
112 for(
int iEntr=0; iEntr<
NENTRXT; iEntr++){
113 for(int lr=0; lr<2; lr++){
114 m_vt.clear();
115 m_vd.clear();
116 m_entries.clear();
117 for(int iPf=0; iPf<3; iPf++){
118 TProfile* pro;
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];
122
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);
128 if(entries > 10){
129 m_vt.push_back(tt);
130 m_vd.push_back(dd);
131 m_entries.push_back(entries);
132 }
133 }
134 }
135 unsigned vsize = m_vt.size();
136 if(vsize > 10){
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){
140 m_vt.pop_back();
141 m_vd.pop_back();
142 m_entries.pop_back();
143 vsize = m_vt.size();
144 }
145 }
146 }
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]);
152 }
153 }
154 }
155
156 double tdr, doca;
157 for(
int lay=0; lay<
NLAYER; lay++){
158 double tCut = 500.0;
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);
164 if(-1 != iEntrNew){
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);
169 }
170 } else if(fgOldXt) {
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);
176 }
177 }
178 }
179 int nn = grXtfit[lay][iEntr][lr]->GetN();
180 double tmax, dmax;
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;
184 }
185 }
186 }
187
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);
193 if(-1 != iEntrNew){
194 double t1, d1;
195 int n1 = grXtfit[lay][iEntr][lr]->GetN();
196 grXtfit[lay][iEntr][lr]->GetPoint(
n1-1, t1, d1);
197 double t2, d2;
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);
201 if(t2 > t1){
202 grXtfit[lay][iEntr][lr]->SetPoint(
n1, t2, d2);
204 }
205 }
206 }
207 }
208 }
209 }
210 }
211
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();
225 }
226 } else{
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();
231 }
232 }
233 newXtList->Add(xttr[lay][iEntr][lr]);
234 }
235 }
236 }
237
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];
242 }
243 }
244 }
245
246
247 renameHist();
248}
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0