281 |
PKT = 0; |
PKT = 0; |
282 |
atime = 0; |
atime = 0; |
283 |
// |
// |
284 |
|
suf = ""; |
285 |
debug = false; |
debug = false; |
286 |
|
usepl18x = false; |
287 |
// |
// |
288 |
}; |
}; |
289 |
|
|
299 |
PKT = 0; |
PKT = 0; |
300 |
atime = 0; |
atime = 0; |
301 |
// |
// |
302 |
|
suf = ""; |
303 |
debug = false; |
debug = false; |
304 |
|
usepl18x = false; |
305 |
// |
// |
306 |
}; |
}; |
307 |
|
|
379 |
// |
// |
380 |
for (Int_t v=minv; v<maxv;v++){ |
for (Int_t v=minv; v<maxv;v++){ |
381 |
for (Int_t p=minp; p<maxp;p++){ |
for (Int_t p=minp; p<maxp;p++){ |
382 |
TString hid = Form("clatv%ip%i",v,p); |
TString hid = Form("clatv%ip%i%s",v,p,suf.Data()); |
383 |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
384 |
if ( tc ){ |
if ( tc ){ |
385 |
// tc->Clear(); |
// tc->Clear(); |
387 |
tc = new TCanvas(hid,hid); |
tc = new TCanvas(hid,hid); |
388 |
}; |
}; |
389 |
// |
// |
390 |
TString thid = Form("hlatv%ip%i",v,p); |
TString thid = Form("hlatv%ip%i%s",v,p,suf.Data()); |
391 |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
392 |
if ( th ) th->Delete(); |
if ( th ) th->Delete(); |
393 |
// th->Clear(); |
// th->Clear(); |
430 |
gStyle->SetNdivisions(510,"XY"); |
gStyle->SetNdivisions(510,"XY"); |
431 |
// |
// |
432 |
for (Int_t p=minp; p<maxp;p++){ |
for (Int_t p=minp; p<maxp;p++){ |
433 |
TString hid = Form("c2dp%i",p); |
TString hid = Form("c2dp%i%s",p,suf.Data()); |
434 |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
435 |
if ( tc ){ |
if ( tc ){ |
436 |
// tc->Clear(); |
// tc->Clear(); |
438 |
tc = new TCanvas(hid,hid); |
tc = new TCanvas(hid,hid); |
439 |
}; |
}; |
440 |
// |
// |
441 |
TString thid = Form("h2dp%i",p); |
TString thid = Form("h2dp%i%s",p,suf.Data()); |
442 |
TH2F *th = dynamic_cast<TH2F*>(gDirectory->FindObject(thid)); |
TH2F *th = dynamic_cast<TH2F*>(gDirectory->FindObject(thid)); |
443 |
if ( th ) th->Delete(); |
if ( th ) th->Delete(); |
444 |
// th->Clear(); |
// th->Clear(); |
529 |
// |
// |
530 |
for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){ |
for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){ |
531 |
mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); |
mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); |
532 |
|
// |
533 |
|
if ( !usepl18x && view1==0 && plane1==18 ) mip1 = 0.; |
534 |
|
// |
535 |
estrip[view1][plane1][strip1] = mip1; |
estrip[view1][plane1][strip1] = mip1; |
536 |
}; |
}; |
537 |
// |
// |
579 |
// |
// |
580 |
for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){ |
for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){ |
581 |
mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); |
mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); |
582 |
|
// |
583 |
|
if ( !usepl18x && view1==0 && plane1==18 ) mip1 = 0.; |
584 |
|
// |
585 |
es[view1][plane1][strip1] = mip1; |
es[view1][plane1][strip1] = mip1; |
586 |
}; |
}; |
587 |
// |
// |
671 |
mask18b = -1; |
mask18b = -1; |
672 |
// |
// |
673 |
no18x = true; |
no18x = true; |
674 |
|
usepl18x = !no18x; |
675 |
debug = false; |
debug = false; |
676 |
maskXE = false; |
maskXE = false; |
677 |
maskXO = false; |
maskXO = false; |
682 |
umax = 100.; |
umax = 100.; |
683 |
slmax = ""; |
slmax = ""; |
684 |
sumax = ""; |
sumax = ""; |
685 |
|
suf = ""; |
686 |
|
xyaverage = true; |
687 |
// |
// |
688 |
}; |
letmax = -1; |
689 |
|
heavytail = false; |
690 |
|
// lmipth = 100.; |
691 |
|
lmipth = 0.; |
692 |
|
// |
693 |
|
lfit = 0; |
694 |
|
}; |
695 |
|
|
696 |
|
TF1 *CaloLong::GetFit(){ |
697 |
|
// TString fnam=Form("lfit%s",suf.Data()); |
698 |
|
// TF1 *lfit = dynamic_cast<TF1*>(gDirectory->FindObject(fnam)); |
699 |
|
if ( lfit ) return lfit; |
700 |
|
return NULL; |
701 |
|
} |
702 |
|
|
703 |
void CaloLong::MaskSection(TString sec){ |
void CaloLong::MaskSection(TString sec){ |
704 |
sec.ToUpper(); |
sec.ToUpper(); |
722 |
|
|
723 |
void CaloLong::Clear(){ |
void CaloLong::Clear(){ |
724 |
// |
// |
725 |
|
if ( debug ) printf(" Clear called \n"); |
726 |
|
// |
727 |
memset(eplane,0, 2*22*sizeof(Float_t)); |
memset(eplane,0, 2*22*sizeof(Float_t)); |
728 |
// |
// |
729 |
chi2 = 0.; |
chi2 = 0.; |
748 |
Fit(); |
Fit(); |
749 |
// |
// |
750 |
printf("==================== Calorimeter Longitudinal Profile =======================\n"); |
printf("==================== Calorimeter Longitudinal Profile =======================\n"); |
751 |
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
printf(" OBT: %u PKT: %u ATIME: %u suf %s \n",OBT,PKT,atime,suf.Data()); |
752 |
printf(" fitresult:.. %i\n",fitresult); |
printf(" fitresult:.. %i\n",fitresult); |
753 |
printf(" chi2 :.. %f\n",chi2); |
printf(" chi2 :.. %f\n",chi2); |
754 |
printf(" ndf :.. %f\n",ndf); |
printf(" ndf :.. %f\n",ndf); |
866 |
Bool_t gof = true; |
Bool_t gof = true; |
867 |
for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ |
for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ |
868 |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
869 |
|
// |
870 |
|
if ( !usepl18x && view==0 && plane==18 ) mip = 0.; |
871 |
|
// |
872 |
gof = true; |
gof = true; |
873 |
if ( maskXE && (plane%2)==0 && view==1 ) gof = false; |
if ( maskXE && (plane%2)==0 && view==1 ) gof = false; |
874 |
if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; |
if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; |
879 |
// |
// |
880 |
// inclination factor (stolen from Daniele's code) |
// inclination factor (stolen from Daniele's code) |
881 |
// |
// |
882 |
Float_t ytgx = 0; |
Float_t ytgx = 0.; |
883 |
Float_t ytgy = 0; |
Float_t ytgy = 0.; |
884 |
ytgx = 0.76 * clp->tanx[0]; |
ytgx = 0.76 * clp->tanx[0]; |
885 |
ytgy = 0.76 * clp->tany[0]; |
ytgy = 0.76 * clp->tany[0]; |
886 |
X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); |
X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); |
974 |
}; |
}; |
975 |
}; |
}; |
976 |
// |
// |
977 |
|
if ( !clp && debug ) printf(" ERROR!! no CaloLevel2 obj!!\n"); |
978 |
|
// |
979 |
// inclination factor (stolen from Daniele's code) |
// inclination factor (stolen from Daniele's code) |
980 |
// |
// |
981 |
Float_t ytgx = 0; |
Float_t ytgx = 0.; |
982 |
Float_t ytgy = 0; |
Float_t ytgy = 0.; |
983 |
ytgx = 0.76 * clp->tanx[0]; |
ytgx = 0.76 * clp->tanx[0]; |
984 |
ytgy = 0.76 * clp->tany[0]; |
ytgy = 0.76 * clp->tany[0]; |
985 |
X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); |
X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); |
986 |
|
if ( debug ) printf(" X0pl %f tanx %f tany %f \n",X0pl,ytgx,ytgy); |
987 |
// |
// |
988 |
// Find experimental plane of maximum |
// Find experimental plane of maximum |
989 |
// |
// |
1004 |
// |
// |
1005 |
if ( vmax == 0 ) pmax++; |
if ( vmax == 0 ) pmax++; |
1006 |
etmax = pmax * X0pl; |
etmax = pmax * X0pl; |
1007 |
|
letmax = etmax; |
1008 |
// |
// |
1009 |
if ( debug ) this->Print(); |
if ( debug ) this->Print(); |
1010 |
if ( debug ) printf(" exit \n"); |
if ( debug ) printf(" exit \n"); |
1029 |
this->Fit(false); |
this->Fit(false); |
1030 |
}; |
}; |
1031 |
|
|
1032 |
Float_t CaloLong::Evaluate(TString s, Float_t tmax){ |
Float_t CaloLong::Evaluate(TString s, Float_t tmax, Float_t X0pl){ |
1033 |
/* SAMPLE OUTPUT: |
/* SAMPLE OUTPUT: |
1034 |
Enter Infix Expression : A + B + C / (E - F) |
Enter Infix Expression : A + B + C / (E - F) |
1035 |
Postfix Expression is : A B + C E F - / + |
Postfix Expression is : A B + C E F - / + |
1036 |
*/ |
*/ |
1037 |
if ( !s.Contains("t") ){ |
if ( !s.Contains("tmax") && !s.Contains("X0pl") ){ |
1038 |
printf(" ERROR, the input formula must contain \"t\"\n"); |
printf(" ERROR, the input formula must contain \"t\"\n"); |
1039 |
return 0.; |
return 0.; |
1040 |
}; |
}; |
1043 |
return 0.; |
return 0.; |
1044 |
}; |
}; |
1045 |
TString g=Form("%f",tmax); |
TString g=Form("%f",tmax); |
1046 |
|
TString h=Form("%f",X0pl); |
1047 |
TString *ts= new TString(""); |
TString *ts= new TString(""); |
1048 |
ts->Prepend(s.Data()); |
ts->Prepend(s.Data()); |
1049 |
ts->ReplaceAll("t",1,g.Data(),g.Capacity()); |
ts->ReplaceAll("tmax",4,g.Data(),g.Capacity()); |
1050 |
|
ts->ReplaceAll("X0pl",4,h.Data(),h.Capacity()); |
1051 |
ts->Prepend("("); |
ts->Prepend("("); |
1052 |
ts->Append(")"); |
ts->Append(")"); |
1053 |
if ( debug ) printf(" ts %s tssize %i capac %i s %s g %s \n",ts->Data(),ts->Sizeof(),ts->Capacity(),s.Data(),g.Data()); |
if ( debug ) printf(" ts %s tssize %i capac %i s %s g %s \n",ts->Data(),ts->Sizeof(),ts->Capacity(),s.Data(),g.Data()); |
1100 |
gStyle->SetNdivisions(510,"XY"); |
gStyle->SetNdivisions(510,"XY"); |
1101 |
}; |
}; |
1102 |
// |
// |
1103 |
TString hid = Form("clongfit"); |
TString hid = Form("clongfit%s",suf.Data()); |
1104 |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
1105 |
// if ( tc ) tc->Delete(); |
// if ( tc ) tc->Delete(); |
1106 |
// if ( tc ) tc->Close(); |
// if ( tc ) tc->Close(); |
1110 |
if ( tc ) tc->cd(); |
if ( tc ) tc->cd(); |
1111 |
}; |
}; |
1112 |
// |
// |
1113 |
TString thid = Form("hlongfit"); |
TString thid = Form("hlongfit%s",suf.Data()); |
1114 |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
TH2F *th = dynamic_cast<TH2F*>(gDirectory->FindObject(thid)); |
1115 |
if ( th ) th->Delete(); |
if ( th ) th->Delete(); |
1116 |
|
// |
1117 |
|
TString ghid = Form("glongfit%s",suf.Data()); |
1118 |
|
TGraphErrors *gh = dynamic_cast<TGraphErrors*>(gDirectory->FindObject(ghid)); |
1119 |
|
if ( gh ) gh->Delete(); |
1120 |
|
// |
1121 |
Float_t xpos = 0.; |
Float_t xpos = 0.; |
1122 |
Float_t enemip = 0.; |
Float_t enemip = 0.; |
1123 |
Float_t xmax = NC * X0pl + 0.2; |
Float_t xmax = NC * X0pl + 0.2; |
1124 |
// th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax); |
// |
1125 |
th = new TH1F(thid,thid,100,-0.2,xmax); |
Double_t xxx[50]; |
1126 |
|
Double_t exx[50]; |
1127 |
|
Double_t yyy[50]; |
1128 |
|
Double_t eyy[50]; |
1129 |
|
Int_t numpo = 0; |
1130 |
|
memset(xxx,0,50*sizeof(Double_t)); |
1131 |
|
memset(exx,0,50*sizeof(Double_t)); |
1132 |
|
memset(yyy,0,50*sizeof(Double_t)); |
1133 |
|
memset(eyy,0,50*sizeof(Double_t)); |
1134 |
// |
// |
1135 |
// AGH, BUG! |
// AGH, BUG! |
1136 |
// |
// |
1144 |
mmax = NC; |
mmax = NC; |
1145 |
}; |
}; |
1146 |
// |
// |
1147 |
|
Float_t emax = 0.; |
1148 |
Float_t qtotparz = 0.; |
Float_t qtotparz = 0.; |
1149 |
for (Int_t st=mmin;st<mmax+1;st++){ |
for (Int_t st=mmin;st<mmax+1;st++){ |
1150 |
enemip = 0.; |
enemip = 0.; |
1151 |
xpos = (st - mmin) * X0pl; |
xpos = (st - mmin) * X0pl; |
1152 |
if ( st > mmin && st < mmax ){ |
// |
1153 |
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
if ( xyaverage ){ |
1154 |
if ( !maskYO ){ |
// |
1155 |
enemip = 2. * eplane[1][st]; |
if ( st > mmin && st < mmax ){ |
1156 |
|
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
1157 |
|
if ( !maskYO ){ |
1158 |
|
enemip = 2. * eplane[1][st]; |
1159 |
|
} else { |
1160 |
|
enemip = eplane[1][st]; |
1161 |
|
}; |
1162 |
} else { |
} else { |
1163 |
enemip = eplane[1][st]; |
enemip = eplane[0][st-1] + eplane[1][st]; |
1164 |
}; |
}; |
1165 |
} else { |
} else { |
1166 |
enemip = eplane[0][st-1] + eplane[1][st]; |
if ( st == mmin ){ |
1167 |
|
if ( !maskYE ){ |
1168 |
|
enemip = 2. * eplane[1][st]; |
1169 |
|
} else { |
1170 |
|
enemip = eplane[1][st]; |
1171 |
|
}; |
1172 |
|
}; |
1173 |
|
if ( st == mmax ){ |
1174 |
|
if ( !maskXE ){ |
1175 |
|
enemip = 2. * eplane[0][st-1]; |
1176 |
|
} else { |
1177 |
|
enemip = eplane[0][st-1]; |
1178 |
|
}; |
1179 |
|
}; |
1180 |
|
}; |
1181 |
|
// |
1182 |
|
qtotparz += enemip; |
1183 |
|
if ( enemip > emax ) emax = enemip; |
1184 |
|
if ( enemip > 0. ){ |
1185 |
|
xxx[numpo] = xpos; |
1186 |
|
exx[numpo] = 0.1; |
1187 |
|
yyy[numpo] = enemip; |
1188 |
|
eyy[numpo] = sqrt(enemip*3.)+sqrt(5.); |
1189 |
|
//if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo; |
1190 |
|
if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.; |
1191 |
|
if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.; |
1192 |
|
//if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.; |
1193 |
|
if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.; |
1194 |
|
numpo++; |
1195 |
|
// th->Fill(xpos,enemip); |
1196 |
|
if ( debug ) printf(" AVE Filling: st %i xpos %f energy %f error %f letmax %f lmpith %f \n",st,xpos,enemip,eyy[numpo-1],letmax,lmipth); |
1197 |
}; |
}; |
1198 |
} else { |
} else { |
1199 |
if ( st == mmin ){ |
for (Int_t jj=0; jj<2; jj++){ |
1200 |
if ( !maskYE ){ |
if ( st > mmin && st < mmax ){ |
1201 |
enemip = 2. * eplane[1][st]; |
if ( jj == 0 && no18x && ( st == 18+1 || st == mask18b+1 )){ |
1202 |
|
enemip = eplane[1][st]; |
1203 |
|
} else { |
1204 |
|
if ( jj == 0 ){ |
1205 |
|
enemip = eplane[jj][st-1]; |
1206 |
|
} else { |
1207 |
|
enemip = eplane[jj][st]; |
1208 |
|
}; |
1209 |
|
}; |
1210 |
} else { |
} else { |
1211 |
enemip = eplane[1][st]; |
if ( st == mmin && jj == 1 ){ |
1212 |
|
enemip = eplane[jj][st]; |
1213 |
|
}; |
1214 |
|
if ( st == mmax && jj == 0){ |
1215 |
|
enemip = eplane[jj][st-1]; |
1216 |
|
}; |
1217 |
}; |
}; |
1218 |
}; |
// |
1219 |
if ( st == mmax ){ |
qtotparz += enemip; |
1220 |
if ( !maskXE ){ |
if ( enemip > emax ) emax = enemip; |
1221 |
enemip = 2. * eplane[0][st-1]; |
if ( enemip > 0. ){ |
1222 |
} else { |
xxx[numpo] = xpos; |
1223 |
enemip = eplane[0][st-1]; |
exx[numpo] = 0.1; |
1224 |
|
yyy[numpo] = enemip; |
1225 |
|
eyy[numpo] = sqrt(enemip*3.)+sqrt(5.); |
1226 |
|
//if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo; |
1227 |
|
//if ( xpos > letmax && enemip > lmipth && heavytail ) eyy[numpo] = (sqrt(enemip*3.)+sqrt(5.))/numpo; |
1228 |
|
if ( xpos > letmax && enemip > lmipth && heavytail) eyy[numpo] = sqrt(enemip)/5.; |
1229 |
|
if ( xpos > letmax-1 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 5.; |
1230 |
|
//if ( xpos > letmax-2 && xpos < letmax+1 && heavytail ) eyy[numpo] /= 7.; |
1231 |
|
if ( xpos < 3. && heavytail ) eyy[numpo] /= 5.; |
1232 |
|
// eyy[numpo] = sqrt(enemip)/(st*0.95); |
1233 |
|
numpo++; |
1234 |
|
// th->Fill(xpos,enemip); |
1235 |
|
if ( debug ) printf(" XY Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
1236 |
}; |
}; |
1237 |
}; |
}; |
|
}; |
|
|
// |
|
|
qtotparz += enemip; |
|
|
if ( enemip > 0. ){ |
|
|
th->Fill(xpos,enemip); |
|
|
if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
|
1238 |
}; |
}; |
1239 |
|
|
1240 |
// |
// |
1241 |
// for (Int_t v=1; v>=0;v--)// { |
// for (Int_t v=1; v>=0;v--)// { |
1242 |
// // |
// // |
1262 |
// }; |
// }; |
1263 |
}; |
}; |
1264 |
// |
// |
1265 |
TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3); |
// th = new TH2F(thid,thid,int(NC*1.5),-0.2,xmax); |
1266 |
|
th = new TH2F(thid,thid,1000,-0.2,xmax,1000,0.,emax*1.2); |
1267 |
|
gh = new TGraphErrors(numpo,xxx,yyy,exx,eyy); |
1268 |
|
TString fnam=Form("lfit%s",suf.Data()); |
1269 |
|
// TF1 *lfit = dynamic_cast<TF1*>(gDirectory->FindObject(fnam)); |
1270 |
|
if ( lfit ) lfit->Delete(); |
1271 |
|
lfit = new TF1(fnam,ccurve,0.,xmax,3); |
1272 |
|
// if ( !lfit ){ |
1273 |
|
// lfit = new TF1(fnam,ccurve,0.,xmax,3); |
1274 |
|
// }; |
1275 |
|
// lfit->Clear(); |
1276 |
|
// lfit->SetName(fnam); |
1277 |
|
// lfit->SetRange(0.,xmax); |
1278 |
|
// lfit->Print(); |
1279 |
|
// |
1280 |
if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz); |
if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz); |
1281 |
E0 = qtotparz; |
E0 = qtotparz; |
1282 |
// E0 = clp->qtot; |
// E0 = clp->qtot; |
1287 |
// lfit->SetParLimits(0,0.,1000.); |
// lfit->SetParLimits(0,0.,1000.); |
1288 |
// lfit->SetParLimits(1,-1.,80.); |
// lfit->SetParLimits(1,-1.,80.); |
1289 |
// lfit->SetParLimits(2,-1.,10.); |
// lfit->SetParLimits(2,-1.,10.); |
1290 |
TString optio; |
// TString optio = "ROW"; // "RO" |
1291 |
|
TString optio = "RO"; // "RO" |
1292 |
if ( debug ){ |
if ( debug ){ |
1293 |
// optio = "MERBOV"; |
optio += "NV"; |
1294 |
// optio = "MEROV"; |
if ( draw ) optio += "V"; |
|
// optio = "EROV"; |
|
|
optio = "RNOV"; |
|
|
if ( draw ) optio = "ROV"; |
|
1295 |
} else { |
} else { |
1296 |
// optio = "MERNOQ"; |
optio += "NQ"; |
1297 |
// optio = "ERNOQ"; |
if ( draw ) optio += "Q"; |
|
optio = "RNOQ"; |
|
|
if ( draw ) optio = "ROQ"; |
|
1298 |
}; |
}; |
1299 |
// |
// |
1300 |
if ( debug ) printf(" OK, start the fitting procedure...\n"); |
if ( debug ) printf(" OK, start the fitting procedure... options: %s \n",optio.Data()); |
1301 |
// |
// |
1302 |
fitresult = th->Fit("lfit",optio); |
// fitresult = th->Fit("lfit",optio); |
1303 |
|
// lfit->Update(); |
1304 |
|
fitresult = gh->Fit("lfit",optio); |
1305 |
|
// fitresult = gh->Fit("lfit","ROQW"); |
1306 |
// |
// |
1307 |
if ( debug ) printf(" the fit is done! result: %i \n",fitresult); |
if ( debug ) printf(" the fit is done! result: %i \n",fitresult); |
1308 |
// |
// |
1323 |
asymm = -1.; |
asymm = -1.; |
1324 |
defE0 = -1.; |
defE0 = -1.; |
1325 |
} else { |
} else { |
1326 |
if ( slmax.MaybeRegexp() ) lmax = this->Evaluate(slmax,tmax); |
if ( slmax.MaybeRegexp() ) lmax = this->Evaluate(slmax,tmax,X0pl); |
1327 |
if ( sumax.MaybeRegexp() ) umax = this->Evaluate(sumax,tmax); |
if ( sumax.MaybeRegexp() ) umax = this->Evaluate(sumax,tmax,X0pl); |
1328 |
Int_t npp = 1000; |
Int_t npp = 1000; |
1329 |
double *xpp=new double[npp]; |
double *xpp=new double[npp]; |
1330 |
double *wpp=new double[npp]; |
double *wpp=new double[npp]; |
1346 |
delete w; |
delete w; |
1347 |
delete xp; |
delete xp; |
1348 |
delete wp; |
delete wp; |
1349 |
|
delete xpp; |
1350 |
|
delete wpp; |
1351 |
// Float_t i10max = lfit->Integral(0.,10.*tmax); |
// Float_t i10max = lfit->Integral(0.,10.*tmax); |
1352 |
if ( debug ) printf(" Integral: %f \n",i10max); |
if ( debug ) printf(" Integral: %f \n",i10max); |
1353 |
// |
// |
1381 |
// axis titles |
// axis titles |
1382 |
th->SetXTitle("Depth [X0]"); |
th->SetXTitle("Depth [X0]"); |
1383 |
th->SetYTitle("Energy [MIP]"); |
th->SetYTitle("Energy [MIP]"); |
1384 |
th->DrawCopy("Perror"); |
// th->DrawCopy("Perror"); |
1385 |
|
th->DrawCopy(); |
1386 |
|
gh->SetMarkerSize(1.); |
1387 |
|
gh->SetMarkerStyle(21); |
1388 |
|
// gh->SetMarkerColor(kRed); |
1389 |
|
gh->Draw("Psame"); |
1390 |
lfit->Draw("same"); |
lfit->Draw("same"); |
1391 |
tc->Modified(); |
tc->Modified(); |
1392 |
tc->Update(); |
tc->Update(); |
1398 |
if ( th ) th->Delete(); |
if ( th ) th->Delete(); |
1399 |
}; |
}; |
1400 |
// |
// |
1401 |
delete lfit; |
// gMinuit->SetPrintLevel(1); |
1402 |
|
// gMinuit->mnamin(); |
1403 |
|
// // gMinuit->mnfree(0); |
1404 |
|
// gMinuit->mncler(); |
1405 |
|
// gMinuit->mnrset(1); |
1406 |
|
// gMinuit->Delete(); |
1407 |
|
//ROOT::Math::Minimizer::Clear(); |
1408 |
|
// gMinuit->mnhelp("*"); |
1409 |
|
// |
1410 |
|
// delete lfit; |
1411 |
// |
// |
1412 |
}; |
}; |
1413 |
|
|
1436 |
// |
// |
1437 |
if ( maxv != -1 ){ |
if ( maxv != -1 ){ |
1438 |
for (Int_t v=minv; v<maxv;v++){ |
for (Int_t v=minv; v<maxv;v++){ |
1439 |
TString hid = Form("clongv%i",v); |
TString hid = Form("clongv%i%s",v,suf.Data()); |
1440 |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
1441 |
if ( tc ){ |
if ( tc ){ |
1442 |
// tc->Clear(); |
// tc->Clear(); |
1444 |
tc = new TCanvas(hid,hid); |
tc = new TCanvas(hid,hid); |
1445 |
}; |
}; |
1446 |
// |
// |
1447 |
TString thid = Form("hlongv%i",v); |
TString thid = Form("hlongv%i%s",v,suf.Data()); |
1448 |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
1449 |
if ( th ) th->Delete(); |
if ( th ) th->Delete(); |
1450 |
// th->Clear(); |
// th->Clear(); |
1463 |
}; |
}; |
1464 |
} else { |
} else { |
1465 |
// |
// |
1466 |
TString hid = Form("clongvyvx"); |
TString hid = Form("clongvyvx%s",suf.Data()); |
1467 |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
1468 |
if ( tc ){ |
if ( tc ){ |
1469 |
} else { |
} else { |
1470 |
tc = new TCanvas(hid,hid); |
tc = new TCanvas(hid,hid); |
1471 |
}; |
}; |
1472 |
// |
// |
1473 |
TString thid = Form("hlongvyvx"); |
TString thid = Form("hlongvyvx%s",suf.Data()); |
1474 |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
1475 |
if ( th ) th->Delete(); |
if ( th ) th->Delete(); |
1476 |
th = new TH1F(thid,thid,44,-0.5,43.5); |
th = new TH1F(thid,thid,44,-0.5,43.5); |