+#if !defined( __CINT__) || defined(__MAKECINT__)
+#include <AliRun.h>
+#include <AliStack.h>
+#include <AliLoader.h>
+#include <AliRunLoader.h>
+
+#include "AliRICH.h"
+#include "AliRICHDisplFast.h"
+#endif
+
//globals for easy manual manipulations
-AliRun *a;
-AliRunLoader *al;
-AliLoader *rl;
-AliRICH *r;
-AliStack *s;
+AliRun *a; AliStack *s; AliRunLoader *al;
+AliRICH *r; AliLoader *rl;
+
-void ph(Int_t event=0) {r->PrintHits(event);} //utility print hits for 'event' event
-void ps(Int_t event=0) {r->PrintSDigits(event);} //utility print sdigits
-void pd(Int_t event=0) {r->PrintDigits(event);} //utility print digits
-void pc(Int_t event=0) {r->PrintClusters(event);}//utility print clusters
-void pt(Int_t event=0) {r->PrintTracks(event);} //utility print tracks
-Int_t ne(Int_t event=0) {AliRICH::Nparticles(kElectron,event,al);} //utility number of electrons
-Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0,event,al);} //utility number of electrons
-Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus,event,al);} //utility number of electrons
-Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus,event,al);} //utility number of electrons
-Int_t nk0(Int_t event=0) {AliRICH::Nparticles(kK0,event,al);} //utility number of electrons
-Int_t nkp(Int_t event=0) {AliRICH::Nparticles(kKPlus,event,al);} //utility number of electrons
-Int_t nkm(Int_t event=0) {AliRICH::Nparticles(kKMinus,event,al);} //utility number of electrons
-Int_t npp(Int_t event=0) {AliRICH::Nparticles(kProton,event,al);} //utility number of protons
//__________________________________________________________________________________________________
void pp(int tid)
{
// Prints particle info for a given TID
TParticle *p=al->Stack()->Particle(tid);
cout<<p->GetName()<<"("<<tid<<")";
- if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
+ if(!p->IsPrimary()){cout<<" from "; PrintParticleInfo(p->GetFirstMother());}
else {cout<<endl;}
}
//__________________________________________________________________________________________________
-Int_t prim(Int_t tid)
+Int_t mother(Int_t tid)
{
-// Provides mother TID for the given TID
+// Who is the mother of given track TID?
al->LoadHeader(); al->LoadKinematics();
if(tid<0||tid>=al->Stack()->GetNtrack())
else
while(1){
TParticle *p=al->Stack()->Particle(tid);
- if(p->GetMother(0)==-1) break;
- tid=p->GetMother(0);
+ if(p->IsPrimary()) break;
+ tid=p->GetFirstMother();
}
al->UnloadKinematics(); al->UnloadHeader();
return tid;
}
-
-//__________________________________________________________________________________________________
-void Show()
-{
- CreateHists();
- Info("","\n\n\n");
-//load all trees
- al->LoadHeader();
- al->LoadKinematics();
- Bool_t isHits=!rl->LoadHits();
- Bool_t isSdigits=!rl->LoadSDigits();
- Bool_t isDigits=!rl->LoadDigits();//loaders
- Bool_t isClusters=!rl->LoadRecPoints();
-
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- Int_t iNparticles=al->Stack()->GetNtrack();
- Int_t iNprims=al->Stack()->GetNprimary();
-
- Int_t iKPlusCounter=0,iKMinusCounter=0;
- for(Int_t iParticleN=0;iParticleN<iNparticles;iParticleN++){//stack loop
- TParticle *pPart=al->Stack()->Particle(iParticleN);
- switch(pPart->GetPdgCode()){
- case kKPlus: iKPlusCounter++; break;
- case kKMinus:iKMinusCounter++; break;
- }
- }//stack loop
-
- Info("Show-STA","Evt %i-> %i particles %i primaries %i K+ %i K-",
- iEventN, iNparticles, iNprims, iKPlusCounter, iKMinusCounter);
-
- Int_t iHitsCounter=0;
- Int_t iNentries=rl->TreeH()->GetEntries();
- for(Int_t iEntryN=0;iEntryN<iNentries;iEntryN++){//TreeH loop
- rl->TreeH()->GetEntry(iEntryN);//get current entry (prim)
-
- for(Int_t iHitN=0;iHitN<r->Hits()->GetEntries();iHitN++){//hits loop
- iHitsCounter++;
- AliRICHhit *pHit = (AliRICHhit*)r->Hits()->At(iHitN);//get current hit
- TParticle *pPart=al->Stack()->Particle(pHit->GetTrack());//get stack particle which produced the current hit
- FillContribs(pPart->GetPdgCode(),pHit->C(),kFALSE);
- }//hits loop
-
- if(iEntryN<7) Info("Show","Evt %i-> prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
- iEventN,iEntryN, r->Hits()->GetEntries(), pPart->GetName(), pPart->Theta()*TMath::RadToDeg(),pPart->Phi()*TMath::RadToDeg());
- }//TreeH loop
- Info("Show-HIT","Evt %i-> %i particles %i primaries %i entries in TreeH %i hits",
- iEventN, iNparticles, iNprims, iNentries, iHitsCounter);
-
- if(isSdigits){
- rl->TreeS()->GetEntry(0);
- Info("Show-SDI","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
- }
- if(isDigits){
- rl->TreeD()->GetEntry(0);
- for(int i=1;i<=7;i++)
- Info("Show-DIG","Evt %i chamber %i contains %5i digits",
- iEventN, i, r->Digits(i)->GetEntries());
- }else
- Info("Show-DIG","There is no digits for this event");
- if(isClusters){
- rl->TreeR()->GetEntry(0);
- for(int i=1;i<=7;i++)
- Info("Show-CLU","Evt %i chamber %i contains %5i clusters",
- iEventN, i, r->Clusters(i)->GetEntries());
- }
- cout<<endl;
- }//events loop
-//unload all trees
- rl->UnloadHits();
- if(isSdigits) rl->UnloadSDigits();
- if(isDigits) rl->UnloadDigits();
- if(isClusters) rl->UnloadRecPoints();
- al->UnloadHeader();
- al->UnloadKinematics();
- ShowHists();
-}//void Show()
//__________________________________________________________________________________________________
-
-
-Bool_t ReadAlice()
+Bool_t AliceRead()
{
- Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
+ Info("ReadAlice","Tring to read ALICE from SIMULATED FILE...");
if(gAlice){
delete gAlice->GetRunLoader();
delete gAlice;
}
- if(!(al=AliRunLoader::Open())){//if not possible to read from galice.root, then create the new session
- gSystem->Exec("rm -rf *.root *.dat");
- Error("menu.C::ReadAlice","galice.root broken, removing all this garbage then init new one");
- new AliRun("gAlice","Alice experiment system");
- AliLog::SetModuleDebugLevel("RICH",1);
- gAlice->Init("Config.C");
- r=(AliRICH*)gAlice->GetDetector("RICH");
- a=gAlice; //for manual convinience
- return kFALSE;
- }
- al->LoadgAlice();//before this gAlice is 0;
- if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
- a=al->GetAliRun();//provides pointer to AliRun object
-//RICH
- if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
- if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
-
- Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
- return kTRUE;
+
+ if(gSystem->Exec("ls galice.root>/dev/null")==256){//there is no galice.root in current directory
+ AliceNew();
+ RichGet();
+ return kFALSE; //new session
+ }else{
+ if(!(al=AliRunLoader::Open())){//if not possible to read from galice.root, then remove grabage and reinvoke AliceRead()
+ gSystem->Exec("rm -rf *.root *.dat");
+ AliceRead();
+ }
+ al->LoadgAlice();//before this gAlice is 0;
+ if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
+ a=al->GetAliRun();//provides pointer to AliRun object
+ Info("AliceRead","Run contains %i event(s)",a->GetEventsPerRun());
+ RichGet();
+ return kTRUE; //old session opened from file
+ }
+}//AliceRead()
+//__________________________________________________________________________________________________
+void AliceNew()
+{
+ Info("AliceNew","Init new session");
+ new AliRun("gAlice","Alice experiment system"); gAlice->Init(); a=gAlice; al=gAlice->GetRunLoader();
+}//AliceNew()
+//__________________________________________________________________________________________________
+void RichGet()
+{
+ if(!(r=r())) Warning("RICH/menu.C::ReadAlice","No RICH in file");
+ if(!(rl=rl())) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
}
+
//__________________________________________________________________________________________________
-void TestMenu()
+void MenuRich()
{
- TControlBar *pMenu = new TControlBar("vertical","RICH test");
- pMenu->AddButton("Test segmentation" ,"rp->TestSeg()" ,"Test AliRICHParam segmentation methods");
- pMenu->AddButton("Test response" ,"rp->TestResp()" ,"Test AliRICHParam response methods");
- pMenu->AddButton("Test transformation","rp->TestTrans()","Test AliRICHParam transformation methods");
- pMenu->AddButton("Test opticals" ,".x Opticals.h" ,"Test optical properties");
+ TControlBar *pMenu = new TControlBar("vertical","RICH");
pMenu->Show();
}//TestMenu()
//__________________________________________________________________________________________________
void RichMenu()
-{
- TControlBar *pMenu = new TControlBar("vertical","RICH main");
+{
+ TControlBar *pMenu = new TControlBar("vertical","MAIN");
- if(ReadAlice()){//it's from file, show some info
- pMenu->AddButton("Show", "Show()", "Shows the structure of events in files");
- pMenu->AddButton("Display Fast", "AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();", "Display Fast");
- pMenu->AddButton("Control Plots", "ControlPlots()", "Create some control histograms");
-
+ if(AliceRead()){//it's from file, show some info
+ pMenu->AddButton("Display single chambers" ,"r->Display();" , "Display Fast");
+ pMenu->AddButton("Display ALL chambers" ,"r->DisplayEvent(0,0);" , "Display Fast");
+ pMenu->AddButton("Hits QA" ,"hqa()" ,"????");
+ pMenu->AddButton("Recon with stack" ,"AliRICHReconstructor::CheckPR( )","Create RSR.root with ntuple hn");
+ pMenu->AddButton("RichAna no Recon" ,"AliRICHReconstructor::RichAna(0,kFALSE)","Create RichAna.root with ntuple hn without PatRec");
+ pMenu->AddButton("RichAna with Recon" ,"AliRICHReconstructor::RichAna(0,kTRUE )","Create RichAna.root with ntuple hn with PatRec");
+ pMenu->AddButton("Print hits" ,"h();" ,"????");
+ pMenu->AddButton("Print sdigits" ,"s();" ,"????");
+ pMenu->AddButton("Print digits" ,"d();" ,"????");
+ pMenu->AddButton("Print clusters" ,"c();" ,"????");
+ pMenu->AddButton("Print occupancy" ,"r->OccupancyPrint(-1);" ,"????");
+ pMenu->AddButton("Print event summary " ,"r->SummaryOfEvent();" ,"????");
}else{//it's aliroot, simulate
pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
- pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
- pMenu->AddButton("Run", "a->Run(1)", "Process!");
- pMenu->AddButton("Geo GUI", "GeomGui()", "Shows geometry");
- pMenu->AddButton("Read RAW", "ReadRaw()", "Read a list of digits from test beam file");
+ pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
+ pMenu->AddButton("Run", "a()->Run(1)", "Process!");
}
- pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
- pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
- pMenu->AddButton("Quit", ".q", "Close session");
+ pMenu->AddButton("Test segmentation" ,"rp->TestSeg()" ,"Test AliRICHParam segmentation methods" );
+ pMenu->AddButton("Test response" ,"rp->TestResp()" ,"Test AliRICHParam response methods" );
+ pMenu->AddButton("Test transformation","rp->TestTrans()","Test AliRICHParam transformation methods" );
+ pMenu->AddButton("Optics" ,"opt()" ,"Shows optical properties");
+ pMenu->AddButton("Geo GUI" ,"geo();" ,"Shows geometry" );
+ pMenu->AddButton("Debug ON" ,"AliLog::SetGlobalDebugLevel(AliLog::kDebug);" ,"Switch debug on" );
+ pMenu->AddButton("Debug OFF" ,"AliLog::SetGlobalDebugLevel(0);" ,"Switch debug off" );
+ pMenu->AddButton("Browser" ,"new TBrowser;" ,"Start ROOT TBrowser" );
+ pMenu->AddButton("Quit" ,".q" ,"Close session" );
pMenu->Show();
}//menu()
//__________________________________________________________________________________________________
void DebugOFF(){ Info("DebugOFF",""); AliLog::SetGlobalDebugLevel(0);}
void DebugON() { Info("DebugON",""); AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
-//__________________________________________________________________________________________________
-TObjArray * CreateHists(Double_t pcut=0.9)
-{
- TH2F *pPosH2 =new TH2F("pos" ,"Pos mixture",5,0,5, 9,0,9); pPosH2->SetStats(0);
- TH2F *pNegH2 =new TH2F("neg" ,"Neg mixture",5,0,5, 9,0,9); pNegH2->SetStats(0);
- TH2F *pPosCutH2 =new TH2F("poscut",Form("Pos mixture with P>%4.2f GeV",pcut),5,0,5, 9,0,9); pPosCutH2->SetStats(0);
- TH2F *pNegCutH2 =new TH2F("negcut",Form("Neg mixture with P>%4.2f GeV",pcut),5,0,5, 9,0,9); pNegCutH2->SetStats(0);
- pPosH2->GetXaxis()->SetBinLabel(1,"e^{+}"); pNegH2->GetXaxis()->SetBinLabel(1,"e^{-}");
- pPosH2->GetXaxis()->SetBinLabel(2,"#mu^{+}"); pNegH2->GetXaxis()->SetBinLabel(2,"#mu^{-}");
- pPosH2->GetXaxis()->SetBinLabel(3,"#pi^{+}"); pNegH2->GetXaxis()->SetBinLabel(3,"#pi^{-}");
- pPosH2->GetXaxis()->SetBinLabel(4,"K^{+}"); pNegH2->GetXaxis()->SetBinLabel(4,"K^{-}");
- pPosH2->GetXaxis()->SetBinLabel(5,"p^{+}"); pNegH2->GetXaxis()->SetBinLabel(5,"p^{-}");
-
- pPosCutH2->GetXaxis()->SetBinLabel(1,"e^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(1,"e^{-}");
- pPosCutH2->GetXaxis()->SetBinLabel(2,"#mu^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(2,"#mu^{-}");
- pPosCutH2->GetXaxis()->SetBinLabel(3,"#pi^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(3,"#pi^{-}");
- pPosCutH2->GetXaxis()->SetBinLabel(4,"K^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(4,"K^{-}");
- pPosCutH2->GetXaxis()->SetBinLabel(5,"p^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(5,"p^{-}");
-
- pPosH2->GetYaxis()->SetBinLabel(1,"ch1"); pNegH2->GetYaxis()->SetBinLabel(1,"ch1");
- pPosH2->GetYaxis()->SetBinLabel(2,"ch2"); pNegH2->GetYaxis()->SetBinLabel(2,"ch2");
- pPosH2->GetYaxis()->SetBinLabel(3,"ch3"); pNegH2->GetYaxis()->SetBinLabel(3,"ch3");
- pPosH2->GetYaxis()->SetBinLabel(4,"ch4"); pNegH2->GetYaxis()->SetBinLabel(4,"ch4");
- pPosH2->GetYaxis()->SetBinLabel(5,"ch5"); pNegH2->GetYaxis()->SetBinLabel(5,"ch5");
- pPosH2->GetYaxis()->SetBinLabel(6,"ch6"); pNegH2->GetYaxis()->SetBinLabel(6,"ch6");
- pPosH2->GetYaxis()->SetBinLabel(7,"ch7"); pNegH2->GetYaxis()->SetBinLabel(7,"ch7");
- pPosH2->GetYaxis()->SetBinLabel(8,"prim"); pNegH2->GetYaxis()->SetBinLabel(8,"prim");
- pPosH2->GetYaxis()->SetBinLabel(9,"tot"); pNegH2->GetYaxis()->SetBinLabel(9,"tot");
-
- pPosCutH2->GetYaxis()->SetBinLabel(1,"ch1"); pNegCutH2->GetYaxis()->SetBinLabel(1,"ch1");
- pPosCutH2->GetYaxis()->SetBinLabel(2,"ch2"); pNegCutH2->GetYaxis()->SetBinLabel(2,"ch2");
- pPosCutH2->GetYaxis()->SetBinLabel(3,"ch3"); pNegCutH2->GetYaxis()->SetBinLabel(3,"ch3");
- pPosCutH2->GetYaxis()->SetBinLabel(4,"ch4"); pNegCutH2->GetYaxis()->SetBinLabel(4,"ch4");
- pPosCutH2->GetYaxis()->SetBinLabel(5,"ch5"); pNegCutH2->GetYaxis()->SetBinLabel(5,"ch5");
- pPosCutH2->GetYaxis()->SetBinLabel(6,"ch6"); pNegCutH2->GetYaxis()->SetBinLabel(6,"ch6");
- pPosCutH2->GetYaxis()->SetBinLabel(7,"ch7"); pNegCutH2->GetYaxis()->SetBinLabel(7,"ch7");
- pPosCutH2->GetYaxis()->SetBinLabel(8,"prim"); pNegCutH2->GetYaxis()->SetBinLabel(8,"prim");
- pPosCutH2->GetYaxis()->SetBinLabel(9,"tot"); pNegCutH2->GetYaxis()->SetBinLabel(9,"tot");
- TObjArray *pOA=new TObjArray;
- pOA->Add(pPosH2);pOA->Add(pNegH2);pOA->Add(pPosCutH2);pOA->Add(pNegCutH2);
- return pOA;
-}//ParticleContribs()
-//__________________________________________________________________________________________________
-
-void ShowHists()
-{
- pC=new TCanvas("c1","Particle composition");
- pC->Divide(2,2);
- pC->cd(1); pos->Draw("text"); gPad->SetGrid();
- pC->cd(2); neg->Draw("text"); gPad->SetGrid();
- pC->cd(3); poscut->Draw("text"); gPad->SetGrid();
- pC->cd(4); negcut->Draw("text"); gPad->SetGrid();
-}
-
//__________________________________________________________________________________________________
void GeomGui()
{
if(gGeoManager){
gGeoManager->GetTopVolume()->Draw();
- AliRICHParam::ShowAxis();
+ AliRICHParam::DrawAxis();
}else
new G3GeometryGUI;
}
-//__________________________________________________________________________________________________
-void ControlPlots()
-{
- r->ControlPlots();
- new TBrowser;
-}
+
+AliRun *a() {return al->GetAliRun();} //provides pointer to main AliRun object (aka gAlice)
+AliRICH *r() {return (AliRICH*) a()->GetDetector("RICH");} //provides pointer to RICH detector
+AliLoader *rl(){return al->GetLoader("RICHLoader");}
+
+
+void geo ( ) { gGeoManager->SetVisOption(0);gGeoManager->GetTopVolume()->Draw(); AliRICHParam::DrawAxis();}
+void opt ( ) { AliRICHParam::Materials(); } //draw optical properties
+void dis (Int_t evt=-1) {r->Display (evt);} //utility display
+void dum ( ) {r->Dump ( );} //utility display
+
+void h (Int_t evt=0 ) {r->HitsPrint (evt);} //print hits for requested event
+void s (Int_t evt=0 ) {r->SDigitsPrint (evt);} //print sdigits for requested event
+void d (Int_t evt=0 ) {r->DigitsPrint (evt);} //print digits for requested event
+void c (Int_t evt=0 ) {r->ClustersPrint(evt);} //print clusters for requested event
+
+void hqa ( ) {r->HitsQA ( );} //hits QA plots for all events
+void dqa ( ) {r->DigitsQA ( );} //digits QA plots for all events
+void cqa ( ) {r->ClustersQA ( );} //clusters QA plots for all events
+
+
+Int_t t (Int_t pid,Int_t evt=0) {return (AliRICH*)v())->TrackPrint(pid,evt);} //print track
+
+void rt(Int_t event=0) {r->PrintTracks (event);} //utility print tracks
+Int_t nem(Int_t event=0) {AliRICH::Nparticles(kElectron ,event,al);} //utility number of electrons
+Int_t nep(Int_t event=0) {AliRICH::Nparticles(kPositron ,event,al);} //utility number of positrons
+Int_t nmup(Int_t event=0) {AliRICH::Nparticles(kMuonPlus ,event,al);} //utility number of positive muons
+Int_t nmum(Int_t event=0) {AliRICH::Nparticles(kMuonMinus ,event,al);} //utility number of negative muons
+Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0 ,event,al);} //utility number of neutral pions
+Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus ,event,al);} //utility number of positive pions
+Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus ,event,al);} //utility number of negative pions
+Int_t nk0(Int_t event=0) {AliRICH::Nparticles(kK0 ,event,al);} //utility number of neutral kaons
+Int_t nkp(Int_t event=0) {AliRICH::Nparticles(kKPlus ,event,al);} //utility number of positive kaons
+Int_t nkm(Int_t event=0) {AliRICH::Nparticles(kKMinus ,event,al);} //utility number of negative kaons
+Int_t npp(Int_t event=0) {AliRICH::Nparticles(kProton ,event,al);} //utility number of protons
+Int_t npm(Int_t event=0) {AliRICH::Nparticles(kProtonBar ,event,al);} //utility number of antiprotons