15 TTree* t0=
new TTree(
"EsTimeOffset",
"EsTimeOffset");
16 double offset[2]={0.};;
19 for(
int i = 0; i<2; i++){
20 sprintf(estbrname,
"Offset%d",i);
21 sprintf(estptname,
"Offset%d/D",i);
22 t0->Branch(estbrname, &offset[i], estptname);
27 inf0.open(
"calib_EsTimeOffset.txt",ios::in);
28 inf01.open(
"EsTimeOffset.txt", ios::in);
29 if(inf0.good() && inf01.good()) {
39 std::cerr<<
"file: calib_estimeOffset.txt or est_estimeOffset can't be found!"<<std::endl;
44 TTree*
t=
new TTree(
"BarTofPar",
"barrel parameters");
49 for(
int i=0;i<20;i++){
52 t->Branch(brname,&p[i],ptname);
58 t->Branch(brname,&
w[i],ptname);
64 t->Branch(brname, &Atten[i], ptname);
66 double Speed[2]={0.},Q0[1]={0.};
67 t->Branch(
"Speed0",&Speed[0],
"Speed0/D");
68 t->Branch(
"Speed1",&Speed[1],
"Speed1/D");
69 t->Branch(
"Q0",Q0,
"Q0[1]/D");
70 double fitfun[20]={0.};;
79 sprintf(fptname1,
"fleft%d/D",i);
80 t->Branch(fbrname1,&fitfun[i],fptname1);
82 sprintf(fptname2,
"fright%d/D",i);
83 t->Branch(fbrname2,&fitfun[5+i],fptname2);
85 for(
int i=0;i<10;i++){
86 sprintf(fbrname3,
"FCounter%d",i);
87 sprintf(fptname3,
"fcounter%d/D",i);
88 t->Branch(fbrname3,&fitfun[10+i],fptname3);
92 bool is_open[N]={
false};
93 const char* filelist[N]={
"calib_barrel_left.txt",
"calib_barrel_right.txt",
"calib_barrel_w.txt",
"calib_barrel_atten.txt",
"calib_barrel_veff.txt",
"calib_barrel_sigma.txt",
"calib_barrel_left1.txt",
"calib_barrel_right1.txt",
"calib_barrel_common.txt",
"calib_barrel_q0.txt"};
95 inf[m].open(filelist[m],ios::in);
99 std::cerr<<
"file: "<<filelist[N]<<
" can't be found!"<<std::endl;
102 for(
int k=0;k<176;k++){
104 if(is_open[0]&&is_open[1]){
105 for(
int j=0;j<7;j++){
109 for(
int l=10;l<17;l++)
119 for(
int j=0;j<2;j++){
122 Atten[0]=1./Atten[0];
126 for(
int j=0;j<2;j++){
129 Speed[0]=1./Speed[0];
132 for(
int j=0; j<4; j++) {
135 for(
int j=5; j<9; j++) {
138 for(
int j=10; j<13; j++) {
144 for(
int j=2;j<5;j++){
158 TTree* t1=
new TTree(
"BarTofParInner",
"barrel inner layer parameters");
163 for(
int i=0;i<20;i++){
166 t1->Branch(brname1,&
p1[i],ptname1);
169 for(
int k=0;k<88;k++){
171 if(is_open[6]&&is_open[7]){
172 for(
int j=0;j<7;j++){
176 for(
int l=10;l<17;l++)
185 TTree* t2=
new TTree(
"BarTofParCommon",
"common part of barrel");
186 double t0Offset[2]={0.},sigmaCorr[8]={0.};
187 for(
int i=0;i<2;i++){
188 sprintf(brname,
"t0offset%d",i);
189 sprintf(ptname,
"t0offset%d/D",i);
190 t2->Branch(brname,&t0Offset[i],ptname);
192 for(
int i=0;i<8;i++){
193 sprintf(brname,
"sigmaCorr%d",i);
194 sprintf(ptname,
"sigmaCorr%d/D",i);
195 t2->Branch(brname,&sigmaCorr[i],ptname);
199 inf[8] >> sigmaCorr[0] >> sigmaCorr[1] >> t0Offset[0] >> t0Offset[1];
208 TFile
f(
"BarTofPar.root",
"RECREATE");
232 TTree* t0=
new TTree(
"EsTimeOffset",
"EsTimeOffset");
233 double offset[2]={0.};
236 for(
int i = 0; i<2; i++){
237 sprintf(estbrname,
"Offset%d",i);
238 sprintf(estptname,
"Offset%d/D",i);
239 t0->Branch(estbrname, &offset[i], estptname);
244 inf0.open(
"calib_estimeOffset.txt",ios::in);
245 inf01.open(
"est_estimeOffset.txt", ios::in);
246 if(inf0.good()&& inf01.good()) {
256 std::cerr<<
"file: calib_estimeOffset.txt or est_estimeOffset can't be found!"<<std::endl;
261 TTree*
t=
new TTree(
"EndTofPar",
"endcap parameters");
266 for(
int i=0;i<8;i++){
269 t->Branch(brname,&p[i],ptname);
271 double Atten[5]={0.},Speed[3]={0.},Q0[1]={0.};
272 t->Branch(
"Atten0",&Atten[0],
"Atten0/D");
273 t->Branch(
"Atten1",&Atten[1],
"Atten1/D");
274 t->Branch(
"Atten2",&Atten[2],
"Atten2/D");
275 t->Branch(
"Atten3",&Atten[3],
"Atten3/D");
276 t->Branch(
"Atten4",&Atten[4],
"Atten4/D");
277 t->Branch(
"Speed0",&Speed[0],
"Speed0/D");
278 t->Branch(
"Speed1",&Speed[1],
"Speed1/D");
279 t->Branch(
"Speed2",&Speed[2],
"Speed2/D");
280 t->Branch(
"Q0",Q0,
"Q0[1]/D");
283 bool is_open[N]={
false};
284 const char* filelist[N]={
"calib_endcap_left.txt",
"calib_endcap_atten.txt",
"calib_endcap_veff.txt"};
285 for(
int m=0;m<N;m++){
286 inf[m].open(filelist[m],ios::in);
290 std::cerr<<
"File: "<<filelist[m]<<
" can't be opened"<<std::endl;
294 for(
int k=0;k<96;k++){
296 if(is_open[0]&&is_open[1]){
297 for(
int j=0;j<5;j++){
304 for(
int j=0;j<3;j++){
307 Atten[0]=1./Atten[0];
311 for(
int j=0;j<3;j++){
314 Speed[0]=1./Speed[0];
328 TFile
f(
"EndTofPar.root",
"RECREATE");
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)