FairRoot/PandaRoot
Functions
outdated/run/reco_complete_gf2.C File Reference

Go to the source code of this file.

Functions

void process_mem_usage (double &vm_usage)
 
int reco_complete_gf2 ()
 

Function Documentation

void process_mem_usage ( double &  vm_usage)

Definition at line 1 of file outdated/run/reco_complete_gf2.C.

References pid().

Referenced by reco_complete_gf2().

2 {
3  using std::ios_base;
4  using std::ifstream;
5  using std::string;
6 
7  vm_usage = 0.0;
8 
9 
10  // 'file' stat seems to give the most reliable results
11  //
12  ifstream stat_stream("/proc/self/stat",ios_base::in);
13 
14  // dummy vars for leading entries in stat that we don't care about
15  //
16  string pid, comm, state, ppid, pgrp, session, tty_nr;
17  string tpgid, flags, minflt, cminflt, majflt, cmajflt;
18  string utime, stime, cutime, cstime, priority, nice;
19  string O, itrealvalue, starttime;
20 
21  // the two fields we want
22  //
23  unsigned long vsize;
24  long rss;
25 
26  stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
27  >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt
28  >> utime >> stime >> cutime >> cstime >> priority >> nice
29  >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest
30 
31  stat_stream.close();
32 
33  vm_usage = vsize / (1024*1024);
34 
35 }
int pid()
int reco_complete_gf2 ( )

Definition at line 37 of file outdated/run/reco_complete_gf2.C.

References ctime, digiFile, Double_t, emcDigiFile, fRun, Geane, PndEmcMapper::Init(), iVerbose, nEvents, PndTrkTracking2::NoMvdAloneTracking(), outFile, parFile, parInput1, parIo1, process_mem_usage(), recoKalman, recoKalmanFwd, rtdb, rtime, PndRecoKalmanTask2::SetBusyCut(), PndTrkTracking2::SetInputBranchName(), PndFtsTrackerIdeal::SetPersistence(), PndTrkTracking2::SetPersistence(), PndFtsTrackerIdeal::SetRelativeMomentumSmearing(), PndRecoKalmanTask2::SetTrackInBranchName(), PndFtsTrackerIdeal::SetTrackingEfficiency(), PndRecoKalmanTask2::SetTrackOutBranchName(), PndFtsTrackerIdeal::SetTrackOutput(), PndFtsTrackerIdeal::SetVertexSmearing(), SttMvdGemTracking, timer, trackFts, tracking, and TString.

