BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
dimuon/convert_root_to_txt.cxx File Reference
#include <iostream>

Go to the source code of this file.

Functions

void extract_trkindex ()
 

Function Documentation

◆ extract_trkindex()

void extract_trkindex ( )

Definition at line 3 of file dimuon/convert_root_to_txt.cxx.

3 {
4 TChain *chain = new TChain("infmom");
5 chain->Add("temp/*.root");
6 ofstream out;
7 TString para_file_name("dimu.txt");
8 out.open(para_file_name,ios::out);
9 long m_run, m_event, m_trk;
10 chain->SetBranchAddress("run", &m_run);
11 chain->SetBranchAddress("event", &m_event);
12 chain->SetBranchAddress("trkindex", &m_trk);
13
14 long m_num_evt = chain->GetEntries();
15 long m_scale = m_num_evt/100000;
16 if(!(m_scale%2)) m_scale --;
17 for(long i=0; i<m_num_evt; i++){
18 if(i%10000==0) cout << "i=" << i << endl;
19 if(i%m_scale!=0) continue;
20 chain->GetEntry(i);
21 out << m_run << " " << m_event << " " << m_trk << endl;
22 }
23 cout << "the scale is: " << m_scale << endl;
24 out.close();
25}
std::ofstream ofstream
Definition: bpkt_streams.h:42