some minor changes
authorkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 9 Dec 2004 10:15:42 +0000 (10:15 +0000)
committerkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 9 Dec 2004 10:15:42 +0000 (10:15 +0000)
RICH/CreateConfig.C
RICH/Geom.C
RICH/api.txt

index 55f0121..b0f0414 100644 (file)
@@ -2,14 +2,17 @@ class RichConfig
 {
 RQ_OBJECT()
 public:
+  
+          RichConfig(const char*sFileName);
+         ~RichConfig()                    {Info("ctor","");fMainFM->Cleanup(); delete fMainFM;}
+protected:
+  enum ERichVers  {kNoRich=-1,kNormalRich,kTestBeam,kTestRadio,kAerogel,kOnTop};
   enum EDetectors {kPIPE=1,kITS=2,kTPC=4,kTRD=8,kTOF=16,kFRAME=32,kMAG=64,kCRT=128,kHALL=256,kPHOS=512,kSTART=1024,kFMD=2048,kABSO=4096,
                    kPMD=8192,kDIPO=16384,kEMCAL=32768,kVZERO=65536,kMUON=131072,kZDC=262144,kSHILD=524288};
   enum EProcesses {kDCAY=1,kPAIR=2,kCOMP=4,kPHOT=8,kPFIS=16,kDRAY=32,kANNI=64,kBREM=128,kMUNU=256,kCKOV=512,kHADR=1024,kLOSS=2048,kMULS=4096,
                    kRAYL=8192};
   enum EGenTypes  {kGun1=100,kGun7,kPythia7,kHijing,kHijingPara};
   
-          RichConfig(const char*sFileName);
-         ~RichConfig()                    {Info("ctor","");fMain->Cleanup(); delete fMain;}
   void    AddDetector(Int_t id)          {fDetectors+=id; if(id==kTRD || id==kTOF) fDetButGrp->SetButton(kFRAME);}
   void    RemoveDetector(Int_t id)       {fDetectors-=id; if(id==kFRAME) {fDetButGrp->SetButton(kTRD,kFALSE);fDetButGrp->SetButton(kTOF,kFALSE);}}
   void    AddProcess(Int_t id)           {fProcesses+=id;}
@@ -17,11 +20,13 @@ public:
   Bool_t  IsDetectorOn(Int_t id)    const{return fDetectors&id;}
   Bool_t  IsProcessOn(Int_t id)     const{return fProcesses&id;}
   Float_t Eta2Theta(Float_t arg)    const{return (180./TMath::Pi())*2.*TMath::ATan(TMath::Exp(-arg));}
-  void    CreateConfigFile();
-protected:
-  TGMainFrame  *fMain;//main window poiter
-  TGComboBox   *fRichVersionCombo;  TGButton *fRichTopChkBtn,*fRichDeclusterChkBtn,*fRichSagChkBtn,*fRichRadioSrcChkBtn;//RICH
-  TGButton     *fMagFldChkBtn;                               //MAG
+  void    CreateConfig();
+  void    CreateRichBatch();
+  void    Exit();
+  
+  TGMainFrame  *fMainFM;//main window poiter
+  TGComboBox   *fRichVerCombo;  TGButton *fRichDeclusterBC,*fRichSagBC,*fRichDebugBC;//RICH
+  TGButton     *fMagFldBC;                               //MAG
   TGComboBox   *fGenTypeCombo,*fGenPartIdCombo,*fGenMinMomCombo,*fGenMaxMomCombo,*fGenChamberCombo; TGNumberEntry *fGenNprimEntry;//GEN
   Int_t         fDetectors; TGButtonGroup *fDetButGrp;       //DETECTORS
   Int_t         fProcesses;
@@ -33,21 +38,23 @@ RichConfig::RichConfig(const char *sFileName)
   fFileName=sFileName;
   fDetectors=0;
 // Create main frame       
-  fMain=new TGMainFrame(gClient->GetRoot(),500,400);
+  fMainFM=new TGMainFrame(gClient->GetRoot(),500,400);
 //  fMain->Connect("CloseWindow()","RichConfig",this,"CloseWindow()");   
-  fMain->AddFrame(pHorFrame=new TGHorizontalFrame(fMain,100,200));
+  fMainFM->AddFrame(pHorFrame=new TGHorizontalFrame(fMainFM,100,200));
 //RICH
   pHorFrame->AddFrame(pVerFrame=new TGVerticalFrame(pHorFrame,100,200));  
-  pVerFrame->AddFrame(pRichGrpFrm=new TGGroupFrame(pHorFrame,"RICH"));
-  pRichGrpFrm->AddFrame(fRichVersionCombo=new TGComboBox(pRichGrpFrm,100));
-  fRichVersionCombo->AddEntry("no RICH",-1);
-  fRichVersionCombo->AddEntry("version 0",0);  
-  fRichVersionCombo->AddEntry("version 1",1);
-  fRichVersionCombo->Select(1);  fRichVersionCombo->Resize(160,20);
-  pRichGrpFrm->AddFrame(fRichTopChkBtn=new TGCheckButton(pRichGrpFrm,"Rotate to Top?"));
-  pRichGrpFrm->AddFrame(fRichDeclusterChkBtn=new TGCheckButton(pRichGrpFrm,"Declustering")); fRichDeclusterChkBtn->SetState(kButtonDown);
-  pRichGrpFrm->AddFrame(fRichSagChkBtn=new TGCheckButton(pRichGrpFrm,"Wire sagita?"));       fRichSagChkBtn->SetState(kButtonDown);
-  pRichGrpFrm->AddFrame(fRichRadioSrcChkBtn=new TGCheckButton(pRichGrpFrm,"Radioactive source"));
+  pVerFrame->AddFrame(pRichFG=new TGGroupFrame(pHorFrame,"RICH"));
+  pRichFG->AddFrame(fRichVerCombo=new TGComboBox(pRichFG,100));
+  fRichVerCombo->AddEntry("no RICH"      ,kNoRich);
+  fRichVerCombo->AddEntry("normal RICH"  ,kNormalRich);
+  fRichVerCombo->AddEntry("RICH on top"  ,kOnTop);
+  fRichVerCombo->AddEntry("test beam"    ,kTestBeam);
+  fRichVerCombo->AddEntry("radio source" ,kTestRadio);
+  fRichVerCombo->AddEntry("aerogel"      ,kAerogel);
+  fRichVerCombo->Select(kNormalRich);  fRichVerCombo->Resize(150,20);
+  pRichFG->AddFrame(fRichDeclusterBC=new TGCheckButton(pRichFG,"Declustering"));       fRichDeclusterBC->SetState(kButtonDown);
+  pRichFG->AddFrame(fRichSagBC      =new TGCheckButton(pRichFG,"Wire sagita?"));       fRichSagBC      ->SetState(kButtonDown);
+  pRichFG->AddFrame(fRichDebugBC    =new TGCheckButton(pRichFG,"Debug StepManager?"));
 //Generator  
   pVerFrame->AddFrame(pGenGrpFrm=new TGGroupFrame(pHorFrame,"Generator"));
   pGenGrpFrm->AddFrame(fGenTypeCombo=new TGComboBox(pGenGrpFrm,100));
@@ -101,8 +108,8 @@ RichConfig::RichConfig(const char *sFileName)
   
 // Magnetic Field
   pVerFrame->AddFrame(pFldGrpFrm=new TGGroupFrame(pHorFrame,"Magnetic Field"));
-  pFldGrpFrm->AddFrame(fMagFldChkBtn=new TGCheckButton(pFldGrpFrm,"On/Off"));
-  fMagFldChkBtn->SetState(kButtonDown);
+  pFldGrpFrm->AddFrame(fMagFldBC=new TGCheckButton(pFldGrpFrm,"On/Off"));
+  fMagFldBC->SetState(kButtonDown);
 //Detectors
   pHorFrame->AddFrame(fDetButGrp=new TGButtonGroup(pHorFrame,"Detectors"));
   fDetButGrp->Connect("Pressed(Int_t)","RichConfig",this,"AddDetector(Int_t)");
@@ -128,36 +135,36 @@ RichConfig::RichConfig(const char *sFileName)
   new TGCheckButton(fDetButGrp,"ZDC"   ,kZDC));         
   new TGCheckButton(fDetButGrp,"SHILD" ,kSHILD));         
 //Processes  