38 {
39  // Macro created 20/09/2006 by S.Spataro
40  // It loads a digi file and performs tracking
41 
42  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
43  Int_t iVerbose = 0; // just forget about it, for the moment
44 
45  // Number of events to process
46  Int_t nEvents = 0; // if 0 all the vents will be processed
47 
48  // Parameter file
49  TString parFile = "simparams.root"; // at the moment you do not need it
50 
51  // Digitisation file (ascii)
52  TString digiFile = "all.par";
53 
54  // Output file
55  TString outFile = "reco_complete.root";
56 
57  // ----- Timer --------------------------------------------------------
58  TStopwatch timer;
59  // ------------------------------------------------------------------------
60 
61  // ----- Reconstruction run -------------------------------------------
62  FairRunAna *fRun= new FairRunAna();
63  fRun->SetInputFile("sim_complete.root");
64  fRun->AddFriend("digi_complete.root");
65  fRun->SetOutputFile(outFile);
66  fRun->SetGenerateRunInfo(kFALSE);
67  fRun->SetUseFairLinks(kTRUE);
68  FairGeane *Geane = new FairGeane();
69  fRun->AddTask(Geane);
70 
71  // ----- Parameter database --------------------------------------------
72  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
73  emcDigiFile += "/macro/params/";
74  emcDigiFile += digiFile;
75 
76  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
77  FairParRootFileIo* parInput1 = new FairParRootFileIo();
78  parInput1->open(parFile.Data());
79 
80  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
81  parIo1->open(emcDigiFile.Data(),"in");
82 
83  rtdb->setFirstInput(parInput1);
84  rtdb->setSecondInput(parIo1);
85 
86  // ------------------------------------------------------------------------
87  // use the constructor with input :
88  // printout flag (int) , plotting flag (bool), MC comparison flag (bool), SciTil.
89  PndTrkTracking2* tracking = new PndTrkTracking2(0,false,false,true);
90  tracking->SetInputBranchName("STTHit","MVDHitsPixel","MVDHitsStrip");
91  // tracking->SetInputBranchName("STTHitMix","MVDHitsPixelMix","MVDHitsStripMix");
92  // don't do the Pattern Recognition second part, starting from the Mvd;
93  tracking->NoMvdAloneTracking();
94  // do Cleanup only when there is Mixing;
95  // tracking->Cleanup();
96  tracking->SetPersistence(kFALSE);
97  fRun->AddTask(tracking);
98 
100  //SttMvdGemTracking->SetPdgFromMC();
101  SttMvdGemTracking->SetPersistence(kFALSE);
102  fRun->AddTask(SttMvdGemTracking);
103 
104 // PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
105 // trackMC->SetTrackInBranchName("SttMvdGemTrack");
106 // trackMC->SetTrackOutBranchName("SttMvdGemTrackID");
107 // trackMC->SetPersistence(kFALSE);
108 // fRun->AddTask(trackMC);
109 
111  recoKalman->SetTrackInBranchName("SttMvdGemTrack");
112 // recoKalman->SetTrackInIDBranchName("SttMvdGemTrackID");
113  recoKalman->SetTrackOutBranchName("SttMvdGemGenTrack");
114  recoKalman->SetBusyCut(50); // CHECK to be tuned
115  //recoKalman->SetIdealHyp(kTRUE);
116  //recoKalman->SetNumIterations(3);
117  //recoKalman->SetTrackRep(0); // 0 Geane (default), 1 RK
118  //recoKalman->SetPropagateToIP(kFALSE);
119  fRun->AddTask(recoKalman);
120 
121 // PndMCTrackAssociator* trackMC2 = new PndMCTrackAssociator();
122 // trackMC2->SetTrackInBranchName("SttMvdGemGenTrack");
123 // trackMC2->SetTrackOutBranchName("SttMvdGemGenTrackID");
124 // fRun->AddTask(trackMC2);
125 
127  trackFts->SetRelativeMomentumSmearing(0.05);
128  trackFts->SetVertexSmearing(0.05, 0.05, 0.05);
129  trackFts->SetTrackingEfficiency(1.);
130  trackFts->SetTrackOutput("FtsIdealTrack");
131  trackFts->SetPersistence(kFALSE);
132  fRun->AddTask(trackFts);
133 
134 // PndMCTrackAssociator* trackMCfwd = new PndMCTrackAssociator();
135 // trackMCfwd->SetTrackInBranchName("FtsIdealTrack");
136 // trackMCfwd->SetTrackOutBranchName("FtsIdealTrackID");
137 // fRun->AddTask(trackMCfwd);
138 
140  recoKalmanFwd->SetTrackInBranchName("FtsIdealTrack");
141  //recoKalmanFwd->SetTrackInIDBranchName("FtsIdealTrackID");
142  recoKalmanFwd->SetTrackOutBranchName("FtsIdealGenTrack");
143  recoKalmanFwd->SetBusyCut(50); // CHECK to be tuned
144  //recoKalmanFwd->SetIdealHyp(kTRUE);
145  //recoKalmanFwd->SetNumIterations(3);
146  //recoKalmanFwd->SetTrackRep(0); // 0 Geane (default), 1 RK
147  //recoKalmanFwd->SetPropagateToIP(kFALSE);
148  fRun->AddTask(recoKalmanFwd);
149 
150 // PndMCTrackAssociator* trackMC3 = new PndMCTrackAssociator();
151 // trackMC3->SetTrackInBranchName("FtsIdealGenTrack");
152 // trackMC3->SetTrackOutBranchName("FtsIdealGenTrackID");
153 // fRun->AddTask(trackMC3);
154 
155  // ----- Intialise and run --------------------------------------------
157  cout << "fRun->Init()" << endl;
158  fRun->Init();
159 
160  timer.Start();
161  fRun->Run(0,nEvents);
162  // ------------------------------------------------------------------------
163 
164 
165  // ----- Finish -------------------------------------------------------
166  timer.Stop();
167  Double_t rtime = timer.RealTime();
168  Double_t ctime = timer.CpuTime();
169  cout << endl << endl;
170  cout << "Macro finished successfully." << endl;
171  cout << "Output file is " << outFile << endl;
172  cout << "Parameter file is " << parFile << endl;
173  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
174  cout << endl;
175  // ------------------------------------------------------------------------
176  double vm;
177  process_mem_usage(vm);
178  cout << "-------------------------------------------"<<endl;
179  cout << "Memory: " << vm << " MB."<< endl;
180  // ------------------------------------------------------------------------
181  cout << " Test passed" << endl;
182  cout << " All ok " << endl;
183  return 0;
184 }
TString outFile
Definition: hit_dirc.C:17
void SetTrackOutput(TString name="FTSTrkIdeal")
void SetTrackingEfficiency(Double_t eff=1.)
void SetTrackInBranchName(const TString &name)
TString digiFile
Definition: bump_emc.C:20
TString emcDigiFile
Definition: bump_emc.C:45
FairGeane * Geane
void process_mem_usage(double &vm_usage)
FairRunAna * fRun
Definition: hit_dirc.C:58
void SetTrackOutBranchName(const TString &name)
Double_t
TString parFile
Definition: hit_dirc.C:14
void SetVertexSmearing(Double_t sigmax=-1., Double_t sigmay=-1., Double_t sigmaz=-1.)
PndRecoKalmanTask * recoKalmanFwd
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
void SetPersistence(Bool_t persistence)
static void Init(Int_t MapVersion)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetPersistence(Bool_t persistence)
PndTrkTracking * tracking
PndFtsTrackerIdeal * trackFts
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
void SetInputBranchName(const char *string1, const char *string2, const char *string3)
void NoMvdAloneTracking()
PndSttMvdGemTracking * SttMvdGemTracking
Int_t iVerbose
PndRecoKalmanTask * recoKalman
Double_t rtime
Definition: hit_dirc.C:113
void SetBusyCut(Int_t b)
void SetRelativeMomentumSmearing(Double_t dpop=-1.)