FairRoot/PandaRoot
runOnline.C
Go to the documentation of this file.
1 
2 int runOnline() {
3  gROOT->Reset();
4  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
5  Int_t iVerbose = 0;
6 
7  enum DetectorId {
9 
10 
11  TStopwatch timer;
12  timer.Start();
13  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
14  rootlogon();
15 
16 
17  TString simFileName = "Sim_Dpm_500.root";
18  TString parFileName = "Sim_Dpm_500_params.root";
19  TString digiFileName = "Sim_Dpm_500_digi.root";
20  TString recoFileName = "Sim_Dpm_500_reco.root";
21  TString outFileName = "Sim_Dpm_500_streamdisplay.root";
22 
23  TFile filedigi(digiFileName.Data());
24  TFile filereco(recoFileName.Data());
25  TFile filerecopixel(recoFileName.Data());
26 
27  TTree *treedigi = (TTree*) filedigi.Get("pndsim");
28  //TClonesArray *sttsortedhits = new TClonesArray("PndSttHit");
29  //treedigi->SetBranchAddress("STTSortedHits",&sttsortedhits);
30 
31  TTree *recotree = (TTree*) filereco.Get("pndsim");
32  //TClonesArray *mvdstripreco = new TClonesArray("PndSdsHit");
33  //recotree->SetBranchAddress("MVDHitsStrip",&mvdstripreco);
34  //TClonesArray *mvdpixelreco = new TClonesArray("PndSdsHit");
35  //recotree->SetBranchAddress("MVDHitsPixel",&mvdpixelreco);
36 
37 
38  FairRunAna *fRun = new FairRunAna();
39  fRun->SetInputFile(simFileName.Data());
40  //fRun->AddFriend(recoFile.Data());
41  fRun->AddFriend(digiFileName.Data());
42  fRun->SetOutputFile(outFileName.Data());
43 
44  //FairRuntimeDb *rtdb = LoadRuntimeDB(parFileName, fRun);
45  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
46  FairParRootFileIo* parInput1 = new FairParRootFileIo();
47  parInput1->open(parFileName.Data());
48  rtdb->setFirstInput(parInput1);
49 
50 
51  // load geometry parameters
52  //PndGeoSttPar* fSttParameters = (PndGeoSttPar*) rtdb->getContainer("PndGeoSttPar");
53  //PndSttMapCreator* mapper = new PndSttMapCreator(fSttParameters);
54  //TClonesArray* tubearray = mapper->FillTubeArray();
55 
56 
60  PndSttFindTracks* sttFindTracks = new PndSttFindTracks("Track Finder", "FairTask", sttTrackFinder, iVerbose);
61  sttFindTracks->AddHitCollectionName("STTHit", "STTPoint");
62  //sttFindTracks->SetPersistence(kFALSE);
63  fRun->AddTask(sttFindTracks);
64  fRun->Init();
66 
67 
68  PndOnlineHitProducer *online_hit_producer = new PndOnlineHitProducer();
69  online_hit_producer->LoadStream(kSTT, "STTSortedHits");
70  online_hit_producer->LoadStream(kMVD, "MVDHitsStrip");
71  online_hit_producer->LoadStream(kMVD, "MVDHitsPixel");
72  //online_hit_producer->LoadHits(kSTT);
73 
74 
75 
76  PndOnlineManager *online = new PndOnlineManager();
77  online->AddHitProducer(online_hit_producer);
78  online->SetRuntimeDB(rtdb);
79  online->LoadSTTGeom();
80  //online->SetActiveDetector(kMVD); // WHY DOESNT THIS WORK??
81 
82  TClonesArray* tubearray = online->GetSTTGeom();
83 
84  // load task
85  PndOnlineSttTripletFinder *triplet_finder = new PndOnlineSttTripletFinder(online, tubearray);
86  //triplet_finder->Init();
87  online->AddTask((FairTask*)triplet_finder);
88 
89 
90  // do 1 go around of the event loop!
91  //online->LoadHits( PndOnlineManager::kHESRRevolution );
92  online->LoadHits( 200 );
93  online->Process();
94  //online->Clear();
95 
96 
97  // now print out the triplets
98  //online->PrintTracks();
99  TObjArray *tracks = online->GetTrackObjectList();
100  for(int i=0; i<tracks->GetEntriesFast(); ++i) {
101  PndOnlineTrack *trk_ptr = (PndOnlineTrack *)(tracks->At(i));
102  cout << " triplet cms; "; trk_ptr->Vertex().Print();
103  }
104 
105 
106 
107  // ----- Finish -------------------------------------------------------
108  timer.Stop();
109  Double_t rtime = timer.RealTime();
110  Double_t ctime = timer.CpuTime();
111  cout << endl << endl;
112  cout << "Macro finished succesfully." << endl;
113  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
114  cout << endl;
115  // ------------------------------------------------------------------------
116 
117 
118  return 0;
119 }
TFile filereco("MvdStt_Test_reco.root")
Int_t i
Definition: run_full.C:25
int runOnline()
Definition: runOnline.C:2
PndSttTrackFinderReal * sttTrackFinder
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
TTree * treedigi
TStopwatch timer
Definition: hit_dirc.C:51
TFile filedigi("testdigi.root")
PndSttFindTracks * sttFindTracks
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
Int_t iVerbose
Double_t rtime
Definition: hit_dirc.C:113
void AddHitCollectionName(char *hitCollectionName, char *pointCollectionName)