]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RichMenu.C
f01946ce29b4d4fb309ea95406ac344562aaaef1
[u/mrichter/AliRoot.git] / RICH / RichMenu.C
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
11 //globals for easy manual manipulations
12 AliRun *a;    AliStack *s;  AliRunLoader *al; 
13 AliRICH   *r; AliLoader    *rl,*vl;
14
15
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<<")";
35   if(!p->IsPrimary()){cout<<" from "; PrintParticleInfo(p->GetFirstMother());}
36   else                   {cout<<endl;} 
37 }    
38 //__________________________________________________________________________________________________
39 Int_t mother(Int_t tid)
40 {
41 // Who is the mother of given track TID?
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);
49       if(p->IsPrimary()) break;
50       tid=p->GetFirstMother();
51     }
52   
53   al->UnloadKinematics();  al->UnloadHeader();
54   return tid;
55 }
56 //__________________________________________________________________________________________________
57
58 Bool_t AliceRead()
59 {
60   Info("ReadAlice","Tring to read ALICE from SIMULATED FILE...");
61   if(gAlice){
62     delete gAlice->GetRunLoader();
63     delete gAlice;
64   }      
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");        
94 }
95
96 //__________________________________________________________________________________________________
97 void MenuRich()
98 {
99   TControlBar *pMenu = new TControlBar("vertical","RICH");
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();"  ,"????");  
106   pMenu->AddButton("Print occupancy"  ,"r->OccupancyPrint(-1);" ,"????");  
107   pMenu->AddButton("Event Summary  "  ,"r->SummaryOfEvent();" ,"????");  
108   pMenu->AddButton("Hits plots"       ,"r->ControlPlots()"    ,"????");
109   pMenu->AddButton("Recon with stack" ,"r->CheckPR()"                                           , "Create RSR.root with ntuple hn");    
110   pMenu->Show();  
111 }//TestMenu()
112 //__________________________________________________________________________________________________
113 void RichMenu()
114 {   
115   TControlBar *pMenu = new TControlBar("vertical","MAIN");
116        
117   if(AliceRead()){//it's from file, show some info
118     if(r) pMenu->AddButton("RICH submenu"    , "MenuRich()"               , "Show RICH submenu"       );
119   }else{//it's aliroot, simulate
120     pMenu->AddButton("Debug ON",     "DebugON();",   "Switch debug on-off");   
121     pMenu->AddButton("Debug OFF",    "DebugOFF();",  "Switch debug on-off");   
122     pMenu->AddButton("Run",          "a()->Run(1)",  "Process!");
123   }
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"                              );
131   pMenu->Show();
132 }//menu()
133 //__________________________________________________________________________________________________
134 void DebugOFF(){  Info("DebugOFF","");  AliLog::SetGlobalDebugLevel(0);}
135 void DebugON() {  Info("DebugON","");   AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
136 //__________________________________________________________________________________________________
137 void GeomGui()
138 {
139   if(gGeoManager){ 
140     gGeoManager->GetTopVolume()->Draw(); 
141     AliRICHParam::DrawAxis();
142   }else 
143     new G3GeometryGUI;
144 }  
145
146 AliRun    *a() {return al->GetAliRun();}                         //provides pointer to main AliRun object (aka gAlice)
147 AliRICH   *r() {return (AliRICH*)  a()->GetDetector("RICH");}    //provides pointer to RICH detector
148 AliLoader *rl(){return             al->GetLoader("RICHLoader");}
149
150 void rt(Int_t event=0)    {r->PrintTracks  (event);}                                                       //utility print tracks
151 Int_t nem(Int_t event=0)  {AliRICH::Nparticles(kElectron  ,event,al);} //utility number of electrons
152 Int_t nep(Int_t event=0)  {AliRICH::Nparticles(kPositron  ,event,al);} //utility number of positrons
153 Int_t nmup(Int_t event=0) {AliRICH::Nparticles(kMuonPlus  ,event,al);} //utility number of positive muons
154 Int_t nmum(Int_t event=0) {AliRICH::Nparticles(kMuonMinus ,event,al);} //utility number of negative muons
155 Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0       ,event,al);} //utility number of neutral pions 
156 Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus    ,event,al);} //utility number of positive pions
157 Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus   ,event,al);} //utility number of negative pions
158 Int_t nk0(Int_t event=0)  {AliRICH::Nparticles(kK0        ,event,al);} //utility number of neutral kaons
159 Int_t nkp(Int_t event=0)  {AliRICH::Nparticles(kKPlus     ,event,al);} //utility number of positive kaons
160 Int_t nkm(Int_t event=0)  {AliRICH::Nparticles(kKMinus    ,event,al);} //utility number of negative kaons
161 Int_t npp(Int_t event=0)  {AliRICH::Nparticles(kProton    ,event,al);} //utility number of protons
162 Int_t npm(Int_t event=0)  {AliRICH::Nparticles(kProtonBar ,event,al);} //utility number of antiprotons