FairRoot/PandaRoot
run_linkLoading.C
Go to the documentation of this file.
1 {
2  // ========================================================================
3  Int_t iVerbose = 0;
4  TString parFile = "simparams.root";
5  //Int_t nEvents = 10;
6  Int_t startEvent = 0;
7  Int_t stopEvent = 10;
8  // ---- Load libraries -------------------------------------------------
9  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
10  // ------------------------------------------------------------------------
11  // Output file
12 
13  TString linkFile = "links_emc.root";
14  TString outFile = "Dummy.root";
15 
16 
17  std::cout << "LinkFile: " << linkFile.Data() << std::endl;
18 
19  gSystem->Load("libMCMatch");
20 
21 
22  // ----- Timer --------------------------------------------------------
23  TStopwatch timer;
24  timer.Start();
25  // ------------------------------------------------------------------------
26 
27 
28 
29  // ----- Reconstruction run -------------------------------------------
30  FairRunAna *fRun= new FairRunAna();
31 
32  fRun->SetInputFile(linkFile);
33 
34  fRun->SetOutputFile(outFile);
35  // ------------------------------------------------------------------------
36 
37 
38 
39  // ----- Parameter database --------------------------------------------
40  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
41 
42  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
43  parInput1->open(parFile.Data(),"UPDATE");
44 // FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo();
45 // parInput1->open(parFile.Data(),"in");
46 
47  rtdb->setFirstInput(parInput1);
49 // FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
50 // output->open(parOutFile.Data(),"RECREATE");
51  rtdb->setOutput(parInput1);
52  rtdb->print();
53 // fRun->LoadGeometry();
54 
55  // ------------------------------------------------------------------------
56 
57 
58 
59  // =========================================================================
60  // ====== Hit Producers ======
61  // =========================================================================
62 
63  // ----- MVD hit producer --------------------------------------------
64 
65 
66  PndMCMatchLoaderTask* mcMatch = new PndMCMatchLoaderTask();
67  fRun->AddTask(mcMatch);
68 
69  PndMCMatchSelectorTask* mcSelector = new PndMCMatchSelectorTask(16,1); // MC Match for charged particles
70  mcSelector->SetAllWeights(1.);
71  fRun->AddTask(mcSelector);
72 
73  fRun->Init();
74 
75  fRun->Run(startEvent,stopEvent);
76 
77 
78  // ------------------------------------------------------------------------
79 
80 // rtdb->saveOutput();
81  // ----- Finish -------------------------------------------------------
82  timer.Stop();
83  Double_t rtime = timer.RealTime();
84  Double_t ctime = timer.CpuTime();
85  cout << endl << endl;
86  cout << "Macro finished succesfully." << endl;
87  cout << "Output file is " << outFile << endl;
88  cout << "Parameter file is " << parFile << endl;
89  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
90  cout << endl;
91  // ------------------------------------------------------------------------
92 
93 
94 }
FairRunAna * fRun
TString parFile
TStopwatch timer
TString outFile
TString linkFile
FairRuntimeDb * rtdb
Double_t
PndMCMatchSelectorTask * mcSelector
PndMCMatchLoaderTask * mcMatch
Int_t iVerbose
Bool_t kParameterMerged
Int_t startEvent
Double_t rtime
Double_t ctime
Int_t stopEvent
FairParRootFileIo * parInput1