当前位置: 首页>>代码示例>>C++>>正文


C++ TVectorD::Zero方法代码示例

本文整理汇总了C++中TVectorD::Zero方法的典型用法代码示例。如果您正苦于以下问题:C++ TVectorD::Zero方法的具体用法?C++ TVectorD::Zero怎么用?C++ TVectorD::Zero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TVectorD的用法示例。


在下文中一共展示了TVectorD::Zero方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// ------------ method called once each job just before starting event loop  ------------
void
LYZ::beginJob()
{
    double Vmax[nbin], eps[nbin];
    for(int ibin=0; ibin<nbin ; ibin++) {
        Vmax[ibin]=0.065*(trkbin[ibin]+30);
        eps[ibin]=0.00025*(trkbin[ibin]+30);
    }

    Nevent.ResizeTo(nbin);
    totmultall.ResizeTo(nbin), tottrk.ResizeTo(nbin);;
    Nevent.Zero();
    totmultall.Zero(),	tottrk.Zero();
    for(int ibin=0; ibin<nbin; ibin++) {
        for(int iptbin=0; iptbin<nptV; iptbin++) {
            Qx2[ibin][iptbin]=0;
            Qy2[ibin][iptbin]=0;
        }
    }

    for(int itheta=0; itheta<ntheta; itheta++) {
        theta[itheta]=itheta*TMath::Pi()/ntheta/nn;
        for(int ibin=0; ibin<nbin; ibin++) {
            for(int iptbin=0; iptbin<nptV; iptbin++) {
                GRe[ibin][iptbin][itheta].ResizeTo(nstepr);
                GRe[ibin][iptbin][itheta].Zero();
                GIm[ibin][iptbin][itheta].ResizeTo(nstepr);
                GIm[ibin][iptbin][itheta].Zero();
            }
        }
    }

    for(int ibin=0; ibin<nbin; ibin++) {
        for(int ir=0; ir<nstepr; ir++)
            if(isSimple==0)	r[ibin][ir]=j01/(Vmax[ibin]-eps[ibin]*ir);
            else	r[ibin][ir]=0.00025*20*(ir+1);
        Qx1[ibin].ResizeTo(nptV);
        Qy1[ibin].ResizeTo(nptV);
        Q2[ibin].ResizeTo(nptV);
        Qx1[ibin].Zero();
        Qy1[ibin].Zero();
        Q2[ibin].Zero();
        totmult[ibin].ResizeTo(nptv);
        totmult[ibin].Zero();
        totpt[ibin].ResizeTo(nptv);
        totpt[ibin].Zero();
        dDRe[ibin].ResizeTo(ntheta);
        dDRe[ibin].Zero();
        dDIm[ibin].ResizeTo(ntheta);
        dDIm[ibin].Zero();
        for(int itheta=0; itheta<ntheta; itheta++) {
            dNRe[ibin][itheta].ResizeTo(nptv);
            dNRe[ibin][itheta].Zero();
            dNIm[ibin][itheta].ResizeTo(nptv);
            dNIm[ibin][itheta].Zero();

        }
    }
}
开发者ID:XuQiao,项目名称:HI,代码行数:60,代码来源:LYZtrack.C

示例2: merge

void merge(){
	TVectorD Nevent;	Nevent.ResizeTo(nbin);  Nevent.Zero();
     //   TVectorD totmultall;	totmultall.ResizeTo(nbin);      totmultall.Zero();
     //   TVectorD avgmultall;	avgmultall.ResizeTo(nbin);      avgmultall.Zero();
        TVectorD tottrk;	tottrk.ResizeTo(nbin);      tottrk.Zero();
//	TVectorD totptall;      totptall.ResizeTo(nbin);    totptall.Zero();
//	TVectorD totetaall;      totetaall.ResizeTo(nbin);    totetaall.Zero();
        TVectorD avgtrk;	avgtrk.ResizeTo(nbin);      avgtrk.Zero();
//	TVectorD avgmult;       avgmult.ResizeTo(nbin);
            
        TH2F* s[nbin];
        TH2F* b[nbin];
        for(int ibin=0;ibin<nbin;ibin++){
            s[ibin] = new TH2F(Form("s_%d",ibin),Form("signal",ibin),detastep,detamin,detamax,dphistep,dphimin,dphimax);
            s[ibin]->Sumw2();
            b[ibin]  = new TH2F(Form("b_%d",ibin), "background",detastep,detamin,detamax,dphistep,dphimin,dphimax);
            b[ibin]->Sumw2();
        }
        TFile *fout = new TFile(Form("Anav3_merged.root"),"Recreate");
        TFile *f[nFileAll];
        for(int ifile=; ifile<63; ifile++){
                f[ifile] = TFile::Open(Form("%s/Anav3_%d.root",outdir.Data(),ifile));
                if(!f[ifile]) continue;
		TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
	//	TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
		TVectorD* tottrk_t =  (TVectorD*)f[ifile]->Get(Form("tottrk"));
	//	TVectorD* totptall_t =  (TVectorD*)f[ifile]->Get(Form("totptall"));
//		TVectorD* totetaall_t =  (TVectorD*)f[ifile]->Get(Form("totetaall"));
		for(int ibin=0;ibin<nbin;ibin++){
			//	totptall[ibin] += (*totptall_t)[ibin];
			//	totetaall[ibin] += (*totetaall_t)[ibin];
			        Nevent[ibin] += (*Nevent_t)[ibin];
			  //      totmultall[ibin] += (*totmultall_t)[ibin];	
			        tottrk[ibin] += (*tottrk_t)[ibin];	
                                TH1D* s_t = (TH1D*)f[ifile]->Get(Form("signal_%d",ibin));
                                TH1D* b_t = (TH1D*)f[ifile]->Get(Form("background_%d",ibin));
                                s[ibin]->Add(s_t);
                                b[ibin]->Add(b_t);
		}
		f[ifile]->Close();
        }
    for(int ibin=0;ibin<nbin;ibin++){
    avgtrk[ibin] = tottrk[ibin]/Nevent[ibin];
    TH1D* hr = (TH1D*)s[ibin]->Clone("hr");
    hr->Divide(b[ibin]);
    hr->Scale(b[ibin]->GetBinContent(b[ibin]->FindBin(0,0)));

    fout->cd();
    Nevent.Write("Nevent");
    avgtrk.Write("avgtrk");
    TDirectory *dir0 = (TDirectory*)fout->mkdir(Form("D_%d",ibin));
    dir0->cd();
    s[ibin]->Write("s");
    b[ibin]->Write("b");
    hr->Write();
    }
}
开发者ID:XuQiao,项目名称:HI,代码行数:57,代码来源:merge.C

示例3:

