FairRoot/PandaRoot
Functions
globT_theta.C File Reference

Go to the source code of this file.

Functions

int globT_theta (Int_t pid=13, Double_t theta=5., Int_t nStations=3)
 

Function Documentation

int globT_theta ( Int_t  pid = 13,
Double_t  theta = 5.,
Int_t  nStations = 3 
)

Definition at line 1 of file globT_theta.C.

References allDigiFile, ctime, Double_t, fRun, Geane, inDigiFile, inSimFile, iVerbose, nEvents, outFile, parFile, parInput1, parIo1, pid(), recoKalman, rootlogon(), rtdb, rtime, PndRecoKalmanTask::SetTrackInBranchName(), PndRecoKalmanTask::SetTrackOutBranchName(), sysFile, theta, timer, and TString.

1  {
2 
3  if ( nStations != 3 && nStations != 4 ) {
4  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
5  return;
6  }
7 
8  // ========================================================================
9  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
10  Int_t iVerbose = 0;
11 
12  // Input file (MC events)
13  TString inLocTFile = Form("locT_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
14  TString inDigiFile = Form("digi_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
15  TString inSimFile = Form("points_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
16 
17  // Parameter file
18  TString parFile = Form("params_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
19 
20  // Output file
21  TString outFile = Form("globT_%dStations_p%d_theta%.1f.root",nStations,pid,theta);
22 
23  // Number of events to process
24  Int_t nEvents = 0;
25 
26  // ---- Load libraries -------------------------------------------------
27  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
28  rootlogon();
29  TString sysFile = gSystem->Getenv("VMCWORKDIR");
30  // ------------------------------------------------------------------------
31  // In general, the following parts need not be touched
32  // ========================================================================
33 
34  // ----- Timer --------------------------------------------------------
35  TStopwatch timer;
36  timer.Start();
37  // ------------------------------------------------------------------------
38 
39  // ----- Digitization run -------------------------------------------
40  FairRunAna *fRun= new FairRunAna();
41  fRun->SetInputFile(inLocTFile);
42  fRun->AddFriend(inDigiFile);
43  fRun->AddFriend(inSimFile);
44  fRun->SetOutputFile(outFile);
45  // ------------------------------------------------------------------------
46 
47  // ----- Parameter database --------------------------------------------
48  TString allDigiFile = sysFile+"/macro/params/all.par";
49  if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/all4.par";
50 
51  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
52  FairParRootFileIo* parInput1 = new FairParRootFileIo();
53  parInput1->open(parFile.Data());
54 
55  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
56  parIo1->open(allDigiFile.Data(),"in");
57 
58  rtdb->setFirstInput(parInput1);
59  rtdb->setSecondInput(parIo1);
60  // ################################################################## MERGE
61  PndGlobalIdealTrackMerger* trackMerger = new PndGlobalIdealTrackMerger(iVerbose);
62  fRun->AddTask(trackMerger);
63 
64  PndGlobalTrackMergerQA* trackMergerQA = new PndGlobalTrackMergerQA(iVerbose);
65  fRun->AddTask(trackMergerQA);
66 
67  // ################################################################## FIT MERGED TRACKS
68  // ----- Prepare Geane ------------------------------------------------
69  FairGeane *Geane = new FairGeane();
70  fRun->AddTask(Geane);
71 
72  // ----- Run Kalman fitter --------------------------------------------
74  recoKalman->SetTrackInBranchName("GlobalTrack");
75  recoKalman->SetTrackOutBranchName("GlobalFitTrack");
76  //recoKalman->SetNumIterations(3);
77  fRun->AddTask(recoKalman);
78 
79  PndGlobalTrackFitQA* trackFitQA = new PndGlobalTrackFitQA(0);
80  fRun->AddTask(trackFitQA);
81  // ##################################################################
82 
83  // ----- Intialise and run --------------------------------------------
84  fRun->Init();
85  // PndEmcMapper *emcMap = PndEmcMapper::Instance(2);
86  fRun->Run(0, nEvents);
87 
88  rtdb->saveOutput();
89  rtdb->print();
90 
91  // ------------------------------------------------------------------------
92 
93  // ----- Finish -------------------------------------------------------
94 
95  timer.Stop();
96  Double_t rtime = timer.RealTime();
97  Double_t ctime = timer.CpuTime();
98  cout << endl << endl;
99  cout << "Macro finished succesfully." << endl;
100  cout << "Output file is " << outFile << endl;
101  cout << "Parameter file is " << parFile << endl;
102  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
103  cout << endl;
104  // ------------------------------------------------------------------------
105 
106 
107  return 0;
108 }
TString outFile
Definition: hit_dirc.C:17
int pid()
TString allDigiFile
Definition: hit_muo.C:36
void SetTrackOutBranchName(const TString &name)
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
TString sysFile
TString inSimFile
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
TString inDigiFile
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
void SetTrackInBranchName(const TString &name)
Int_t iVerbose
PndRecoKalmanTask * recoKalman
Double_t rtime
Definition: hit_dirc.C:113