control plots went to AliRICH
authorkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 May 2004 11:57:13 +0000 (11:57 +0000)
committerkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 May 2004 11:57:13 +0000 (11:57 +0000)
RICH/menu.C

index c5f29dc..bdbc2cf 100644 (file)
-AliRICH * R() {return r;}
+AliRICH * R()    {return r;}
+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 ControlPlots()
-{  
-  TH1F *pHxD,*pHyD,*pCqH1,*pCsH1,*pCqMipH1,*pCsMipH1,*pCqCerH1,*pCsCerH1,*pCqFeeH1,*pCsFeeH1,*pNumClusH1;  
-  TH2F *pCmH2,*pCmMipH2,*pCmCerH2,*pCmFeeH2;
-  
-  Bool_t isDig =!R()->GetLoader()->LoadDigits();
-  Bool_t isClus=!R()->GetLoader()->LoadRecPoints();
-
-  if(!isDig && !isClus){ Info("ControlPlots","No digits and clusters! Nothing to do.");return;}
-    
-  TFile *pFile = new TFile("$(HOME)/ControlPlots.root","RECREATE");   
-  
-  if(isDig){
-    cout<<"Digits available\n";
-    pHxD=new TH1F("HitDigitDiffX","Hit-Digits diff X all chambers;diff [cm]",100,-10,10); 
-    pHyD=new TH1F("HitDigitDiffY","Hit-Digits diff Y all chambers;diff [cm]",100,-10,10); 
-  }//isDig
-  
-  if(isClus){ 
-    cout<<"Clusters available\n";
-    pNumClusH1=new TH1F("NumClusPerEvent","Number of clusters per event;number",50,0,49);
-    pCqH1=new TH1F("ClusQ",   "Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
-    pCsH1=new TH1F("ClusSize","Cluster size all chambers;size [number of pads in cluster]",100,0,100);
-    pCmH2=new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
-                                                          1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
-  
-    pCqMipH1=new TH1F("MipClusQ",   "MIP Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
-    pCsMipH1=new TH1F("MipClusSize","MIP Cluster size all chambers;size [number of pads in cluster]",100,0,100);
-    pCmMipH2=new TH2F("MipClusMap", "MIP Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
-                                                                    1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
-  
-    pCqCerH1=new TH1F("CerClusQ",   "Cerenkov Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
-    pCsCerH1=new TH1F("CerClusSize","Cernekov Cluster size all chambers;size [number of pads in cluster]",100,0,100);
-    pCmCerH2=new TH2F("CerClusMap", "Cerenkov Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
-                                                                         1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
-    
-    pCqFeeH1=new TH1F("FeeClusQ",   "Feedback Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
-    pCsFeeH1=new TH1F("FeeClusSize","Feedback Cluster size all chambers;size [number of pads in cluster]",100,0,100);
-    pCmFeeH2=new TH2F("FeeClusMap", "Feedback Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
-                                                                         1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
-  }//isClus
-  
-  for(Int_t iEvtN=0;iEvtN<R()->GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEvtN++){//events loop
-    R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);    
-    if(isClus) R()->GetLoader()->TreeR()->GetEntry(0);
-    if(isDig)  R()->GetLoader()->TreeD()->GetEntry(0);  
-    
-    for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop
-      if(isClus){
-        Int_t iNclusCham=R()->Clusters(iChamN)->GetEntries();
-        if(iNclusCham) pNumClusH1->Fill(iNclusCham);//fill total number of clusters for a given event
-        for(Int_t iClusN=0;iClusN<iNclusCham;iClusN++){//clusters loop
-          AliRICHcluster *pClus=(AliRICHcluster*)R()->Clusters(iChamN)->At(iClusN);
-                                      pCqH1->Fill(pClus->Q());   pCsH1->Fill(pClus->Size());   pCmH2->Fill(pClus->X(),pClus->Y());    //common        
-           if(pClus->IsPureMip())     {pCqMipH1->Fill(pClus->Q());pCsMipH1->Fill(pClus->Size());pCmMipH2->Fill(pClus->X(),pClus->Y());}//Pure Mips
-           if(pClus->IsPureCerenkov()){pCqCerH1->Fill(pClus->Q());pCsCerH1->Fill(pClus->Size());pCmCerH2->Fill(pClus->X(),pClus->Y());}//Pure Photons
-           if(pClus->IsPureFeedback()){pCqFeeH1->Fill(pClus->Q());pCsFeeH1->Fill(pClus->Size());pCmFeeH2->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks
-        }//clusters loop
-      }//isClus
-      if(isDig){
-        for(Int_t iDigN=0;iDigN<r->Digits(iChamN)->GetEntries();iDigN++){//digits loop
-          AliRICHdigit *pDig=(AliRICHdigit*)r->Digits(iChamN)->At(iDigN);
-          AliRICHhit   *pHit=hit(pDig->Tid(0));
-          TVector2 hitV2=R()->C(iChamN)->Glob2Loc(pHit->OutX3()); TVector2 digV2=R()->P()->Pad2Loc(pDig->X(),pDig->Y());
-          pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y());
-        }//digits loop
-      }//isDig
-    }//chambers loop
-    Info("ControlPlots","Event %i processed.",iEvtN);
-  }//events loop 
-  
-  if(isDig)  R()->GetLoader()->UnloadDigits();
-  if(isClus) R()->GetLoader()->UnloadRecPoints();
-  
-  pFile->Write(); delete pFile;
-}//void ControlPlots()
 //__________________________________________________________________________________________________
-void MainTrank()
-{
-  TStopwatch sw;TDatime time;
-  H_SD(); SD_D();   AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();//delete z;  
-  cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
-    cout<<"Info in <MainTrank>: Stop  time: ";time.Set();  time.Print();
-    cout<<"Info in <MainTrank>: Time  used: ";sw.Print();
-}
-//__________________________________________________________________________________________________
-void sh()
-{//prints list of hits for a given event
-  R()->GetLoader()->LoadHits();
-  
-  Int_t iTotalHits=0;
-  for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
-    R()->GetLoader()->TreeH()->GetEntry(iPrimN);      
-    R()->Hits()->Print();
-    iTotalHits+=R()->Hits()->GetEntries();
-  }
-  Info("sh","totally %i hits",iTotalHits);
-  R()->GetLoader()->UnloadHits();
-}
-//__________________________________________________________________________________________________
-AliRICHhit* hit(Int_t tid)
-{//print hits for given tid
-  R()->GetLoader()->LoadHits();
-  for(Int_t iPrimN=0;iPrimN<R()->GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop      
-    R()->GetLoader()->TreeH()->GetEntry(iPrimN);
-    for(Int_t iHitN=0;iHitN<R()->Hits()->GetEntries();iHitN++){
-      AliRICHhit *pHit=(AliRICHhit*)R()->Hits()->At(iHitN);
-      if(tid==pHit->Track()) {R()->GetLoader()->UnloadHits();return pHit;}
-    }//hits
-  }//prims loop
-  R()->GetLoader()->UnloadHits();
-}
-//__________________________________________________________________________________________________
-void ss()
-{
-  if(rl->LoadSDigits()) return;
-  rl->TreeS()->GetEntry(0);
-  r->SDigits()->Print();
-  Info("ss","totally %i sdigits",r->SDigits()->GetEntries());
-  rl->UnloadSDigits();
-}
-//__________________________________________________________________________________________________
-void sd()
-{
-  if(rl->LoadDigits()) return;
-  rl->TreeD()->GetEntry(0);
-  Int_t iTotalDigits=0;
-  for(int i=1;i<=7;i++){
-    r->Digits(i)->Print();
-    iTotalDigits+=r->Digits(i)->GetEntries();
-  }
-  Info("sd","totally %i digits",iTotalDigits);
-  rl->UnloadDigits();
-}
-//__________________________________________________________________________________________________
-void sc(Int_t iEvtN=0)
-{
-  Info("sc","List of clusters for event %i",iEvtN);
-  R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);    
-  if(R()->GetLoader()->LoadRecPoints()) return;
-//  r->SetTreeAddress();
-  R()->GetLoader()->TreeR()->GetEntry(0);
-  Int_t iTotalClusters=0;
-  for(Int_t iChamber=1;iChamber<=7;iChamber++){
-    R()->Clusters(iChamber)->Print();
-    iTotalClusters+=R()->Clusters(iChamber)->GetEntries();
-  }
-  R()->GetLoader()->UnloadRecPoints();
-  Info("sc","totally %i clusters",iTotalClusters);
-}
-//__________________________________________________________________________________________________
-void sp(int tid)
+void pp(int tid)
 {
   R()->GetLoader()->GetRunLoader()->LoadHeader();  R()->GetLoader()->GetRunLoader()->LoadKinematics();
   
@@ -223,54 +77,6 @@ void D_C()
 }
 //__________________________________________________________________________________________________
 
-void SD_D()
-{
-  Info("SD_D","Start.");  
-  extern Int_t kBad; 
-  R()->P()->GenSigmaThMap();
-  rl->LoadSDigits();
-  
-  for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
-    al->GetEvent(iEventN);    cout<<"Event "<<iEventN<<endl;  
-    rl->MakeTree("D");      R()->MakeBranch("D"); //create TreeD with RICH branches 
-    R()->ResetSDigits();    R()->ResetDigits();   //reset lists of sdigits and digits
-    rl->TreeS()->GetEntry(0);                        //get sdigits to memory container
-    R()->SDigits()->Sort();
-      
-    Int_t combiPid=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
-    Int_t iNdigitsPerPad;//how many sdigits for a given pad
-    const int kBad=-101;//??? to be removed in code    
-    for(Int_t i=0;i<R()->SDigits()->GetEntries();i++){//sdigits loop (sorted)
-      AliRICHdigit *pSdig=(AliRICHdigit*)R()->SDigits()->At(i);
-      if(pSdig->Id()==id){//still the same pad
-        iNdigitsPerPad++; q+=pSdig->Q();  combiPid+=pSdig->CombiPid();
-        if(iNdigitsPerPad<=3)
-          tid[iNdigitsPerPad-1]=pSdig->Tid(0);
-        else
-          Warning("SDigits2Digits","More then 3 sdigits for the given pad");
-      }else{//new pad, add the pevious one
-        if(id!=kBad&&R()->P()->IsOverTh(chamber,x,y,q)) {
-           R()->AddDigit(chamber,x,y,q,combiPid,tid);
-         }
-        combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id();
-        x=pSdig->X();y=pSdig->Y();
-        q=pSdig->Q();
-        tid[0]=pSdig->Tid(0);
-        iNdigitsPerPad=1;tid[1]=tid[2]=kBad;
-      }
-    }//sdigits loop (sorted)
-  
-    if(R()->SDigits()->GetEntries() && R()->P()->IsOverTh(chamber,x,y,q))
-      R()->AddDigit(chamber,x,y,q,combiPid,tid);//add the last digit
-        
-    rl->TreeD()->Fill();  
-    rl->WriteDigits("OVERWRITE");
-  }//events loop
-  rl->UnloadSDigits();     rl->UnloadDigits();  
-  R()->ResetSDigits(); R()->ResetDigits();//reset lists of sdigits and digits
-  Info("SD_D","Stop.");  
-}//SD_D()
-//__________________________________________________________________________________________________
 void Show()
 {  
   cout<<endl;
@@ -315,12 +121,18 @@ void Show()
     }
     cout<<endl;
   }//events loop
+    
   rl->UnloadHits();  
     if(isSdigits) rl->UnloadSDigits(); 
       if(isDigits) rl->UnloadDigits(); 
         if(isClusters) rl->UnloadRecPoints();
   al->UnloadHeader();
   al->UnloadKinematics();
+  
+  TVector counters=r->Counters();
+  
+  counters(9)=counters(0); for(Int_t i=1;i<=8;i++) counters(9)-=counters(i);
+  counters.Print();
   cout<<endl;
 }//void Show()
 //__________________________________________________________________________________________________
