FairRoot/PandaRoot
runMvdTpcDigi.C
Go to the documentation of this file.
1 {
2  // ----- Timer --------------------------------------------------------
3  TStopwatch timer;
4  timer.Start();
5 
6  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
7  Int_t iVerbose = 0;
8 
9  Int_t nEvents = 100;
10 
11 // gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
12  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
13  // Input file (MC events)
14  //TString inFile = "Mvd_DPMfixed_4GeV_10000.root"; //"MvdG4_DPM405_Mag_5000.root";
15  //TString inFile = "data/mvdparams.root";
16 // TString inFile = "Mvd_D+D-withTPC.root";
17  // Parameter file
18 // TString parFile = "MvdParamsNewVersion.root";
19  //TString parFile = "data/mvdparams.root";
20  // Parameter output file
21 
22 // TString parOutFile = "Test/testParamsOutput.root";
23 
24  // Input file (MC events)
25  TString inFile="/home/stockman/fairroot/cbmsoft/pandaroot/macro/data/MvdTpc_D+D-_2Disks/Combined.mc.root";
26  TString jobname="digiMVD";
27 
28  TString inDir=inFile(0,inFile.Last('/')+1);
29  // make new subdir
30  TString jobDir=inDir; jobDir+=jobname; jobDir+="/";
31  TString cmd="mkdir ";
32  cmd+=jobDir;
33  if(gSystem->Exec(cmd)){
34  std::cout<<"Could not create Job-Directory "<<jobDir
35  <<". Aborting."<<std::endl;
36  return;
37  }
38 
40  outFile.ReplaceAll(inDir,jobDir);
41  outFile.ReplaceAll(".mc.root",".raw.root");
42 
44  paramIn.ReplaceAll(".mc.root",".param.root");
46  paramOut.ReplaceAll(".raw.root",".param.root");
47 
48  TString digiparFile = gSystem->Getenv("VMCWORKDIR");
49  digiparFile += "/mvd/MvdTools/mvd.digi.par";
50 
51 
52  // In general, the following parts need not be touched
53  // ========================================================================
54  // Output file
55 
56 
57 //
58 // PndFileNameCreator creator(inFile.Data());
59 // TString outFile = creator.GetDigiFileName().c_str(); //"MvdG4_DPM405_Mag_5000_digi.root";
60 // std::cout << "DigiFileName: " << outFile.Data() << std::endl;
61 
62  // ----- Reconstruction run -------------------------------------------
63  FairRunAna *fRun= new FairRunAna();
64  fRun->SetInputFile(inFile);
65  fRun->SetOutputFile(outFile);
66 
67 
68  // ----- Parameter database --------------------------------------------
69  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
70  // FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
71  // parInput1->open(parFile.Data(),"UPDATE");
72  // rtdb->setFirstInput(parInput1);
73 // Bool_t kParameterMerged=kTRUE;
74 
75  FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
76  parInput2->open(digiparFile.Data(),"in");
77  rtdb->setSecondInput(parInput2);
78 
79  fRun->LoadGeometry();
80 
81 
82  // ----- Digitization ---------------------------------------
83 // PndMvdDigiTask* mvddigi = new PndMvdDigiTask();
84 // mvddigi->SetVerbose(iVerbose);
85 // fRun->AddTask(mvddigi);
86  // =========================================================================
87  // ====== Hit Producers ======
88  // =========================================================================
89 
90  // ----- MVD Strip hit producer ---------------------------------------
91 
92 // double topPitch=0.015,
93 // botPitch=0.015,
94 // orient=TMath::Pi()*(0.5),
95 // skew=TMath::Pi()*(0.5);
96 // TVector2 topAnchor(0.,0.);
97 // TVector2 botAnchor(0.,0.);
98 // int topFE = 10,
99 // botFE = 4,
100 // nrFEChannels = 128;
101 // double threshold=3000., noise=1000.;
102 // PndMvdStripHitProducer* mvdStripProd
103 // = new PndMvdStripHitProducer(topPitch, botPitch,
104 // orient, skew,
105 // topAnchor,botAnchor,
106 // topFE, botFE, nrFEChannels,
107 // threshold, noise);
108 
110  mvdStripProd->SetVerbose(iVerbose);
111 
112 
113 
114  fRun->AddTask(mvdStripProd);
115  // ----- MVD Pixel hit producer ---------------------------------------
116 // Double_t lx=0.01, ly=0.01, threshold=600, noise=200;
117 // PndMvdHybridHitProducer* mvdPixProd = new PndMvdHybridHitProducer(lx,ly,threshold,noise);
119  mvdPixProd->SetVerbose(iVerbose);
120  fRun->AddTask(mvdPixProd);
121 
122 
123 
124  FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
125  output->open(paramOut.Data());
126  rtdb->setOutput(output);
127 // rtdb->setOutput(parInput1);
128 
129 // PndMvdNoiseProducer* mvdNoiseMaker = new PndMvdNoiseProducer();
130 // mvdNoiseMaker->SetVerbose(iVerbose);
131 // fRun->AddTask(mvdNoiseMaker);
132 
133  // PndTpcClusterizerTask* tpcClusterizer = new PndTpcClusterizerTask();
134  //tpcClusterizer->SetPersistence();
135  // fRun->AddTask(tpcClusterizer);
136 
137  /* PndTpcDriftTask* tpcDrifter = new PndTpcDriftTask();
138  tpcDrifter->SetPersistence();
139  tpcDrifter->SetDistort(false);
140  double deg=TMath::Pi()/180;
141  //tpcDrifter->SetPhiCut(-15*deg,15*deg);
142  //tpcDrifter->SetQAPlotCol(qa);
143  fRun->AddTask(tpcDrifter);
144 
145  PndTpcGemTask* tpcGem = new PndTpcGemTask();
146  //tpcGem->SetPersistence();
147  fRun->AddTask(tpcGem);
148 
149  PndTpcPadResponseTask* tpcPadResponse = new PndTpcPadResponseTask();
150  tpcPadResponse->SetPersistence();
151  //tpcPadResponse->SetQAPlotCol(qa);
152  fRun->AddTask(tpcPadResponse);
153 
154 
155  //PndTpcEvtMixTask* evtmixer = new PndTpcEvtMixTask();
156  // evtmixer->SetBkgFileName("bkg2.raw.root");
157  // evtmixer->SetNBkgEvts(500);
158  // evtmixer->SetEvtRate(1E7);
159  //fRun->AddTask(evtmixer);
160 
161  PndTpcElectronicsTask* tpcElec = new PndTpcElectronicsTask();
162  tpcElec->SetPersistence();
163  //tpcElec->SetQAPlotCol(qa);
164  fRun->AddTask(tpcElec);
165 */
166 // FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
167 // output->open(parOutFile.Data());
168 // rtdb->setOutput(output);
169 
170  rtdb->print();
171  // ===== End of HitProducers =====
172  // =========================================================================
173  PndMvdGeoPar* geoPar = (PndMvdGeoPar*)(rtdb->getContainer("PndMvdGeoPar"));
174 
175  // ----- Intialise and run --------------------------------------------
176  fRun->Init();
177 
178  fRun->Run(0,nEvents);
179 
180  rtdb->saveOutput();
181  rtdb->print();
182 
183  // ----- Finish -------------------------------------------------------
184  timer.Stop();
185  Double_t rtime = timer.RealTime();
186  Double_t ctime = timer.CpuTime();
187  cout << endl << endl;
188  cout << "Macro finished succesfully." << endl;
189  cout << "Output file is " << outFile << endl;
190  cout << "Parameter file is " << paramOut << endl;
191  cout << "Real time " << rtime << " s, CPU time " << ctime << " s\a\a" << endl;
192  cout << endl;
193 
194 }
Hit Producer Task for strip detectors.
PndMvdGeoPar * geoPar
TString outFile
Definition: hit_dirc.C:17
PndMvdHybridHitProducer * mvdPixProd
PndMvdStripHitProducer * mvdStripProd
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
FairParAsciiFileIo * parInput2
Definition: conMvdDigi.C:26
Double_t ctime
Definition: hit_dirc.C:114
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
TString digiparFile