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

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <TFile.h>
#include <TTree.h>
#include <TString.h>
#include <TBranch.h>
#include <TLeaf.h>
#include <TH1F.h>
#include <cstdio>

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 17 of file realnewrun.cxx.

References f1, f2, and genRecEmupikp::i.

00017                                 {
00018   if(argc<5){
00019     cout << "please append two root files' names you want to compare " << endl;
00020     cout << "realnewrun.exe new.root treename old.root treename [output.root]" << endl;
00021     return 1;
00022   }
00023 
00024 
00025   TFile f1(argv[1]);
00026   TTree *t1 = (TTree*)f1.Get(argv[2]);
00027   TFile f2(argv[3]);
00028   TTree *t2 = (TTree*)f2.Get(argv[4]);
00029   TString str_output = "output.root";
00030   if(argc>5) str_output = argv[5];
00031   TFile f3(str_output,"recreate");
00032   TTree *t3 = new TTree("track","track");
00033   int newrun, newevt;
00034   t3->Branch("run", &newrun, "run/I");
00035   t3->Branch("event", &newevt, "event/I");
00036 
00037   int run, evt;
00038   t1->SetBranchAddress("run", &run);
00039   t1->SetBranchAddress("event", &evt);
00040   char str[255];
00041   for(int i=0; i<t1->GetEntries(); i++){
00042     t1->GetEntry(i);
00043     sprintf(str, "run==%d && event==%d", run, evt);
00044     if(t2->GetEntries(str)>0) cout << "str: " << str << "  run: " << run << "  event: " << evt << endl;
00045     else{
00046       newrun = run;
00047       newevt = evt;
00048       t3->Fill();
00049     }
00050   }
00051 
00052   f1.Close();
00053   f2.Close();
00054   f3.cd();
00055   t3->Write();
00056   f3.Close();
00057   return 0;
00058 }


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