00001
00002
00003
00004
00005
00006
00007 #include "TFndHdt.h"
00008
00009 using namespace FROOT;
00010
00011 Int_t start_run, stop_run;
00012 Int_t start_time, stop_time;
00013 Float_t ped_e[K_N_TOFINO_SLABS];
00014 Float_t ped_p[K_N_TOFINO_SLABS];
00015 Float_t bhapeak_e[K_N_TOFINO_SLABS];
00016 Float_t bhapeak_p[K_N_TOFINO_SLABS];
00017 Float_t eq_e[K_N_TOFINO_SLABS];
00018 Float_t eq_p[K_N_TOFINO_SLABS];
00019
00020 void PrintTofCalib(const TString &fname, const TString &output){
00021 if (fname==output){
00022 cout << ".root file and output file must be different!" << endl;
00023 return;
00024 }
00025 TFile *file = new TFile(fname.Data());
00026 if (!file) return;
00027
00028 std::fstream cFstrm(output.Data(), std::ios::out);
00029 if (cFstrm.fail()) return;
00030
00031 TTree *tofcalib;
00032 tofcalib=(TTree*) file->Get("CalibTree");
00033
00034 tofcalib->SetBranchAddress("StartRun", &start_run);
00035 tofcalib->SetBranchAddress("StartTime", &start_time);
00036 tofcalib->SetBranchAddress("StopRun", &stop_run);
00037 tofcalib->SetBranchAddress("StopTime", &stop_time);
00038 tofcalib->SetBranchAddress("PedE", ped_e);
00039 tofcalib->SetBranchAddress("PedP", ped_p);
00040 tofcalib->SetBranchAddress("EqE", eq_e);
00041 tofcalib->SetBranchAddress("EqP", eq_p);
00042
00043 tofcalib->GetEntry(0);
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 TDatime start_time_dt, stop_time_dt;
00060 start_time_dt.Set(start_time-60);
00061 stop_time_dt.Set(stop_time);
00062
00063 TString start_time_st=start_time_dt.AsString();
00064 TString stop_time_st=stop_time_dt.AsString();
00065
00066 cFstrm << start_run << " " << start_time-60 << " \"" << start_time_st << "\" "
00067 << stop_run << " " << stop_time << " \"" << stop_time_st << "\"";
00068
00069 cout << start_run << " " << start_time-60 << " \"" << start_time_st << "\" "
00070 << stop_run << " " << stop_time << " \"" << stop_time_st << "\"";
00071
00072 for (Int_t sl=0; sl<K_N_TOFINO_SLABS; sl++){
00073 cFstrm << " " << ped_e[sl];
00074 cout << " " << ped_e[sl];
00075 }
00076 for (Int_t sl=0; sl<K_N_TOFINO_SLABS; sl++){
00077 cFstrm << " " << ped_p[sl];
00078 cout << " " << ped_p[sl];
00079 }
00080 for (Int_t sl=0; sl<K_N_TOFINO_SLABS; sl++){
00081 cFstrm << " " << eq_e[sl];
00082 cout << " " << eq_e[sl];
00083 }
00084 for (Int_t sl=0; sl<K_N_TOFINO_SLABS; sl++){
00085 cFstrm << " " << eq_p[sl];
00086 cout << " " << eq_p[sl];
00087 }
00088 cFstrm << endl;
00089 cout << endl;
00090 }
00091
00092 void PrintTofCalib(const TString &fname_part){
00093 TString fname, output;
00094 fname=fname_part+".root";
00095 output=fname_part+".txt";
00096 PrintTofCalib(fname, output);
00097 }