1 //globals for easy manual manipulations
8 void ph(Int_t event=0) {r->PrintHits(event);} //utility print hits for 'event' event
9 void ps(Int_t event=0) {r->PrintSDigits(event);} //utility print sdigits
10 void pd(Int_t event=0) {r->PrintDigits(event);} //utility print digits
11 void pc(Int_t event=0) {r->PrintClusters(event);}//utility print clusters
12 void pt(Int_t event=0) {r->PrintTracks(event);} //utility print tracks
13 Int_t ne(Int_t event=0) {AliRICH::Nparticles(kElectron,event,al);} //utility number of electrons
14 Int_t npi0(Int_t event=0) {AliRICH::Nparticles(kPi0,event,al);} //utility number of electrons
15 Int_t npip(Int_t event=0) {AliRICH::Nparticles(kPiPlus,event,al);} //utility number of electrons
16 Int_t npim(Int_t event=0) {AliRICH::Nparticles(kPiMinus,event,al);} //utility number of electrons
17 Int_t nk0(Int_t event=0) {AliRICH::Nparticles(kK0,event,al);} //utility number of electrons
18 Int_t nkp(Int_t event=0) {AliRICH::Nparticles(kKPlus,event,al);} //utility number of electrons
19 Int_t nkm(Int_t event=0) {AliRICH::Nparticles(kKMinus,event,al);} //utility number of electrons
20 //__________________________________________________________________________________________________
24 al->LoadHeader(); al->LoadKinematics();
26 if(tid<0||tid>=al->Stack()->GetNtrack())
27 cout<<"Valid tid number is 0-"<<al->Stack()->GetNtrack()-1<<" for this event.\n";
29 PrintParticleInfo(tid);
31 al->UnloadKinematics(); al->UnloadHeader();
33 //__________________________________________________________________________________________________
34 void PrintParticleInfo(int tid)
36 // Prints particle info for a given TID
37 TParticle *p=al->Stack()->Particle(tid);
38 cout<<p->GetName()<<"("<<tid<<")";
39 if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
42 //__________________________________________________________________________________________________
45 // Provides mother TID for the given TID
46 al->LoadHeader(); al->LoadKinematics();
48 if(tid<0||tid>=al->Stack()->GetNtrack())
49 cout<<"Valid tid number is 0-"<<al->Stack()->GetNtrack()-1<<" for this event.\n";
52 TParticle *p=al->Stack()->Particle(tid);
53 if(p->GetMother(0)==-1) break;
57 al->UnloadKinematics(); al->UnloadHeader();
61 //__________________________________________________________________________________________________
69 Bool_t isHits=!rl->LoadHits();
70 Bool_t isSdigits=!rl->LoadSDigits();
71 Bool_t isDigits=!rl->LoadDigits();//loaders
72 Bool_t isClusters=!rl->LoadRecPoints();
74 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
75 Int_t iNparticles=al->Stack()->GetNtrack();
76 Int_t iNprims=al->Stack()->GetNprimary();
78 Int_t iKPlusCounter=0,iKMinusCounter=0;
79 for(Int_t iParticleN=0;iParticleN<iNparticles;iParticleN++){//stack loop
80 TParticle *pPart=al->Stack()->Particle(iParticleN);
81 switch(pPart->GetPdgCode()){
82 case kKPlus: iKPlusCounter++; break;
83 case kKMinus:iKMinusCounter++; break;
87 Info("Show-STA","Evt %i-> %i particles %i primaries %i K+ %i K-",
88 iEventN, iNparticles, iNprims, iKPlusCounter, iKMinusCounter);
91 Int_t iNentries=rl->TreeH()->GetEntries();
92 for(Int_t iEntryN=0;iEntryN<iNentries;iEntryN++){//TreeH loop
93 rl->TreeH()->GetEntry(iEntryN);//get current entry (prim)
95 for(Int_t iHitN=0;iHitN<r->Hits()->GetEntries();iHitN++){//hits loop
97 AliRICHhit *pHit = (AliRICHhit*)r->Hits()->At(iHitN);//get current hit
98 TParticle *pPart=al->Stack()->Particle(pHit->GetTrack());//get stack particle which produced the current hit
99 FillContribs(pPart->GetPdgCode(),pHit->C(),kFALSE);
102 if(iEntryN<7) Info("Show","Evt %i-> prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
103 iEventN,iEntryN, r->Hits()->GetEntries(), pPart->GetName(), pPart->Theta()*TMath::RadToDeg(),pPart->Phi()*TMath::RadToDeg());
105 Info("Show-HIT","Evt %i-> %i particles %i primaries %i entries in TreeH %i hits",
106 iEventN, iNparticles, iNprims, iNentries, iHitsCounter);
109 rl->TreeS()->GetEntry(0);
110 Info("Show-SDI","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
113 rl->TreeD()->GetEntry(0);
114 for(int i=1;i<=7;i++)
115 Info("Show-DIG","Evt %i chamber %i contains %5i digits",
116 iEventN, i, r->Digits(i)->GetEntries());
118 Info("Show-DIG","There is no digits for this event");
120 rl->TreeR()->GetEntry(0);
121 for(int i=1;i<=7;i++)
122 Info("Show-CLU","Evt %i chamber %i contains %5i clusters",
123 iEventN, i, r->Clusters(i)->GetEntries());
129 if(isSdigits) rl->UnloadSDigits();
130 if(isDigits) rl->UnloadDigits();
131 if(isClusters) rl->UnloadRecPoints();
133 al->UnloadKinematics();
136 //__________________________________________________________________________________________________
142 Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
143 if(gAlice) delete gAlice;
144 if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
145 gSystem->Exec("rm -rf *.root *.dat");
146 Error("menu.C::ReadAlice","galice.root broken, removing all this garbage then init new one");
147 new AliRun("gAlice","Alice experiment system");
148 AliLog::SetModuleDebugLevel("RICH",1);
149 gAlice->Init("Config.C");
150 r=(AliRICH*)gAlice->GetDetector("RICH");
151 a=gAlice; //for manual convinience
155 if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
156 a=al->GetAliRun();//provides pointer to AliRun object
159 if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
160 if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
162 Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
165 //__________________________________________________________________________________________________
168 TControlBar *pMenu = new TControlBar("vertical","RICH test");
169 pMenu->AddButton("Test segmentation" ,"rp->TestSeg()" ,"Test AliRICHParam segmentation methods");
170 pMenu->AddButton("Test response" ,"rp->TestResp()" ,"Test AliRICHParam response methods");
171 pMenu->AddButton("Test transformation","rp->TestTrans()","Test AliRICHParam transformation methods");
172 pMenu->AddButton("Test opticals" ,".x Opticals.h" ,"Test optical properties");
175 //__________________________________________________________________________________________________
178 TControlBar *pMenu = new TControlBar("vertical","RICH main");
180 if(ReadAlice()){//it's from file, show some info
181 pMenu->AddButton("Show", "Show()", "Shows the structure of events in files");
182 pMenu->AddButton("Display Fast", "AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();", "Display Fast");
183 pMenu->AddButton("Control Plots", "r->ControlPlots()","Create some control histograms");
185 }else{//it's aliroot, simulate
186 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
187 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
188 pMenu->AddButton("Run", "a->Run(1)", "Process!");
189 pMenu->AddButton("Geo GUI", "GeomGui()", "Shows geometry");
190 pMenu->AddButton("Read RAW", "ReadRaw()", "Read a list of digits from test beam file");
192 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
193 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
194 pMenu->AddButton("Quit", ".q", "Close session");
197 //__________________________________________________________________________________________________
198 void DebugOFF(){ Info("DebugOFF",""); AliLog::SetGlobalDebugLevel(0);}
199 void DebugON() { Info("DebugON",""); AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
200 //__________________________________________________________________________________________________
201 TObjArray * CreateHists(Double_t pcut=0.9)
203 TH2F *pPosH2 =new TH2F("pos" ,"Pos mixture",5,0,5, 9,0,9); pPosH2->SetStats(0);
204 TH2F *pNegH2 =new TH2F("neg" ,"Neg mixture",5,0,5, 9,0,9); pNegH2->SetStats(0);
205 TH2F *pPosCutH2 =new TH2F("poscut",Form("Pos mixture with P>%4.2f GeV",pcut),5,0,5, 9,0,9); pPosCutH2->SetStats(0);
206 TH2F *pNegCutH2 =new TH2F("negcut",Form("Neg mixture with P>%4.2f GeV",pcut),5,0,5, 9,0,9); pNegCutH2->SetStats(0);
207 pPosH2->GetXaxis()->SetBinLabel(1,"e^{+}"); pNegH2->GetXaxis()->SetBinLabel(1,"e^{-}");
208 pPosH2->GetXaxis()->SetBinLabel(2,"#mu^{+}"); pNegH2->GetXaxis()->SetBinLabel(2,"#mu^{-}");
209 pPosH2->GetXaxis()->SetBinLabel(3,"#pi^{+}"); pNegH2->GetXaxis()->SetBinLabel(3,"#pi^{-}");
210 pPosH2->GetXaxis()->SetBinLabel(4,"K^{+}"); pNegH2->GetXaxis()->SetBinLabel(4,"K^{-}");
211 pPosH2->GetXaxis()->SetBinLabel(5,"p^{+}"); pNegH2->GetXaxis()->SetBinLabel(5,"p^{-}");
213 pPosCutH2->GetXaxis()->SetBinLabel(1,"e^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(1,"e^{-}");
214 pPosCutH2->GetXaxis()->SetBinLabel(2,"#mu^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(2,"#mu^{-}");
215 pPosCutH2->GetXaxis()->SetBinLabel(3,"#pi^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(3,"#pi^{-}");
216 pPosCutH2->GetXaxis()->SetBinLabel(4,"K^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(4,"K^{-}");
217 pPosCutH2->GetXaxis()->SetBinLabel(5,"p^{+}"); pNegCutH2->GetXaxis()->SetBinLabel(5,"p^{-}");
219 pPosH2->GetYaxis()->SetBinLabel(1,"ch1"); pNegH2->GetYaxis()->SetBinLabel(1,"ch1");
220 pPosH2->GetYaxis()->SetBinLabel(2,"ch2"); pNegH2->GetYaxis()->SetBinLabel(2,"ch2");
221 pPosH2->GetYaxis()->SetBinLabel(3,"ch3"); pNegH2->GetYaxis()->SetBinLabel(3,"ch3");
222 pPosH2->GetYaxis()->SetBinLabel(4,"ch4"); pNegH2->GetYaxis()->SetBinLabel(4,"ch4");
223 pPosH2->GetYaxis()->SetBinLabel(5,"ch5"); pNegH2->GetYaxis()->SetBinLabel(5,"ch5");
224 pPosH2->GetYaxis()->SetBinLabel(6,"ch6"); pNegH2->GetYaxis()->SetBinLabel(6,"ch6");
225 pPosH2->GetYaxis()->SetBinLabel(7,"ch7"); pNegH2->GetYaxis()->SetBinLabel(7,"ch7");
226 pPosH2->GetYaxis()->SetBinLabel(8,"prim"); pNegH2->GetYaxis()->SetBinLabel(8,"prim");
227 pPosH2->GetYaxis()->SetBinLabel(9,"tot"); pNegH2->GetYaxis()->SetBinLabel(9,"tot");
229 pPosCutH2->GetYaxis()->SetBinLabel(1,"ch1"); pNegCutH2->GetYaxis()->SetBinLabel(1,"ch1");
230 pPosCutH2->GetYaxis()->SetBinLabel(2,"ch2"); pNegCutH2->GetYaxis()->SetBinLabel(2,"ch2");
231 pPosCutH2->GetYaxis()->SetBinLabel(3,"ch3"); pNegCutH2->GetYaxis()->SetBinLabel(3,"ch3");
232 pPosCutH2->GetYaxis()->SetBinLabel(4,"ch4"); pNegCutH2->GetYaxis()->SetBinLabel(4,"ch4");
233 pPosCutH2->GetYaxis()->SetBinLabel(5,"ch5"); pNegCutH2->GetYaxis()->SetBinLabel(5,"ch5");
234 pPosCutH2->GetYaxis()->SetBinLabel(6,"ch6"); pNegCutH2->GetYaxis()->SetBinLabel(6,"ch6");
235 pPosCutH2->GetYaxis()->SetBinLabel(7,"ch7"); pNegCutH2->GetYaxis()->SetBinLabel(7,"ch7");
236 pPosCutH2->GetYaxis()->SetBinLabel(8,"prim"); pNegCutH2->GetYaxis()->SetBinLabel(8,"prim");
237 pPosCutH2->GetYaxis()->SetBinLabel(9,"tot"); pNegCutH2->GetYaxis()->SetBinLabel(9,"tot");
238 TObjArray *pOA=new TObjArray;
239 pOA->Add(pPosH2);pOA->Add(pNegH2);pOA->Add(pPosCutH2);pOA->Add(pNegCutH2);
241 }//ParticleContribs()
242 //__________________________________________________________________________________________________
246 pC=new TCanvas("c1","Particle composition");
248 pC->cd(1); pos->Draw("text"); gPad->SetGrid();
249 pC->cd(2); neg->Draw("text"); gPad->SetGrid();
250 pC->cd(3); poscut->Draw("text"); gPad->SetGrid();
251 pC->cd(4); negcut->Draw("text"); gPad->SetGrid();
255 //__________________________________________________________________________________________________
258 //Pattern recognition wirh Stack particles
259 TFile *pFile = new TFile("$(HOME)/RPR.root","RECREATE","RICH Pattern Recognition");
260 TNtupleD *hn = new TNtupleD("hn","ntuple","Pmod:Charge:TrackTheta:TrackPhi:TrackX:TrackY:MinX:MinY:ChargeMIP:ThetaCerenkov:NPhotons:MipIndex:Chamber:Particle");
262 printf("Pattern Recognition done for event %5i",0);
263 AliMagF * magf = gAlice->Field();
264 AliTracker::SetFieldMap(magf);
265 for(Int_t iEvtN=0;iEvtN<R()->GetLoader()->GetRunLoader()->GetNumberOfEvents();iEvtN++) {
267 AliRICHTracker *tr = new AliRICHTracker();
268 tr->RecWithStack(hn);
269 // Info("CheckPR","Pattern Recognition done for event %i \b",iEvtN);
270 printf("\b\b\b\b\b%5i",iEvtN+1);
273 pFile->Write();pFile->Close();
276 //__________________________________________________________________________________________________
280 gGeoManager->GetTopVolume()->Draw();
281 AliRICHParam::ShowAxis();