FairRoot/PandaRoot
runMvdTpcTrackCorr.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 
6  // Input file (MC events)
7 // TString MCFile = "Mvd_TestNewVersion.root";
8  // Parameter file
9 // TString parFile = "MvdParamsNewVersion.root";
10  // Parameter output file
11 // TString parOutFile = "MvdParamsNewVersion.root";
12  // Number of events to process
13  Int_t nEvents = 100;
14  // ---- Load libraries -------------------------------------------------
15  // gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
16  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
17  gSystem->Load("libriemann");
18 
19  // ------------------------------------------------------------------------
20 
21  TString inFile="$SIMPATH/pandaroot/macro/data/MvdTpc_D+D-_2Disks/digiMVD/recoMVD/riemannMVD/Combined.riemann.root";
22  TString jobname="combinedMVDTPC";
23 
24  TString mcFile="$SIMPATH/pandaroot/macro/data/MvdTpc_D+D-_2Disks/Combined.mc.root";
25  TString recoMVDFile = "$SIMPATH/pandaroot/macro/data/MvdTpc_D+D-_2Disks/digiMVD/recoMVD/Combined.reco.root";
26  TString recoTPCFile = "$SIMPATH/pandaroot/macro/data/MvdTpc_D+D-_2Disks/digiTPC/recoTPC/Combined.reco.root";
27 
28 
29  TString SIMPATH = gSystem->Getenv("SIMPATH");
30 
31  inFile.ReplaceAll("$SIMPATH",SIMPATH);
32  recoMVDFile.ReplaceAll("$SIMPATH",SIMPATH);
33  recoTPCFile.ReplaceAll("$SIMPATH",SIMPATH);
34 
35  TString inDir=inFile(0,inFile.Last('/')+1);
36  // make new subdir
37  TString jobDir=inDir; jobDir+=jobname; jobDir+="/";
38  TString cmd="mkdir ";
39  cmd+=jobDir;
40  if(gSystem->Exec(cmd)){
41  std::cout<<"Could not create Job-Directory "<<jobDir
42  <<". Aborting."<<std::endl;
43  return;
44  }
45 
47  outFile.ReplaceAll(inDir,jobDir);
48  outFile.ReplaceAll(".riemann.root",".combined.root");
49 
51  paramIn.ReplaceAll(".riemann.root",".param.root");
53  paramOut.ReplaceAll(".combined.root",".param.root");
54 
55 /*
56  TString mcDir = inDir;
57  mcDir=mcDir(0,mcDir.Last('/')); // remove last /
58  mcDir=mcDir(0,mcDir.Last('/')+1); // one directory up
59  TString mcFile= inFile;
60  mcFile.ReplaceAll(inDir,mcDir);
61  mcFile.ReplaceAll(".raw.root",".mc.root");
62  */
63 
64  std::cout<<"Input: "<<inFile<<std::endl;
65  std::cout<<"Output: "<<outFile<<std::endl;
66  std::cout<<"RecoMVDFile: "<<recoMVDFile<<std::endl;
67  std::cout<<"RecoTPCFile: "<<recoTPCFile<<std::endl;
68  std::cout<<"ParamIn: "<<paramIn<<std::endl;
69  std::cout<<"ParamOut: "<<paramOut<<std::endl;
70 
71  // --- Now choose concrete engines for the different tasks -------------
72  // ------------------------------------------------------------------------
73 
74 
75  // In general, the following parts need not be touched
76  // ========================================================================
77 
78 
79 
80 
81  // ----- Timer --------------------------------------------------------
82  TStopwatch timer;
83  timer.Start();
84  // ------------------------------------------------------------------------
85 
86 
87 
88  // ----- Reconstruction run -------------------------------------------
89  FairRunAna *fRun= new FairRunAna();
90 
91  fRun->SetInputFile(inFile);
92  fRun->AddFriend(recoMVDFile);
93  fRun->AddFriend(recoTPCFile);
94 
95  fRun->SetOutputFile(outFile);
96  // ------------------------------------------------------------------------
97 
98 
99 
100  // ----- Parameter database --------------------------------------------
101  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
102 
103  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
104  parInput1->open(paramIn.Data(),"UPDATE");
105 // FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo();
106 // parInput1->open(parFile.Data(),"in");
107 
108  rtdb->setFirstInput(parInput1);
109 
110 
111 // fRun->LoadGeometry();
112 
113  // ------------------------------------------------------------------------
114 
115 
116 
117  // =========================================================================
118  // ====== Hit Producers ======
119  // =========================================================================
120 
121  // ----- MVD hit producer --------------------------------------------
122 
123 
124  double MaxDist = 1;
125  double MaxSZ = 1;
126  double MaxSZChi2 = 1;
127 
128  PndMvdTpcRiemannCorrelatorTask* mvdtpccorr = new PndMvdTpcRiemannCorrelatorTask();
129  mvdtpccorr->SetMaxDist(MaxDist);
130  mvdtpccorr->SetMaxSZ(MaxSZ);
131  mvdtpccorr->SetMaxSZChi2(MaxSZChi2);
132  mvdtpccorr->SetVerbose(iVerbose);
133  fRun->AddTask(mvdtpccorr);
134 
135  FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
136  output->open(paramOut.Data());
137  rtdb->setOutput(output);
138 // rtdb->setOutput(parInput1);
139  rtdb->print();
140  // ===== End of HitProducers =====
141  // =========================================================================
142 // PndMvdGeoPar* geoPar = (PndMvdGeoPar*)(rtdb->getContainer("PndMvdGeoPar"));
143 
144  // ----- Intialise and run --------------------------------------------
145  fRun->Init();
146 
147  fRun->Run(0,nEvents);
148  // ------------------------------------------------------------------------
149  //TCanvas* myCan1 = new TCanvas();
150  //mvdtpccorr->DrawDistHistos(myCan1, 0);
151 
152  //TCanvas* myCan2 = new TCanvas();
153  //mvdtpccorr->DrawSZHistos(myCan2, 0);
154 
155  // TCanvas* myCan3 = new TCanvas();
156  // mvdtpccorr->DrawSZChi2Histos(myCan3, 0);
157 // rtdb->saveOutput();
158  // ----- Finish -------------------------------------------------------
159  timer.Stop();
160  Double_t rtime = timer.RealTime();
161  Double_t ctime = timer.CpuTime();
162  cout << endl << endl;
163  cout << "Macro finished succesfully." << endl;
164  cout << "Output file is " << outFile << endl;
165  cout << "Parameter file is " << paramOut << endl;
166  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
167  cout << endl;
168  // ------------------------------------------------------------------------
169 
170 
171 }
double MaxSZChi2
double MaxDist
double MaxSZ
TString outFile
Definition: hit_dirc.C:17
TString SIMPATH
Definition: runMvdTpcReco.C:24
PndMvdTpcRiemannCorrelatorTask * mvdtpccorr
TString recoTPCFile
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
TString paramOut
Definition: runMvdTpcDigi.C:45
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
Double_t
TString inDir
Definition: runMvdTpcDigi.C:28
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
TString jobDir
Definition: runMvdTpcDigi.C:30
TString mcFile
Definition: runMvdTpcReco.C:22
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
TString recoMVDFile
TString cmd
Definition: runMvdTpcDigi.C:31
Int_t iVerbose
TString paramIn
Definition: runMvdTpcDigi.C:43
TString jobname
Definition: runMvdTpcDigi.C:26
Double_t rtime
Definition: hit_dirc.C:113