@@ -339,7 +151,7 @@ Bool_t ReadAlice()
   if(gAlice) delete gAlice;      
   if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
     gSystem->Exec("rm -rf *.root *.dat");
-    Error("ReadAlice","galice.root broken, removing all this garbage then init new one");
+    Error("menu.C::ReadAlice","galice.root broken, removing all this garbage then init new one");
     new AliRun("gAlice","Alice experiment system");
     gAlice->SetDebug(-1);
     gAlice->Init("Config.C");
@@ -347,7 +159,7 @@ Bool_t ReadAlice()
     return kFALSE;
   }
   al->LoadgAlice();
-  if(!gAlice) Fatal("ReadAlice","No gAlice in file");
+  if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
   a=al->GetAliRun();
   a->SetDebug(0);    
 //RICH      
@@ -363,25 +175,23 @@ void TestResponse()
 {
   TCanvas *pC=new TCanvas("c","Amplification test",900,800);
   pC->Divide(1,2);
-  pC->cd(1);
-  TF1 *pF1=new TF1("f1",Gain,-70,70,1);  pF1->SetParameters(1,1);pF1->SetParNames("Sector");
-  TF1 *pF2=new TF1("f2",Gain,-70,70,1);  pF2->SetParameters(2,1);pF2->SetParNames("Sector");
-  pF1->Draw();pF2->Draw("same");
   
-  pC->cd(2);
   
   const Int_t nPoints=8;
-  THStack *pStack=new THStack("stack","photons");
+  THStack *pStackPhot=new THStack("StackPhot","photons");
+  THStack *pStackMip =new THStack("StackMip","mips");
   TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");    
-  TH1F *apH[nPoints];
+  TH1F *apHphot[nPoints];
+  TH1F *apHmip[nPoints];
   
-  Double_t starty=AliRICHParam::DeadZone()/2;
+  Double_t starty=0;
   Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
   
   for(int i=0;i<nPoints;i++){
-    apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apH[i]->SetLineColor(i);
-    pStack->Add(apH[i]);                 
-    pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
+    apHphot[i]=new TH1F(Form("hphot%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apHphot[i]->SetLineColor(i);pStackPhot->Add(apHphot[i]);                 
+    apHmip[i] =new TH1F(Form("hmip%i",i),"Qdc for Mip;QDC;Counts",4000,0,4000);   apHmip[i]->SetLineColor(i);pStackMip->Add(apHmip[i]);                 
+    
+    pLeg->AddEntry(apHphot[i],Form("@(10,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
   }
         
   
@@ -389,12 +199,14 @@ void TestResponse()
 //  AliRICHParam::ResetWireSag();
   for(Int_t i=0;i<10000;i++){//events loop
     for(int j=0;j<nPoints;j++){
-      x2.Set(0,starty-j*deltay);
-      apH[j]->Fill(AliRICHParam::TotQdc(x2,0));
+      x2.Set(10,starty+j*deltay);
+      apHphot[j]->Fill(AliRICHParam::TotQdc(x2,0));
+      apHmip[j]->Fill(AliRICHParam::TotQdc(x2,gRandom->Landau(600,150)*1e-9));
     }
   }
-  pStack->Draw("nostack");
-  pLeg->Draw();
+  
+  pC->cd(1);  pStackMip->Draw("nostack");
+  pC->cd(2);  pStackPhot->Draw("nostack"); pLeg->Draw();
 }//TestResponse()
 //__________________________________________________________________________________________________
 void TestSD()
@@ -420,103 +232,141 @@ void TestSD()
 void TestC()
 {
   Info("TestC","Creating test clusters.");
-  rl->MakeTree("R");r->MakeBranch("R");
+  R()->GetLoader()->MakeTree("R");R()->MakeBranch("R");
   
   AliRICHcluster c;
   c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
   c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
   c.CoG();
   
-  r->AddCluster(c);  
+  R()->AddCluster(c);  
   
-  rl->TreeR()->Fill();
-  rl->WriteRecPoints("OVERWRITE");
-  rl->UnloadRecPoints();
-  r->ResetClusters();
+  R()->GetLoader()->TreeR()->Fill();  R()->GetLoader()->WriteRecPoints("OVERWRITE");
+  R()->GetLoader()->UnloadRecPoints();
+  R()->ResetClusters();
   
   Info("TestC","Stop.");
 }//TestC()
 //__________________________________________________________________________________________________
 void TestSeg()
 {
-  AliRICHParam *p=R()->P();
-  Int_t padx,pady,sec;
-  Double_t x,y;
-  Double_t eps=0.0000001;
-  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;
-  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;
-  Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
-  Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
-  TVector2 v2;
-  
-  AliRICHParam::Print();
-  
-  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());
-  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());
-  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());
-  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());
-  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());
-
-  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());
-  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());
-  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());
-  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());
-  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());
-  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());
-  
-  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());
-  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());
-  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());
-  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());
-  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());
-  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());
-  
-  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());
-  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());
-  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());
-  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());
-  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());
-  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());
+  AliRICHParam p;
   
