示例#1
0
文件: Getvn.C 项目: XuQiao/phenix
int GetRun(int irun){
    ifstream frun(dataset+".Lst");
    int RunNumber;
    int jrun = 0;
    while(!frun.eof() && jrun<=irun){
        frun>>RunNumber;
        jrun++;
    }
    return RunNumber;
}
示例#2
0
文件: Getvn.C 项目: XuQiao/phenix
int GetTotalRun(){
    ifstream frun(dataset+".Lst");
    int RunNumber;
    int nrun = -1;
    while(!frun.eof()){
        frun>>RunNumber;
        nrun++;
    }
    return nrun;
}
示例#3
0
void GetQAtoffset()
{
	char datafile[400][50]; // first dimension should be >= Nruns 

	// reading the runlist and creating array of datafiles names ----
	char runlist[] = "../runlist";
	char runnum[20];
	ifstream frun(runlist);
	if (!frun) {cout<<"can't open "<<runlist<<" file\n"; return;}
	int Nrun = 0;
	while(frun.getline(runnum,20)) 
	{
		sprintf(datafile[Nrun], "../%s/T0offset.txt", runnum);
		Nrun++;
	}
	frun.close();
	// ------

	// **** reading t0offset
	Float_t t0[NMUL][400];
	Float_t t0sig[NMUL][400];
	Float_t run[400];

	for (int ir = 0; ir < Nrun; ir++)
	{
		ifstream f(datafile[ir]);
		if (!f) {cout<<"can't open "<<datafile[ir]<<" file\n"; return;}
		for(int ic=0; ic<NMUL; ic++)
		{
			int cent;
			f>>run[ir]>>cent>>t0[ic][ir]>>t0sig[ic][ir];
			if (cent != ic) {cout<<"incorrect "<<datafile[ir]<<" file data reading!! ic = "<<ic<<" cent = "<<cent<<endl; return;}
		}

	}
	// ****

	// make graph of t0 vs runnum for all the centralities and write them to the root file
	TFile *outfile = new TFile("QAt0offset.root","recreate");
	TGraph *gr[NMUL];
	char name[20];
				
	for (int ic = 0; ic < NMUL; ic++)
	{
		gr[ic] = new TGraphErrors(Nrun, run, t0[ic], 0, t0sig[ic]); 
		sprintf(name, "Graph_cent%i", ic);
		gr[ic]->Write(name);
	}
	outfile->Close();
}
示例#4
0
/*void timer0( ) interrupt 1 //定时器0工作方式1
{
anjian();
TH0=(65536-2)/256;	  //重装计数初值
TL0=(65536-2)%256;	  //重装计数初值
} */
main()
{
a=0;
b=0;
/*TMOD=0X01;			  //定时器中断0

TH0=(65536-2)/256;	  //定时时间高八位初值
TL0=(65536-2)%256;	  //定时时间低八位初值
EA=1;				  //开CPU中断
ET0=1;				  //开T/C0中断
TR0=1; */
   while(1)
    { 
	 if(P2_0==0)
      {
	  while(!P2_0);	
	  	  b=1;
      }
       if(P2_1==0)
      {
	  while(!P2_1);
	  b=2;
       }
	 anjian();  
	   switch(b)
	{
	case 0: break;
	case 1: frun();break;
	case 2: zrun();	break;
	default:break;	
	} 
		switch(a)
	{
	case 0:y=100; P3=ZERO;break;
	case 1:y=75; P3=ONE;	break;
	case 2:y=60; P3=TWO;	break;
	case 3:y=45; P3=THREE;break;
	case 4:y=35; P3=FOUR; break;
	case 5:y=25; P3=FIVE; break;
	case 6:y=20; P3=SIX;	break;
	case 7:y=16; P3=SEVEN;break;
	case 8:y=12; P3=EIGHT; break;
	case 9:y=8; P3=NINE; break;
	default:break;	
	}
      
   }
}
示例#5
0
void GetQAsincos()
{
	char datafile[400][50]; // first dimension should be >= Nruns 

	// reading the runlist and creating array of datafiles names ----
	char runlist[] = "../runlist";
	char runnum[20];
	ifstream frun(runlist);
	if (!frun) {cout<<"can't open "<<runlist<<" file\n"; return;}
	int Nrun = 0;
	while(frun.getline(runnum,20)) 
	{
		sprintf(datafile[Nrun], "../%s/MeanCosSinNphi.txt", runnum);
		Nrun++;
	}
	frun.close();
	// ------

	// **** reading mean cos and sin only for RXN18 det (S+N, out+in)
	Float_t cos[2][NMUL][400]; // first dimension - nharm
	Float_t ercos[2][NMUL][400]; // first dimension - nharm
	Float_t sin[2][NMUL][400];
	Float_t ersin[2][NMUL][400];
	Float_t run[400];

	for (int ir = 0; ir < Nrun; ir++)
	{
		ifstream f(datafile[ir]);
		if (!f) {cout<<"can't open "<<datafile[ir]<<" file\n"; return;}
		for(int ic=0; ic<NMUL; ic++)
		{
			for (int ih = 0; ih < NHARM; ih++ )
			{
				for (int id = 0; id < NDET; id++)
				{
					int cent, harm, det;
					Float_t sincos, sig;
					if (id == 7 && ih != 2) {f>>run[ir]>>cent>>harm>>det>>cos[ih][ic][ir]>>ercos[ih][ic][ir]>>sin[ih][ic][ir]>>ersin[ih][ic][ir];}// for rxn18
					else {f>>run[ir]>>cent>>harm>>det>>sincos>>sig>>sincos>>sig;}
					if (cent != ic || harm != ih) {cout<<"incorrect "<<datafile[ir]<<" file data reading!! ic = "<<ic<<" cent = "<<cent<<" ih = "<<ih<<" harm = "<<harm<<endl; return;}
				}
			}
		}
示例#6
0
void fitrp2fvtx0s(){
  gStyle->SetOptStat(1);
  gStyle->SetOptFit(1);
  //gStyle->SetOptLogy(1);
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetStatColor(10);
  gStyle->SetTitleFillColor(10);

  static const float PI = 3.1415926535627;

  const int ncent = 1;
  const int nrun = 1;
  float run[nrun];

  TH1F *h[ncent][nrun];
  TF1 *fun[ncent];

  char filename[100];
  char histname[100];
  char listname[100];
  char funname[100];

  for(int icent=0; icent<ncent; icent++){
    sprintf(funname,"fun_cent_%d",icent);
    fun[icent] = new TF1(funname,"pol0",-PI, PI);
  }
  
  //float con[nrun][1600];
  ifstream frun("Run15pAu200GeV.Lst");
  ofstream fout[ncent];
  fout[0].open("fvtx0s_v2_cent_0.dat");
  fout[1].open("fvtx0s_v2_cent_1.dat");
  fout[2].open("fvtx0s_v2_cent_2.dat");
  fout[3].open("fvtx0s_v2_cent_3.dat");
  fout[4].open("fvtx0s_v2_cent_4.dat");
  fout[5].open("fvtx0s_v2_cent_5.dat");

  c1=new TCanvas("c1","c1");
  c1->SetFillColor(10);

  for(int irun=0; irun<nrun; irun++){
    
    frun>>run[irun];
    cout<<run[irun]<<endl;

    sprintf(filename,"rp/hrp_%d.root",run[irun]);
    TFile *f=new TFile(filename);

    for(int icent=0; icent<ncent; icent++){
      sprintf(histname,"dis_%d_%d_%d",icent,1,10);
      cout<<histname<<endl;
      ((TH2*)f->Get(histname))->ProjectionY("hrpdis",21,30);
      
      //sprintf(histname,"fvtx0ss_v1_cent_%d_%d",icent,run[irun]);
      //hrpdis->SetName(histname);
      //hrpdis->SetTitle(histname);
      if(hrpdis->GetEntries()>10000){
	hrpdis->SetMarkerStyle(20);
	hrpdis->SetMarkerSize(0.6);
	hrpdis->SetMarkerColor(4);
	hrpdis->SetMinimum(10);
	sprintf(funname,"fun_cent_%d",icent);
	hrpdis->Fit(funname,"R");
	float par=fun[icent]->GetParameter(0);
	hrpdis->SetMaximum(1.5*par);
	hrpdis->Draw();

	sprintf(histname,"gif/fvtx0s_v2_cent_%d_%d.pdf",icent,run[irun]);
	c1->Print(histname);
	fout[icent]<<run[irun]<<" "
		   <<fun[icent]->GetChisquare()/fun[icent]->GetNDF()<<endl;
      }
    }

  }

  frun.close();
  for(int icent=0; icent<4; icent++){
    fout[icent].close();
  }

}