-  pHorFrame->AddFrame(pProcButGrp=new TGButtonGroup(pHorFrame,"Processes"));
-  pProcButGrp->Connect("Pressed(Int_t)","RichConfig",this,"AddProcess(Int_t)");
-  pProcButGrp->Connect("Released(Int_t)","RichConfig",this,"RemoveProcess(Int_t)");
-  new TGCheckButton(pProcButGrp,"DCAY decay",kDCAY));  pProcButGrp->SetButton(kDCAY);       
-  new TGCheckButton(pProcButGrp,"PAIR pair production",kPAIR));  pProcButGrp->SetButton(kPAIR);       
-  new TGCheckButton(pProcButGrp,"COMP Compton",kCOMP));  pProcButGrp->SetButton(kCOMP);
-  new TGCheckButton(pProcButGrp,"PHOT",kPHOT));  pProcButGrp->SetButton(kPHOT);
-  new TGCheckButton(pProcButGrp,"PFIS Photofission",kPFIS));  
-  new TGCheckButton(pProcButGrp,"DRAY delta electrons",kDRAY));  
-  new TGCheckButton(pProcButGrp,"ANNI annihilation",kANNI));  pProcButGrp->SetButton(kANNI);       
-  new TGCheckButton(pProcButGrp,"BREM Bremstraslung",kBREM));  pProcButGrp->SetButton(kBREM);       
-  new TGCheckButton(pProcButGrp,"MUNU",kMUNU));  pProcButGrp->SetButton(kMUNU);       
-  new TGCheckButton(pProcButGrp,"CKOV Cerenkovs",kCKOV));  pProcButGrp->SetButton(kCKOV);       
-  new TGCheckButton(pProcButGrp,"HADR Hadronic interactions ",kHADR));  pProcButGrp->SetButton(kHADR);       
-  new TGCheckButton(pProcButGrp,"LOSS",kLOSS));  pProcButGrp->SetButton(kLOSS);       
-  new TGCheckButton(pProcButGrp,"MULS",kMULS));  pProcButGrp->SetButton(kMULS);       
-  new TGCheckButton(pProcButGrp,"RAYL",kRAYL));  pProcButGrp->SetButton(kRAYL);       
+  pHorFrame->AddFrame(pProcBG=new TGButtonGroup(pHorFrame,"Processes"));
+  pProcBG->Connect("Pressed(Int_t)","RichConfig",this,"AddProcess(Int_t)");
+  pProcBG->Connect("Released(Int_t)","RichConfig",this,"RemoveProcess(Int_t)");
+  new TGCheckButton(pProcBG,"DCAY Decay",kDCAY))                 ;  pProcBG->SetButton(kDCAY);       
+  new TGCheckButton(pProcBG,"PAIR Pair production",kPAIR))       ;  pProcBG->SetButton(kPAIR);       
+  new TGCheckButton(pProcBG,"COMP Compton",kCOMP))               ;  pProcBG->SetButton(kCOMP);
+  new TGCheckButton(pProcBG,"PHOT",kPHOT))                       ;  pProcBG->SetButton(kPHOT);
+  new TGCheckButton(pProcBG,"PFIS Photofission",kPFIS))          ;  
+  new TGCheckButton(pProcBG,"DRAY Delta electrons",kDRAY))       ;  
+  new TGCheckButton(pProcBG,"ANNI Annihilation",kANNI))          ;  pProcBG->SetButton(kANNI);       
+  new TGCheckButton(pProcBG,"BREM Bremstraslung",kBREM))         ;  pProcBG->SetButton(kBREM);       
+  new TGCheckButton(pProcBG,"MUNU",kMUNU))                       ;  pProcBG->SetButton(kMUNU);       
+  new TGCheckButton(pProcBG,"CKOV Cerenkovs",kCKOV))             ;  pProcBG->SetButton(kCKOV);       
+  new TGCheckButton(pProcBG,"HADR Hadronic interactions ",kHADR));  pProcBG->SetButton(kHADR);       
+  new TGCheckButton(pProcBG,"LOSS Energy losses",kLOSS))         ;  pProcBG->SetButton(kLOSS);       
+  new TGCheckButton(pProcBG,"MULS Multiple scattering",kMULS))   ;  pProcBG->SetButton(kMULS);       
+  new TGCheckButton(pProcBG,"RAYL",kRAYL))                       ;  pProcBG->SetButton(kRAYL);       
 //File    
-  fMain->AddFrame(pFileHorFrm=new TGHorizontalFrame(fMain,100,200));
-  pFileHorFrm->AddFrame(pCreateBtn=new TGTextButton(pFileHorFrm,"Create"));
-  pCreateBtn->Connect("Clicked()","RichConfig",this,"CreateConfigFile()");                                 
+  fMainFM->AddFrame(pFileHorFrm=new TGHorizontalFrame(fMainFM,100,200));
+  pFileHorFrm->AddFrame(pCreateB=new TGTextButton(pFileHorFrm,"Create"));
+  pCreateB->Connect("Clicked()","RichConfig",this,"Exit()");                                 
   pFileHorFrm->AddFrame(new TGLabel(pFileHorFrm,Form(" config file as %s",fFileName)));  
   
-  fMain->MapSubwindows();   
-  fMain->Layout();
-  fMain->SetWindowName("Create AliROOT scripts");
-  fMain->MapWindow();      
+  fMainFM->MapSubwindows();   
+  fMainFM->Layout();
+  fMainFM->SetWindowName("Create AliROOT scripts");
+  fMainFM->MapWindow();      
 }//KirCondig::ctor
 //__________________________________________________________________________________________________          
