FairRoot/PandaRoot
runMvdTpcRiemannTrackFinder.C
Go to the documentation of this file.
1 {
2  // ========================================================================
3  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
4  Int_t iVerbose = 1;
5  // Input file (MC events)
6 // TString MCFile = "Mvd_TestNewVersion.root";
7  // Parameter file
8 // TString parFile = "MvdParamsNewVersion.root";
9  // Parameter output file
10  TString parOutFile = "MvdParamsNewVersion.root";
11  // Number of events to process
12  Int_t nEvents = 100;
13  // ---- Load libraries -------------------------------------------------
14  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
15  //gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
16  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
17 
18 
19  // gSystem->Load("libriemann");
20 
21  // ------------------------------------------------------------------------
22  TString inFile="$SIMPATH/pandaroot/macro/data/MvdTpc_D+D-_2Disks/digiMVD/recoMVD/Combined.reco.root";
23  TString jobname="riemannMVD";
24 
25  TString mcFile="$SIMPATH/pandaroot/macro/data/MvdTpc_D+D-_2Disks/Combined.mc.root";
26 
27  TString SIMPATH = gSystem->Getenv("SIMPATH");
28 
29  inFile.ReplaceAll("$SIMPATH",SIMPATH);
30  mcFile.ReplaceAll("$SIMPATH",SIMPATH);
31 
32  TString inDir=inFile(0,inFile.Last('/')+1);
33  // make new subdir
34  TString jobDir=inDir; jobDir+=jobname; jobDir+="/";
35  TString cmd="mkdir ";
36  cmd+=jobDir;
37  if(gSystem->Exec(cmd)){
38  std::cout<<"Could not create Job-Directory "<<jobDir
39  <<". Aborting."<<std::endl;
40  return;
41  }
42 
44  outFile.ReplaceAll(inDir,jobDir);
45  outFile.ReplaceAll(".reco.root",".riemann.root");
46 
48  paramIn.ReplaceAll(".reco.root",".param.root");
50  paramOut.ReplaceAll(".riemann.root",".param.root");
51 
52 /*
53  TString mcDir = inDir;
54  mcDir=mcDir(0,mcDir.Last('/')); // remove last /
55  mcDir=mcDir(0,mcDir.Last('/')+1); // one directory up
56  TString mcFile= inFile;
57  mcFile.ReplaceAll(inDir,mcDir);
58  mcFile.ReplaceAll(".raw.root",".mc.root");
59  */
60 
61  std::cout<<"Input: "<<inFile<<std::endl;
62  std::cout<<"Output: "<<outFile<<std::endl;
63  std::cout<<"MCFile: "<<mcFile<<std::endl;
64  std::cout<<"ParamIn: "<<paramIn<<std::endl;
65  std::cout<<"ParamOut: "<<paramOut<<std::endl;
66 
67  // --- Now choose concrete engines for the different tasks -------------
68  // ------------------------------------------------------------------------
69  // In general, the following parts need not be touched
70  // ========================================================================
71 
72  // ----- Timer --------------------------------------------------------
73  TStopwatch timer;
74  timer.Start();
75  // ------------------------------------------------------------------------
76 
77 
78 
79  // ----- Reconstruction run -------------------------------------------
80  FairRunAna *fRun= new FairRunAna();
81  fRun->SetInputFile(inFile);
82 
83  fRun->SetOutputFile(outFile);
84  // ------------------------------------------------------------------------
85 
86 
87 
88  // ----- Parameter database --------------------------------------------
89  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
90 
91  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
92  parInput1->open(paramIn.Data(),"UPDATE");
93 // FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo();
94 // parInput1->open(parFile.Data(),"in");
95 
96  rtdb->setFirstInput(parInput1);
98 // FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
99 // output->open(parOutFile.Data(),"RECREATE");
100  // ------------------------------------------------------------------------
101 
102 
103 
104  // =========================================================================
105  // ====== Hit Producers ======
106  // =========================================================================
107 
108  // ----- MVD hit producer --------------------------------------------
109 
111  mvdTrackFinder->SetVerbose(iVerbose);
112  mvdTrackFinder->SetMaxDist(0.7);
113  mvdTrackFinder->SetMaxSZChi2(1);
114  mvdTrackFinder->SetMaxSZDist(1);
115  fRun->AddTask(mvdTrackFinder);
116 
117  FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
118  output->open(paramOut.Data());
119  rtdb->setOutput(parInput1);
120  rtdb->print();
121  // ===== End of HitProducers =====
122  // =========================================================================
123  PndMvdGeoPar* geoPar = (PndMvdGeoPar*)(rtdb->getContainer("PndMvdGeoPar"));
124 
125  // ----- Intialise and run --------------------------------------------
126  fRun->Init();
127 
128  fRun->Run(0,nEvents);
129  // fRun->Run(96,97);
130  // ------------------------------------------------------------------------
131 
132  rtdb->saveOutput();
133  rtdb->print();
134  // ----- Finish -------------------------------------------------------
135  timer.Stop();
136  Double_t rtime = timer.RealTime();
137  Double_t ctime = timer.CpuTime();
138  cout << endl << endl;
139  cout << "Macro finished succesfully." << endl;
140  cout << "Output file is " << outFile << endl;
141  cout << "Parameter file is " << paramOut << endl;
142  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
143  cout << endl;
144  // ------------------------------------------------------------------------
145 
146 
147 }
TString jobname
FairRuntimeDb * rtdb
Double_t ctime
FairParRootFileIo * output
PndMvdRiemannTrackFinderTask * mvdTrackFinder
TString paramIn
PndMvdGeoPar * geoPar
TString parOutFile
FairRunAna * fRun
Definition: hit_dirc.C:58
TString outFile
Bool_t kParameterMerged
FairParRootFileIo * parInput1
Double_t
TStopwatch timer
Definition: hit_dirc.C:51
TString paramOut
TString inDir
Double_t rtime
Int_t iVerbose
TString jobDir
TString inFile
TString SIMPATH
TString mcFile