FairRoot/PandaRoot
mcMatch.C
Go to the documentation of this file.
1 int mcMatch(Int_t nEvents = 0)
2 {
3  //-----User Settings:-----------------------------------------------
4  TString SimEngine ="TGeant3";
5  TString InputFile ="sim_complete.root";
6  TString DigiFile ="digi_complete.root";
7  TString RecoFile ="reco_complete.root";
8  TString ParFile ="simparams.root";
9 
10  //------------------------------------------------------------------
11 
12  // ----- Reconstruction run -------------------------------------------
13  FairRunAna *fRun= new FairRunAna();
14  fRun->SetInputFile(InputFile.Data());
15  fRun->SetOutputFile("tst.root");
16 
17  TFile* testFile;
18  testFile = new TFile(DigiFile.Data());
19  if (!testFile->IsZombie()){
20  fRun->AddFriend(DigiFile.Data());
21  }
22  testFile->Close();
23 
24  testFile = new TFile(RecoFile.Data());
25  if (!testFile->IsZombie()){
26  fRun->AddFriend(RecoFile.Data());
27  }
28  testFile->Close();
29 
30  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
31  FairParRootFileIo* parInput1 = new FairParRootFileIo();
32  parInput1->open(ParFile.Data());
33  rtdb->setFirstInput(parInput1);
34  FairEventManager *fMan= new FairEventManager();
35 
36  PndMCTruthMatch* mcTruth = new PndMCTruthMatch("EmcCluster");
37  fRun->AddTask(mcTruth);
38 
39  cout << "fRun->Init()" << endl;
40  fRun->Init();
41  TStopwatch timer;
42 
43  timer.Start();
44  fRun->Run(0,nEvents);
45  // ------------------------------------------------------------------------
46 
47 
48  // ----- Finish -------------------------------------------------------
49  timer.Stop();
50  Double_t rtime = timer.RealTime();
51  Double_t ctime = timer.CpuTime();
52  cout << endl << endl;
53  cout << "Macro finished successfully." << endl;
54 // cout << "Output file is " << outFile << endl;
55  // cout << "Parameter file is " << parFile << endl;
56  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
57  cout << endl;
58  // ------------------------------------------------------------------------
59  cout << " Test passed" << endl;
60  cout << " All ok " << endl;
61  return 0;
62 }
TString RecoFile
PndMCMatchCreatorTask * mcMatch
FairRunAna * fRun
Definition: hit_dirc.C:58
TString DigiFile
Double_t
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairEventManager * fMan
Definition: drawEveTracks.C:7
int testFile(TString nome, TString type)
Definition: testFile.C:1
Double_t rtime
Definition: hit_dirc.C:113