-void RichConfig::CreateConfigFile()
+void RichConfig::CreateConfig()
 {   
   FILE *fp=fopen(fFileName,"w"); if(!fp){Info("CreateConfigFile","Cannot open output file:%sn",fFileName);return;}
   
@@ -195,6 +202,7 @@ void RichConfig::CreateConfigFile()
   if(IsProcessOn(kMULS)) fprintf(fp,"  gMC->SetProcess(\"MULS\",1);");  else fprintf(fp,"  gMC->SetProcess(\"MULS\",0);");
   if(IsProcessOn(kRAYL)) fprintf(fp,"  gMC->SetProcess(\"RAYL\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"RAYL\",0);\n");
   
+  fprintf(fp,"\n");  
   fprintf(fp,"  gMC->SetCut(\"CUTGAM\",0.001); ");  fprintf(fp,"  gMC->SetCut(\"CUTELE\",0.001); ");
   fprintf(fp,"  gMC->SetCut(\"CUTNEU\",0.001);\n"); fprintf(fp,"  gMC->SetCut(\"CUTHAD\",0.001); ");
   fprintf(fp,"  gMC->SetCut(\"CUTMUO\",0.001); ");  fprintf(fp,"  gMC->SetCut(\"BCUTE\" ,0.001);\n");
@@ -202,22 +210,30 @@ void RichConfig::CreateConfigFile()
   fprintf(fp,"  gMC->SetCut(\"DCUTM\" ,0.001);\n");  fprintf(fp,"  gMC->SetCut(\"PPCUTM\",0.001); ");
   fprintf(fp,"  gMC->SetCut(\"TOFMAX\",1e10);\n\n"); 
 //Field
-  if(fMagFldChkBtn->GetState()==kButtonDown) fprintf(fp,"  gAlice->SetField();\n\n");else fprintf(fp,"  gAlice->SetField(0);\n\n");
+  if(fMagFldBC->GetState()==kButtonDown) fprintf(fp,"  gAlice->SetField();\n\n");else fprintf(fp,"  gAlice->SetField(0);\n\n");
   fprintf(fp,"  pAL->CdGAFile();\n\n");                                 //????       
 //BODY-ALIC 
   fprintf(fp,"  new AliBODY(\"BODY\",\"Alice envelop\");\n\n");
 //RICH
-  if(fRichVersionCombo->GetSelected() != -1){  
-    if(fRichTopChkBtn->GetState()==kButtonDown)       fprintf(fp,"  AliRICHParam::AngleRot(0);\n");
-    if(fRichDeclusterChkBtn->GetState()!=kButtonDown) fprintf(fp,"  AliRICHParam::SetDeclustering(kFALSE);\n");
-    if(fRichSagChkBtn->GetState()!=kButtonDown)       fprintf(fp,"  AliRICHParam::SetWireSag(kFALSE);\n");
-    if(fRichRadioSrcChkBtn->GetState()==kButtonDown)  fprintf(fp,"  AliRICHParam::SetRadioSrc(kTRUE);\n");
-    switch(fRichVersionCombo->GetSelected()){//RICH
-      case 0:   fprintf(fp,"  pRICH=new AliRICHv0(\"RICH\",\"RICH version 0\");\n"); break;   
-      case 1:   fprintf(fp,"  pRICH=new AliRICHv1(\"RICH\",\"RICH version 1\");\n"); break;   
+  if(fRichVerCombo->GetSelected() != kNoRich){  
+    TString richStr="RICH "; 
+    if(fRichDeclusterBC->GetState()!=kButtonDown){richStr+="no declustering "  ; fprintf(fp,"  AliRICHParam::SetDeclustering(kFALSE);\n");}
+    if(fRichSagBC->GetState()      !=kButtonDown){richStr+="no sagita "        ; fprintf(fp,"  AliRICHParam::SetWireSag(kFALSE);\n")     ;}
+    switch(fRichVerCombo->GetSelected()){//RICH
+      case kOnTop:      richStr+="top position";fprintf(fp,"  AliRICHParam::SetAngleRot(0);\n")      ;break;   
+      case kAerogel:    richStr+="aerogel"     ;fprintf(fp,"  AliRICHParam::SetAerogel(kTRUE);\n") ;break;   
+      case kTestRadio:  richStr+="radioactive" ;fprintf(fp,"  AliRICHParam::SetRadioSrc(kTRUE);\n");
+                                                fprintf(fp,"  AliRICHParam::SetTestBeam(kTRUE);\n");break;   
+      case kTestBeam:   richStr+="test beam"   ;fprintf(fp,"  AliRICHParam::SetTestBeam(kTRUE);\n");break;   
+      case kNormalRich: richStr+="normal"      ;                                                    break;   
     }
-    fprintf(fp,"  ::Info(\"RICH private config\",\"version %i\");\n\n",fRichVersionCombo->GetSelected()); 
-  }
+    if(fRichDebugBC->GetState()    ==kButtonDown){
+      richStr+="+debug StepManager"; 
+      fprintf(fp,"  AliRICH *pRICH=new AliRICHv0(\"RICH\",\"%s\");\n\n",richStr.Data());
+    }else{
+      fprintf(fp,"  AliRICH *pRICH=new AliRICHv1(\"RICH\",\"%s\");\n\n",richStr.Data());
+    }
+  }//Rich not selected
 //Generator
   switch(fGenTypeCombo->GetSelected()){
     case kHijingPara: 
@@ -307,10 +323,10 @@ void RichConfig::CreateConfigFile()
 
   fprintf(fp,"\n  ::Info(\"RICH private config\",\"Stop\");\n"); 
   fprintf(fp,"}\n");
+out:  
   fclose(fp);  
-  CreateRichBatch();  
 //  fMain->CloseWindow();
-}//CreateConfigFile
+}//CreateConfig
 //__________________________________________________________________________________________________
 void RichConfig::CreateRichBatch()
 {//creates RichBatch.C file
@@ -318,7 +334,7 @@ void RichConfig::CreateRichBatch()
   
   fprintf(fp,"void RichBatch(const Int_t iNevents,const Bool_t isDebug,const char *sConfigFileName)\n");
   fprintf(fp,"{\n");
-  fprintf(fp,"  gSystem->Exec(\"rm -rf *.root hlt hough ZZZ*\");\n");
+  fprintf(fp,"  gSystem->Exec(\"rm -rf *.root hlt hough fort* ZZZ*\");\n");
   fprintf(fp,"  if(isDebug)   AliLog::SetGlobalDebugLevel(AliLog::kDebug);\n");
   fprintf(fp,"  TStopwatch sw;TDatime time;\n\n");
   
@@ -329,11 +345,12 @@ void RichConfig::CreateRichBatch()
     fprintf(fp,"  pSim->SetMakeDigitsFromHits(\"ITS TPC TRD\");\n");
   }
   fprintf(fp,"  pSim->Run(iNevents); delete pSim;\n\n");
-  
-  fprintf(fp,"  AliReconstruction *pRec=new AliReconstruction;\n");
-  fprintf(fp,"  pRec->SetRunLocalReconstruction(\"ITS TPC TRD TOF RICH\");\n");
-  fprintf(fp,"  pRec->SetFillESD(\"ITS TPC TRD TOF RICH\");\n");
-  fprintf(fp,"  pRec->Run();         delete pRec;\n\n");
+  if(fRichVerCombo->GetSelected()==kNormalRich){
+    fprintf(fp,"  AliReconstruction *pRec=new AliReconstruction;\n");
+    fprintf(fp,"  pRec->SetRunLocalReconstruction(\"ITS TPC TRD TOF RICH\");\n");
+    fprintf(fp,"  pRec->SetFillESD(\"ITS TPC TRD TOF RICH\");\n");
+    fprintf(fp,"  pRec->Run();         delete pRec;\n\n");
+  }
   
   fprintf(fp,"  cout<<\"!!!!!!!!!!!!Info in <my/RichBatch.C>: Start time: \";time.Print();\n");
   fprintf(fp,"  cout<<\"!!!!!!!!!!!!Info in <my/RichBatch.C>: Stop  time: \";time.Set();  time.Print();\n");
@@ -346,6 +363,14 @@ void RichConfig::CreateRichBatch()
   fclose(fp);  
 }//CreateRichBatch()
 //__________________________________________________________________________________________________
