FairRoot/PandaRoot
detectors/disc/pid.C
Go to the documentation of this file.
1 int pid()
2 {
3  // Macro created 02/10/2012 by S.Spataro
4  // It loads a reconstruction file and compute PID informations
5 
6  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
7  Int_t iVerbose = 0; // just forget about it, for the moment
8 
9  // Number of events to process
10  Int_t nEvents = 0; // if 0 all the vents will be processed
11 
12  // Parameter file
13  TString parFile = "simparams.root"; // at the moment you do not need it
14 
15  // Digitisation file (ascii)
16  TString digiFile = "all.par";
17 
18  // Output file
19  TString outFile = "pid.root";
20 
21  // ----- Timer --------------------------------------------------------
22  TStopwatch timer;
23  // ------------------------------------------------------------------------
24 
25  // ----- Reconstruction run -------------------------------------------
26  FairRunAna *fRun= new FairRunAna();
27  fRun->SetInputFile("sim.root");
28  fRun->AddFriend("digi.root");
29  fRun->AddFriend("reco.root");
30  fRun->SetOutputFile(outFile);
31  fRun->SetGenerateRunInfo(kFALSE);
32  fRun->SetUseFairLinks(kTRUE);
33  FairGeane *Geane = new FairGeane();
34  fRun->AddTask(Geane);
35 
36  // ----- Parameter database --------------------------------------------
37  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
38  emcDigiFile += "/macro/params/";
39  emcDigiFile += digiFile;
40 
41  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
42  FairParRootFileIo* parInput1 = new FairParRootFileIo();
43  parInput1->open(parFile.Data());
44 
45  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
46  parIo1->open(emcDigiFile.Data(),"in");
47 
48  rtdb->setFirstInput(parInput1);
49  rtdb->setSecondInput(parIo1);
50 
51  // ------------------------------------------------------------------------
52 
54  //corr->SetVerbose();
55  corr->SetBarrelTrackBranch("SttMvdGemGenTrack");
56 // corr->SetInputIDBranch("SttMvdGemGenTrackID");
57  corr->SetForwardTrackBranch("FtsIdealGenTrack");
58  // corr->SetInputIDBranch2("FtsIdealGenTrackID");
59  //corr->SetDebugMode(kTRUE);
60  //corr->SetFast(kTRUE);
61  //corr->SetBackPropagate(kFALSE);
62  fRun->AddTask(corr);
63 
64  PndDiscTaskPID *Disc= new PndDiscTaskPID();
65  fRun->AddTask(Disc);
66 
67  // ----- Intialise and run --------------------------------------------
69  cout << "fRun->Init()" << endl;
70  fRun->Init();
71 
72  timer.Start();
73  fRun->Run(0,nEvents);
74  // ------------------------------------------------------------------------
75 
76 
77  // ----- Finish -------------------------------------------------------
78  timer.Stop();
79  Double_t rtime = timer.RealTime();
80  Double_t ctime = timer.CpuTime();
81  cout << endl << endl;
82  cout << "Macro finished successfully." << endl;
83  cout << "Output file is " << outFile << endl;
84  cout << "Parameter file is " << parFile << endl;
85  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
86  cout << endl;
87  // ------------------------------------------------------------------------
88  cout << " Test passed" << endl;
89  cout << " All ok " << endl;
90  return 0;
91 }
PndPidCorrelator * corr
TString outFile
Definition: hit_dirc.C:17
void SetBarrelTrackBranch(TString branch)
int pid()
TString digiFile
Definition: bump_emc.C:20
TString emcDigiFile
Definition: bump_emc.C:45
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
static void Init(Int_t MapVersion)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
Int_t iVerbose
void SetForwardTrackBranch(TString branch)
Double_t rtime
Definition: hit_dirc.C:113