recoMC_ndet.C 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // May 2009
  3. //
  4. void recoMC_ndet()
  5. {
  6. // ========================================================================
  7. // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
  8. Int_t iVerbose = 3;
  9. // Input file (MC events)
  10. TString inFile = "evetest.root";
  11. // Number of events to process
  12. Int_t nEvents = 10; // 1999;
  13. // Parameter file
  14. TString parFile = "testparams.root";
  15. // Output file
  16. TString outFile = "test.raw.root";
  17. // ---- Load libraries -------------------------------------------------
  18. gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
  19. basiclibs();
  20. gSystem->Load("libGeoBase");
  21. gSystem->Load("libParBase");
  22. gSystem->Load("libBase");
  23. gSystem->Load("libMCStack");
  24. //... gSystem->Load("libField");
  25. gSystem->Load("libPassive");
  26. gSystem->Load("libGen");
  27. // gSystem->Load("libtpc");
  28. // gSystem->Load("libmvd");
  29. // gSystem->Load("libEtof");
  30. // gSystem->Load("libTof");
  31. // // gSystem->Load("libStrawendcap");
  32. // gSystem->Load("libBbc");
  33. // gSystem->Load("libStt");
  34. // gSystem->Load("libEmc");
  35. // gSystem->Load("libZdc");
  36. // // gSystem->Load("libGen");
  37. //---- ndet ----
  38. gSystem->Load("libNDet");
  39. gROOT->LoadMacro("$VMCWORKDIR/macro/mpd/geometry_v2.C");
  40. geometry_v2(0x0, kFALSE);
  41. //???
  42. //geometry_v2(fRun, kTRUE); // load mpd standard geometries
  43. // ------------------------------------------------------------------------
  44. // --- Now choose concrete engines for the different tasks -------------
  45. // ------------------------------------------------------------------------
  46. // In general, the following parts need not be touched
  47. // ========================================================================
  48. // ----- Timer --------------------------------------------------------
  49. TStopwatch timer;
  50. timer.Start();
  51. // ------------------------------------------------------------------------
  52. // ----- Digitization run -------------------------------------------
  53. FairRunAna *fRun= new FairRunAna();
  54. fRun->SetInputFile(inFile);
  55. fRun->SetOutputFile(outFile);
  56. // ------------------------------------------------------------------------
  57. // Fill the Parameter containers for this run
  58. //-------------------------------------------
  59. FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
  60. Bool_t kParameterMerged=kTRUE;
  61. FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
  62. output->open(parFile.Data());
  63. rtdb->setOutput(output);
  64. rtdb->saveOutput();
  65. rtdb->print();
  66. // ----- Parameter database --------------------------------------------
  67. //... FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
  68. //... FairParRootFileIo* parInput1 = new FairParRootFileIo();
  69. //... parInput1->open(parFile.Data());
  70. //... //FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
  71. //... //TString stsDigiFile = gSystem->Getenv("VMCWORKDIR");
  72. //... //stsDigiFile += "/parameters/sts/sts_digi_new_standard.par";
  73. //... //parInput2->open(stsDigiFile.Data(),"in");
  74. //... rtdb->setFirstInput(parInput1);
  75. //rtdb->setSecondInput(parInput2);
  76. //... fRun->LoadGeometry();
  77. // ------------------------------------------------------------------------
  78. #if 0
  79. // ----- Digi Sequence --------------------------------------------
  80. /*
  81. TpcClusterizerTask* tpcClusterizer = new TpcClusterizerTask();
  82. fRun->AddTask(tpcClusterizer);
  83. TpcDriftTask* tpcDrifter = new TpcDriftTask();
  84. fRun->AddTask(tpcDrifter);
  85. TpcGemTask* tpcGem = new TpcGemTask();
  86. fRun->AddTask(tpcGem);
  87. TpcPadResponseTask* tpcPadResponse = new TpcPadResponseTask();
  88. tpcPadResponse->SetMinSigAmp(100);
  89. fRun->AddTask(tpcPadResponse);
  90. TpcAdcTask* tpcAdc = new TpcAdcTask();
  91. fRun->AddTask(tpcAdc);
  92. TpcPSATask* tpcPSA = new TpcPSATask();
  93. tpcPSA->SetPersistence();
  94. fRun->AddTask(tpcPSA);
  95. */
  96. //digitization done
  97. /*
  98. IdealPatternRecTask *IdealPatternRec= new IdealPatternRecTask();
  99. IdealPatternRec->SetPersistence();
  100. fRun->AddTask(IdealPatternRec);
  101. GenfitTask *Genfit= new GenfitTask();
  102. Genfit->SetPersistence();
  103. fRun->AddTask(Genfit);
  104. TrackVisTask *trackVis= new TrackVisTask();
  105. fRun->AddTask(trackVis);
  106. */
  107. // FitStatTask *fitStat= new FitStatTask();
  108. // fRun->AddTask(fitStat);
  109. #endif
  110. //-------- NDet begin ------
  111. MpdNDetAnalysis *simplendet = new MpdNDetAnalysis("first NDET Test","----KM---");
  112. fRun->AddTask(simplendet);
  113. //-------- NDet done -------
  114. // ----- Intialise and run --------------------------------------------
  115. fRun->Init();
  116. cout << "-I- recoMC_ndet.C: run init completed." << endl;
  117. fRun->Run(0,nEvents);
  118. // ------------------------------------------------------------------------
  119. // ----- Finish -------------------------------------------------------
  120. cout << "----- Finish ---------------------" << endl;
  121. fRun->Run(-1,0);
  122. //delete fitStat;
  123. timer.Stop();
  124. Double_t rtime = timer.RealTime();
  125. Double_t ctime = timer.CpuTime();
  126. cout << endl << endl;
  127. cout << "Macro finished succesfully." << endl;
  128. cout << "Output file is " << outFile << endl;
  129. cout << "Parameter file is " << parFile << endl;
  130. cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
  131. cout << endl;
  132. // ------------------------------------------------------------------------
  133. }