c_cpp Run13 TOF reso export

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp Run13 TOF reso export相关的知识,希望对你有一定的参考价值。





void make_res(){

    TChain *c = new TChain( "tof" );
    c->Add("4E5CCBAF2CE7730AD34F794AD547FBD1_*.ntuple.root");

    TFile * f = new TFile( "hRes.root", "RECREATE" );
    TH2 *hRes = new TH2F( "hRes", ";cell;delta tof (ns)", 24000, 0, 24000, 100, -0.5, 0.5 );

    c->Draw("tofCorr - TMath::Sqrt( length*length / (898.755) * ( 1 + 0.135*0.135 / pow(pt * TMath::CosH(eta), 2) ) ) : ((tray-1) * 192) + (module-1) * 6 + (cell-1)  >>hRes", "", "colz");

    // hRes = (TH2*)gDirectory->Get( "hRes" );
    hRes->Draw("colz");
    TF1 * fg = new TF1( "fg", "gaus" );
    fg->SetRange( -0.2, 0.2 );

    hRes->FitSlicesY( fg );

    f->Write();
    f->Close();

}



void print_tray( int tray ){
	cout << endl << tray << " 0" << endl;
}


void export_params(){

	TFile *f = new TFile( "hRes.root" );

	TH1 * h1 = (TH1*)f->Get( "hRes_1" );
	TH1 * h2 = (TH1*)f->Get( "hRes_2" );

	TH1F * hm = new TH1F( "hm", "", 1000, -1, 1 );
	vector<float> means;
	for ( int i = 0; i < h1->GetXaxis()->GetNbins(); i++ ){
		float v = h1->GetBinContent( i+1 );
		if ( 0 == v )
			continue;
		hm->Fill( v );
	}

	hm->Draw();
	stdev = hm->GetStdDev()/2.0;

	int iTray = 0;
	string delim = "";
	for ( int i = 0; i < h2->GetXaxis()->GetNbins(); i++ ){
		if ( 0 == i % 192 ){
			if ( iTray >= 120 )
				break;
			print_tray( iTray );
			iTray++;
			delim = "";
			
		}
		double v = h2->GetBinContent(i+1) - 0.004 + stdev;
		if ( v < 0.01 || v > 0.15 )
			v = h2->GetBinContent((i%120)+1) - 0.004 + stdev;

		cout << delim << (int)(v*1000); // subtract avg start side
		delim = " ";
	}


}

以上是关于c_cpp Run13 TOF reso export的主要内容,如果未能解决你的问题,请参考以下文章

react native expo run-ios

android程序连接网络错误 java net unknownhostexception unable to reso

c_cpp uv_run.c

c_cpp uv_run_redacted.c

c_cpp uv__run_timers.c

c_cpp uv__run_pending.c