]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/RichMenu.C
Replacing array of objects by array of pointers
[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();" ,"????");
c23b3bc0 106 pMenu->AddButton("Print occupancy" ,"r->OccupancyPrint();" ,"????");
8da90624 107 pMenu->AddButton("Event Summary " ,"r->SummaryOfEvent();" ,"????");
f770edb5 108 pMenu->AddButton("Hits plots" ,"r->ControlPlots()" ,"????");
0fe8fa07 109 pMenu->AddButton("Recon with stack" ,"r->CheckPR()" , "Create RSR.root with ntuple hn");
8493d0aa 110 pMenu->Show();
111}//TestMenu()
112//__________________________________________________________________________________________________
473cb33a 113void RichMenu()
8493d0aa 114{
115 TControlBar *pMenu = new TControlBar("vertical","MAIN");
473cb33a 116
8493d0aa 117 if(AliceRead()){//it's from file, show some info
118 if(r) pMenu->AddButton("RICH submenu" , "MenuRich()" , "Show RICH submenu" );
473cb33a 119 }else{//it's aliroot, simulate
120 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
8493d0aa 121 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
122 pMenu->AddButton("Run", "a()->Run(1)", "Process!");
473cb33a 123 }
8493d0aa 124 pMenu->AddButton("Test segmentation" ,"rp->TestSeg()" ,"Test AliRICHParam segmentation methods" );
125 pMenu->AddButton("Test response" ,"rp->TestResp()" ,"Test AliRICHParam response methods" );
126 pMenu->AddButton("Test transformation","rp->TestTrans()","Test AliRICHParam transformation methods" );
127 pMenu->AddButton("Test opticals" ,".x Opticals.h" ,"Test optical properties" );
128 pMenu->AddButton("Geo GUI" ,"GeomGui()" ,"Shows geometry" );
129 pMenu->AddButton("Browser" ,"new TBrowser;" ,"Start ROOT TBrowser" );
130 pMenu->AddButton("Quit" ,".q" ,"Close session" );
473cb33a 131 pMenu->Show();
132}//menu()
133//__________________________________________________________________________________________________
134void DebugOFF(){ Info("DebugOFF",""); AliLog::SetGlobalDebugLevel(0);}
135void DebugON() { Info("DebugON",""); AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
473cb33a 136//__________________________________________________________________________________________________
137void GeomGui()
138{
139 if(gGeoManager){
140 gGeoManager->GetTopVolume()->Draw();
8493d0aa 141 AliRICHParam::DrawAxis();
473cb33a 142 }else
143 new G3GeometryGUI;
144}
d3eb6079 145
8493d0aa 146AliRun *a() {return al->GetAliRun();} //provides pointer to main AliRun object (aka gAlice)
147AliRICH *r() {return (AliRICH*) a()->GetDetector("RICH");} //provides pointer to RICH detector
148AliLoader *rl(){return al->GetLoader("RICHLoader");}
d3eb6079 149
0fe8fa07 150void rt(Int_t event=0) {r->PrintTracks (event);} //utility print tracks
151Int_t nem(Int_t event=0) {AliRICH::Nparticles(kElectron ,event,al);} //utility number of electrons
152Int_t nep(Int_t event=0) {AliRICH::Nparticles(kPositron ,event,al);} //utility number of positrons
153Int_t nmup(Int_t event=0) {AliRICH::Nparticles(kMuonPlus ,event,al);} //utility number of positive muons
154Int_t nmum(Int_t event=0) {AliRICH::Nparticles(kMuonMinus ,event,al);} //utility number of negative muons
155Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0 ,event,al);} //utility number of neutral pions
156Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus ,event,al);} //utility number of positive pions
157Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus ,event,al);} //utility number of negative pions
158Int_t nk0(Int_t event=0) {AliRICH::Nparticles(kK0 ,event,al);} //utility number of neutral kaons
159Int_t nkp(Int_t event=0) {AliRICH::Nparticles(kKPlus ,event,al);} //utility number of positive kaons
160Int_t nkm(Int_t event=0) {AliRICH::Nparticles(kKMinus ,event,al);} //utility number of negative kaons
161Int_t npp(Int_t event=0) {AliRICH::Nparticles(kProton ,event,al);} //utility number of protons
162Int_t npm(Int_t event=0) {AliRICH::Nparticles(kProtonBar ,event,al);} //utility number of antiprotons