main_proc.C 620 B

1234567891011121314151617181920212223242526272829303132
  1. //#include "FlowANA.C"
  2. #include "FlowANA.C"
  3. #include <TStopwatch.h>
  4. #include <TChain.h>
  5. #include <iostream>
  6. #include <fstream>
  7. void main_proc(const char *filelist, const char *output = "./test1.root")
  8. {
  9. TStopwatch timer;
  10. timer.Start();
  11. TChain *chain = new TChain("mctree");
  12. std::ifstream file(filelist);
  13. std::string str;
  14. int nfiles = 0;
  15. while (std::getline(file,str))
  16. {
  17. chain->Add(str.c_str());
  18. nfiles++;
  19. }
  20. std::cout << nfiles << " files were opened." << std::endl;
  21. FlowANA *t = new FlowANA(chain);
  22. t->ana_init(output);
  23. t->Loop();
  24. t->ana_end();
  25. timer.Stop();
  26. timer.Print();
  27. }