]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/menu.C
some minor changes to adpat for the situation when no digits or clusters avalbale
[u/mrichter/AliRoot.git] / RICH / menu.C
1
2 Int_t countContrib[7][3];
3
4 void ControlPlots()
5 {  
6   Int_t iChamber=1;
7   
8   TFile *pFile = new TFile("$(HOME)/plots.root","RECREATE");   
9   TH1F *pCqH1=new TH1F("ClusQ",   "Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
10   TH1F *pCsH1=new TH1F("ClusSize","Cluster size all chambers;size [number of pads in cluster]",100,0,100);
11   TH2F *pCmH2=new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
12                                                              1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
13   
14   TH1F *pCqMipH1=new TH1F("MipClusQ",   "MIP Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
15   TH1F *pCsMipH1=new TH1F("MipClusSize","MIP Cluster size all chambers;size [number of pads in cluster]",100,0,100);
16   TH2F *pCmMipH2=new TH2F("MipClusMap", "MIP Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
17                                                              1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
18   
19   TH1F *pCqCerH1=new TH1F("CerClusQ",   "Cerenkov Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
20   TH1F *pCsCerH1=new TH1F("CerClusSize","Cernekov Cluster size all chambers;size [number of pads in cluster]",100,0,100);
21   TH2F *pCmCerH2=new TH2F("CerClusMap", "Cerenkov Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
22                                                              1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
23   TH1F *pCqFeeH1=new TH1F("FeeClusQ",   "Feedback Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
24   TH1F *pCsFeeH1=new TH1F("FeeClusSize","Feedback Cluster size all chambers;size [number of pads in cluster]",100,0,100);
25   TH2F *pCmFeeH2=new TH2F("FeeClusMap", "Feedback Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
26                                                              1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
27   Bool_t isClusters=!rl->LoadRecPoints();
28   r->SetTreeAddress();  
29   for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
30     al->GetEvent(iEventN);    
31     if(isClusters){
32       rl->TreeR()->GetEntry(0);
33       Int_t iTotalClusters=0;
34       for(int i=1;i<=7;i++){//chambers loop
35         iTotalClusters+=r->Clusters(i)->GetEntries();    
36         for(Int_t iClusterN=0;iClusterN<r->Clusters(i)->GetEntries();iClusterN++){//clusters loop
37           AliRICHcluster *pClus=(AliRICHcluster*)r->Clusters(i)->At(iClusterN);
38           
39           countContrib[i-1][0] += pClus->Nmips();
40           countContrib[i-1][1] += pClus->Ncerenkovs();
41           countContrib[i-1][2] += pClus->Nfeedbacks();
42               
43           pCqH1->Fill(pClus->Q());             
44           pCsH1->Fill(pClus->Size());           
45           pCmH2->Fill(pClus->X(),pClus->Y());  
46           
47           if(pClus->IsPureMip()){ //Pure Mips
48             pCqMipH1->Fill(pClus->Q());
49             pCsMipH1->Fill(pClus->Size()); 
50             pCmMipH2->Fill(pClus->X(),pClus->Y());
51           }
52           if(pClus->IsPureCerenkov()){ //Pure Photons
53             pCqCerH1->Fill(pClus->Q());
54             pCsCerH1->Fill(pClus->Size()); 
55             pCmCerH2->Fill(pClus->X(),pClus->Y());
56           }
57           if(pClus->IsPureFeedback()){ //Pure Feedbacks
58             pCqFeeH1->Fill(pClus->Q());
59             pCsFeeH1->Fill(pClus->Size()); 
60             pCmFeeH2->Fill(pClus->X(),pClus->Y());
61           }
62         }//clusters loop
63       }//chambers loop
64     }//isClusters
65     Info("ControlPlots","Event %i processed.",iEventN);
66   }//events loop 
67   if(isClusters) rl->UnloadRecPoints();
68   
69   pFile->Write();
70   delete pFile;
71   for(Int_t i=0;i<7;i++)
72     cout <<" chamber " << i+1 << " n. mips " << countContrib[i][0] << " n. ckovs " << countContrib[i][1] << " n. fdbks " << countContrib[i][2] << endl;
73 }//void ControlPlots()
74 //__________________________________________________________________________________________________
75 void MainTrank()
76 {
77   TStopwatch sw;TDatime time;
78   H_SD(); SD_D();   AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();//delete z;  
79   cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
80     cout<<"Info in <MainTrank>: Stop  time: ";time.Set();  time.Print();
81     cout<<"Info in <MainTrank>: Time  used: ";sw.Print();
82 }
83 //__________________________________________________________________________________________________
84 void sh()
85 {
86   if(rl->LoadHits()) return;
87   
88   Int_t iTotalHits=0;
89   for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
90     rl->TreeH()->GetEntry(iPrimN);      
91     r->Hits()->Print();
92     iTotalHits+=r->Hits()->GetEntries();
93   }
94   Info("sh","totally %i hits",iTotalHits);
95   rl->UnloadHits();
96 }
97 //__________________________________________________________________________________________________
98 void ss()
99 {
100   if(rl->LoadSDigits()) return;
101   rl->TreeS()->GetEntry(0);
102   r->SDigits()->Print();
103   Info("ss","totally %i sdigits",r->SDigits()->GetEntries());
104   rl->UnloadSDigits();
105 }
106 //__________________________________________________________________________________________________
107 void sd()
108 {
109   if(rl->LoadDigits()) return;
110   rl->TreeD()->GetEntry(0);
111   Int_t iTotalDigits=0;
112   for(int i=1;i<=7;i++){
113     r->Digits(i)->Print();
114     iTotalDigits+=r->Digits(i)->GetEntries();
115   }
116   Info("sd","totally %i digits",iTotalDigits);
117   rl->UnloadDigits();
118 }
119 //__________________________________________________________________________________________________
120 void sc()
121 {
122   if(rl->LoadRecPoints()) return;
123   r->SetTreeAddress();
124   rl->TreeR()->GetEntry(0);
125   for(int i=1;i<=7;i++) r->Clusters(i)->Print();
126   rl->UnloadRecPoints();
127 }
128 //__________________________________________________________________________________________________
129 void sp(int tid)
130 {
131   al->LoadHeader();  al->LoadKinematics();
132   PrintParticleInfo(tid);
133   al->UnloadKinematics();  al->UnloadHeader();
134 }
135 //__________________________________________________________________________________________________
136 void PrintParticleInfo(int tid)
137 {
138   TParticle *p=al->Stack()->Particle(tid);
139   cout<<p->GetName();
140   if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
141   else                   {cout<<endl;} 
142 }    
143 //__________________________________________________________________________________________________
144
145 Double_t r2d = TMath::RadToDeg();
146 Double_t d2r = TMath::DegToRad();
147
148 void DisplFast(){ AliRICHDisplFast *d = new AliRICHDisplFast();  d->Exec();}  
149
150
151 void C_R()
152 {
153   AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
154     
155
156   for (int nev=0; nev< a->GetEventsPerRun(); nev++) {    // Event Loop
157     al->GetEvent(nev);
158     cout <<endl<< "Processing event:" <<nev<<endl;
159     detect->StartProcessEvent();
160   } // event loop  
161   delete detect;
162 }  
163 //__________________________________________________________________________________________________
164 void D_C()
165 {
166   TStopwatch sw;TDatime time;
167
168    AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();
169
170    cout << endl;
171    cout << "Info in Digits->Clusters: Start time: ";time.Print();
172    cout << "Info in Digits->Clusters: Stop  time: ";time.Set();  time.Print();
173    cout << "Info in Digits->Clusters: Time  used: ";sw.Print();
174 }
175 //__________________________________________________________________________________________________
176
177 AliRICH * Rich() {return r;}
178 void SD_D()
179 {
180   Info("SD_D","Start.");  
181   extern Int_t kBad; 
182   Rich()->Param()->GenSigmaThMap();
183   rl->LoadSDigits();
184   
185   for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
186     al->GetEvent(iEventN);    cout<<"Event "<<iEventN<<endl;  
187     rl->MakeTree("D");      Rich()->MakeBranch("D"); //create TreeD with RICH branches 
188     Rich()->ResetSDigits(); Rich()->ResetDigits();   //reset lists of sdigits and digits
189     rl->TreeS()->GetEntry(0);                        //get sdigits to memory container
190     Rich()->SDigits()->Sort();
191       
192     Int_t combiPid=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
193     Int_t iNdigitsPerPad;//how many sdigits for a given pad
194     const int kBad=-101;//??? to be removed in code    
195     for(Int_t i=0;i<Rich()->SDigits()->GetEntries();i++){//sdigits loop (sorted)
196       AliRICHdigit *pSdig=(AliRICHdigit*)Rich()->SDigits()->At(i);
197       if(pSdig->Id()==id){//still the same pad
198         iNdigitsPerPad++; q+=pSdig->Q();  combiPid+=pSdig->CombiPid();
199         if(iNdigitsPerPad<=3)
200           tid[iNdigitsPerPad-1]=pSdig->Tid(0);
201         else
202           Warning("SDigits2Digits","More then 3 sdigits for the given pad");
203       }else{//new pad, add the pevious one
204         if(id!=kBad&&Rich()->Param()->IsOverTh(chamber,x,y,q)) {
205            Rich()->AddDigit(chamber,x,y,q,combiPid,tid);
206          }
207         combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id();
208         x=pSdig->X();y=pSdig->Y();
209         q=pSdig->Q();
210         tid[0]=pSdig->Tid(0);
211         iNdigitsPerPad=1;tid[1]=tid[2]=kBad;
212       }
213     }//sdigits loop (sorted)
214   
215     if(Rich()->SDigits()->GetEntries() && Rich()->Param()->IsOverTh(chamber,x,y,q))
216       Rich()->AddDigit(chamber,x,y,q,combiPid,tid);//add the last digit
217         
218     rl->TreeD()->Fill();  
219     rl->WriteDigits("OVERWRITE");
220   }//events loop
221   rl->UnloadSDigits();     rl->UnloadDigits();  
222   Rich()->ResetSDigits(); Rich()->ResetDigits();//reset lists of sdigits and digits
223   Info("SD_D","Stop.");  
224 }//SD_D()
225 //__________________________________________________________________________________________________
226 void Show()
227 {  
228   cout<<endl;
229   al->LoadHeader();  al->LoadKinematics();
230   
231   rl->LoadHits();  
232     Bool_t isSdigits=!rl->LoadSDigits();  
233       Bool_t isClusters=!rl->LoadRecPoints();
234         Bool_t isDigits=!rl->LoadDigits();//loaders
235   
236   cout<<endl;  cout<<endl;  
237   for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
238     Int_t iNparticles=a->GetEvent(iEventN);
239     Int_t iNprims=rl->TreeH()->GetEntries();
240     
241     Int_t iTotalHits=0;
242     for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
243       rl->TreeH()->GetEntry(iPrimN);      
244       iTotalHits+=r->Hits()->GetEntries();
245       TParticle *pPrim=al->Stack()->Particle(iPrimN);
246       Info("Show","Evt %4i prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
247                   iEventN,iPrimN, r->Hits()->GetEntries(), pPrim->GetName(), pPrim->Theta()*r2d,pPrim->Phi()*r2d);
248     }//prims loop
249     Info("Show-HITS","Evt %i total:  %i particles %i primaries %i hits",
250                         iEventN,   iNparticles, iNprims,     iTotalHits);
251     if(isSdigits){
252       rl->TreeS()->GetEntry(0);
253       Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
254     }
255     if(isDigits){
256       rl->TreeD()->GetEntry(0);
257       for(int i=1;i<=7;i++)
258         Info("Show-DIGITS","Evt %i chamber %i contains %5i digits",
259                                  iEventN,   i,           r->Digits(i)->GetEntries());
260     }else
261         Info("Show-DIGITS","There is no digits for this event");
262     if(isClusters){
263       rl->TreeR()->GetEntry(0);
264       for(int i=1;i<=7;i++)
265         Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters",
266                                  iEventN,   i,           r->Clusters(i)->GetEntries());
267     }
268     cout<<endl;
269   }//events loop
270   rl->UnloadHits();  
271     if(isSdigits) rl->UnloadSDigits(); 
272       if(isDigits) rl->UnloadDigits(); 
273         if(isClusters) rl->UnloadRecPoints();
274   al->UnloadHeader();
275   al->UnloadKinematics();
276   cout<<endl;
277 }//void Show()
278 //__________________________________________________________________________________________________
279
280
281 AliRun *a;
282 AliRunLoader *al;
283 AliLoader *rl,*tl,*il;
284
285 AliRICH *r;
286
287 Bool_t ReadAlice()
288 {
289   Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
290   AliLoader::SetDebug(0);
291   if(gAlice) delete gAlice;      
292   if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
293     gSystem->Exec("rm -rf *.root *.dat");
294     Error("ReadAlice","galice.root broken, removing all this garbage then init new one");
295     new AliRun("gAlice","Alice experiment system");
296     gAlice->SetDebug(-1);
297     gAlice->Init("Config.C");
298     r=(AliRICH*)gAlice->GetDetector("RICH");
299     return kFALSE;
300   }
301   al->LoadgAlice();
302   if(!gAlice) Fatal("ReadAlice","No gAlice in file");
303   a=al->GetAliRun();
304   a->SetDebug(0);    
305 //RICH      
306   if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
307   r->SetDebug(0);
308   if(!(rl=al->GetLoader("RICHLoader")))          Warning("RICH/menu.C::ReadAlice","No RICH loader in file");        
309         
310   Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());      
311   return kTRUE;
312 }
313 //__________________________________________________________________________________________________
314 void TestResponse()
315 {
316   TCanvas *pC=new TCanvas("c","Amplification test",900,800);
317   pC->Divide(1,2);
318   pC->cd(1);
319   TF1 *pF1=new TF1("f1",Gain,-70,70,1);  pF1->SetParameters(1,1);pF1->SetParNames("Sector");
320   TF1 *pF2=new TF1("f2",Gain,-70,70,1);  pF2->SetParameters(2,1);pF2->SetParNames("Sector");
321   pF1->Draw();pF2->Draw("same");
322   
323   pC->cd(2);
324   
325   const Int_t nPoints=8;
326   THStack *pStack=new THStack("stack","photons");
327   TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");    
328   TH1F *apH[nPoints];
329   
330   Double_t starty=AliRICHParam::DeadZone()/2;
331   Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
332   
333   for(int i=0;i<nPoints;i++){
334     apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apH[i]->SetLineColor(i);
335     pStack->Add(apH[i]);                 
336     pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
337   }
338         
339   
340   TVector2 x2(0,0);  
341 //  AliRICHParam::ResetWireSag();
342   for(Int_t i=0;i<10000;i++){//events loop
343     for(int j=0;j<nPoints;j++){
344       x2.Set(0,starty-j*deltay);
345       apH[j]->Fill(AliRICHParam::TotQdc(x2,0));
346     }
347   }
348   pStack->Draw("nostack");
349   pLeg->Draw();
350 }//TestResponse()
351 //__________________________________________________________________________________________________
352 void TestSD()
353 {
354   Info("TestSD","Creating test sdigits.");
355   TVector3 hit(426.55,246.28,17.21);        
356   TVector2 x2=r->C(4)->Glob2Loc(hit);        
357   Int_t iTotQdc=r->Param()->TotQdc(x2,624e-9);        
358   Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
359   Int_t padx,pady;
360   Int_t sec=r->Param()->Loc2Pad(x2,padx,pady);
361   r->Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
362   Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge",
363                           hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc);
364   
365   cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
366   for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
367     for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++)
368        cout<<r->Param()->FracQdc(x2,iPadX,iPadY)<<endl;
369   Info("TestSD","Stop.");
370 }//void TestSdigits()
371 //__________________________________________________________________________________________________
372 void TestC()
373 {
374   Info("TestC","Creating test clusters.");
375   rl->MakeTree("R");r->MakeBranch("R");
376   
377   AliRICHcluster c;
378   c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
379   c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
380   c.CoG();
381   
382   r->AddCluster(c);  
383   
384   rl->TreeR()->Fill();
385   rl->WriteRecPoints("OVERWRITE");
386   rl->UnloadRecPoints();
387   r->ResetClusters();
388   
389   Info("TestC","Stop.");
390 }//TestC()
391 //__________________________________________________________________________________________________
392 void TestSeg()
393 {
394   AliRICHParam *p=r->Param();
395   Int_t padx,pady,sec;
396   Double_t x,y;
397   Double_t eps=0.0000001;
398   Double_t x1=-0.5*p->PcSizeX()+eps; Double_t x2=-0.5*p->SectorSizeX()-p->DeadZone()-eps; Double_t x3=-0.5*p->SectorSizeX()+eps;
399   Double_t x6= 0.5*p->PcSizeX()-eps; Double_t x5= 0.5*p->SectorSizeX()+p->DeadZone()+eps; Double_t x4= 0.5*p->SectorSizeX()-eps;
400   Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
401   Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
402   TVector2 v2;
403   
404   AliRICHParam::Print();
405   
406   sec=p->Loc2Pad(TVector2(x= 0,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
407   sec=p->Loc2Pad(TVector2(x= 0,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
408   sec=p->Loc2Pad(TVector2(x= 0,y= 0),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" dead  ","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
409   sec=p->Loc2Pad(TVector2(x= 0,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
410   sec=p->Loc2Pad(TVector2(x= 0,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
411
412   sec=p->Loc2Pad(TVector2(x=x1,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info("  1-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
413   sec=p->Loc2Pad(TVector2(x=x2,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
414   sec=p->Loc2Pad(TVector2(x=x3,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
415   sec=p->Loc2Pad(TVector2(x=x4,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
416   sec=p->Loc2Pad(TVector2(x=x5,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
417   sec=p->Loc2Pad(TVector2(x=x6,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
418   
419   sec=p->Loc2Pad(TVector2(x=x1,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info("  1- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
420   sec=p->Loc2Pad(TVector2(x=x2,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
421   sec=p->Loc2Pad(TVector2(x=x3,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
422   sec=p->Loc2Pad(TVector2(x=x4,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
423   sec=p->Loc2Pad(TVector2(x=x5,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
424   sec=p->Loc2Pad(TVector2(x=x6,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
425   
426   sec=p->Loc2Pad(TVector2(x=x1,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info("  1- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
427   sec=p->Loc2Pad(TVector2(x=x2,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
428   sec=p->Loc2Pad(TVector2(x=x3,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
429   sec=p->Loc2Pad(TVector2(x=x4,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
430   sec=p->Loc2Pad(TVector2(x=x5,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
431   sec=p->Loc2Pad(TVector2(x=x6,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
432   
433   sec=p->Loc2Pad(TVector2(x=x1,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info("  1-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
434   sec=p->Loc2Pad(TVector2(x=x2,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
435   sec=p->Loc2Pad(TVector2(x=x3,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
436   sec=p->Loc2Pad(TVector2(x=x4,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
437   sec=p->Loc2Pad(TVector2(x=x5,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
438   sec=p->Loc2Pad(TVector2(x=x6,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144-  1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
439    
440 }//void TestSeg()
441 //__________________________________________________________________________________________________
442 void TestMenu()
443 {
444   TControlBar *pMenu = new TControlBar("vertical","RICH test");
445   pMenu->AddButton("Test segmentation",  "TestSeg()",         "Test AliRICHParam segmentation methods");
446   pMenu->AddButton("Test response",      "TestResponse()",    "Test AliRICHParam response methods");
447   pMenu->AddButton("Test sdigits",       "TestSD()",          "Create test set of sdigits");
448   pMenu->AddButton("Test clusters",      "TestC()",           "Create test set of clusters");
449   pMenu->AddButton("Test digits OLD",    "TestDigitsOLD()",   "Create test set of OLD digits");
450   pMenu->Show();  
451 }//TestMenu()
452 //__________________________________________________________________________________________________
453 void menu()
454
455   TControlBar *pMenu = new TControlBar("vertical","RICH main");
456        
457   if(ReadAlice()){//it's from file, reconstruct
458     pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert");
459     
460     pMenu->AddButton("sdigits->digits"  ,"SD_D()" ,"AliRICHDigitizer");
461     pMenu->AddButton("digits->clusters" ,"D_C()"  ,"AliRICHClusterFinder");
462     pMenu->AddButton("clusters->recos"  ,"C_R()"  ,"AliRICHRecon");
463
464     pMenu->AddButton("Show",            "Show()","Shows the structure of events in files");
465     pMenu->AddButton("Display Fast",    "DisplFast()",           "Display Fast");
466     pMenu->AddButton("Control Plots",   "ControlPlots()",        "Display some control histograms");
467     pMenu->AddButton("OLD specials->sdigits",          "OLD_S_SD()",       "Perform first phase converstion");
468     
469   }else{//it's aliroot, simulate
470     pMenu->AddButton("Run",         "a->Run(1)",       "Process!");
471     pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI"); 
472   }
473   pMenu->AddButton("Test submenu",    "TestMenu()",            "Shows test submenu");
474   pMenu->AddButton("Browser",         "new TBrowser;",         "Start ROOT TBrowser");
475   pMenu->AddButton("Debug ON",     "DebugON();",   "Switch debug on-off");   
476   pMenu->AddButton("Debug OFF",    "DebugOFF();",   "Switch debug on-off");   
477   pMenu->AddButton("Quit",            ".q",                    "Close session");
478   pMenu->Show();
479   a=gAlice;//for manual manipulation convinience
480 }//menu()
481 //__________________________________________________________________________________________________
482 void DebugOFF(){  Info("DebugOFF","");  a->SetDebug(0);  r->SetDebug(0);  AliLoader::SetDebug(0);}
483 void DebugON() {  Info("DebugON","");   a->SetDebug(1);  r->SetDebug(1);  AliLoader::SetDebug(1);}