/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Mdc/DedxCalibAlg/DedxCalibAlg-00-01-15/share/shell/genRawScript/getMinMax.cxx File Reference

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <TFile.h>
#include <TTree.h>
#include <TString.h>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 24 of file getMinMax.cxx.

References genRecEmupikp::i, and t().

00024                                 {
00025   if(argc<2){
00026     cout << "please append a root file name " << endl;
00027     return 1;
00028   }
00029 
00030   TString str_root_file(argv[1]);
00031   str_root_file.Append(argv[2]);
00032   TFile f(str_root_file);
00033   TTree *t(0);
00034   if(argc>3) t = (TTree*)f.Get(argv[3]);
00035   else{
00036     TList *l = f.GetListOfKeys();
00037     if(l->GetEntries()<1){ 
00038       cout << "the root file " << argv[2] << " is empty, check it!" << endl;
00039       return 1;
00040     }
00041     else t = (TTree*)f.Get(l->At(0)->GetName());
00042   }
00043   Long_t m_totnum = t->GetEntries();
00044   double m_run(0), m_min(9999999), m_max(0), m_cur_run(0);
00045   t->SetBranchAddress("run", &m_run);
00046 
00047   for(Long_t i=0; i<m_totnum; i++){
00048     t->GetEntry(i);
00049     if(i%10000==0) cout << "i = " << i << "   run: " << m_run  << endl; 
00050     if(m_run != m_cur_run && m_run>1){
00051       if(m_min>m_run) m_min=m_run;
00052       if(m_max<m_run) m_max=m_run;
00053       m_cur_run = m_run;
00054     }
00055   }
00056   cout << "min " << (long)m_min << "  max " << (long)m_max << endl;
00057 
00058   return 0;
00059 }


Generated on Tue Nov 29 23:16:43 2016 for BOSS_7.0.2 by  doxygen 1.4.7