FairRoot/PandaRoot
npipi/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 
97  recoKalman->SetTrackInBranchName("SttMvdGemTrack");
98  recoKalman->SetTrackOutBranchName("SttMvdGemGenTrack");
99  recoKalman->SetBusyCut(50); // CHECK to be tuned
100  recoKalman->SetMvdBranchName("Mix");
101  recoKalman->SetCentralTrackerBranchName("Mix");
102  //recoKalman->SetNumIterations(3);
103  fRun->AddTask(recoKalman);
104 
105  PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
106  trackMC->SetTrackInBranchName("SttMvdGemGenTrack");
107  trackMC->SetTrackOutBranchName("SttMvdGemGenTrackID");
108  fRun->AddTask(trackMC);
109 
110  // ----- Intialise and run --------------------------------------------
112  fRun->Init();
113  fRun->Run(0, nEvents);
114 
115  rtdb->saveOutput();
116  rtdb->print();
117 
118  // ------------------------------------------------------------------------
119 
120  // ----- Finish -------------------------------------------------------
121 
122  timer.Stop();
123  Double_t rtime = timer.RealTime();
124  Double_t ctime = timer.CpuTime();
125  cout << endl << endl;
126  cout << "Macro finished succesfully." << endl;
127  cout << "Output file is " << outFile << endl;
128  cout << "Parameter file is " << parFile << endl;
129  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
130  cout << endl;
131  // ------------------------------------------------------------------------
132 
133 
134 }
PndMvdRiemannTrackFinderTask * mvdTrackFinder
void SetBranchNames(TString mvdpixel, TString mvdstrip, TString stt, TString gem)
TString outFile
Definition: hit_dirc.C:17
void SetMvdBranchName(const TString &name)
void SetCentralTrackerBranchName(const TString &name)
TString allDigiFile
Definition: hit_muo.C:36
PndSttTrackFinderReal * sttTrackFinder
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
PndSttMvdTracking * SttMvdTracking
PndSttFindTracks * sttFindTracks
static void Init(Int_t MapVersion)
PndMixBackgroundEvents * mix
Definition: runrecoMix.C:67
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
TString inDigiFile
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
PndMCTrackAssociator * trackMC
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
void SetBusyCut(Int_t b)
void SetInputBkgFilesName(char *string1)
void SetTrackInBranchName(const TString &name)
PndSttMvdGemTracking * SttMvdGemTracking
Int_t iVerbose
PndRecoKalmanTask * recoKalman
Double_t rtime
Definition: hit_dirc.C:113
void AddHitCollectionName(char *hitCollectionName, char *pointCollectionName)