+void RichConfig::Exit()
+{
+//slot to be invoked by clik on the Create button  
+  CreateConfig();
+  CreateRichBatch();
+  fMainFM->SendCloseMessage();
+}
+//__________________________________________________________________________________________________
 RichConfig *p;
 void CreateConfig()
 {
index d0f46e4..b07f980 100644 (file)
 TGeoManager  *g=0;
 AliRICHParam *p=0;
+Int_t copy; //volume copy number 
+Double_t dx,dy,dz,r1,r2;//tmp vars for volume dimentions
+Double_t cm=1,m=100*cm,mm=0.1*cm,mkm=0.001*cm;//length units  
+
 void Geom()
 {
-  Bool_t isSr90=kFALSE;
-  gSystem->Load("libGeom.so");
-  g=new TGeoManager("HMPID","HMPID single chamber");
+  AliRICHParam::SetRadioSrc(kTRUE);
   p=new AliRICHParam;
-//Dimentions and tmp
-  Int_t copy;  
-  Double_t dx,dy,dz,r1,r2,a=0,z=0,den=0,radlen=0,intlen=0;
-  Double_t cm=1,m=100*cm,mm=0.1*cm,mkm=0.001*cm;  
-//Medium  
-                                                                                       pAir =new TGeoMedium("Air"      ,1, g->GetMaterial("Air"));
-  new TGeoMaterial("CH4"      ,a=26.98 ,z=13,den=0.4224                             ); pCH4 =new TGeoMedium("CH4"      ,2, g->GetMaterial("CH4"));
-  new TGeoMaterial("CsI"      ,a=26.98 ,z=13,den=2.7 ,radlen=24.01*cm,intlen=70.6*cm); pCsI =new TGeoMedium("CsI"      ,3, g->GetMaterial("CsI"));
-  new TGeoMaterial("Al"       ,a=26.98 ,z=13,den=2.7 ,radlen=24.01*cm,intlen=70.6*cm); pAl  =new TGeoMedium("Al"       ,4, g->GetMaterial("Al")); 
-  new TGeoMaterial("W"        ,a=183.84,z=27,den=19.3,radlen= 9.59*cm,intlen=0.35*cm); pW   =new TGeoMedium("W"      ,5, g->GetMaterial("W"));
-  new TGeoMaterial("Cu"       ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pCu  =new TGeoMedium("Cu"       ,6, g->GetMaterial("Cu"));
-  new TGeoMaterial("Rohacell",a=12.01 ,z=6 ,den=0.1,radlen=18.8,intlen=0);            pRoha =new TGeoMedium("Rohacell" ,7, g->GetMaterial("Rohacell"));
-  new TGeoMaterial("SiO2"     ,a=0     ,z=0 ,den=0);                                  pSiO2= new TGeoMedium("SiO2"     ,8,g->GetMaterial("SiO2"));
-  new TGeoMaterial("C6F14"    ,a=0     ,z=0 ,den=0);                                  pC6F14=new TGeoMedium("C6F14"    ,9,g->GetMaterial("C6F14"));
-//for Sr90 source  
-  new TGeoMaterial("Perpex"  ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pPerpex=new TGeoMedium("Perpex",10, g->GetMaterial("Perpex"));
-  new TGeoMaterial("Steel"   ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pSteel=new TGeoMedium("Steel"  ,11, g->GetMaterial("Steel"));
-  new TGeoMaterial("Mylar"   ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pMylar=new TGeoMedium("Mylar"  ,12, g->GetMaterial("Mylar"));
-  new TGeoMaterial("Sr"      ,a=87.62 ,z=38,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pSr   =new TGeoMedium("Sr"     ,13, g->GetMaterial("Sr"));
-//Mother
-  TGeoVolume *pMother=g->MakeBox("Mother",pAir,dx=10*m/2,dy=10*m/2,dz=30*m/2); //arbitrary values  
+  
+  //gSystem->Load("libGeom.so");  
+  g=new TGeoManager("GEL","Aerogel test configuration");
+  Materials();  
+  TGeoVolume *pMother=g->MakeBox("Mother",g->GetMedium("Air"),dx=30*m/2,dy=30*m/2,dz=30*m/2); //arbitrary values  
+  g->SetTopVolume(g->GetVolume("Mother"));
+    
+  Rich(pMother);
+  
+  Colors();  
+  g->CloseGeometry();
+  
+  g->SetVisOption(0); g->SetVisLevel(5); 
+  
+  g->GetMasterVolume()->Draw();
+  Axis();
+//  gPad->GetView()->SetView(3,94,-70,0);
+  new TBrowser;
+}
+//__________________________________________________________________________________________________
+void Aerogel()
+{
+  
+  TGeoVolume *pGel     =g->MakeBox("RGEL" ,g->GetMedium("Air"),dx=10*cm/2,dy= 10*cm/2 ,dz=10*cm/2);//10x10x10 cm aerogel cubic
+  for(int i=1;i<=7;i++)//put 7 cubics
+    g->GetVolume("Mother")->AddNode(pGel,copy=i,new TGeoCombiTrans(p->C(i)->Center().X(), p->C(i)->Center().Y(), p->C(i)->Center().Z(),
+                                                new TGeoRotation(Form("GelRot%i",i),p->C(i)->ThetaXd(),p->C(i)->PhiXd(),
+                                                                                    p->C(i)->ThetaYd(),p->C(i)->PhiYd(),
+                                                                                    p->C(i)->ThetaZd(),p->C(i)->PhiZd())));
+
+}
+//__________________________________________________________________________________________________
+void Materials()
+{
+// Defines all the materials and tracking media
+  Double_t a=0,z=0,den=0,radlen=0,intlen=0;//tmp vars for material parameters
+  new TGeoMaterial("Air"      ,a=26.98 ,z=13,den=0.4224                             );        new TGeoMedium("Air"      ,1,g->GetMaterial("Air")); 
+  new TGeoMaterial("CH4"      ,a=26.98 ,z=13,den=0.4224                             ); pCH4  =new TGeoMedium("CH4"      ,2,g->GetMaterial("CH4"));
+  new TGeoMaterial("CsI"      ,a=26.98 ,z=13,den=2.7 ,radlen=24.01*cm,intlen=70.6*cm); pCsI  =new TGeoMedium("CsI"      ,3,g->GetMaterial("CsI"));
+  new TGeoMaterial("Al"       ,a=26.98 ,z=13,den=2.7 ,radlen=24.01*cm,intlen=70.6*cm); pAl   =new TGeoMedium("Al"       ,4,g->GetMaterial("Al")); 
+  new TGeoMaterial("W"        ,a=183.84,z=27,den=19.3,radlen= 9.59*cm,intlen=0.35*cm); pW    =new TGeoMedium("W"        ,5,g->GetMaterial("W"));
+  new TGeoMaterial("Cu"       ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pCu   =new TGeoMedium("Cu"       ,6,g->GetMaterial("Cu"));
+  new TGeoMaterial("Rohacell" ,a=12.01 ,z=6 ,den=0.1 ,radlen=18.8,intlen=0);           pRoha =new TGeoMedium("Rohacell" ,7,g->GetMaterial("Rohacell"));
+  new TGeoMaterial("SiO2"     ,a=0     ,z=0 ,den=0);                                   pSiO2 =new TGeoMedium("SiO2"     ,8,g->GetMaterial("SiO2"));
+  new TGeoMaterial("C6F14"    ,a=0     ,z=0 ,den=0);                                   pC6F14=new TGeoMedium("C6F14"    ,9,g->GetMaterial("C6F14"));
+//Medium for Sr90 source  
+  new TGeoMaterial("Perpex"  ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pPerpex=new TGeoMedium("Perpex"  ,10,g->GetMaterial("Perpex"));
+  new TGeoMaterial("Steel"   ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pSteel =new TGeoMedium("Steel"   ,11,g->GetMaterial("Steel"));
+  new TGeoMaterial("Mylar"   ,a=55.845,z=26,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pMylar =new TGeoMedium("Mylar"   ,12,g->GetMaterial("Mylar"));
+  new TGeoMaterial("Sr90"    ,a=87.62 ,z=38,den=7.87,radlen=13.84*cm,intlen=82.8*cm); pSr    =new TGeoMedium("Sr90"    ,13,g->GetMaterial("Sr90"));
+}//Materials()
+//__________________________________________________________________________________________________
+void Rich(TGeoVolume *pTop)
+{
 //Rich  
-  TGeoVolume *pRich=g->MakeBox( "Rich"     ,pCH4,dx=(6*mm+1681*mm+6*mm)/2  ,dy=(6*mm+1466*mm+6*mm)/2 ,dz=(80*mm+40*mm)*2/2); //2033P1  z p84 TDR
+  TGeoVolume *pRich=g->MakeBox( "Rich"     ,g->GetMedium("CH4"),dx=(6*mm+1681*mm+6*mm)/2,  //main RICH volume
+                                                                dy=(6*mm+1466*mm+6*mm)/2,
+                                                                dz=(80*mm+40*mm)*2/2);     //x,y taken from 2033P1  z from p84 TDR  
+  for(int i=1;i<=p->Nchambers();i++)//put 7 chambers
+    pTop->AddNode(pRich,copy=i,new TGeoCombiTrans(p->C(i)->Center().X(), p->C(i)->Center().Y(), p->C(i)->Center().Z(),
+                                                 new TGeoRotation(Form("RichRot%i",i),p->C(i)->ThetaXd(),p->C(i)->PhiXd(),
+                                                                                      p->C(i)->ThetaYd(),p->C(i)->PhiYd(),
+                                                                                      p->C(i)->ThetaZd(),p->C(i)->PhiZd()))); //Rich to Mother    
   
-  for(int i=1;i<=7;i++)
-    pMother->AddNode(pRich,copy=i,new TGeoCombiTrans(p->C(i)->Center().X(), p->C(i)->Center().Y(), p->C(i)->Center().Z(),
-    new TGeoRotation(Form("RichRot%i",i),p->C(i)->ThetaXd(),p->C(i)->PhiXd(),p->C(i)->ThetaYd(),p->C(i)->PhiYd(),p->C(i)->ThetaZd(),p->C(i)->PhiZd()))); //Rich to Mother    
+                 PadPanelFrame(pRich); //photocathode
+                 Gap(pRich);           //anod wires
+                 Frame3(pRich);        //cathode wires
+                 Frame4(pRich);        //collection wires  
+  if(!p->IsRadioSrc())    Radiators(pRich);
+  else                    Sr90(pRich);
+                 Sandbox(pRich);
+}//Rich()
+//__________________________________________________________________________________________________
+void PadPanelFrame(TGeoVolume *pTop)
+{
 //Pad Panel frame  
-  TGeoVolume *pPpf     =g->MakeBox("PPF"      ,pAl  ,dx=648*mm/2   ,dy=  411*mm/2 ,dz=40  *mm/2);//PPF 2001P2 inner size of the slab by 1mm more
-  TGeoVolume *pPpfLarge=g->MakeBox("PPFlarge" ,pAir ,dx=181*mm/2   ,dy=89.25*mm/2 ,dz=38.3*mm/2);//large whole
-  TGeoVolume *pPpfSmall=g->MakeBox("PPFsmall" ,pAir ,dx=114*mm/2   ,dy=89.25*mm/2 ,dz=38.3*mm/2);//small whole
-  TGeoVolume *pPc      =g->MakeBox("Pc"       ,pCsI ,dx=644*mm/2   ,dy=  407*mm/2 ,dz= 1.7*mm/2);//by 0.2 mm more then actual size (PCB 2006P1)
+  TGeoVolume *pPpf     =g->MakeBox("PPF"      ,g->GetMedium("Al")  ,dx=648*mm/2,dy=  411*mm/2 ,dz=40  *mm/2);//PPF 2001P2 inner size of the slab by 1mm more
+  TGeoVolume *pPpfLarge=g->MakeBox("PPFlarge" ,g->GetMedium("Air") ,dx=181*mm/2,dy=89.25*mm/2 ,dz=38.3*mm/2);//large whole
+  TGeoVolume *pPpfSmall=g->MakeBox("PPFsmall" ,g->GetMedium("Air") ,dx=114*mm/2,dy=89.25*mm/2 ,dz=38.3*mm/2);//small whole
+  TGeoVolume *pPc      =g->MakeBox("PC"       ,g->GetMedium("CsI") ,dx=644*mm/2,dy=  407*mm/2 ,dz= 1.7*mm/2);//by 0.2 mm more then actual size (PCB 2006P1)
   
-  pRich->AddNode(pPpf,copy=1,new TGeoTranslation(-335*mm,-433*mm,8*cm+20*mm));//F1 2040P1 z p.84 TDR
-  pRich->AddNode(pPpf,copy=2,new TGeoTranslation(+335*mm,-433*mm,8*cm+20*mm));
-  pRich->AddNode(pPpf,copy=3,new TGeoTranslation(-335*mm,   0*mm,8*cm+20*mm));
-  pRich->AddNode(pPpf,copy=4,new TGeoTranslation(+335*mm,   0*mm,8*cm+20*mm));
-  pRich->AddNode(pPpf,copy=5,new TGeoTranslation(-335*mm,+433*mm,8*cm+20*mm));
-  pRich->AddNode(pPpf,copy=6,new TGeoTranslation(+335*mm,+433*mm,8*cm+20*mm));
+  pTop->AddNode(pPpf,copy=1,new TGeoTranslation(-335*mm,-433*mm,8*cm+20*mm));//F1 2040P1 z p.84 TDR
+  pTop->AddNode(pPpf,copy=2,new TGeoTranslation(+335*mm,-433*mm,8*cm+20*mm));
+  pTop->AddNode(pPpf,copy=3,new TGeoTranslation(-335*mm,   0*mm,8*cm+20*mm));
+  pTop->AddNode(pPpf,copy=4,new TGeoTranslation(+335*mm,   0*mm,8*cm+20*mm));
+  pTop->AddNode(pPpf,copy=5,new TGeoTranslation(-335*mm,+433*mm,8*cm+20*mm));
+  pTop->AddNode(pPpf,copy=6,new TGeoTranslation(+335*mm,+433*mm,8*cm+20*mm));
   pPpf->AddNode( pPc ,copy=1,new TGeoTranslation(   0*mm,   0*mm,-19.15*mm));//PPF 2001P2 
   pPpf->AddNode(pPpfLarge,copy=1,new TGeoTranslation(-224.5*mm,-151.875*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=2,new TGeoTranslation(-224.5*mm,- 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=3,new TGeoTranslation(-224.5*mm,+ 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=4,new TGeoTranslation(-224.5*mm,+151.875*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=1,new TGeoTranslation(- 65.0*mm,-151.875*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=2,new TGeoTranslation(- 65.0*mm,- 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=3,new TGeoTranslation(- 65.0*mm,+ 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=4,new TGeoTranslation(- 65.0*mm,+151.875*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=5,new TGeoTranslation(+ 65.0*mm,-151.875*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=6,new TGeoTranslation(+ 65.0*mm,- 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=7,new TGeoTranslation(+ 65.0*mm,+ 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFsmall"),copy=8,new TGeoTranslation(+ 65.0*mm,+151.875*mm,  0.85*mm)); 
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=5,new TGeoTranslation(+224.5*mm,-151.875*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=6,new TGeoTranslation(+224.5*mm,- 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=7,new TGeoTranslation(+224.5*mm,+ 50.625*mm,  0.85*mm));
-  pPpf->AddNode(g->GetVolume("PPFlarge"),copy=8,new TGeoTranslation(+224.5*mm,+151.875*mm,  0.85*mm));
+  pPpf->AddNode(pPpfLarge,copy=2,new TGeoTranslation(-224.5*mm,- 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfLarge,copy=3,new TGeoTranslation(-224.5*mm,+ 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfLarge,copy=4,new TGeoTranslation(-224.5*mm,+151.875*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=1,new TGeoTranslation(- 65.0*mm,-151.875*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=2,new TGeoTranslation(- 65.0*mm,- 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=3,new TGeoTranslation(- 65.0*mm,+ 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=4,new TGeoTranslation(- 65.0*mm,+151.875*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=5,new TGeoTranslation(+ 65.0*mm,-151.875*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=6,new TGeoTranslation(+ 65.0*mm,- 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=7,new TGeoTranslation(+ 65.0*mm,+ 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfSmall,copy=8,new TGeoTranslation(+ 65.0*mm,+151.875*mm,  0.85*mm)); 
+  pPpf->AddNode(pPpfLarge,copy=5,new TGeoTranslation(+224.5*mm,-151.875*mm,  0.85*mm));
+  pPpf->AddNode(pPpfLarge,copy=6,new TGeoTranslation(+224.5*mm,- 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfLarge,copy=7,new TGeoTranslation(+224.5*mm,+ 50.625*mm,  0.85*mm));
+  pPpf->AddNode(pPpfLarge,copy=8,new TGeoTranslation(+224.5*mm,+151.875*mm,  0.85*mm));
+}//PadPanelFrame()
+//__________________________________________________________________________________________________
+void Gap(TGeoVolume *pTop)
+{
 //Gap - anod wires
-  TGeoVolume *pGap =g->MakeBox ("Gap"  ,pCH4 ,dx=648*mm/2,dy=  411*mm/2 ,dz=4.45*mm/2);//xy as PPF 2001P2 z WP 2099P1
-  TGeoVolume *pAnod=g->MakeTube("Anod" ,pW   ,r1=  0*mm  ,r2=  20*mkm/2,dz=648*mm/2);  //WP 2099P1 z = gap x PPF 2001P2
+  TGeoVolume *pGap =g->MakeBox ("Gap"  ,g->GetMedium("CH4") ,dx=648*mm/2,dy=  411*mm/2 ,dz=4.45*mm/2);//xy as PPF 2001P2 z WP 2099P1
+  TGeoVolume *pAnod=g->MakeTube("Anod" ,g->GetMedium("W")   ,r1=  0*mm  ,r2=  20*mkm/2 ,dz=648*mm/2);  //WP 2099P1 z = gap x PPF 2001P2
   TGeoRotation *pAnodRot=new TGeoRotation("AnodRot",90,90,0);
   
-  pRich->AddNode(pGap,copy=1,new TGeoTranslation(-335*mm,-433*mm,8*cm-2.225*mm)); //F1 2040P1 z WP 2099P1
-  pRich->AddNode(pGap,copy=2,new TGeoTranslation(+335*mm,-433*mm,8*cm-2.225*mm)); 
-  pRich->AddNode(pGap,copy=3,new TGeoTranslation(-335*mm,   0*mm,8*cm-2.225*mm)); 
-  pRich->AddNode(pGap,copy=4,new TGeoTranslation(+335*mm,   0*mm,8*cm-2.225*mm)); 
-  pRich->AddNode(pGap,copy=5,new TGeoTranslation(-335*mm,+433*mm,8*cm-2.225*mm)); 
-  pRich->AddNode(pGap,copy=6,new TGeoTranslation(+335*mm,+433*mm,8*cm-2.225*mm)); 
+  pTop->AddNode(pGap,copy=1,new TGeoTranslation(-335*mm,-433*mm,8*cm-2.225*mm)); //F1 2040P1 z WP 2099P1
+  pTop->AddNode(pGap,copy=2,new TGeoTranslation(+335*mm,-433*mm,8*cm-2.225*mm)); 
+  pTop->AddNode(pGap,copy=3,new TGeoTranslation(-335*mm,   0*mm,8*cm-2.225*mm)); 
+  pTop->AddNode(pGap,copy=4,new TGeoTranslation(+335*mm,   0*mm,8*cm-2.225*mm)); 
+  pTop->AddNode(pGap,copy=5,new TGeoTranslation(-335*mm,+433*mm,8*cm-2.225*mm)); 
+  pTop->AddNode(pGap,copy=6,new TGeoTranslation(+335*mm,+433*mm,8*cm-2.225*mm)); 
   for(int i=1;i<=96;i++)
     pGap->AddNode(pAnod,copy=i,new TGeoCombiTrans( 0*mm, -411/2*mm+i*4*mm, 0.185*mm,pAnodRot)); //WP 2099P1  
-//Frame 3- cathode wires      
-  TGeoVolume *pCath=g->MakeTube("Cath"  ,pCu  ,r1=0  ,r2=100*mkm/2,dz=1323*mm/2);//r WP 2099P1 z F3 2041P1       
+}//Gap()
+//__________________________________________________________________________________________________
+void Frame3(TGeoVolume *pTop)
+{//Frame 3- cathode wires      
+  TGeoVolume *pCath=g->MakeTube("Cath"  ,g->GetMedium("Cu")  ,r1=0  ,r2=100*mkm/2,dz=1323*mm/2);//r WP 2099P1 z F3 2041P1       
   TGeoRotation *pCathRot=new TGeoRotation("CathRot",90,90,0);
-  
   for(int i=1;i<=618;i++)
-    pRich->AddNode(pCath,copy=i,new TGeoCombiTrans( 0*mm, -649.5*mm+i*2.1*mm, 75*mm,pCathRot)); //WP 2099P1    
+    pTop->AddNode(pCath,copy=i,new TGeoCombiTrans( 0*mm, -649.5*mm+i*2.1*mm, 75*mm,pCathRot)); //WP 2099P1    
+}//Frame3()
+//__________________________________________________________________________________________________
+void Frame4(TGeoVolume *pTop)
+{
 //Frame 4- collection wires
-  TGeoVolume *pF4  =g->MakeBox( "F4"       ,pCH4   ,dx=1407*mm/2 ,dy=1366*mm/2  ,dz=  15*mm/2);//F4 2043P1 
-  TGeoVolume *pF4al=g->MakeBox( "F4al"     ,pAl    ,dx=1407*mm/2 ,dy=1366*mm/2  ,dz=  10*mm/2); 
-  TGeoVolume *pF4in=g->MakeBox( "F4in"     ,pCH4   ,dx=1323*mm/2 ,dy=1296*mm/2  ,dz=  10*mm/2); 
-  TGeoVolume *pColl=g->MakeTube("Coll"     ,pCu    ,r1=   0*mm   ,r2=100*mkm/2  ,dz=1323*mm/2);
+  TGeoVolume *pF4  =g->MakeBox( "F4"       ,g->GetMedium("CH4")   ,dx=1407*mm/2 ,dy=1366*mm/2  ,dz=  15*mm/2);//F4 2043P1 
+  TGeoVolume *pF4al=g->MakeBox( "F4al"     ,g->GetMedium("Al")    ,dx=1407*mm/2 ,dy=1366*mm/2  ,dz=  10*mm/2); 
+  TGeoVolume *pF4in=g->MakeBox( "F4in"     ,g->GetMedium("CH4")   ,dx=1323*mm/2 ,dy=1296*mm/2  ,dz=  10*mm/2); 
+  TGeoVolume *pColl=g->MakeTube("Coll"     ,g->GetMedium("Cu")    ,r1=   0*mm   ,r2=100*mkm/2  ,dz=1323*mm/2);
   TGeoRotation *pCollRot=new TGeoRotation("CollRot",90,90,0);
   
-  pRich->AddNode(pF4      ,copy=1,new TGeoTranslation(   0*mm,0*mm,   9*mm)); //F4 to Rich p.84 TDR
-  pF4  ->AddNode(pF4al    ,copy=1,new TGeoTranslation(   0*mm,0*mm, 2.5*mm)); //F4 al to F4 2043P1 
-  pF4al->AddNode(pF4in    ,copy=1,new TGeoTranslation(   0*mm,0*mm,   0*mm)); //F4 whole F4 al 2043P1   
-  for(int i=1;i<=322;i++)
-    pF4->AddNode(pColl,copy=i,new TGeoCombiTrans( 0*mm, -1296/2*mm+i*4*mm, -5*mm,pCollRot)); //F4 2043P1
-//Radiators or Sr90 source
-  if(!isSr90){//Radiators  
-    TGeoVolume *pRad      =g->MakeBox( "Rad"      ,g->GetMedium("C6F14")    ,dx=1330*mm/2 ,dy= 413*mm/2  ,dz=  24*mm/2); // Rad 2011P1
-    TGeoVolume *pRadFront =g->MakeBox( "RadFront" ,g->GetMedium("Neoceram") ,dx=1330*mm/2 ,dy= 413*mm/2  ,dz=   4*mm/2); 
-    TGeoVolume *pRadWin   =g->MakeBox( "RadWin"   ,g->GetMedium("SiO2")     ,dx=1330*mm/2 ,dy= 413*mm/2  ,dz=   5*mm/2); 
-    TGeoVolume *pRadLong  =g->MakeBox( "RadLong"  ,g->GetMedium("Neoceram") ,dx=1330*mm/2 ,dy=   5*mm/2  ,dz=  15*mm/2);    
-    TGeoVolume *pRadShort =g->MakeBox( "RadShort" ,g->GetMedium("Neoceram") ,dx=  10*mm/2 ,dy= 403*mm/2  ,dz=  15*mm/2);    
-    TGeoVolume *pRadSpacer=g->MakeTube("RadSpacer",g->GetMedium("SiO2")     ,r1= 0        ,r2=10*mm/2  ,dz=  15*mm/2);         
+  pTop->AddNode(pF4      ,copy=1,new TGeoTranslation(   0*mm,0*mm,   9*mm)); //F4 to Rich p.84 TDR
+    pF4  ->AddNode(pF4al    ,copy=1,new TGeoTranslation(   0*mm,0*mm, 2.5*mm)); //F4 al to F4 2043P1 
+    pF4al->AddNode(pF4in    ,copy=1,new TGeoTranslation(   0*mm,0*mm,   0*mm)); //F4 whole F4 al 2043P1   
+    for(int i=1;i<=322;i++)
+      pF4->AddNode(pColl,copy=i,new TGeoCombiTrans( 0*mm, -1296/2*mm+i*4*mm, -5*mm,pCollRot)); //F4 2043P1
+}//void Frame4()
+//__________________________________________________________________________________________________
+void Radiators(TGeoVolume *pTop)
+{
+  TGeoVolume *pRad      =g->MakeBox( "Rad"      ,g->GetMedium("C6F14")    ,dx=1330*mm/2 ,dy= 413*mm/2  ,dz=  24*mm/2); // Rad 2011P1
+  TGeoVolume *pRadFront =g->MakeBox( "RadFront" ,g->GetMedium("Neoceram") ,dx=1330*mm/2 ,dy= 413*mm/2  ,dz=   4*mm/2); 
+  TGeoVolume *pRadWin   =g->MakeBox( "RadWin"   ,g->GetMedium("SiO2")     ,dx=1330*mm/2 ,dy= 413*mm/2  ,dz=   5*mm/2); 
+  TGeoVolume *pRadLong  =g->MakeBox( "RadLong"  ,g->GetMedium("Neoceram") ,dx=1330*mm/2 ,dy=   5*mm/2  ,dz=  15*mm/2);    
+  TGeoVolume *pRadShort =g->MakeBox( "RadShort" ,g->GetMedium("Neoceram") ,dx=  10*mm/2 ,dy= 403*mm/2  ,dz=  15*mm/2);    
+  TGeoVolume *pRadSpacer=g->MakeTube("RadSpacer",g->GetMedium("SiO2")     ,r1= 0        ,r2=10*mm/2  ,dz=  15*mm/2);         
     
-    pRich->AddNode(pRad      ,copy=1,new TGeoTranslation(   0*mm,-434*mm,   -12*mm)); 
-    pRich->AddNode(pRad      ,copy=2,new TGeoTranslation(   0*mm,   0*mm,   -12*mm)); 
-    pRich->AddNode(pRad      ,copy=3,new TGeoTranslation(   0*mm,+434*mm,   -12*mm)); 
+  pTop->AddNode(pRad      ,copy=1,new TGeoTranslation(   0*mm,-434*mm,   -12*mm)); 
+  pTop->AddNode(pRad      ,copy=2,new TGeoTranslation(   0*mm,   0*mm,   -12*mm)); 
+  pTop->AddNode(pRad      ,copy=3,new TGeoTranslation(   0*mm,+434*mm,   -12*mm)); 
     
-    pRad ->AddNode(pRadFront ,copy=1,new TGeoTranslation(   0*mm,   0*mm, -10.0*mm));
-    pRad ->AddNode(pRadWin   ,copy=1,new TGeoTranslation(   0*mm,   0*mm,   9.5*mm));
-    pRad ->AddNode(pRadLong  ,copy=1,new TGeoTranslation(   0*mm,-204*mm,  -0.5*mm));
-    pRad ->AddNode(pRadLong  ,copy=2,new TGeoTranslation(   0*mm,+204*mm,  -0.5*mm));
-    pRad ->AddNode(pRadShort ,copy=1,new TGeoTranslation(-660*mm,   0*mm,  -0.5*mm));
-    pRad ->AddNode(pRadShort ,copy=2,new TGeoTranslation(+660*mm,   0*mm,  -0.5*mm));
-    for(int i=0;i<3;i++)
-      for(int j=0;j<10;j++)
-        pRad->AddNode(pRadSpacer,copy=10*i+j,new TGeoTranslation(-1330*mm/2+116*mm+j*122*mm,(i-1)*105*mm,-0.5*mm));
-  }else{//Sr90
-    pSrc               =g->MakeTube("Src"              ,pCH4    , 0 , 70*mm/2 ,  30*mm/2);       //top container
-      pAlGlass         =g->MakeTube("SrcAlGlass"        ,pAl    , 0 , 38*mm/2 ,21.8*mm/2);       //Al glass wall        
-        pPerpexPlug    =g->MakeTube("SrcPerpex"        ,pPerpex , 0 , 34*mm/2 ,  20*mm/2);       //Perpex plug         
-          pSteelScrew  =g->MakeTube("SrcSteelScrew"    ,pSteel  , 0 ,  5*mm/2 ,  15*mm/2);       //Steel screw in the center        
-          pSr90Screw   =g->MakeTube("SrcSr90Screw"     ,pSteel  , 0 ,  2*mm/2 ,  10*mm/2);       //Steel screw to support Sr90 
-            pSr90      =g->MakeTube("SrcSr90"          ,pSr     , 0 ,  1*mm/2 ,   1*mm/2);       //Sr90 source
-          pHolePerpex  =g->MakeTube("SrcHolePerpex"    ,pAir    , 0 ,  4*mm/2 ,  10*mm/2);       //Air hole in perpex plug      
-        pHoleAl        =g->MakeTube("SrcHoleAl"        ,pAir    , 0 ,  4*mm/2 , 1.8*mm/2);       //Air hole in Al glass bottom
-    pMylarFoil         =g->MakeTube("SrcMylarFoil"     ,pMylar  , 0 , 30*mm/2 , 50*mkm/2);       //Mylar foil                
+  pRad ->AddNode(pRadFront ,copy=1,new TGeoTranslation(   0*mm,   0*mm, -10.0*mm));
+  pRad ->AddNode(pRadWin   ,copy=1,new TGeoTranslation(   0*mm,   0*mm,   9.5*mm));
+  pRad ->AddNode(pRadLong  ,copy=1,new TGeoTranslation(   0*mm,-204*mm,  -0.5*mm));
+  pRad ->AddNode(pRadLong  ,copy=2,new TGeoTranslation(   0*mm,+204*mm,  -0.5*mm));
+  pRad ->AddNode(pRadShort ,copy=1,new TGeoTranslation(-660*mm,   0*mm,  -0.5*mm));
+  pRad ->AddNode(pRadShort ,copy=2,new TGeoTranslation(+660*mm,   0*mm,  -0.5*mm));
+  for(int i=0;i<3;i++)
+    for(int j=0;j<10;j++)
+      pRad->AddNode(pRadSpacer,copy=10*i+j,new TGeoTranslation(-1330*mm/2+116*mm+j*122*mm,(i-1)*105*mm,-0.5*mm));
+}//Radiators()  
+//__________________________________________________________________________________________________
+void Sr90(TGeoVolume *pTop)
+{
+    pSrc               =g->MakeTube("Src"              ,g->GetMedium("CH4")   , 0 , 70*mm/2 ,  30*mm/2);       //top container
+      pAlGlass         =g->MakeTube("SrcAlGlass"       ,g->GetMedium("Al")    , 0 , 38*mm/2 ,21.8*mm/2);       //Al glass wall        
+        pPerpexPlug    =g->MakeTube("SrcPerpex"        ,g->GetMedium("Perpex"), 0 , 34*mm/2 ,  20*mm/2);       //Perpex plug         
+          pScrewCentral=g->MakeTube("SrcScrewCentral"  ,g->GetMedium("Steel") , 0 ,  5*mm/2 ,  15*mm/2);       //Steel screw in the center        
+          pScrewSr90   =g->MakeTube("SrcScrewSr90"     ,g->GetMedium("Steel") , 0 ,  2*mm/2 ,  10*mm/2);       //Steel screw to support Sr90 
+            pSr90      =g->MakeTube("SrcSr90"          ,g->GetMedium("Sr90")  , 0 ,  1*mm/2 ,   1*mm/2);       //Sr90 source
+          pHolePerpex  =g->MakeTube("SrcHolePerpex"    ,g->GetMedium("Air")   , 0 ,  4*mm/2 ,  10*mm/2);       //Air hole in perpex plug      
+        pHoleAl        =g->MakeTube("SrcHoleAl"        ,g->GetMedium("Air")   , 0 ,  5*mm/2 , 1.8*mm/2);       //Air hole in Al glass bottom
+    pMylarFoil         =g->MakeTube("SrcMylarFoil"     ,g->GetMedium("Mylar") , 0 , 30*mm/2 , 50*mkm/2);       //Mylar foil                
                 
-    pRich->AddNode(pSrc,1,new TGeoTranslation(30*cm,0,alVesselZ));
+    pTop->AddNode(pSrc,1,new TGeoTranslation(30*cm,0,1*cm));
       pSrc ->AddNode(pMylarFoil,1,new TGeoTranslation(0,0,21.8*mm/2+50*mkm/2));
-      pSrc ->AddNode(pAlGlass,1,new TGeoTranslation(0,0,0));//Al glass to fake Src volume
-        pAlGlass->AddNode(pHoleAl,1,new TGeoTranslation(6*mm, 0*mm, 10.9*mm));
-        pAlGlass->AddNode(pPerpexPlug,1,new TGeoTranslation(0*mm,0*mm,-0.9*mm));
-          pPerpexPlug->AddNode(pSteelScrew,1,new TGeoTranslation(shift,0, perpexPlugZ-steelScrewZ));  
-          pPerpexPlug->AddNode(pHolePerpex,1,new TGeoTranslation(shift,0,-perpexPlugZ+airWholeZ));      
-          pPerpexPlug->AddNode(pSr90Screw ,1,new TGeoTranslation(shift,0, perpexPlugZ-sr90ScrewZ));  
-          pSr90Screw->AddNode(pSr90 ,1,new TGeoTranslation(0,0, -(sr90ScrewZ-sr90Z)));  
-  }//if(!isSr90)
-//Sandbox  
-  TGeoVolume *pSandBox  =g->MakeBox( "SandBox"  ,pAir  ,dx=1419*mm/2 ,dy=1378*mm/2   ,dz=50.5*mm/2);  //2072P1   
-  TGeoVolume *pSandCover=g->MakeBox( "SandCover",pAl   ,dx=1419*mm/2 ,dy=1378*mm/2   ,dz= 0.5*mm/2);  
-  TGeoVolume *pSandComb =g->MakeBox( "SandComb" ,pRoha ,dx=1359*mm/2 ,dy=1318*mm/2   ,dz=49.5*mm/2);  
+      pSrc ->AddNode(pAlGlass,1,new TGeoTranslation(0,0,0));                           //Al glass to fake Src volume
+        pAlGlass->AddNode(       pHoleAl      ,1,new TGeoTranslation(6*mm,0, -10*mm));
+        pAlGlass->AddNode(       pPerpexPlug  ,1,new TGeoTranslation(0*mm,0, 0.9*mm));
+          pPerpexPlug->AddNode(  pHolePerpex  ,1,new TGeoTranslation(6*mm,0,  -5*mm));      
+          pPerpexPlug->AddNode(  pScrewCentral,1,new TGeoTranslation(0   ,0, 2.5*mm));  
+          pPerpexPlug->AddNode(  pScrewSr90   ,1,new TGeoTranslation(6*mm,0,   5*mm));  
+            pScrewSr90->AddNode( pSr90        ,1,new TGeoTranslation(0   ,0,-4.5*mm));  
+}//Sr90()    
+//__________________________________________________________________________________________________
+void Sandbox(TGeoVolume *pTop)
+{//Sandbox  
+  TGeoVolume *pSandBox  =g->MakeBox( "SandBox"  ,g->GetMedium("Air")  ,dx=1419*mm/2 ,dy=1378*mm/2   ,dz=50.5*mm/2);  //2072P1   
+  TGeoVolume *pSandCover=g->MakeBox( "SandCover",g->GetMedium("Al")   ,dx=1419*mm/2 ,dy=1378*mm/2   ,dz= 0.5*mm/2);  
+  TGeoVolume *pSandComb =g->MakeBox( "SandComb" ,g->GetMedium("Roha") ,dx=1359*mm/2 ,dy=1318*mm/2   ,dz=49.5*mm/2);  
   
-  pRich->AddNode(pSandBox,copy=1,new TGeoTranslation(  0*mm,0*mm, -73.75*mm)); //p.84 TDR
+  pTop->AddNode(pSandBox,copy=1,new TGeoTranslation(  0*mm,0*mm, -73.75*mm)); //p.84 TDR
     pSandBox->AddNode(pSandComb  ,copy=1,new TGeoTranslation(  0*mm,0*mm,      0*mm)); //2072P1
     pSandBox->AddNode(pSandCover ,copy=1,new TGeoTranslation(  0*mm,0*mm,    +25*mm)); 
     pSandBox->AddNode(pSandCover ,copy=2,new TGeoTranslation(  0*mm,0*mm,    -25*mm)); 
-//Colors  
-  g->GetVolume("Pc")       ->SetLineColor(kGreen);
-  g->GetVolume("PPF")      ->SetLineColor(33);
-  g->GetVolume("PPFlarge") ->SetLineColor(kYellow);
-  g->GetVolume("PPFsmall") ->SetLineColor(kYellow);
-  g->GetVolume("RadFront") ->SetLineColor(kRed);
-  g->GetVolume("RadLong")  ->SetLineColor(46);
-  g->GetVolume("RadShort") ->SetLineColor(kMagenta);
-  g->GetVolume("RadWin")   ->SetLineColor(kBlue);
-  g->GetVolume("RadSpacer")->SetLineColor(kYellow);
-  
-  g->GetVolume("SandCover")->SetLineColor(50);
-  
-  pColl ->SetLineColor(kBlue);  
-//Final
-  g->SetTopVolume(g->GetVolume("Mother"));
-  g->CloseGeometry();
-  
-  g->SetVisOption(0); g->SetVisLevel(5); 
-  
-  g->GetMasterVolume()->Draw();
-  Axis();
-  new TBrowser;
-}
-
-
+}//Sandbox()
+//__________________________________________________________________________________________________
 void Axis()
-{  
+{
+// Draw axises  on top of geometry    
   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();  
 }
+//__________________________________________________________________________________________________
+void Colors()
+{
+//Set volume colors  
+  TGeoVolume *pVol=0;
+  pVol=g->GetVolume("Pc")       ; if(pVol) pVol->SetLineColor(kGreen);
+  pVol=g->GetVolume("PPFlarge") ; if(pVol) pVol->SetLineColor(kYellow);
+  pVol=g->GetVolume("PPFsmall") ; if(pVol) pVol->SetLineColor(kYellow);
+  pVol=g->GetVolume("RadFront") ; if(pVol) pVol->SetLineColor(kRed);
+  pVol=g->GetVolume("RadLong")  ; if(pVol) pVol->SetLineColor(46);
+  pVol=g->GetVolume("RadShort") ; if(pVol) pVol->SetLineColor(kMagenta);
+  pVol=g->GetVolume("RadWin")   ; if(pVol) pVol->SetLineColor(kBlue);
+  pVol=g->GetVolume("RadSpacer"); if(pVol) pVol->SetLineColor(kYellow);
+  pVol=g->GetVolume("SrcSr90")       ; if(pVol) pVol->SetLineColor(kRed);
+  pVol=g->GetVolume("SrcScrewSr90")  ; if(pVol) pVol->SetLineColor(kGreen);
+  pVol=g->GetVolume("SrcHolePerpex") ; if(pVol) pVol->SetLineColor(26);
+  pVol=g->GetVolume("SrcHoleAl")     ; if(pVol) pVol->SetLineColor(27);
+}
index 0e059c7..fd84278 100644 (file)
@@ -1,4 +1,4 @@
-How to open session?
+How to open session:
        use static methode  AliRunLoader::Open("galice.root","AlicE","update")
 How to retrive pointer to alice run loader:
         use pRICH->GetLoader()->GetRunLoader() (all detector classes inherit from AliDetector wich has GetLoader())
@@ -10,50 +10,58 @@ How to get pointers to different root trees:
        TreeS belongs to AliLoader   , available after AliLoader::LoadSDigits()
        TreeD belongs to AliLoader   , available after AliLoader::LoadDigits()
        TreeR belongs to AliLoader   , available after AliLoader::LoadRecPoints()
-
-
-How to work with the stack of particles?
+        all methodes return 0 on success. 
+How to deal with the stack of particles?
         - first of all, the stack includes primary as well as secondary particles
-       - pointer to the stack is returned by AliRun::Stack() (global gAlice of type AliRun - depricated way to do)
-          or by AliRunLoader::Stack() but before one needs to load event header by AliRunLoader::LoadHeader() otherwise both methods return 0.
-          Moreover loading header gives the information about number of particles only. 
-          To retrive the list of particle one also needs to load kinematics by AliRunLoader::LoadKinematics()        
-       - total amount of particles in stack for a given event:         AliStack::GetNtrack() or AliRun::GetEvent() (after LoadHeader())
-       - total amount of primiry particles in stack for a given event: AliStack::GetNprimary() or AliLoader::TreeH()->GetEntries() (after LoadHeader())
-
-
-
+       - pointer to the stack is taken:
+               AliRun::Stack() (global gAlice of type AliRun - depricated way to do)
+               AliRunLoader::Stack() but before one needs to load event header by AliRunLoader::LoadHeader() otherwise both methods return 0.
+               Moreover loading header gives the information about number of particles only. 
+               To retrive the list of particle one also needs to load kinematics by AliRunLoader::LoadKinematics()        
+       - total amount of particles in stack for a given event:        
+               AliStack::GetNtrack() 
+                AliRun::GetEvent() (after LoadHeader())
+       - total amount of primary particles in stack for a given event (after LoadHeader()): 
+               AliStack::GetNprimary() 
 How to retrive hits:
-       Hits a stored on primary by primary basis. To retrieve all hits one needs to do:
-       initialise the root tree and containers:    AliLoader::LoadHits() 
-       read number of primaries in current event:
-       loop on the list of primiries:
-
-
-
+  -Hits are stored on primary by primary basis. Hits for the given primary is TClonesArray.
+   To retrieve all hits one needs to do:
+     -initialise the root tree and containers:    AliLoader::LoadHits() 
+     -read number of entries in TreeH:           TreeH()->GetEntries()
+     -loop on the list of entires:
 How to retrive sdigits? 
        Sdigits stored in tree S with the branch of TClonesArray, all sdigits in a single TClonesArray
        So the tree has only one entry.
        One needs to say:
        pRich->GetLoader()->LoadSDigits(); this one open file, get the tree and invoke AliRICH::SetTreeAddress()    
-
 What are the debug methodes avail:
        AliModule::GetDebug() now depricated, use AliDebug printout instead
        AliModule::SetDebug()
        AliRun::GetDebug()
        AliRun::SetDebug()
-
-
-How to get info for tid number?
+How to get info for a given particle number:
        Header and Kinematics trees must be loaded, then possible to retrive pointer to Stack of particles
        Int_t AliRunLoader::LoadHeader(); Int_t AliRunLoader::LoadKinematics()
        AliStack *AliRunLoader::Stack()
        TParticle *AliStack::Particle(tid)
        TParticle::Print()
-
-How to deal with AliRunDigitizer?
+How to deal with AliRunDigitizer:
        AliRunDigitizer::Exec() just call AliRunDigitizer::Digitize()   
-
-How to avoid using gAlice?
+How to avoid using gAlice:
        Rich()->GetLoader()->GetRunLoader()->GetAliRun() returns gAlice global pointer.
-         
+What are hte meanings of different VMC flags:         
+       gMC->IsTrackAlive()
+       gMC->IsTrackStop()
+       gMC->IsTrackDisappeared()
+How is sdigit prodiced from hit:
+       Responsible methode is AliRICH::
+       One hit may affect one or more pads.
+        Hit position is taken on the anod wires plane as the most of avalanche is developed there.
+        This poistion is not directly avalable, track intersections with entrance and exit of amplification gap are only store.
+        So the position in the middle of the gap is calculated as average out of In and Out position.
+        Then, total charge collected for this hit is calculated by AliRICHParam::Hit2Qdc.        
+How to get pad number for a local position:
+       use static TVector AliRICHParam::Loc2Pad(TVector2 position)
+Why list of chambers belongs to AliRICHParam:
+        
+