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