// ------------ method called once each job just before starting event loop  ------------
void 
LYZ::beginJob(int ispt_)
{
  double Vmax[nbin], eps[nbin];
  for(int ibin=0; ibin<nbin ;ibin++){
        Vmax[ibin]=0.065*(trkbin[ibin]+30);
        eps[ibin]=0.00025*(trkbin[ibin]+30);
  }
    ispt = ispt_;
    if(ispt_){             nvv = nptv;       binv = ptbinv;}
    else{             nvv = netav;          binv = etabinv;}

	Nevent.ResizeTo(nbin);	totmultall.ResizeTo(nbin), tottrk.ResizeTo(nbin), totptall.ResizeTo(nbin), totetaall.ResizeTo(nbin); totwall.ResizeTo(nbin); 
		Qx1.ResizeTo(nbin);	Qy1.ResizeTo(nbin);	Q2.ResizeTo(nbin);
	Nevent.Zero();	totmultall.Zero(); totwall.Zero(); tottrk.Zero(); totptall.Zero(); totetaall.Zero();
		Qx1.Zero();	Qy1.Zero();	Q2.Zero();
	for(int ibin=0; ibin<nbin; ibin++){
        		Qx2[ibin]=0;  Qy2[ibin]=0;
	}

        	for(int itheta=0;itheta<ntheta;itheta++){
               		theta[itheta]=itheta*TMath::Pi()/ntheta/nn;
			for(int ibin=0; ibin<nbin; ibin++){
					GRe[ibin][itheta].ResizeTo(nstepr); 	GRe[ibin][itheta].Zero();
					GIm[ibin][itheta].ResizeTo(nstepr);	GIm[ibin][itheta].Zero();
				}
		}
	
	for(int ibin=0; ibin<nbin; ibin++){
        	    for(int ir=0; ir<nstepr; ir++)
                        if(isSimple==0)	r[ibin][ir]=j01/(Vmax[ibin]-eps[ibin]*ir);
                	else	r[ibin][ir]=0.00025*20*(ir+1);
                totmultv[ibin].ResizeTo(nvv);	totmultv[ibin].Zero();  
                totptv[ibin].ResizeTo(nvv);	totptv[ibin].Zero();  
                totetav[ibin].ResizeTo(nvv);	totetav[ibin].Zero();  
		dDRe[ibin].ResizeTo(ntheta);	dDRe[ibin].Zero();
		dDIm[ibin].ResizeTo(ntheta);	dDIm[ibin].Zero();
                for(int itheta=0;itheta<ntheta;itheta++){
                    dNRe[ibin][itheta].ResizeTo(nvv);	dNRe[ibin][itheta].Zero();
                    dNIm[ibin][itheta].ResizeTo(nvv);	dNIm[ibin][itheta].Zero();
                }
        }
}
开发者ID:XuQiao,项目名称:HI,代码行数:44,代码来源:LYZ.C

示例4:

// ------------ method called once each job just before starting event loop  ------------
void 
qfit::beginJob(int ispt_)
{
    ispt = ispt_;
    if(ispt_){             nvv = nptv;       binv = ptbinv;}
    else{             nvv = netav;          binv = etabinv;}

	Nevent.ResizeTo(nbin);	totmultall.ResizeTo(nbin), tottrk.ResizeTo(nbin), totptall.ResizeTo(nbin), totptall2.ResizeTo(nbin); totetaall.ResizeTo(nbin);
	Nevent.Zero();	totmultall.Zero(),	tottrk.Zero(); totptall.Zero(); totptall2.Zero(); totetaall.Zero();
        q22.ResizeTo(nbin);q24.ResizeTo(nbin);
        q22.Zero();q24.Zero();

        	for(int itheta=0;itheta<ntheta;itheta++){
               		theta[itheta]=itheta*TMath::Pi()/ntheta/nn;
		}
	
	for(int ibin=0; ibin<nbin; ibin++){
                totmultv[ibin].ResizeTo(nvv);	totmultv[ibin].Zero();  
                totptv[ibin].ResizeTo(nvv);	totptv[ibin].Zero();  
                totetav[ibin].ResizeTo(nvv);	totetav[ibin].Zero();  
                for(int itheta=0;itheta<ntheta;itheta++){
                    hq[ibin][itheta] = new TH1D(Form("hq_%d_%d",ibin,itheta),Form("hq_%d_%d",ibin,itheta),1000,0,10);
                    hq[ibin][itheta]->Sumw2();
                }
                hqx[ibin] = new TH1D(Form("hqx_%d",ibin),Form("hqx_%d",ibin),1000,0,10);
                hqy[ibin] = new TH1D(Form("hqy_%d",ibin),Form("hqy_%d",ibin),1000,0,10);
                hq2[ibin] = new TH1D(Form("hq2_%d",ibin),Form("hq2_%d",ibin),1000,0,10);
                hvq2[ibin] = new TH1D(Form("hvq2_%d",ibin),Form("hvq2_%d",ibin),1000,0,1);
                hq2nonf[ibin] = new TH1D(Form("hq2nonf_%d",ibin),Form("hq2nonf_%d",ibin),1000,0,10);
                hqx[ibin]->Sumw2();
                hqy[ibin]->Sumw2();
                hq2[ibin]->Sumw2();
                hvq2[ibin]->Sumw2();
                hq2nonf[ibin]->Sumw2();
        }
}
开发者ID:XuQiao,项目名称:HI,代码行数:37,代码来源:qfit.C

示例5: getResV

