Possibility to run standalone PatRec without run again ESD and creation of ntuples...
[u/mrichter/AliRoot.git] / RICH / RichMenu.C
CommitLineData
ef210ba6 1#if !defined( __CINT__) || defined(__MAKECINT__)
2#include <AliRun.h>
3#include <AliStack.h>
4#include <AliLoader.h>
5#include <AliRunLoader.h>
6
7#include "AliRICH.h"
8#include "AliRICHDisplFast.h"
9#endif
10
473cb33a 11//globals for easy manual manipulations
8493d0aa 12AliRun *a; AliStack *s; AliRunLoader *al;
101624cd 13AliRICH *r; AliLoader *rl,*vl;
8493d0aa 14
473cb33a 15
473cb33a 16//__________________________________________________________________________________________________
17void pp(int tid)
18{
19 if(!al) return;
20 al->LoadHeader(); al->LoadKinematics();
21
22 if(tid<0||tid>=al->Stack()->GetNtrack())
23 cout<<"Valid tid number is 0-"<<al->Stack()->GetNtrack()-1<<" for this event.\n";
24 else
25 PrintParticleInfo(tid);
26
27 al->UnloadKinematics(); al->UnloadHeader();
28}
29//__________________________________________________________________________________________________
30void PrintParticleInfo(int tid)
31{
32// Prints particle info for a given TID
33 TParticle *p=al->Stack()->Particle(tid);
34 cout<<p->GetName()<<"("<<tid<<")";
8493d0aa 35 if(!p->IsPrimary()){cout<<" from "; PrintParticleInfo(p->GetFirstMother());}
473cb33a 36 else {cout<<endl;}
37}
38//__________________________________________________________________________________________________
8493d0aa 39Int_t mother(Int_t tid)
473cb33a 40{
ef210ba6 41// Who is the mother of given track TID?
473cb33a 42 al->LoadHeader(); al->LoadKinematics();
43
44 if(tid<0||tid>=al->Stack()->GetNtrack())
45 cout<<"Valid tid number is 0-"<<al->Stack()->GetNtrack()-1<<" for this event.\n";
46 else
47 while(1){
48 TParticle *p=al->Stack()->Particle(tid);
8493d0aa 49 if(p->IsPrimary()) break;
50 tid=p->GetFirstMother();
473cb33a 51 }
52
53 al->UnloadKinematics(); al->UnloadHeader();
54 return tid;
55}
473cb33a 56//__________________________________________________________________________________________________
57
8493d0aa 58Bool_t AliceRead()
473cb33a 59{
8493d0aa 60 Info("ReadAlice","Tring to read ALICE from SIMULATED FILE...");
473cb33a 61 if(gAlice){
62 delete gAlice->GetRunLoader();
63 delete gAlice;
64 }
8493d0aa 65
66 if(gSystem->Exec("ls galice.root>/dev/null")==256){//there is no galice.root in current directory
67 AliceNew();
68 RichGet();
69 return kFALSE; //new session
70 }else{
71 if(!(al=AliRunLoader::Open())){//if not possible to read from galice.root, then remove grabage and reinvoke AliceRead()
72 gSystem->Exec("rm -rf *.root *.dat");
73 AliceRead();
74 }
75 al->LoadgAlice();//before this gAlice is 0;
76 if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
77 a=al->GetAliRun();//provides pointer to AliRun object
78 Info("AliceRead","Run contains %i event(s)",a->GetEventsPerRun());
79 RichGet();
80 return kTRUE; //old session opened from file
81 }
82}//AliceRead()
83//__________________________________________________________________________________________________
84void AliceNew()
85{
86 Info("AliceNew","Init new session");
87 new AliRun("gAlice","Alice experiment system"); gAlice->Init(); a=gAlice; al=gAlice->GetRunLoader();
88}//AliceNew()
89//__________________________________________________________________________________________________
90void RichGet()
91{
92 if(!(r=r())) Warning("RICH/menu.C::ReadAlice","No RICH in file");
93 if(!(rl=rl())) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
473cb33a 94}
8493d0aa 95
473cb33a 96//__________________________________________________________________________________________________
8493d0aa 97void MenuRich()
98{
99 TControlBar *pMenu = new TControlBar("vertical","RICH");
d0831219 100 pMenu->AddButton("Display single chambers" ,"r->Display();" , "Display Fast");
101 pMenu->AddButton("Display ALL chambers" ,"r->DisplayEvent(0,0);" , "Display Fast");
102 pMenu->AddButton("Print hits" ,"r->HitsPrint();" ,"????");
103 pMenu->AddButton("Print sdigits" ,"r->SDigitsPrint();" ,"????");
104 pMenu->AddButton("Print digits" ,"r->DigitsPrint();" ,"????");
105 pMenu->AddButton("Print clusters" ,"r->ClustersPrint();" ,"????");
d3b83c55 106 pMenu->AddButton("Print occupancy" ,"r->OccupancyPrint(-1);" ,"????");
8da90624 107 pMenu->AddButton("Event Summary " ,"r->SummaryOfEvent();" ,"????");
f770edb5 108 pMenu->AddButton("Hits plots" ,"r->ControlPlots()" ,"????");
910735ae 109 pMenu->AddButton("Recon with stack" ,"r->CheckPR()", "Create RSR.root with ntuple hn");
110 pMenu->AddButton("RichAna" ,"r->RichAna()", "Create RichAna.root with ntuple hn");
8493d0aa 111 pMenu->Show();
112}//TestMenu()
113//__________________________________________________________________________________________________
473cb33a 114void RichMenu()
8493d0aa 115{
116 TControlBar *pMenu = new TControlBar("vertical","MAIN");
473cb33a 117
8493d0aa 118 if(AliceRead()){//it's from file, show some info
119 if(r) pMenu->AddButton("RICH submenu" , "MenuRich()" , "Show RICH submenu" );
473cb33a 120 }else{//it's aliroot, simulate
121 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
8493d0aa 122 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
123 pMenu->AddButton("Run", "a()->Run(1)", "Process!");
473cb33a 124 }
8493d0aa 125 pMenu->AddButton("Test segmentation" ,"rp->TestSeg()" ,"Test AliRICHParam segmentation methods" );
126 pMenu->AddButton("Test response" ,"rp->TestResp()" ,"Test AliRICHParam response methods" );
127 pMenu->AddButton("Test transformation","rp->TestTrans()","Test AliRICHParam transformation methods" );
128 pMenu->AddButton("Test opticals" ,".x Opticals.h" ,"Test optical properties" );
129 pMenu->AddButton("Geo GUI" ,"GeomGui()" ,"Shows geometry" );
130 pMenu->AddButton("Browser" ,"new TBrowser;" ,"Start ROOT TBrowser" );
131 pMenu->AddButton("Quit" ,".q" ,"Close session" );
473cb33a 132 pMenu->Show();
133}//menu()
134//__________________________________________________________________________________________________
135void DebugOFF(){ Info("DebugOFF",""); AliLog::SetGlobalDebugLevel(0);}
136void DebugON() { Info("DebugON",""); AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
137//__________________________________________________________________________________________________
473cb33a 138void GeomGui()
139{
140 if(gGeoManager){
141 gGeoManager->GetTopVolume()->Draw();
8493d0aa 142 AliRICHParam::DrawAxis();
473cb33a 143 }else
144 new G3GeometryGUI;
145}
d3eb6079 146
8493d0aa 147AliRun *a() {return al->GetAliRun();} //provides pointer to main AliRun object (aka gAlice)
148AliRICH *r() {return (AliRICH*) a()->GetDetector("RICH");} //provides pointer to RICH detector
149AliLoader *rl(){return al->GetLoader("RICHLoader");}
d3eb6079 150
0fe8fa07 151void rt(Int_t event=0) {r->PrintTracks (event);} //utility print tracks
152Int_t nem(Int_t event=0) {AliRICH::Nparticles(kElectron ,event,al);} //utility number of electrons
153Int_t nep(Int_t event=0) {AliRICH::Nparticles(kPositron ,event,al);} //utility number of positrons
154Int_t nmup(Int_t event=0) {AliRICH::Nparticles(kMuonPlus ,event,al);} //utility number of positive muons
155Int_t nmum(Int_t event=0) {AliRICH::Nparticles(kMuonMinus ,event,al);} //utility number of negative muons
156Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0 ,event,al);} //utility number of neutral pions
157Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus ,event,al);} //utility number of positive pions
158Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus ,event,al);} //utility number of negative pions
159Int_t nk0(Int_t event=0) {AliRICH::Nparticles(kK0 ,event,al);} //utility number of neutral kaons
160Int_t nkp(Int_t event=0) {AliRICH::Nparticles(kKPlus ,event,al);} //utility number of positive kaons
161Int_t nkm(Int_t event=0) {AliRICH::Nparticles(kKMinus ,event,al);} //utility number of negative kaons
162Int_t npp(Int_t event=0) {AliRICH::Nparticles(kProton ,event,al);} //utility number of protons
163Int_t npm(Int_t event=0) {AliRICH::Nparticles(kProtonBar ,event,al);} //utility number of antiprotons