]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RichMenu.C
Introduction of the TPC ALTRO mapping files.
[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;
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->Show();  
101 }//TestMenu()
102 //__________________________________________________________________________________________________
103 void RichMenu()
104 {   
105   TControlBar *pMenu = new TControlBar("vertical","MAIN");
106        
107   if(AliceRead()){//it's from file, show some info
108     pMenu->AddButton("Display single chambers"         ,"r->Display();"  , "Display Fast");
109     pMenu->AddButton("Display ALL chambers"            ,"r->DisplayEvent(0,0);"  , "Display Fast");
110     pMenu->AddButton("Hits QA"                         ,"hqa()"    ,"QA plots for hits: hqa()");
111     pMenu->AddButton("Recon with stack"                ,"AliRICHReconstructor::CheckPR(        )","Create RSR.root with ntuple hn");    
112     pMenu->AddButton("RichAna no Recon"                ,"AliRICHReconstructor::RichAna(0,0,kFALSE)","Create RichAna.root with ntuple hn without PatRec");    
113     pMenu->AddButton("RichAna with Recon"              ,"AliRICHReconstructor::RichAna(0,0,kTRUE )","Create RichAna.root with ntuple hn with PatRec");    
114     pMenu->AddButton("Print hits"                      ,"h();"      ,"To print hits: h()");
115     pMenu->AddButton("Print sdigits"                   ,"s();"      ,"To print sdigits: s()");
116     pMenu->AddButton("Print digits"                    ,"d();"      ,"To print digits: d()");
117     pMenu->AddButton("Print clusters"                  ,"c();"      ,"To print clusters: c()");  
118     pMenu->AddButton("Print occupancy"                 ,"r->OccupancyPrint(-1);" ,"To print occupancy");  
119     pMenu->AddButton("Print event summary  "           ,"r->SummaryOfEvent();"   ,"To print a summary of the event");  
120   }else{//it's aliroot, simulate
121     pMenu->AddButton("Debug ON",     "DebugON();",   "Switch debug on-off");   
122     pMenu->AddButton("Debug OFF",    "DebugOFF();",  "Switch debug on-off");   
123     pMenu->AddButton("Run",          "a()->Run(1)",  "Process!");
124   }
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("Optics"             ,"opt()"                                                           ,"Shows optical properties");
129   pMenu->AddButton("Geo GUI"            ,"geo();"                                                          ,"Shows geometry"                             ); 
130   pMenu->AddButton("Debug ON"           ,"AliLog::SetGlobalDebugLevel(AliLog::kDebug);"                    ,"Switch debug on"                            );   
131   pMenu->AddButton("Debug OFF"          ,"AliLog::SetGlobalDebugLevel(0);"                                 ,"Switch debug off"                           );   
132   pMenu->AddButton("Browser"            ,"new TBrowser;"                                                   ,"Start ROOT TBrowser"                        );
133   pMenu->AddButton("Quit"               ,".q"                                                              ,"Close session"                              );
134   pMenu->Show();
135 }//menu()
136 //__________________________________________________________________________________________________
137 void DebugOFF(){  Info("DebugOFF","");  AliLog::SetGlobalDebugLevel(0);}
138 void DebugON() {  Info("DebugON","");   AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
139 //__________________________________________________________________________________________________
140 void GeomGui()
141 {
142   if(gGeoManager){ 
143     gGeoManager->GetTopVolume()->Draw(); 
144     AliRICHParam::DrawAxis();
145   }else 
146     new G3GeometryGUI;
147 }  
148
149 AliRun    *a() {return al->GetAliRun();}                         //provides pointer to main AliRun object (aka gAlice)
150 AliRICH   *r() {return (AliRICH*)  a()->GetDetector("RICH");}    //provides pointer to RICH detector
151 AliLoader *rl(){return             al->GetLoader("RICHLoader");}
152
153
154 void geo (            )   { gGeoManager->SetVisOption(0);gGeoManager->GetTopVolume()->Draw(); AliRICHParam::DrawAxis();}
155 void opt (            )   { AliRICHParam::Materials();        }   //draw optical properties  
156 void dis (Int_t evt=-1)   {r->Display      (evt);}                //utility display 
157 void dum (            )   {r->Dump         (   );}                //utility display 
158
159 void h   (Int_t evt=0 )   {r->HitsPrint    (evt);}   //print hits for requested event
160 void s   (Int_t evt=0 )   {r->SDigitsPrint (evt);}   //print sdigits for requested event
161 void d   (Int_t evt=0 )   {r->DigitsPrint  (evt);}   //print digits for requested event
162 void c   (Int_t evt=0 )   {r->ClustersPrint(evt);}   //print clusters for requested event
163
164 void hqa (            )   {r->HitsQA       (   );}   //hits QA plots for all events 
165 void dqa (            )   {r->DigitsQA     (   );}   //digits QA plots for all events
166 void cqa (            )   {r->ClustersQA   (   );}   //clusters QA plots for all events
167
168
169 Int_t t   (Int_t pid,Int_t evt=0)   {return (AliRICH*)v())->TrackPrint(pid,evt);}   //print track
170
171 void rt(Int_t event=0)    {r->PrintTracks  (event);}                                                       //utility print tracks
172 Int_t nem(Int_t event=0)  {AliRICH::Nparticles(kElectron  ,event,al);} //utility number of electrons
173 Int_t nep(Int_t event=0)  {AliRICH::Nparticles(kPositron  ,event,al);} //utility number of positrons
174 Int_t nmup(Int_t event=0) {AliRICH::Nparticles(kMuonPlus  ,event,al);} //utility number of positive muons
175 Int_t nmum(Int_t event=0) {AliRICH::Nparticles(kMuonMinus ,event,al);} //utility number of negative muons
176 Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0       ,event,al);} //utility number of neutral pions 
177 Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus    ,event,al);} //utility number of positive pions
178 Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus   ,event,al);} //utility number of negative pions
179 Int_t nk0(Int_t event=0)  {AliRICH::Nparticles(kK0        ,event,al);} //utility number of neutral kaons
180 Int_t nkp(Int_t event=0)  {AliRICH::Nparticles(kKPlus     ,event,al);} //utility number of positive kaons
181 Int_t nkm(Int_t event=0)  {AliRICH::Nparticles(kKMinus    ,event,al);} //utility number of negative kaons
182 Int_t npp(Int_t event=0)  {AliRICH::Nparticles(kProton    ,event,al);} //utility number of protons
183 Int_t npm(Int_t event=0)  {AliRICH::Nparticles(kProtonBar ,event,al);} //utility number of antiprotons