simple_loop.cc

Go to the documentation of this file.
00001 //
00002 // Example C++ routine to run analysis module, ana_base.
00003 // The usage is same for inherited analysis class instance.
00004 //
00005 
00006 #include <TSystem.h>
00007 #include <Analysis-TypeDef.hh>
00008 
00009 int main(){
00010   // Create ana_processor instance
00011   ana_processor my_proc;
00012 
00013   // Set input root file: this is decoder output root file.
00014   // This time, we use a sample file prepared.
00015   my_proc.add_input_file(Form("%s/dat/sample.root",gSystem->Getenv("ANA_PROC_DIR")));
00016 
00017   // Specify IO mode
00018   my_proc.set_io_mode(storage_manager::READ);
00019 
00020   // Set output root file: this is a separate root file in which your
00021   // analysis module can store anything such as histograms, your own TTree, etc.
00022   my_proc.set_ana_output_file("myout.root");
00023 
00024   // Create analysis class instance. For this example, ana_base.
00025   // To show how one can run multiple analysis modules at once,
00026   // we make multiple ana_base instance.
00027 
00028   ana_base* my_ana_1=new ana_base();
00029   ana_base* my_ana_2=new ana_base();
00030   ana_base* my_ana_3=new ana_base();
00031 
00032   // Add analysis modules to the processor
00033 
00034   my_proc.add_process(my_ana_1);
00035   my_proc.add_process(my_ana_2);
00036   my_proc.add_process(my_ana_3);
00037 
00038   // Let's run it.
00039 
00040   my_proc.run();
00041 
00042   // done!
00043 }

Generated on Mon Apr 7 15:35:12 2014 for MyProject by  doxygen 1.4.7