-  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());
-  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());
-  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());
-  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());
-  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());
-  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());
-   
-  new TCanvas("name","title");
-  gPad->Range(-80,-80,80,80);
+  new TCanvas("name","PC segmentation");
+  gPad->Range(-20,-20,200,150);
   AliRICHDisplFast::DrawSectors();
-  AliRICHParam *p=new AliRICHParam;
-  
-  Double_t eps=0.0001;
-  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;
-  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;
-  Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
-  Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
   
   TLatex t; t.SetTextSize(0.02);
+  t.DrawLatex(p.PcSizeX()+10,120,Form("Pc  %6.2fx%6.2fcm %3ix%3ipads",p.PcSizeX()    ,p.PcSizeY(),    p.NpadsX()   ,p.NpadsY()));
+  t.DrawLatex(p.PcSizeX()+10,115,Form("Sec %6.2fx%5.2fcm %3ix%2ipads",p.SectorSizeX(),p.SectorSizeY(),p.NpadsXsec(),p.NpadsYsec()));
+  t.DrawLatex(p.PcSizeX()+10,110,Form("Pad %6.2fx%4.2fcm DeadZone %6.2fcm",p.PadSizeX()   ,p.PadSizeY(),p.DeadZone()));
   
   TVector2 v2;
-  v2=AliRICHParam::Pad2Loc( 1,140); t.DrawLatex(v2.X(),v2.Y(),"Sector 1");  
-  v2=AliRICHParam::Pad2Loc(49,140); t.DrawLatex(v2.X(),v2.Y(),"Sector 2");  
-  v2=AliRICHParam::Pad2Loc(97,140); t.DrawLatex(v2.X(),v2.Y(),"Sector 3");  
-  v2=AliRICHParam::Pad2Loc( 1, 60); t.DrawLatex(v2.X(),v2.Y(),"Sector 4");  
-  v2=AliRICHParam::Pad2Loc(49, 60); t.DrawLatex(v2.X(),v2.Y(),"Sector 5");  
-  v2=AliRICHParam::Pad2Loc(97, 60); t.DrawLatex(v2.X(),v2.Y(),"Sector 6");  
-  
-  t.SetTextColor(kRed);
-  t.DrawLatex(-63.08,-70,"-63.08"); t.DrawLatex(-28.00,-70,"-22.76"); t.DrawLatex(-20.16,-70,"-20.16"); //x position        
-  t.DrawLatex( 58.00,-70," 63.08"); t.DrawLatex( 22.76,-70," 22.76"); t.DrawLatex( 15.00,-70," 20.16");       
-  t.DrawLatex(-70,-64,"-65.30"); t.DrawLatex(-70,-5,"-1.30"); //y position 
-  t.DrawLatex(-70, 63," 65.30"); t.DrawLatex(-70, 2," 1.30");        
+  t.SetTextAlign(12);
+  v2=AliRICHParam::Pad2Loc( 1,24);  t.DrawText(v2.X(),v2.Y(),"sec 1");  
+  v2=AliRICHParam::Pad2Loc(81,24);  t.DrawText(v2.X(),v2.Y(),"sec 2");  
+  v2=AliRICHParam::Pad2Loc( 1,70);  t.DrawText(v2.X(),v2.Y(),"sec 3");  
+  v2=AliRICHParam::Pad2Loc(81,70);  t.DrawText(v2.X(),v2.Y(),"sec 4");  
+  v2=AliRICHParam::Pad2Loc( 1,120); t.DrawText(v2.X(),v2.Y(),"sec 5");  
+  v2=AliRICHParam::Pad2Loc(81,120); t.DrawText(v2.X(),v2.Y(),"sec 6");  
+  
+//  TGaxis *pAx=new TGaxis(0,0,140,  0,0,140,510,"-="); pAx->SetTitle("x, cm"); pAx->SetTextSize(0.05); pAx->Draw();
+//  TGaxis *pAy=new TGaxis(0,0,  0,140,0,140,510,"-="); pAy->SetTitle("y, cm"); pAy->SetTextSize(0.05); pAy->Draw();
+   
   
   t.SetTextColor(kBlue);  
