pp200_run12_QA.C 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include "TROOT.h"
  2. #include "TSystem.h"
  3. #include "TChain.h"
  4. #include "TFile.h"
  5. #include "TString.h"
  6. #include <iostream>
  7. const Char_t *defaultInFile = "pp200_run12.list";
  8. const Char_t *defaultOutFile = "PicoDstQA.root";
  9. class StPicoDstQA;
  10. class StPicoDstMaker;
  11. void pp200_run12_QA(const char *inFileList = defaultInFile,
  12. const char *outFileName = defaultOutFile)
  13. {
  14. std::cout << "**************************************" << std::endl
  15. << "* *" << std::endl
  16. << "* Hello, this is quality assurance *" << std::endl
  17. << "* for the pp200 PicoDst *" << std::endl
  18. << "* *" << std::endl
  19. << "**************************************" << std::endl;
  20. //
  21. // Load libraries
  22. //
  23. std::cout << "Loading libraries..." << std::endl;
  24. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  25. loadSharedLibraries();
  26. gSystem->Load("libMinuit");
  27. gSystem->Load("StChain");
  28. gSystem->Load("StarClassLibrary");
  29. gSystem->Load("StFlowMaker");
  30. gSystem->Load("StHbtMaker");
  31. gSystem->Load("StPicoDstMaker");
  32. std::cout << "Libraries have been successfully loaded" << std::endl;
  33. //
  34. // Create chain
  35. //
  36. StChain *chain = new StChain("StChain");
  37. chain->SetDebug(0);
  38. //
  39. // Create PicoDst reader
  40. //
  41. std::cout << Form("Try to read file: %s", inFileList) << std::endl;
  42. StPicoDstMaker *picoMaker = new StPicoDstMaker(0, inFileList);
  43. StPicoDstQA *QAmaker = new StPicoDstQA(picoMaker, outFileName);
  44. unsigned int trigWord = 0;
  45. for (int i = 0; i < 2; trigWord |= 1 << i++); // set only VPDMB
  46. std::cout << "TRIGGER WORD: " << trigWord << std::endl;
  47. QAmaker->SetTriggers(trigWord);
  48. QAmaker->SetRunIdParameters(80000, 13000000, 13080000);
  49. chain->Init();
  50. TChain *currentTree = picoMaker->chain();
  51. Long64_t nEvents = currentTree->GetEntries();
  52. std::cout << Form("Number of events in TTree: %d", nEvents) << std::endl;
  53. Int_t iReturn = 0;
  54. Int_t nEventsProcessed = 0;
  55. Float_t percentCounter = 0.01;
  56. Float_t progress = 0.;
  57. for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
  58. progress = (Float_t)iEvent/(Float_t)nEvents;
  59. nEventsProcessed++;
  60. if(progress >= percentCounter) {
  61. percentCounter += 0.01;
  62. std::cout << Form("Processing progress: %4.2f%%", percentCounter*100.)
  63. << std::endl;
  64. }
  65. chain->Clear();
  66. iReturn = chain->Make(iEvent);
  67. if (iReturn != 0) {
  68. std::cout << "Error has been occured. Event processing has been stopped"
  69. << std::endl;
  70. break;
  71. }
  72. }
  73. chain->Finish();
  74. delete chain;
  75. std::cout << "*************************" << std::endl
  76. << "* Finish *" << std::endl
  77. << "*************************" << std::endl;
  78. }