void getResV(){

//------------------------Deal with the number and get the output stored in txt files and root files
	
	string SumorProd = getenv("SUMORPROD");
	double Vmax[nbin], eps[nbin];
	for(int ibin=0; ibin<nbin ;ibin++){
        	//Vmax[ibin]=0.065*(trkbin[ibin]+30);
	       	Vmax[ibin]=0.065*avgmultIn;
        	//eps[ibin]=0.00025*(trkbin[ibin]+30);
        	eps[ibin]=0.00025*avgmultIn;
	}
	ofstream  fstrV;
	double theta[ntheta];
	TVectorD avgmult[nbin], avgpt[nbin], totmult[nbin], totpt[nbin];
	TVectorD Qx1[nbin], Qy1[nbin], Q2[nbin];
	TVectorD Gmod2[nbin][nptV][ntheta];
	TVectorD sigma2[nbin][nptV],deltaV[nbin][nptV];
	TVectorD sigma2_[nbin],chi_[nbin];
	TVectorD deltaVmean[nbin], Vmean[nbin];
	TVectorD r[nbin];
	TVectorD r0[nbin][nptV], V[nbin][nptV], chi[nbin][nptV];
	TVectorD GRe[nbin][nptV][ntheta]; TVectorD* GRe_t[nbin][nptV][ntheta];
	TVectorD GIm[nbin][nptV][ntheta]; TVectorD* GIm_t[nbin][nptV][ntheta];
	TComplex G[nbin][nptV][ntheta][nstepr];
	if(SumorProd=="Sum")	fstrV.open("V_Sum.txt");
	else	fstrV.open("V_Prod.txt");
	TFile *f[nFileAll];

        for(int ibin=0; ibin<nbin; ibin++){
		r[ibin].ResizeTo(nstepr);
                for(int ir=0; ir<nstepr; ir++){
        if(isSimple==0)  r[ibin][ir]=j01/(Vmax[ibin]-eps[ibin]*ir);	
	else		 r[ibin][ir]=0.00025*20*(ir+1);
		}
	}
                
	TVectorD Nevent;	Nevent.ResizeTo(nbin);  Nevent.Zero();
        TVectorD totmultall;	totmultall.ResizeTo(nbin);      totmultall.Zero();
        TVectorD avgmultall;	avgmultall.ResizeTo(nbin);      avgmultall.Zero();
        TVectorD tottrk;	tottrk.ResizeTo(nbin);      tottrk.Zero();
        TVectorD avgtrk;	avgtrk.ResizeTo(nbin);      avgtrk.Zero();
	
	for(int itheta=0;itheta<ntheta;itheta++)
        	theta[itheta]=itheta*TMath::Pi()/ntheta/nn;

	for(int ibin=0;ibin<nbin;ibin++){
		for(int iptbin=0;iptbin<nptV;iptbin++){
			r0[ibin][iptbin].ResizeTo(ntheta);
			sigma2[ibin][iptbin].ResizeTo(ntheta);
			V[ibin][iptbin].ResizeTo(ntheta);
			deltaV[ibin][iptbin].ResizeTo(ntheta);
			chi[ibin][iptbin].ResizeTo(ntheta);
                        for(int itheta=0;itheta<ntheta;itheta++){
				Gmod2[ibin][iptbin][itheta].ResizeTo(nstepr);
				GRe[ibin][iptbin][itheta].ResizeTo(nstepr);
				GRe[ibin][iptbin][itheta].Zero();
				GIm[ibin][iptbin][itheta].ResizeTo(nstepr);
				GIm[ibin][iptbin][itheta].Zero();
			}
		}

		avgmult[ibin].ResizeTo(nptV);	deltaVmean[ibin].ResizeTo(nptV);	Vmean[ibin].ResizeTo(nptV);
		totpt[ibin].ResizeTo(nptV);	totpt[ibin].Zero();
		totmult[ibin].ResizeTo(nptV);	totmult[ibin].Zero();
		avgpt[ibin].ResizeTo(nptV);
                Qx1[ibin].ResizeTo(nptV);     Qx1[ibin].Zero();
                Qy1[ibin].ResizeTo(nptV);     Qy1[ibin].Zero();
                Q2[ibin].ResizeTo(nptV);     Q2[ibin].Zero();
		sigma2_[ibin].ResizeTo(nptV);sigma2_[ibin].Zero();
		chi_[ibin].ResizeTo(nptV);chi_[ibin].Zero();
	}

	for(int ifile=0; ifile<nFileAll; ifile++){
		if(SumorProd=="Sum") f[ifile] = TFile::Open(Form("/lio/lfs/cms/store/user/qixu/flow/pbsjoboutput/PFcandpt03to6/M300260/AnaV_Sum_%d.root",ifile));
		else f[ifile] = TFile::Open(Form("/lio/lfs/cms/store/user/qixu/flow/pbsjoboutput/PFcandpt03to6/M300260/AnaV_Prod_%d.root",ifile));
		TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
		TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
		TVectorD* tottrk_t =  (TVectorD*)f[ifile]->Get(Form("tottrk"));
		for(int ibin=0;ibin<nbin;ibin++){
			for(int iptbin=0;iptbin<nptV;iptbin++){
					for(int itheta=0;itheta<ntheta;itheta++){
					GRe_t[ibin][iptbin][itheta] = (TVectorD*)f[ifile]->Get(Form("GRe_%d_%d_%d",ibin,iptbin,itheta));
					GIm_t[ibin][iptbin][itheta] = (TVectorD*)f[ifile]->Get(Form("GIm_%d_%d_%d",ibin,iptbin,itheta));
					for(ir=0; ir<nstepr; ir++){
						GRe[ibin][iptbin][itheta][ir] += (*GRe_t[ibin][iptbin][itheta])[ir];
						GIm[ibin][iptbin][itheta][ir] += (*GIm_t[ibin][iptbin][itheta])[ir];
					}
				}
			}
			TVectorD* Qx1_t =  (TVectorD*)f[ifile]->Get(Form("Qx1_%d",ibin));
			TVectorD* Qy1_t =  (TVectorD*)f[ifile]->Get(Form("Qy1_%d",ibin));
			TVectorD* Q2_t =  (TVectorD*)f[ifile]->Get(Form("Q2_%d",ibin));
			TVectorD* totmult_t =  (TVectorD*)f[ifile]->Get(Form("totmult_%d",ibin));
			TVectorD* totpt_t =  (TVectorD*)f[ifile]->Get(Form("totpt_%d",ibin));
			for(int iptbin=0;iptbin<nptV;iptbin++){
				Qx1[ibin][iptbin] += (*Qx1_t)[iptbin];
				Qy1[ibin][iptbin] += (*Qy1_t)[iptbin];
				Q2[ibin][iptbin] += (*Q2_t)[iptbin];
				totmult[ibin][iptbin] += (*totmult_t)[iptbin];
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:getResV.C

示例6: getResV

void getResV(){

//------------------------Deal with the number and get the output stored in txt files and root files
	
        TF1 *ffit[nbin];
        TF1 *ffit0[nbin][ntheta];
	TFile *f[nFileAll];

	double theta[ntheta];
	TVectorD Nevent;	Nevent.ResizeTo(nbin);  Nevent.Zero();
        TVectorD totmultall;	totmultall.ResizeTo(nbin);      totmultall.Zero();
        TVectorD avgmultall;	avgmultall.ResizeTo(nbin);      avgmultall.Zero();
        TVectorD tottrk;	tottrk.ResizeTo(nbin);      tottrk.Zero();
	TVectorD totptall;      totptall.ResizeTo(nbin);    totptall.Zero();
	TVectorD totetaall;      totetaall.ResizeTo(nbin);    totetaall.Zero();
        TVectorD avgtrk;	avgtrk.ResizeTo(nbin);      avgtrk.Zero();
        TVectorD avgpt;         avgpt.ResizeTo(nbin);
        TVectorD avgeta;         avgeta.ResizeTo(nbin);
        TH1D* hq[nbin][ntheta];
        TH1D* hqx[nbin];
        TH1D* hqy[nbin];
        TH1D* hq2[nbin];
        TH1D* hq2nonf[nbin];
	
	string dir = getenv("DIR");
	for(int itheta=0;itheta<ntheta;itheta++)
        	theta[itheta]=itheta*TMath::Pi()/ntheta/nn;

	for(int ibin=0;ibin<nbin;ibin++){
                        for(int itheta=0;itheta<ntheta;itheta++){
                                hq[ibin][itheta] = new TH1D(Form("hq"),Form("hq"),1000,0,10);
                        }
                        hqx[ibin] = new TH1D(Form("hqx"),Form("hqx"),1000,0,10);
                        hqy[ibin] = new TH1D(Form("hqy"),Form("hqy"),1000,0,10);
                        hq2[ibin] = new TH1D(Form("hq2"),Form("hq2"),1000,0,10);
                        hq2nonf[ibin] = new TH1D(Form("hq2nonf"),Form("hq2nonf"),1000,0,10);
	}

        for(int ifile=0; ifile<nFileAll; ifile++){
		f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/qfit/tracknormcpt03to6/%s/AnaV_Sum_%d.root",dir.c_str(),ifile));
		TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
		TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
		TVectorD* tottrk_t =  (TVectorD*)f[ifile]->Get(Form("tottrk"));
		TVectorD* totptall_t =  (TVectorD*)f[ifile]->Get(Form("totptall"));
		TVectorD* totetaall_t =  (TVectorD*)f[ifile]->Get(Form("totetaall"));
		for(int ibin=0;ibin<nbin;ibin++){
                                TH1D* hqx_t = (TH1D*)f[ifile]->Get(Form("hqx_%d",ibin));
                                hqx[ibin]->Add(hqx_t);
                                TH1D* hqy_t = (TH1D*)f[ifile]->Get(Form("hqy_%d",ibin));
                                hqy[ibin]->Add(hqy_t);
                                TH1D* hq2_t = (TH1D*)f[ifile]->Get(Form("hq2_%d",ibin));
                                hq2[ibin]->Add(hq2_t);
                                TH1D* hq2nonf_t = (TH1D*)f[ifile]->Get(Form("hq2nonf_%d",ibin));
                                hq2nonf[ibin]->Add(hq2nonf_t);
				for(int itheta=0;itheta<ntheta;itheta++){
                                    TH1D* hq_t = (TH1D*)f[ifile]->Get(Form("hq_%d_%d",ibin,itheta));
                                    hq[ibin][itheta]->Add(hq_t);
			        }
				totptall[ibin] += (*totptall_t)[ibin];
				totetaall[ibin] += (*totetaall_t)[ibin];
			        Nevent[ibin] += (*Nevent_t)[ibin];
			        totmultall[ibin] += (*totmultall_t)[ibin];	
			        tottrk[ibin] += (*tottrk_t)[ibin];	
		}
		f[ifile]->Close();
	}
	
	for(int ibin=0;ibin<nbin;ibin++){
		avgmultall[ibin]=totmultall[ibin]/Nevent[ibin];
		avgtrk[ibin]=tottrk[ibin]/Nevent[ibin];
			for(int itheta=0;itheta<ntheta;itheta++){
				avgpt[ibin]=1.0*totptall[ibin]/totmultall[ibin];
				avgeta[ibin]=1.0*totetaall[ibin]/totmultall[ibin];
				}
	}

	TString outname = "mergedV_Sum.root";
	TFile *outf = new TFile(outname,"Recreate");
        Nevent.Write("Nevent");
       	totmultall.Write("totmultall");
       	avgmultall.Write("avgmultall");
       	tottrk.Write("tottrk");
       	avgtrk.Write("avgtrk");
        avgpt.Write("avgpt");
        avgeta.Write("avgeta");
        
	for(int ibin=0;ibin<nbin;ibin++){
                TDirectory *dir0 = outf->mkdir(Form("D_%d",ibin));dir0->cd();
                hqx[ibin]->Write(); hqy[ibin]->Write();hq2[ibin]->Write();hq2nonf[ibin]->Write();

        		for(int itheta=0;itheta<ntheta;itheta++){
                        	TDirectory *dir1 = dir0->mkdir(Form("D_%d",itheta));dir1->cd();
                                hq[ibin][itheta]->Write();
                        }
        	}
	outf->Close();
}
开发者ID:XuQiao,项目名称:HI,代码行数:97,代码来源:getResV.C

示例7: getResV

void getResV(){

//------------------------Deal with the number and get the output stored in txt files and root files
	
        double Vmax[nbin], eps[nbin];
        for(int ibin=0; ibin<nbin ;ibin++){
            Vmax[ibin]=0.065*(trkbin[ibin]+30);
            eps[ibin]=0.00025*(trkbin[ibin]+30);
        }
	ofstream  fstrV;
	double theta[ntheta];
	TVectorD Gmod2[nbin][ntheta];
	TVectorD sigma2[nbin],deltaV[nbin];
	TVectorD r[nbin];
	TVectorD r0[nbin], r01[nbin], V[nbin], chi[nbin];
	TVectorD GRe[nbin][ntheta]; TVectorD* GRe_t[nbin][ntheta];
	TVectorD GIm[nbin][ntheta]; TVectorD* GIm_t[nbin][ntheta];
	TComplex G[nbin][ntheta][nstepr];
        TF1 *ffit[nbin];
        TF1 *ffit0[nbin][ntheta];
	if(isSum)	fstrV.open("V_Sum.txt");
	else	fstrV.open("V_Prod.txt"); 
	TFile *f[nFileAll];

        for(int ibin=0; ibin<nbin; ibin++){
		    r[ibin].ResizeTo(nstepr);
                    for(int ir=0; ir<nstepr; ir++){
                        if(isSimple==0)  r[ibin][ir]=j01/(Vmax[ibin]-eps[ibin]*ir);	
	                else		 r[ibin][ir]=0.00025*20*(ir+1);
		    }
        }
                
	TVectorD Nevent;	Nevent.ResizeTo(nbin);  Nevent.Zero();
        TVectorD totmultall;	totmultall.ResizeTo(nbin);      totmultall.Zero();
        TVectorD avgmultall;	avgmultall.ResizeTo(nbin);      avgmultall.Zero();
        TVectorD tottrk;	tottrk.ResizeTo(nbin);      tottrk.Zero();
	TVectorD totptall;      totptall.ResizeTo(nbin);    totptall.Zero();
	TVectorD totetaall;      totetaall.ResizeTo(nbin);    totetaall.Zero();
        TVectorD avgtrk;	avgtrk.ResizeTo(nbin);      avgtrk.Zero();
        TVectorD deltaVmean;    deltaVmean.ResizeTo(nbin);	
        TVectorD Vmean;         Vmean.ResizeTo(nbin);
        TVectorD avgpt;         avgpt.ResizeTo(nbin);
        TVectorD avgeta;         avgeta.ResizeTo(nbin);
        TVectorD Qx1;           Qx1.ResizeTo(nbin); Qx1.Zero();
        TVectorD Qy1;           Qy1.ResizeTo(nbin); Qy1.Zero();
        TVectorD Q2;           Q2.ResizeTo(nbin); Q2.Zero();
        TVectorD sigma2_;       sigma2_.ResizeTo(nbin); sigma2_.Zero();
        TVectorD chi_;           chi_.ResizeTo(nbin); chi_.Zero();
        TH1D* hq[nbin][ntheta];
        TH1D* hqx[nbin];
        TH1D* hqy[nbin];
        TH1D* hq2[nbin];
        TH1D* hq2nonf[nbin];
	
	for(int itheta=0;itheta<ntheta;itheta++)
        	theta[itheta]=itheta*TMath::Pi()/ntheta/nn;

	for(int ibin=0;ibin<nbin;ibin++){
			r0[ibin].ResizeTo(ntheta);
			r01[ibin].ResizeTo(ntheta);
			sigma2[ibin].ResizeTo(ntheta);
			V[ibin].ResizeTo(ntheta);
			deltaV[ibin].ResizeTo(ntheta);
			chi[ibin].ResizeTo(ntheta);
                        for(int itheta=0;itheta<ntheta;itheta++){
				Gmod2[ibin][itheta].ResizeTo(nstepr);
				GRe[ibin][itheta].ResizeTo(nstepr);
				GRe[ibin][itheta].Zero();
				GIm[ibin][itheta].ResizeTo(nstepr);
				GIm[ibin][itheta].Zero();
                                hq[ibin][itheta] = new TH1D(Form("hq"),Form("hq"),1000,0,10);
                        }
                        hqx[ibin] = new TH1D(Form("hqx"),Form("hqx"),1000,0,10);
                        hqy[ibin] = new TH1D(Form("hqy"),Form("hqy"),1000,0,10);
                        hq2[ibin] = new TH1D(Form("hq2"),Form("hq2"),1000,0,10);
                        hq2nonf[ibin] = new TH1D(Form("hq2nonf"),Form("hq2nonf"),1000,0,10);
	}

        for(int ifile=0; ifile<nFileAll; ifile++){
		if(isSum) f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/Bessfun/pPbDataV200m30/AnaV_Sum_%d.root",ifile));
		else f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/Bessfun/pPbDataV200m30/AnaV_Prod_%d.root",ifile));
		TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
		TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
		TVectorD* tottrk_t =  (TVectorD*)f[ifile]->Get(Form("tottrk"));
		TVectorD* totptall_t =  (TVectorD*)f[ifile]->Get(Form("totptall"));
		TVectorD* totetaall_t =  (TVectorD*)f[ifile]->Get(Form("totetaall"));
		TVectorD* Qx1_t =  (TVectorD*)f[ifile]->Get(Form("Qx1"));
	        TVectorD* Qy1_t =  (TVectorD*)f[ifile]->Get(Form("Qy1"));
		TVectorD* Q2_t =  (TVectorD*)f[ifile]->Get(Form("Q2"));
		for(int ibin=0;ibin<nbin;ibin++){
                                TH1D* hqx_t = (TH1D*)f[ifile]->Get(Form("hqx_%d",ibin));
                                hqx[ibin]->Add(hqx_t);
                                TH1D* hqy_t = (TH1D*)f[ifile]->Get(Form("hqy_%d",ibin));
                                hqy[ibin]->Add(hqy_t);
                                TH1D* hq2_t = (TH1D*)f[ifile]->Get(Form("hq2_%d",ibin));
                                hq2[ibin]->Add(hq2_t);
                                TH1D* hq2nonf_t = (TH1D*)f[ifile]->Get(Form("hq2nonf_%d",ibin));
                                hq2nonf[ibin]->Add(hq2nonf_t);
				for(int itheta=0;itheta<ntheta;itheta++){
				    GRe_t[ibin][itheta] = (TVectorD*)f[ifile]->Get(Form("GRe_%d_%d",ibin,itheta));
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:getResV.C

示例8: if

void
Analyze(const TString mode="CLOSED",
        UShort_t       maxH=6,
        Bool_t         /*doLoops*/=false,
        Int_t ifile=0   )
{
#ifdef __CINT__
  gROOT->LoadMacro("correlations/Types.hh++");
  gROOT->LoadMacro("correlations/Result.hh++");
  gROOT->LoadMacro("correlations/QVector.hh++");
  gROOT->LoadMacro("correlations/recursive/FromQVector.hh++");
  gROOT->LoadMacro("correlations/recurrence/FromQVector.hh++");
  gROOT->LoadMacro("correlations/closed/FromQVector.hh++");
  gROOT->LoadMacro("correlations/test/ReadData.hh++");
#endif
  // --- Setup of harmonics, etc -------------------------------------
  gRandom->SetSeed(54321);
  UShort_t emode = 0;
  if      (mode.EqualTo("closed",     TString::kIgnoreCase)) emode = 0;
  else if (mode.EqualTo("recurrence", TString::kIgnoreCase)) emode = 1;
  else if (mode.EqualTo("recursive",  TString::kIgnoreCase)) emode = 2;
  else
    Warning("Analyze", "Mode %s unknown, assuming CLOSED", mode.Data());

  correlations::QVector        q[nbin];
  correlations::FromQVector*   c[nbin];
  correlations::HarmonicVector h(maxH);
  for (UShort_t i = 0; i < maxH; i++) {
    // Generate random harmonicx
   // h[i] = -6 + gRandom->Integer(12);
   h[0] = 2;
   h[1] = -2;
   h[2] = 2;
   h[3] = -2;
   h[4] = 2;
   h[5] = -2;
   h[6] = -2;
   h[7] = 2;
   // Printf("h_%d:\t%d", i, h[i]);
  }

  // Resize the Q-vector to fit the harmonics
    for(int ibin=0;ibin<nbin;ibin++){
    q[ibin] = correlations::QVector(0,0,false);
    q[ibin].resize(h);
  switch (emode) {
  case 0: c[ibin] = new correlations::closed::FromQVector(q[ibin]); break;
  case 1: c[ibin] = new correlations::recurrence::FromQVector(q[ibin]); break;
  case 2: c[ibin] = new correlations::recursive::FromQVector(q[ibin]); break;
    }
  }
  //Printf("Correlator: %s", c->name());


  // --- Some histograms ---------------------------------------------
  TH1* sumreals[nbin];
  TH1* sumimags[nbin];
  TH1* weights[nbin];
  TVectorD tottrk;
  TVectorD Nevent;
  tottrk.ResizeTo(nbin);
  tottrk.Zero();
  Nevent.ResizeTo(nbin);
  Nevent.Zero();

  //TH1*      reals  = new TH1D("reals", "Re(C{n})", maxH-2+1, 2+.5, maxH+1+.5);
  //TH1*      imags  = static_cast<TH1*>(reals->Clone("imags"));
    for(int ibin=0;ibin<nbin;ibin++){
  sumreals[ibin]  = new TH1D(Form("sumreals_%d",ibin), "Re(C{n})", maxH-2+1, 2+.5, maxH+1+.5);
  sumimags[ibin]  = static_cast<TH1*>(sumreals[ibin]->Clone(Form("sumimags_%d",ibin)));
  weights[ibin]  = static_cast<TH1*>(sumreals[ibin]->Clone(Form("weights_%d",ibin)));
    }
  TProfile* timing = new TProfile("timing", "Timing", maxH-2+1, 2+.5,maxH+1+.5);
  TH1*      hs     = new TH1I("harmonics", "Harmonics", maxH, 1.5, maxH+1.5);
  /*reals->SetFillColor(kGreen+1);
  reals->SetFillStyle(3001);
  reals->SetStats(0);
  imags->SetTitle("Im(C{n})");
  imags->SetFillColor(kBlue+1);
  imags->SetFillStyle(3001);
  imags->SetStats(0);
  timing->SetFillColor(kRed+1);
  timing->SetFillStyle(3001);
  timing->SetStats(0);
  hs->SetFillColor(kMagenta+1);
  hs->SetFillStyle(3001);
  hs->SetStats(0);*/
  for (UShort_t i = 0; i < maxH-1; i++) {
    TString label = TString::Format("C{%d}", i+2);
//    reals->GetXaxis()->SetBinLabel(i+1, label);
//    imags->GetXaxis()->SetBinLabel(i+1, label);
    timing->GetXaxis()->SetBinLabel(i+1, label);
    hs->GetXaxis()->SetBinLabel(i+1,Form("h_{%d}", i+1));
    hs->SetBinContent(i+1, h[i]);
  }
  hs->GetXaxis()->SetBinLabel(maxH,Form("h_{%d}", maxH));
  hs->SetBinContent(maxH, h[maxH-1]);

  TStopwatch timer;
 
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:Analyze.C

示例9: merge

void merge(){
	TVectorD Nevent;	Nevent.ResizeTo(nbin);  Nevent.Zero();
     //   TVectorD totmultall;	totmultall.ResizeTo(nbin);      totmultall.Zero();
     //   TVectorD avgmultall;	avgmultall.ResizeTo(nbin);      avgmultall.Zero();
        TVectorD tottrk;	tottrk.ResizeTo(nbin);      tottrk.Zero();
//	TVectorD totptall;      totptall.ResizeTo(nbin);    totptall.Zero();
//	TVectorD totetaall;      totetaall.ResizeTo(nbin);    totetaall.Zero();
        TVectorD avgtrk;	avgtrk.ResizeTo(nbin);      avgtrk.Zero();
//	TVectorD avgmult;       avgmult.ResizeTo(nbin);
        TVectorD qc22, qc24, qc26, qc28;
        qc22.ResizeTo(nbin); qc22.Zero();
        qc24.ResizeTo(nbin); qc24.Zero();
        qc26.ResizeTo(nbin); qc26.Zero();
        qc28.ResizeTo(nbin); qc28.Zero();
        TVectorD c22, c24, c26, c28;
        c22.ResizeTo(nbin); c22.Zero();
        c24.ResizeTo(nbin); c24.Zero();
        c26.ResizeTo(nbin); c26.Zero();
        c28.ResizeTo(nbin); c28.Zero();
        TVectorD v22, v24, v26, v28;
        v22.ResizeTo(nbin); v22.Zero();
        v24.ResizeTo(nbin); v24.Zero();
        v26.ResizeTo(nbin); v26.Zero();
        v28.ResizeTo(nbin); v28.Zero();
            
        TH1* sumreals[nbin];
        TH1* sumimags[nbin];
        TH1* weights[nbin];
        for(int ibin=0;ibin<nbin;ibin++){
            sumreals[ibin]  = new TH1D(Form("sumreals",ibin), "Re(C{n})", maxN-2+1, 2+.5, maxN+1+.5);
            sumimags[ibin]  = static_cast<TH1*>(sumreals[ibin]->Clone(Form("sumimags",ibin)));
            weights[ibin]  = static_cast<TH1*>(sumreals[ibin]->Clone(Form("weights",ibin)));
        }
        TFile *fout = new TFile(Form("%s_merged.root",method.Data()),"Recreate");
        TFile *f[nFileAll];
        for(int ifile=0; ifile<nFileAll; ifile++){
                f[ifile] = TFile::Open(Form("%s/%s_%d.root",outdir.Data(),method.Data(),ifile));
		TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
	//	TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
		TVectorD* tottrk_t =  (TVectorD*)f[ifile]->Get(Form("tottrk"));
	//	TVectorD* totptall_t =  (TVectorD*)f[ifile]->Get(Form("totptall"));
//		TVectorD* totetaall_t =  (TVectorD*)f[ifile]->Get(Form("totetaall"));
		for(int ibin=0;ibin<nbin;ibin++){
			//	totptall[ibin] += (*totptall_t)[ibin];
			//	totetaall[ibin] += (*totetaall_t)[ibin];
			        Nevent[ibin] += (*Nevent_t)[ibin];
			  //      totmultall[ibin] += (*totmultall_t)[ibin];	
			        tottrk[ibin] += (*tottrk_t)[ibin];	
                                TH1D* sumreals_t = (TH1D*)f[ifile]->Get(Form("sumreals_%d",ibin));
                                TH1D* sumimags_t = (TH1D*)f[ifile]->Get(Form("sumimags_%d",ibin));
                                TH1D* weights_t = (TH1D*)f[ifile]->Get(Form("weights_%d",ibin));
                                sumreals[ibin]->Add(sumreals_t);
                                sumimags[ibin]->Add(sumimags_t);
                                weights[ibin]->Add(weights_t);
		}
		f[ifile]->Close();
        }
    cout<<"v2{gen} = "<<inV2<<endl;
    for(int ibin=0;ibin<nbin;ibin++){
    avgtrk[ibin] = tottrk[ibin]/Nevent[ibin];
    TH1D* hQCr = (TH1D*)sumreals[ibin]->Clone("hQCr");
    TH1D* hQCi = (TH1D*)sumimags[ibin]->Clone("hQCi");
    hQCr->Divide(weights[ibin]);
    hQCi->Divide(weights[ibin]);

    complex<double> qc22com(hQCr->GetBinContent(1),hQCi->GetBinContent(1));
    complex<double> qc24com(hQCr->GetBinContent(3),hQCi->GetBinContent(3));
    complex<double> qc26com(hQCr->GetBinContent(5),hQCi->GetBinContent(5));
    qc22[ibin] = abs(qc22com);
    qc24[ibin] = abs(qc24com);
    qc26[ibin] = abs(qc26com);
    c22[ibin] = qc22[ibin];
    c24[ibin] = qc24[ibin] - 2*qc22[ibin]*qc22[ibin];
    c26[ibin] = qc26[ibin] - 9*qc22[ibin]*qc24[ibin] + 12*qc22[ibin]*qc22[ibin]*qc22[ibin];
    v22[ibin] = sqrt(c22[ibin]);
    v24[ibin] = TMath::Power(-c24[ibin],1./4);
    v26[ibin] = TMath::Power(1./4*c26[ibin],1./6);
    //v24[ibin] = TMath::Power(qc24[ibin],1./4);
    //v26[ibin] = TMath::Power(qc26[ibin],1./6);

    cout<<"avgtrk = "<<avgtrk[ibin]<<endl;
    cout<<"v2{2} = "<<v22[ibin]<<endl;
    cout<<"v2{4} = "<<v24[ibin]<<endl;
    cout<<"v2{6} = "<<v26[ibin]<<endl;
    
    fout->cd();
    Nevent.Write("Nevent");
    avgtrk.Write("avgtrk");
    qc22.Write("qc22"); qc24.Write("qc24");   qc26.Write("qc26");   qc28.Write("qc28");
    c22.Write("c22"); c24.Write("c24");   c26.Write("c26");   c28.Write("c28");
    v22.Write("v22"); v24.Write("v24");   v26.Write("v26");   v28.Write("v28");
    TDirectory *dir0 = (TDirectory*)fout->mkdir(Form("D_%d",ibin));
    dir0->cd();
    sumreals[ibin]->Write();
    sumimags[ibin]->Write();
    weights[ibin]->Write();
    }
}
开发者ID:XuQiao,项目名称:HI,代码行数:98,代码来源:merge.C

示例10: getResv2

void getResv2() {

    ifstream f_("merged.root");
    if(!f_.good()) {
        system("hadd merged.root /scratch/xuq7/flow/EPAnalyzer/pPbDataV205m150/AnaEP_*.root");
    }
    TFile *fmerged = TFile::Open("merged.root");
    TH1D* hEPPhip[nbin][neta];
    TH1D* hEPPhim[nbin][neta];
    TH1D* hEPPhic[nbin][neta];
    for(int ibin=0; ibin<nbin; ibin++) {
        for(int ieta=0; ieta<neta; ieta++) {
            hEPPhip[ibin][ieta] = (TH1D*)fmerged->Get(Form("hEPPhip_%d_%d",ibin,ieta));
            hEPPhim[ibin][ieta] = (TH1D*)fmerged->Get(Form("hEPPhim_%d_%d",ibin,ieta));
            hEPPhic[ibin][ieta] = (TH1D*)fmerged->Get(Form("hEPPhic_%d_%d",ibin,ieta));
        }
    }
    ofstream  fstrV;
    fstrV.open("v2.txt");
    TFile *f[nFileAll];

    TVectorD Nevent;
    Nevent.ResizeTo(nbin);
    Nevent.Zero();
    TVectorD totmultall;
    totmultall.ResizeTo(nbin);
    totmultall.Zero();
    TVectorD EPR[nbin], EPRpc[nbin], EPRpm[nbin], EPRcm[nbin];
    for(int ibin=0; ibin<nbin; ibin++) {
        EPR[ibin].ResizeTo(neta);
        EPR[ibin].Zero();
        EPRpc[ibin].ResizeTo(neta);
        EPRpc[ibin].Zero();
        EPRpm[ibin].ResizeTo(neta);
        EPRpm[ibin].Zero();
        EPRcm[ibin].ResizeTo(neta);
        EPRcm[ibin].Zero();
    }
    TVectorD avgmult;
    avgmult.ResizeTo(nbin);
    TVectorD totmult[nbin], totpt[nbin], avgpt[nbin];
    TVectorD Vobs[nbin][neta], Vcorr[nbin][neta], Vcorr3[nbin][neta];
    for(int ibin=0; ibin<nbin; ibin++) {
        totmult[ibin].ResizeTo(npt);
        totmult[ibin].Zero();
        totpt[ibin].ResizeTo(npt);
        totpt[ibin].Zero();
        avgpt[ibin].ResizeTo(npt);
        avgpt[ibin].Zero();
        for(int ieta=0; ieta<neta; ieta++) {
            Vobs[ibin][ieta].ResizeTo(npt);
            Vobs[ibin][ieta].Zero();
            Vcorr[ibin][ieta].ResizeTo(npt);
            Vcorr[ibin][ieta].Zero();
            Vcorr3[ibin][ieta].ResizeTo(npt);
            Vcorr3[ibin][ieta].Zero();
        }
    }

    for(int ifile=0; ifile<nFileAll; ifile++) {
        f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/EPAnalyzer/pPbDataV205m150/AnaEP_%d.root",ifile));
        TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
        TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
        for(int ibin=0; ibin<nbin; ibin++) {
            TVectorD* EPR_t =  (TVectorD*)f[ifile]->Get(Form("EPR_%d",ibin));
            TVectorD* EPRpc_t =  (TVectorD*)f[ifile]->Get(Form("EPRpc_%d",ibin));
            TVectorD* EPRpm_t =  (TVectorD*)f[ifile]->Get(Form("EPRpm_%d",ibin));
            TVectorD* EPRcm_t =  (TVectorD*)f[ifile]->Get(Form("EPRcm_%d",ibin));
            TVectorD* totmult_t = (TVectorD*)f[ifile]->Get(Form("totmult_%d",ibin));
            TVectorD* totpt_t = (TVectorD*)f[ifile]->Get(Form("totpt_%d",ibin));
            Nevent[ibin] += (*Nevent_t)[ibin];
            totmultall[ibin] += (*totmultall_t)[ibin];
            for(int iptbin=0; iptbin<npt; iptbin++) {
                totmult[ibin][iptbin] += (*totmult_t)[iptbin];
                totpt[ibin][iptbin] += (*totpt_t)[iptbin];
            }
            for(int ieta=0; ieta<neta; ieta++) {
                EPR[ibin][ieta] += (*EPR_t)[ieta];
                EPRpc[ibin][ieta] += (*EPRpc_t)[ieta];
                EPRpm[ibin][ieta] += (*EPRpm_t)[ieta];
                EPRcm[ibin][ieta] += (*EPRcm_t)[ieta];
                TVectorD* Vobs_t = (TVectorD*)f[ifile]->Get(Form("v2obs_%d_%d",ibin,ieta));
                for(int iptbin=0; iptbin<npt; iptbin++) {
                    Vobs[ibin][ieta][iptbin] += (*Vobs_t)[iptbin];
                }
            }
        }
        f[ifile]->Close();
    }

    TFile *outf = new TFile("mergedVobs.root","Recreate");
    Nevent.Write("Nevent");
    totmultall.Write("totmultall");
    for(int ibin=0; ibin<nbin; ibin++) {
        for(int ieta=0; ieta<neta; ieta++) {
            hEPPhip[ibin][ieta]->Write();
            hEPPhim[ibin][ieta]->Write();
            hEPPhic[ibin][ieta]->Write();
        }
    }
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:getResv2.C

示例11: getResVsub

//------------------------Deal with the number and get the output stored in txt files and root files
void getResVsub(){
	double Vmax[nbin], eps[nbin];
	for(int ibin=0; ibin<nbin ;ibin++){
        	Vmax[ibin]=0.065*(trkbin[ibin]+30);
        	eps[ibin]=0.00025*(trkbin[ibin]+30);
	}
	ofstream  fstrV;
	double theta[ntheta];
	TVectorD avgmult, avgpt, totptall;
	TVectorD Qx1, Qy1, Q2;
	TVectorD Gmod2[nbin][ntheta];
	TVectorD sigma2[nbin],deltaV[nbin];
	TVectorD sigma2_,chi_;
	TVectorD deltaVmean, Vmean;
	TVectorD deltaVmeanmean, Vmeanmean, sigmaVmeanmean;
	TVectorD r[nbin];
	TVectorD r0[nbin], r01[nbin], V[nbin], chi[nbin];
	TVectorD GRe[nbin][ntheta]; TVectorD* GRe_t[nbin][ntheta];
	TVectorD GIm[nbin][ntheta]; TVectorD* GIm_t[nbin][ntheta];
	TComplex G[nbin][ntheta][nstepr];
	if(isSum)	fstrV.open("V_Sum_sub.txt");
	else	fstrV.open("V_Prod_sub.txt");
	if(isSum)       TString outname = "mergedV_Sum_sub.root";
        else    TString outname="mergedV_Prod_sub.root";
        TFile *outf = new TFile(outname,"Recreate");
        int subsample = (int)(nFileAll/nsamples);
	TFile *f[nFileAll];

        for(int ibin=0; ibin<nbin; ibin++){
		r[ibin].ResizeTo(nstepr);
                for(int ir=0; ir<nstepr; ir++){
        if(isSimple==0)  r[ibin][ir]=j01/(Vmax[ibin]-eps[ibin]*ir);	
	else		 r[ibin][ir]=0.00025*20*(ir+1);
		}
	}
               
	Vmeanmean.ResizeTo(nbin);  Vmeanmean.Zero();
	deltaVmeanmean.ResizeTo(nbin);  deltaVmeanmean.Zero();
	sigmaVmeanmean.ResizeTo(nbin);  sigmaVmeanmean.Zero();
	for(int isample=0;isample<nsamples;isample++){
	cout<<"start with "<<isample<<"\t";
        int start=isample*subsample;
        int end=(isample+1)*subsample;
	TVectorD Nevent;	Nevent.ResizeTo(nbin);  Nevent.Zero();
        TVectorD totmultall;	totmultall.ResizeTo(nbin);      totmultall.Zero();
	
	for(int itheta=0;itheta<ntheta;itheta++)
        	theta[itheta]=itheta*TMath::Pi()/ntheta/nn;

	for(int ibin=0;ibin<nbin;ibin++){
			r0[ibin].ResizeTo(ntheta);
			r01[ibin].ResizeTo(ntheta);
			sigma2[ibin].ResizeTo(ntheta);
			V[ibin].ResizeTo(ntheta);
			deltaV[ibin].ResizeTo(ntheta);
			chi[ibin].ResizeTo(ntheta);
                        for(int itheta=0;itheta<ntheta;itheta++){
				Gmod2[ibin][itheta].ResizeTo(nstepr);
				GRe[ibin][itheta].ResizeTo(nstepr);
				GRe[ibin][itheta].Zero();
				GIm[ibin][itheta].ResizeTo(nstepr);
				GIm[ibin][itheta].Zero();
			}
		}

		avgmult.ResizeTo(nbin);	deltaVmean.ResizeTo(nbin);	Vmean.ResizeTo(nbin);
		deltaVmean.Zero();	Vmean.Zero();	deltaVmean.Zero();
		totptall.ResizeTo(nbin);	totptall.Zero();
		avgpt.ResizeTo(nbin);
                Qx1.ResizeTo(nbin);     Qx1.Zero();
                Qy1.ResizeTo(nbin);     Qy1.Zero();
                Q2.ResizeTo(nbin);     Q2.Zero();
		sigma2_.ResizeTo(nbin);sigma2_.Zero();
		chi_.ResizeTo(nbin);chi_.Zero();

	for(int ifile=start; ifile<end; ifile++){
		if(isSum) f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/ToyMCHole/pPbDataV205m185/AnaV_Sum_%d.root",ifile));
		else f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/ToyMCHole/pPbDataV205m185/AnaV_Prod_%d.root",ifile));
		TVectorD* Nevent_t =  (TVectorD*)f[ifile]->Get(Form("Nevent"));
		TVectorD* totmultall_t =  (TVectorD*)f[ifile]->Get(Form("totmultall"));
			TVectorD* Qx1_t =  (TVectorD*)f[ifile]->Get(Form("Qx1"));
			TVectorD* Qy1_t =  (TVectorD*)f[ifile]->Get(Form("Qy1"));
			TVectorD* Q2_t =  (TVectorD*)f[ifile]->Get(Form("Q2"));
			TVectorD* totptall_t =  (TVectorD*)f[ifile]->Get(Form("totptall"));
		for(int ibin=0;ibin<nbin;ibin++){
					for(int itheta=0;itheta<ntheta;itheta++){
					GRe_t[ibin][itheta] = (TVectorD*)f[ifile]->Get(Form("GRe_%d_%d",ibin,itheta));
					GIm_t[ibin][itheta] = (TVectorD*)f[ifile]->Get(Form("GIm_%d_%d",ibin,itheta));
					for(ir=0; ir<nstepr; ir++){
						GRe[ibin][itheta][ir] += (*GRe_t[ibin][itheta])[ir];
						GIm[ibin][itheta][ir] += (*GIm_t[ibin][itheta])[ir];
					}
				}
				Qx1[ibin] += (*Qx1_t)[ibin];
				Qy1[ibin] += (*Qy1_t)[ibin];
				Q2[ibin] += (*Q2_t)[ibin];
				totptall[ibin] += (*totptall_t)[ibin];
			Nevent[ibin] += (*Nevent_t)[ibin];
			totmultall[ibin] += (*totmultall_t)[ibin];	
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:getResVsub.C


注:本文中的TVectorD::Zero方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。