FairRoot/PandaRoot
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("STTHit", "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->SetPersistence(kFALSE);
82  fRun->AddTask(SttMvdTracking);
83 
84  PndMCTrackAssociator* trackMC0 = new PndMCTrackAssociator();
85  trackMC0->SetTrackInBranchName("SttMvdTrack");
86  trackMC0->SetTrackOutBranchName("SttMvdTrackID");
87  trackMC0->SetPersistence(kFALSE);
88  fRun->AddTask(trackMC0);
89 
91  SttMvdGemTracking->SetPdgFromMC();
92  fRun->AddTask(SttMvdGemTracking);
93 
95  recoKalman->SetTrackInBranchName("SttMvdGemTrack");
96  recoKalman->SetTrackOutBranchName("SttMvdGemGenTrack");
97  recoKalman->SetBusyCut(50); // CHECK to be tuned
98  recoKalman->SetMvdBranchName("Mix");
99  recoKalman->SetCentralTrackerBranchName("Mix");
100  //recoKalman->SetNumIterations(3);
101  fRun->AddTask(recoKalman);
102 
103  PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
104  trackMC->SetTrackInBranchName("SttMvdGemGenTrack");
105  trackMC->SetTrackOutBranchName("SttMvdGemGenTrackID");
106  fRun->AddTask(trackMC);
107 
108  // ----- Intialise and run --------------------------------------------
110  fRun->Init();
111  fRun->Run(0, nEvents);
112 
113  rtdb->saveOutput();
114  rtdb->print();
115 
116  // ------------------------------------------------------------------------
117 
118  // ----- Finish -------------------------------------------------------
119 
120  timer.Stop();
121  Double_t rtime = timer.RealTime();
122  Double_t ctime = timer.CpuTime();
123  cout << endl << endl;
124  cout << "Macro finished succesfully." << endl;
125  cout << "Output file is " << outFile << endl;
126  cout << "Parameter file is " << parFile << endl;
127  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
128  cout << endl;
129  // ------------------------------------------------------------------------
130 
131 
132 }
PndSttFindTracks * sttFindTracks
FairRunAna * fRun
TString inDigiFile
PndSttMvdGemTracking * SttMvdGemTracking
void SetPersistence(Bool_t persistence)
PndMCTrackAssociator * trackMC
TString parFile
FairGeane * Geane
TString sysFile
FairParRootFileIo * parInput1
void SetMvdBranchName(const TString &name)
PndMixBackgroundEvents * mix
FairParAsciiFileIo * parIo1
void SetCentralTrackerBranchName(const TString &name)
PndRecoKalmanTask * recoKalman
void SetTrackOutBranchName(const TString &name)
FairRuntimeDb * rtdb
Double_t ctime
TString outFile
Double_t
TString inSimFile
static void Init(Int_t MapVersion)
Int_t nEvents
TString allDigiFile
void SetBusyCut(Int_t b)
void SetInputBkgFilesName(char *string1)
void SetTrackInBranchName(const TString &name)
PndSttMvdTracking * SttMvdTracking
Int_t iVerbose
Double_t rtime
PndMvdRiemannTrackFinderTask * mvdTrackFinder
PndSttTrackFinderReal * sttTrackFinder
void AddHitCollectionName(char *hitCollectionName, char *pointCollectionName)
TStopwatch timer
PndMCTrackAssociator * trackMC0