FairRoot/PandaRoot
eta_c/run_reco_stt_mix.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 = 0;
5 
6  // Input file
7  TString inDigiFile = "evt_digi_stt.root";
8  TString inSimFile = "evt_points_stt.root";
9 
10  // Parameter file
11  TString parFile = "evt_params_stt.root";
12 
13  // Output file
14  TString outFile = "mix_reco_stt.root";
15 
16  // Number of events to process
17  Int_t nEvents = 0;
18 
19  // ---- Load libraries -------------------------------------------------
20  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
21  rootlogon();
22  TString sysFile = gSystem->Getenv("VMCWORKDIR");
23  // ------------------------------------------------------------------------
24  // In general, the following parts need not be touched
25  // ========================================================================
26 
27  // ----- Timer --------------------------------------------------------
28  TStopwatch timer;
29  timer.Start();
30  // ------------------------------------------------------------------------
31 
32  // ----- Digitization run -------------------------------------------
33  FairRunAna *fRun= new FairRunAna();
34  fRun->SetInputFile(inDigiFile);
35  fRun->AddFriend(inSimFile);
36  fRun->SetOutputFile(outFile);
37  FairGeane *Geane = new FairGeane();
38  fRun->AddTask(Geane);
39  // ------------------------------------------------------------------------
40 
41  // ----- Parameter database --------------------------------------------
42  TString allDigiFile = sysFile+"/macro/params/all.par";
43 
44  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
45  FairParRootFileIo* parInput1 = new FairParRootFileIo();
46  parInput1->open(parFile.Data());
47 
48  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
49  parIo1->open(allDigiFile.Data(),"in");
50 
51  rtdb->setFirstInput(parInput1);
52  rtdb->setSecondInput(parIo1);
53  // ------------------------------------------------------------------------
54 
55  //-------------------------- MixBackgroundEvents task ----------------------------------
56  // The following is the task that mixes physics evt and bkg events.
58  mix->SetInputBkgFilesName("dpm_digi_stt.root");//inBGFile.Data());// Mvd and Stt bkg file.
59  fRun->AddTask(mix);
60  // =========================================================================
61 
63  mvdTrackFinder->AddHitBranch("MVDHitsPixelMix");
64  mvdTrackFinder->AddHitBranch("MVDHitsStripMix");
65  mvdTrackFinder->SetVerbose(iVerbose);
66  mvdTrackFinder->SetMaxDist(0.05);
67  mvdTrackFinder->SetPersistence(kFALSE);
68  fRun->AddTask(mvdTrackFinder);
69 
70  // =========================================================================
71 
72  // PndSttTrackFinderIdeal* sttTrackFinder = new PndSttTrackFinderIdeal(iVerbose);
74  PndSttFindTracks* sttFindTracks = new PndSttFindTracks("Track Finder", "FairTask", sttTrackFinder, iVerbose);
75  sttFindTracks->AddHitCollectionName("STTHitMix", "STTPoint");
76  //sttFindTracks->SetPersistence(kFALSE);
77  fRun->AddTask(sttFindTracks);
78 
79  PndSttMvdTracking * SttMvdTracking = new PndSttMvdTracking(0,false,false);
80  SttMvdTracking->SetInputBranchName("STTHitMix","MVDHitsPixelMix","MVDHitsStripMix");
81  SttMvdTracking->Cleanup();
82  //SttMvdTracking->SetPersistence(kFALSE);
83  fRun->AddTask(SttMvdTracking);
84 
85  //PndMCTrackAssociator* trackMC0 = new PndMCTrackAssociator();
86  //trackMC0->SetTrackInBranchName("SttMvdTrack");
87  //trackMC0->SetTrackOutBranchName("SttMvdTrackID");
88  //trackMC0->SetPersistence(kFALSE);
89  //fRun->AddTask(trackMC0);
90 
92  SttMvdGemTracking->SetBranchNames("MVDHitsPixelMix", "MVDHitsStripMix", "STTHitMix", "GEMHit");
93  //SttMvdGemTracking->SetPdgFromMC();
94  fRun->AddTask(SttMvdGemTracking);
95 
96  PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
97  trackMC->SetTrackInBranchName("SttMvdGemTrack");
98  trackMC->SetTrackOutBranchName("SttMvdGemTrackID");
99  fRun->AddTask(trackMC);
100 
102  recoKalman->SetTrackInBranchName("SttMvdGemTrack");
103  recoKalman->SetTrackInIDBranchName("SttMvdGemTrackID");
104  recoKalman->SetTrackOutBranchName("SttMvdGemGenTrack");
105  recoKalman->SetBusyCut(50); // CHECK to be tuned
106  recoKalman->SetMvdBranchName("Mix");
107  recoKalman->SetCentralTrackerBranchName("Mix");
108  recoKalman->SetIdealHyp(kTRUE);
109  //recoKalman->SetNumIterations(3);
110  fRun->AddTask(recoKalman);
111 
112  PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
113  trackMC->SetTrackInBranchName("SttMvdGemGenTrack");
114  trackMC->SetTrackOutBranchName("SttMvdGemGenTrackID");
115  fRun->AddTask(trackMC);
116 
117  // ----- Intialise and run --------------------------------------------
119  fRun->Init();
120  fRun->Run(0, nEvents);
121 
122  rtdb->saveOutput();
123  rtdb->print();
124 
125  // ------------------------------------------------------------------------
126 
127  // ----- Finish -------------------------------------------------------
128 
129  timer.Stop();
130  Double_t rtime = timer.RealTime();
131  Double_t ctime = timer.CpuTime();
132  cout << endl << endl;
133  cout << "Macro finished succesfully." << endl;
134  cout << "Output file is " << outFile << endl;
135  cout << "Parameter file is " << parFile << endl;
136  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
137  cout << endl;
138  // ------------------------------------------------------------------------
139 
140 
141 }
TString sysFile
FairParAsciiFileIo * parIo1
PndSttFindTracks * sttFindTracks
void SetBranchNames(TString mvdpixel, TString mvdstrip, TString stt, TString gem)
void SetIdealHyp(Bool_t opt=kTRUE)
TString outFile
void SetMvdBranchName(const TString &name)
PndSttMvdTracking * SttMvdTracking
PndMCTrackAssociator * trackMC
TString parFile
TStopwatch timer
FairParRootFileIo * parInput1
FairRunAna * fRun
void SetCentralTrackerBranchName(const TString &name)
void SetTrackOutBranchName(const TString &name)
TString inDigiFile
FairRuntimeDb * rtdb
PndSttTrackFinderReal * sttTrackFinder
PndMvdRiemannTrackFinderTask * mvdTrackFinder
FairGeane * Geane
Double_t
TString allDigiFile
static void Init(Int_t MapVersion)
Double_t rtime
PndSttMvdGemTracking * SttMvdGemTracking
Int_t nEvents
PndRecoKalmanTask * recoKalman
void SetBusyCut(Int_t b)
void SetInputBkgFilesName(char *string1)
void SetTrackInBranchName(const TString &name)
Int_t iVerbose
TString inSimFile
PndMixBackgroundEvents * mix
void AddHitCollectionName(char *hitCollectionName, char *pointCollectionName)
Double_t ctime