-  t.DrawLatex(-63.08,-75,"1");  t.DrawLatex(-25.00,-75,"48");  t.DrawLatex(-20.00,-75,"49");       //x pads
-  t.DrawLatex( 18.00,-75,"96"); t.DrawLatex( 23.00,-75,"97");  t.DrawLatex( 60.00,-75,"144");
-  t.DrawLatex(-75,-64,"1");   t.DrawLatex(-75,-5,"80"); //y pads
-  t.DrawLatex(-75, 63,"160"); t.DrawLatex(-75, 2,"81");        
+
+  Int_t padx,pady,sec;
+  Double_t margin=5;
+  Double_t x0=0; Double_t x1=p.SectorSizeX(); Double_t x2=p.SectorSizeX()+p.DeadZone(); Double_t x3=p.PcSizeX();
+  Double_t y0=0; Double_t y1=p.SectorSizeY(); Double_t y2=p.SectorSizeY()+p.DeadZone(); 
+  Double_t y3=2*p.SectorSizeY()+p.DeadZone(); Double_t y4=p.PcSizeY()-p.SectorSizeY();
+  Double_t y5=p.PcSizeY();
+   
+//pads along x  
+  t.SetTextAlign(11); t.DrawText(x0,y5+margin,"1");  
+  t.SetTextAlign(31); t.DrawText(x1,y5+margin,"80");
+  t.SetTextAlign(11); t.DrawText(x2,y5+margin,"81");   
+  t.SetTextAlign(31); t.DrawText(x3,y5+margin,"160");
+//pads along y    
+  t.SetTextAlign(11); t.DrawText(x3+margin,y0,"1");  
+  t.SetTextAlign(13); t.DrawText(x3+margin,y1,"48"); 
+  t.SetTextAlign(11); t.DrawText(x3+margin,y2,"49");
+  t.SetTextAlign(13); t.DrawText(x3+margin,y3,"96"); 
+  t.SetTextAlign(11); t.DrawText(x3+margin,y4,"97");
+  t.SetTextAlign(13); t.DrawText(x3+margin,y5,"144");        
+  
+  t.SetTextColor(kRed);
+   
+//positions along x   
+  t.SetTextAlign(13);t.DrawText(x0,y0-margin,Form("%5.2f",x0));   
+  t.SetTextAlign(33);t.DrawText(x1,y0-margin,Form("%5.2f",x1));   
+  t.SetTextAlign(13);t.DrawText(x2,y0-margin,Form("%5.2f",x2));   
+  t.SetTextAlign(33);t.DrawText(x3,y0-margin,Form("%5.2f",x3));   
+//positions along y
+  t.SetTextAlign(31);t.DrawText(x0-margin,y0,Form("%5.2f",y0));   
+  t.SetTextAlign(33);t.DrawText(x0-margin,y1,Form("%5.2f",y1));   
+  t.SetTextAlign(31);t.DrawText(x0-margin,y2,Form("%5.2f",y2));   
+  t.SetTextAlign(33);t.DrawText(x0-margin,y3,Form("%5.2f",y3));   
+  t.SetTextAlign(31);t.DrawText(x0-margin,y4,Form("%5.2f",y4));   
+  t.SetTextAlign(33);t.DrawText(x0-margin,y5,Form("%5.2f",y5));   
+//coners      
+  t.SetTextSize(0.02);
+  TVector pad(2);
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+   
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+  v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+//new canvas
+  new TCanvas("trasform","Test LRS-MRS transform");
+  
+  TView *pView=new TView(1);
+  pView->SetRange(-600,-600,-600,600,600,600);
+//axis  
+  Double_t X[6]={0,0,0,300,0,0};  Double_t Y[6]={0,0,0,0,300,0};  Double_t Z[6]={0,0,0,0,0,300};  
+  TPolyLine3D *pXaxis=new TPolyLine3D(2,X);pXaxis->SetLineColor(kRed);   pXaxis->Draw();
+  TPolyLine3D *pYaxis=new TPolyLine3D(2,Y);pYaxis->SetLineColor(kGreen); pYaxis->Draw();
+  TPolyLine3D *pZaxis=new TPolyLine3D(2,Z);pZaxis->SetLineColor(kBlue);  pZaxis->Draw();  
+//chambers  
+  Int_t iNpointsX=50,iNpointsY=50;  
+  for(Int_t iChamberN=1;iChamberN<=7;iChamberN++){//chamber loop
+    TPolyMarker3D *pChamber=new TPolyMarker3D(iNpointsX*iNpointsY);
+    Int_t i=0;
+    for(Double_t x=0;x<p.PcSizeX();x+=p.PcSizeX()/iNpointsX)
+      for(Double_t y=0;y<p.PcSizeY();y+=p.PcSizeY()/iNpointsY){//step loop
+        TVector3 v3=p.C(iChamberN)->Loc2Glob(TVector2(x,y));
+        pChamber->SetPoint(i++,v3.X(),v3.Y(),v3.Z());
+        pChamber->SetMarkerSize(1);
+        pChamber->SetMarkerColor(iChamberN);
+      }//step loop
+    pChamber->Draw();      
+  }//chamber loop   
+  gPad->GetView()->RotateView(270,30);
 }//void TestSeg()
 //__________________________________________________________________________________________________
 void TestMenu()
