reco_with_zdc.C.orig 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // Macro for running reconstruction
  2. #if !defined(__CINT__) || defined(__MAKECINT__)
  3. // ROOT includes
  4. #include "TString.h"
  5. #include "TStopwatch.h"
  6. #include "TSystem.h"
  7. // Fair includes
  8. #include "FairRunAna.h"
  9. #include "FairRuntimeDb.h"
  10. #include "FairParRootFileIo.h"
  11. #include "FairTask.h"
  12. #include "FairField.h"
  13. #include "FairTrackParP.h"
  14. // MPD includes
  15. #include "TpcClusterizerTask.h"
  16. #include "TpcDriftTask.h"
  17. #include "TpcHitFinderTask.h"
  18. #include "MpdKalmanFilter.h"
  19. #include "TpcLheHitsMaker.h"
  20. #include "MpdTpcKalmanFilter.h"
  21. #include "MpdTofHitProducer.h"
  22. #include "MpdTofMatching.h"
  23. #include <iostream>
  24. using namespace std;
  25. #endif
  26. void reco_with_zdc (TString inFile = "zdctest.root", Int_t number_of_events=0)
  27. {
  28. // ========================================================================
  29. // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
  30. Int_t iVerbose = 1;
  31. // Input file (MC events)
  32. //TString inFile = "mc.root";
  33. // Parameter file
  34. //TString parFile = "testparams.root";
  35. TString parFile = inFile;
  36. // Output file
  37. if (number_of_events)
  38. TString outFile = Form("mpddst_%devents_%s",number_of_events,inFile.Data());
  39. else
  40. TString outFile = Form("mpddst_%s",inFile.Data());
  41. // // ---- Load libraries -------------------------------------------------
  42. gROOT->LoadMacro("$VMCWORKDIR/macro/mpd/mpdloadlibs.C");
  43. // mpdloadlibs(kTRUE); // load full set of main libraries
  44. mpdloadlibs(1,1); // load full set of libraries
  45. //gSystem->Load("libMpdData");
  46. gSystem->Load("libXMLIO");
  47. // gROOT->LoadMacro("$VMCWORKDIR/macro/mpd/geometry_v1.C");
  48. // geometry_v1(0x0, kFALSE);
  49. // ------------------------------------------------------------------------
  50. // --- Now choose concrete engines for the different tasks -------------
  51. // ------------------------------------------------------------------------
  52. // In general, the following parts need not be touched
  53. // ========================================================================
  54. // ----- Timer --------------------------------------------------------
  55. TStopwatch timer;
  56. timer.Start();
  57. // ------------------------------------------------------------------------
  58. // ----- Digitization run -------------------------------------------
  59. FairRunAna *fRun= new FairRunAna();
  60. fRun->SetInputFile(inFile);
  61. //fRun->AddFriend(inFile);
  62. fRun->SetOutputFile(outFile);
  63. // ------------------------------------------------------------------------
  64. // ----- Parameter database --------------------------------------------
  65. FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
  66. FairParRootFileIo* parInput1 = new FairParRootFileIo();
  67. parInput1->open(parFile.Data());
  68. //FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
  69. //TString stsDigiFile = gSystem->Getenv("VMCWORKDIR");
  70. //stsDigiFile += "/parameters/sts/sts_digi_new_standard.par";
  71. //parInput2->open(stsDigiFile.Data(),"in");
  72. rtdb->setFirstInput(parInput1);
  73. //rtdb->setSecondInput(parInput2);
  74. // fRun->LoadGeometry(); // EL
  75. // ------------------------------------------------------------------------
  76. // TpcClusterizerTask* tpcClusterizer = new TpcClusterizerTask();
  77. // fRun->AddTask(tpcClusterizer);
  78. // TpcDriftTask* tpcDrifter = new TpcDriftTask();
  79. // fRun->AddTask(tpcDrifter);
  80. // TpcHitFinderTask* tphHitFinderTask = new TpcHitFinderTask();
  81. // fRun->AddTask(tphHitFinderTask);
  82. MpdKalmanFilter *kalman = MpdKalmanFilter::Instance("KF");
  83. fRun->AddTask(kalman);
  84. MpdTpcHitProducer* hitPr = new MpdTpcHitProducer();
  85. hitPr->SetModular(0);
  86. fRun->AddTask(hitPr);
  87. // FairTask* trackMS = new TpcLheHitsMaker("Hit producer");
  88. // fRun->AddTask(trackMS);
  89. FairTask* vertZ = new MpdVertexZfinder();
  90. fRun->AddTask(vertZ);
  91. FairTask* recoKF = new MpdTpcKalmanFilter("Kalman filter");
  92. fRun->AddTask(recoKF);
  93. FairTask* findVtx = new MpdKfPrimaryVertexFinder("Vertex finder");
  94. fRun->AddTask(findVtx);
  95. MpdTofHitProducer* tofHit = new MpdTofHitProducer("Hit producer");
  96. fRun->AddTask(tofHit);
  97. MpdTofMatching* tofMatch = new MpdTofMatching("TOF matching");
  98. fRun->AddTask(tofMatch);
  99. FairTask *tdigi= new MpdZdcDigiProducer("MpdZdcDigiProducer");
  100. fRun->AddTask(tdigi);
  101. FairTask* fillDST = new MpdFillDstTask("MpdDst task");
  102. fRun->AddTask(fillDST);
  103. // Number of events to process
  104. Int_t nEvents = 1; // 100; //50; //250; //90;
  105. if (number_of_events)
  106. nEvents = number_of_events;
  107. // ----- Intialise and run --------------------------------------------
  108. fRun->Init();
  109. cout << "Field: " << fRun->GetField()->GetBz(0.,0.,0.) << endl;
  110. fRun->Run(0, nEvents);
  111. // ------------------------------------------------------------------------
  112. // ----- Finish -------------------------------------------------------
  113. timer.Stop();
  114. Double_t rtime = timer.RealTime();
  115. Double_t ctime = timer.CpuTime();
  116. cout << endl << endl;
  117. cout << "Macro finished succesfully." << endl;
  118. cout << "Output file is " << outFile << endl;
  119. cout << "Parameter file is " << parFile << endl;
  120. cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
  121. cout << endl;
  122. // ------------------------------------------------------------------------
  123. cout << " Test passed" << endl;
  124. cout << " All ok " << endl;
  125. exit(0);
  126. }