无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

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

ROOT35. 波形分析分析代碼

2023-08-27 12:51 作者:guanming-yf  | 我要投稿

void ana(){

? //1. create a TFile file

? //2. create a TTree tree

? //3. define (1) timestamp, (2) time, (3) ch1, (4) ch2, (5) flag_coin

? //4. read the raw data

? //5. save data to tree/file

? const int N = 200;

? double timestamp = 0.0;

? bool flag_coincident;

? vector<double> vtime;

? vector<double> channel1;

? vector<double> channel2;

? double tempT, tempC1, tempC2;

? TFile *ofile = new TFile( "WFM.root", "recreate" );

? TTree *tree = new TTree( "WFM", "ep annihilation waveform" );

? tree->Branch( "TimeStamp", &timestamp, "TimeStamp/D" );

? tree->Branch("Time", &vtime);

? tree->Branch("Channel1", &channel1);

? tree->Branch("Channel2", &channel2);

? tree->Branch("Flag_Coincident", &flag_coincident, "Flag_Coincident/B");

? cout << "start reading" << endl;

? string filename;

? std::ifstream read;

? // j is file id

? for( int j=1; j<20001; j++ ){

? ? filename = Form( "./waveforms/WFM%05d.txt", j );

? ? read.open( filename.c_str() );

? ? // assign value to branches

? ? read >> timestamp;

? ? for( int i=0; i<N; i++ ){

? ? ? read >> tempT >> tempC1 >> tempC2;

? ? ? vtime.push_back( tempT );

? ? ? channel1.push_back( tempC1 );

? ? ? channel2.push_back( tempC2 );

? ? }

? ? // check whether it is an annihilation event

? ? auto c2minimum = std::min_element( channel2.begin(), channel2.end() );

? ? int c2miniID = std::distance( channel2.begin(), c2minimum );

? ? if ( 95<c2miniID && c2miniID <105 ?){ flag_coincident = 1; }

? ? else{ flag_coincident = 0; }

? ??

? ? tree->Fill();

? ? vtime.clear();

? ? channel1.clear();

? ? channel2.clear();

? ? read.close();

? }

? tree->Write();

? ofile->Close();

? cout << "end reading" << endl;

? ?

??

}


ROOT35. 波形分析分析代碼的評論 (共 條)

分享到微博請遵守國家法律
库伦旗| 罗定市| 肥城市| 刚察县| 山东| 阳曲县| 永吉县| 宣城市| 南安市| 常山县| 合江县| 吴江市| 丰都县| 烟台市| 凤城市| 饶河县| 成安县| 青浦区| 澜沧| 丹凤县| 高要市| 彭泽县| 集安市| 伽师县| 高州市| 沭阳县| 罗山县| 杨浦区| 敦煌市| 章丘市| 运城市| 米易县| 喀喇沁旗| 广东省| 漳平市| 巴马| 九龙坡区| 东丽区| 随州市| 建昌县| 永兴县|