@@ -526,7 +376,6 @@ void TestMenu()
   pMenu->AddButton("Test response",      "TestResponse()",    "Test AliRICHParam response methods");
   pMenu->AddButton("Test sdigits",       "TestSD()",          "Create test set of sdigits");
   pMenu->AddButton("Test clusters",      "TestC()",           "Create test set of clusters");
-  pMenu->AddButton("Test digits OLD",    "TestDigitsOLD()",   "Create test set of OLD digits");
   pMenu->Show();  
 }//TestMenu()
 //__________________________________________________________________________________________________
@@ -535,16 +384,9 @@ void menu()
   TControlBar *pMenu = new TControlBar("vertical","RICH main");
        
   if(ReadAlice()){//it's from file, reconstruct
-    pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert");
-    
-    pMenu->AddButton("sdigits->digits"  ,"SD_D()" ,"AliRICHDigitizer");
-    pMenu->AddButton("digits->resolved clusters" ,"cf=new AliRICHClusterFinder(r);cf->Exec();delete cf;","AliRICHClusterFinder");
-    pMenu->AddButton("digits->raw clusters" ,     "AliRICHParam::SetDeclustering(kFALSE);cf=new AliRICHClusterFinder(r);cf->Exec();delete cf;","AliRICHClusterFinder");
-    pMenu->AddButton("clusters->recos"  ,"C_R()"  ,"AliRICHRecon");
-
-    pMenu->AddButton("Show",            "Show()","Shows the structure of events in files");
-    pMenu->AddButton("Display Fast",    "DisplFast()",           "Display Fast");
-    pMenu->AddButton("Control Plots",   "ControlPlots()",        "Display some control histograms");
+    pMenu->AddButton("Show",            "Show()",             "Shows the structure of events in files");
+    pMenu->AddButton("Display Fast",    "DisplFast()",        "Display Fast");
+    pMenu->AddButton("Control Plots",   "R()->ControlPlots()","Create some control histograms");
     
   }else{//it's aliroot, simulate
     pMenu->AddButton("Run",         "a->Run(1)",       "Process!");
@@ -565,6 +407,7 @@ void DebugON() {  Info("DebugON","");   a->SetDebug(1);  r->SetDebug(1);  AliLoa
 
 void ReadRaw()
 {
+// First interation for TB raw data reader  
   char *sRawFileName="beam/run1822_4sigma.dat";
   FILE *pRawFile=fopen(sRawFileName,"r");
   if(!pRawFile){Error("ReadRaw","Something wrong with raw data file %s",sRawFileName); return;}