最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

ROOT34, 產(chǎn)生數(shù)據(jù)的腳本

2023-08-26 18:21 作者:guanming-yf  | 我要投稿

// signal detected by detector 1
double detector1( double time, double offset=0.5 ){
?if( time < offset ){ return (gRandom->Uniform()-0.5)*0.06; ?}
?else{ return -0.3*exp( -(time-offset)/0.05 ) ? (gRandom->Uniform()-0.5)*0.06; ?}
}

// signal detected by detector 2
double detector2( double time, double offset=0.5 ){
?if( time < offset ){ return (gRandom->Uniform()-0.5)*0.06; ?}
?else{ return -0.3*exp( -(time-offset)/0.05 ) ? (gRandom->Uniform()-0.5)*0.06; ?}
}

// generate wave, assign values of D1 and D2 to array
const int N = 200;
const double offset1 = 0.5;
double offset2 = 0.5;
void generateWFM( double* time, double* ch1, double* ch2, bool flag_coin=true ?){
?if( flag_coin==true ){ ?offset2 = 0.5 ? ?(gRandom->Uniform()-0.5)*0.05;}
?else{ offset2 = offset2 = (gRandom->Uniform()); }
?for( int i=0; i<N; i ? ){
time[i] = (double)i*0.005;
? ?ch1[i] = detector1( time[i], offset1 );
? ?ch2[i] = detector2( time[i], offset2 );
?} ?
}


// plot the wave form
int gd(){

?double timeStamp1 = 1;
?double timeStamp2 = 1;
?timeStamp1 = gRandom->Exp( 2.2 );
?timeStamp2 = gRandom->Uniform()*10;

?double time[N], ch1[N], ch2[N];
?generateWFM( time, ch1, ch2, true );
?
?TCanvas *c1 = new TCanvas( "c1", "on and off", 1200, 500 );
?c1->Divide( 2, 1 );
?c1->cd(1);
?TGraph *g1c1 = new TGraph( N, time, ch1);
?TGraph *g1c2 = new TGraph( N, time, ch2);
?g1c2->SetLineColor( kRed );
?g1c1->SetTitle( Form("Coincident Event, TimeStamp = %f", timeStamp1) );
?g1c1->GetXaxis()->SetTitle( "Time [ns]" );
?g1c1->GetYaxis()->SetTitle( "Wave Form" );
?g1c1->GetYaxis()->SetRangeUser(-0.4, 0.1);
?g1c1->Draw("ALP");
?g1c2->Draw("same");
?
?TLegend *leg1 = new TLegend();
?leg1->AddEntry( g1c1, "Channel 1 (trigger)" );
?leg1->AddEntry( g1c2, "Channel 2" );
?leg1->Draw( "same" );
?
?
?c1->cd(2);
?generateWFM( time, ch1, ch2, false );
?TGraph *g2c1 = new TGraph( N, time, ch1);
?TGraph *g2c2 = new TGraph( N, time, ch2);
?g2c1->SetTitle( Form("Anti-Coincident Event, TimeStamp = %f", timeStamp2 ) ?);
?g2c2->SetLineColor( kRed );
?g2c1->GetXaxis()->SetTitle( "Time [ns]" );
?g2c1->GetYaxis()->SetTitle( "Wave Form" );
?g2c1->GetYaxis()->SetRangeUser(-0.4, 0.1);
?g2c1->Draw("ALP");
?g2c2->Draw("same");
?TLegend *leg2 = new TLegend();
?leg2->AddEntry( g2c1, "Channel 1 (trigger)" );
?leg2->AddEntry( g2c2, "Channel 2" );
?leg2->Draw( "same" );


?// create 10000 ?WFMXXXX.txt file
?cout << "Start create data" << endl;
?std::ofstream write;
?for( int j=1; j<10000 1; j ? ){
if( gRandom->Uniform()<0.5 ){
generateWFM( time, ch1, ch2, true );
? ? ?timeStamp1 = gRandom->Exp( 2.2 );
? ? ?cout << "True" << endl;
? ?}else{
? ? ?generateWFM( time, ch1, ch2, false );
? ? ?timeStamp1 = gRandom->Uniform(0, 10);
? ? ?cout << "False" << endl;
? ?}
? ?write.open( Form("WFM%05d.txt", j) );
? ?write << timeStamp1 << "\n";
? ?for( int i=0; i<N; i ? ){
write << time[i] << "\t" << ch1[i] << "\t" << ch2[i] << endl;
? ?}
? ?write.close();
?}
?cout << "Data are created" << endl;
?
?return 1;
}


ROOT34, 產(chǎn)生數(shù)據(jù)的腳本的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
和田市| 芮城县| 潮州市| 吐鲁番市| 镇远县| 沁阳市| 威海市| 邹城市| 昌吉市| 高阳县| 石首市| 平谷区| 田林县| 金寨县| 通城县| 大渡口区| 郓城县| 平安县| 孟州市| 盘山县| 新河县| 华宁县| 田林县| 五寨县| 改则县| 凌云县| 潞西市| 日喀则市| 皮山县| 抚松县| 开平市| 娱乐| 浙江省| 哈尔滨市| 城口县| 清涧县| 青铜峡市| 古田县| 哈巴河县| 老河口市| 济源市|