<commit_before>class KirConfig
{
RQ_OBJECT()
public:
  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,kGun7,kPythia7,kHijing,kHijingPara};
  
          KirConfig(const char*sFileName);
         ~KirConfig()                    {Info("ctor","");fMain->Cleanup(); delete fMain;}
  void    AddDetector(Int_t id)          {fDetectors+=id; if(id==kTRD) fDetButGrp->SetButton(kFRAME);}
  void    RemoveDetector(Int_t id)       {fDetectors-=id; if(id==kFRAME&&IsDetectorOn(kTRD)) fDetButGrp->SetButton(kTRD,kFALSE);}
  void    AddProcess(Int_t id)           {fProcesses+=id;}
  void    RemoveProcess(Int_t id)        {fProcesses-=id;}
  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;//RICH
  TGButton     *fMagFldChkBtn;                               //MAG
  TGComboBox   *fGenTypeCombo,*fGenPartIdCombo,*fGenMomCombo,*fGenChamberCombo; TGNumberEntry *fGenNprimEntry;//GEN
  Int_t         fDetectors; TGButtonGroup *fDetButGrp;       //DETECTORS
  Int_t         fProcesses;
  char         *fFileName;
};//class KirConfig
	 
KirConfig::KirConfig(const char *sFileName)
{   
  fFileName=sFileName;
  fDetectors=0;
// Create main frame       
  fMain=new TGMainFrame(gClient->GetRoot(),500,400);
//  fMain->Connect("CloseWindow()","KirConfig",this,"CloseWindow()");   
  fMain->AddFrame(pHorFrame=new TGHorizontalFrame(fMain,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?"));
//Generator  
  pVerFrame->AddFrame(pGenGrpFrm=new TGGroupFrame(pHorFrame,"Generator"));
  pGenGrpFrm->AddFrame(fGenTypeCombo=new TGComboBox(pGenGrpFrm,100));
  fGenTypeCombo->AddEntry("gun to single chamber",kGun1);  fGenTypeCombo->AddEntry("gun to all chambers",kGun7);
  fGenTypeCombo->AddEntry("7 guns on top of Pythia",kPythia7);
  fGenTypeCombo->AddEntry("HIJING",kHijing);                fGenTypeCombo->AddEntry("parametrized HIJING",kHijingPara);
  fGenTypeCombo->Select(kHijingPara);
  fGenTypeCombo->Resize(160,20);
  
  pGenGrpFrm->AddFrame(fGenPartIdCombo=new TGComboBox(pGenGrpFrm,100)); //PID for guns
  fGenPartIdCombo->AddEntry("Pion+",kPiPlus);
  fGenPartIdCombo->AddEntry("Pion-",kPiMinus);
  fGenPartIdCombo->AddEntry("Kaon+",kKPlus);
  fGenPartIdCombo->AddEntry("Kaon-",kKMinus);
  fGenPartIdCombo->AddEntry("Proton",kProton);
  fGenPartIdCombo->AddEntry("AntiProton",kProtonBar);
  fGenPartIdCombo->Select(kPiPlus);  fGenPartIdCombo->Resize(160,20);

  pGenGrpFrm->AddFrame(fGenMomCombo=new TGComboBox(pGenGrpFrm,100)); //particle energy for guns
  fGenMomCombo->AddEntry("1.5 GeV",15);
  fGenMomCombo->AddEntry("2.0 Gev",20);
  fGenMomCombo->AddEntry("2.5 GeV",25);
  fGenMomCombo->AddEntry("3.0 GeV",30);
  fGenMomCombo->AddEntry("3.5 GeV",35);
  fGenMomCombo->AddEntry("4.0 GeV",40);
  fGenMomCombo->AddEntry("4.5 GeV",45);
  fGenMomCombo->Select(40);  fGenMomCombo->Resize(160,20);
  
  pGenGrpFrm->AddFrame(fGenChamberCombo=new TGComboBox(pGenGrpFrm,100)); //chamber number in case of gun1
  for(int i=1;i<=7;i++) fGenChamberCombo->AddEntry(Form("Chamber %i",i),i);
  fGenChamberCombo->Select(4); fGenChamberCombo->Resize(160,20);
  
  pGenGrpFrm->AddFrame(pGenNprimFrm=new TGGroupFrame(pGenGrpFrm,"Number of primiries"));//number of primiries in case of HIJING
  pGenNprimFrm->AddFrame(fGenNprimEntry=new TGNumberEntry(pGenNprimFrm,500));
  
// Magnetic Field
  pVerFrame->AddFrame(pFldGrpFrm=new TGGroupFrame(pHorFrame,"Magnetic Field"));
  pFldGrpFrm->AddFrame(fMagFldChkBtn=new TGCheckButton(pFldGrpFrm,"On/Off"));
  fMagFldChkBtn->SetState(kButtonUp);
//Detectors
  pHorFrame->AddFrame(fDetButGrp=new TGButtonGroup(pHorFrame,"Detectors"));
  fDetButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddDetector(Int_t)");
  fDetButGrp->Connect("Released(Int_t)","KirConfig",this,"RemoveDetector(Int_t)");
  new TGCheckButton(fDetButGrp,"PIPE"  ,kPIPE));         
  new TGCheckButton(fDetButGrp,"ITS"   ,kITS));         
  new TGCheckButton(fDetButGrp,"TPC"   ,kTPC));
  new TGCheckButton(fDetButGrp,"TRD"   ,kTRD));
  new TGCheckButton(fDetButGrp,"TOF"   ,kTOF));         
  new TGCheckButton(fDetButGrp,"FRAME" ,kFRAME));         
  new TGCheckButton(fDetButGrp,"MAG"   ,kMAG));         
  new TGCheckButton(fDetButGrp,"CRT"   ,kCRT));         
  new TGCheckButton(fDetButGrp,"HALL"  ,kHALL));         
  new TGCheckButton(fDetButGrp,"PHOS"  ,kPHOS));         
  new TGCheckButton(fDetButGrp,"START" ,kSTART));         
  new TGCheckButton(fDetButGrp,"FMD"   ,kFMD));         
  new TGCheckButton(fDetButGrp,"ABSO"  ,kABSO));         
  new TGCheckButton(fDetButGrp,"PMD"   ,kPMD));         
  new TGCheckButton(fDetButGrp,"DIPO"  ,kDIPO));         
  new TGCheckButton(fDetButGrp,"EMCAL" ,kEMCAL));         
  new TGCheckButton(fDetButGrp,"VZERO" ,kVZERO));         
  new TGCheckButton(fDetButGrp,"MUON"  ,kMUON));         
  new TGCheckButton(fDetButGrp,"ZDC"   ,kZDC));         
  new TGCheckButton(fDetButGrp,"SHILD" ,kSHILD));         
//Processes  
  pHorFrame->AddFrame(pProcButGrp=new TGButtonGroup(pHorFrame,"Processes"));
  pProcButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddProcess(Int_t)");
  pProcButGrp->Connect("Released(Int_t)","KirConfig",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);       
//File    
  fMain->AddFrame(pFileHorFrm=new TGHorizontalFrame(fMain,100,200));
  pFileHorFrm->AddFrame(pCreateBtn=new TGTextButton(pFileHorFrm,"Create"));
  pCreateBtn->Connect("Clicked()","KirConfig",this,"CreateConfigFile()");                                 
  pFileHorFrm->AddFrame(new TGLabel(pFileHorFrm,Form(" config file as %s",fFileName)));  
  
  fMain->MapSubwindows();   
  fMain->Layout();
  fMain->SetWindowName("Create AliROOT Config script");
  fMain->MapWindow();      
}//KirCondig::ctor
          
void KirConfig::CreateConfigFile()
{   
  FILE *fp=fopen(fFileName,"w"); if(!fp){Info("CreateConfigFile","Cannot open output file:%sn",fFileName);return;}
  
  fprintf(fp,"void Config()\n");
  fprintf(fp,"{\n");
  fprintf(fp,"  ::Info(\"RICH private config\",\"Start\");\n\n"); 
//Random
  fprintf(fp,"  gRandom->SetSeed(123456);//put 0 to use system time\n\n");    
//Geant  
  fprintf(fp,"  gSystem->Load(\"libgeant321\");\n");
  fprintf(fp,"  new TGeant3(\"C++ Interface to Geant3\");\n\n");
//File
  fprintf(fp,"  AliRunLoader *pAL=AliRunLoader::Open(\"galice.root\",AliConfig::fgkDefaultEventFolderName,\"recreate\");\n");    
  fprintf(fp,"  pAL->SetCompressionLevel(2);\n");
  fprintf(fp,"  pAL->SetNumberOfEventsPerFile(50);\n");
  fprintf(fp,"  gAlice->SetRunLoader(pAL);\n\n");
//Decayer  
  fprintf(fp,"  TVirtualMCDecayer *pDecayer=new AliDecayerPythia();\n");
  fprintf(fp,"  pDecayer->SetForceDecay(kAll);\n"); 
  fprintf(fp,"  pDecayer->Init();\n"); 
  fprintf(fp,"  gMC->SetExternalDecayer(pDecayer);\n\n");
//Physics
  if(IsProcessOn(kDCAY)) fprintf(fp,"  gMC->SetProcess(\"DCAY\",1);");  else fprintf(fp,"  gMC->SetProcess(\"DCAY\",0);");
  if(IsProcessOn(kPAIR)) fprintf(fp,"  gMC->SetProcess(\"PAIR\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"PAIR\",0);\n");
  if(IsProcessOn(kCOMP)) fprintf(fp,"  gMC->SetProcess(\"COMP\",1);");  else fprintf(fp,"  gMC->SetProcess(\"COMP\",0);");
  if(IsProcessOn(kPHOT)) fprintf(fp,"  gMC->SetProcess(\"PHOT\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"PHOT\",0);\n");
  if(IsProcessOn(kPFIS)) fprintf(fp,"  gMC->SetProcess(\"PFIS\",1);");  else fprintf(fp,"  gMC->SetProcess(\"PFIS\",0);");
  if(IsProcessOn(kDRAY)) fprintf(fp,"  gMC->SetProcess(\"DRAY\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"DRAY\",0);\n");
  if(IsProcessOn(kANNI)) fprintf(fp,"  gMC->SetProcess(\"ANNI\",1);");  else fprintf(fp,"  gMC->SetProcess(\"ANNI\",0);");
  if(IsProcessOn(kBREM)) fprintf(fp,"  gMC->SetProcess(\"BREM\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"BREM\",0);\n");
  if(IsProcessOn(kMUNU)) fprintf(fp,"  gMC->SetProcess(\"MUNU\",1);");  else fprintf(fp,"  gMC->SetProcess(\"MUNU\",0);");
  if(IsProcessOn(kCKOV)) fprintf(fp,"  gMC->SetProcess(\"CKOV\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"CKOV\",0);\n");
  if(IsProcessOn(kHADR)) fprintf(fp,"  gMC->SetProcess(\"HADR\",1);");  else fprintf(fp,"  gMC->SetProcess(\"HADR\",0);");
  if(IsProcessOn(kLOSS)) fprintf(fp,"  gMC->SetProcess(\"LOSS\",2);\n");else fprintf(fp,"  gMC->SetProcess(\"LOSS\",0);\n");
  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,"  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");
  fprintf(fp,"  gMC->SetCut(\"BCUTM\" ,0.001); ");  fprintf(fp,"  gMC->SetCut(\"DCUTE\" ,0.001); ");
  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");
  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");
    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;   <commit_msg>TOF can't be created without FRAME error corrected<commit_after>class KirConfig
{
RQ_OBJECT()
public:
  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,kGun7,kPythia7,kHijing,kHijingPara};
  
          KirConfig(const char*sFileName);
         ~KirConfig()                    {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;}
  void    RemoveProcess(Int_t id)        {fProcesses-=id;}
  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;//RICH
  TGButton     *fMagFldChkBtn;                               //MAG
  TGComboBox   *fGenTypeCombo,*fGenPartIdCombo,*fGenMomCombo,*fGenChamberCombo; TGNumberEntry *fGenNprimEntry;//GEN
  Int_t         fDetectors; TGButtonGroup *fDetButGrp;       //DETECTORS
  Int_t         fProcesses;
  char         *fFileName;
};//class KirConfig
	 
KirConfig::KirConfig(const char *sFileName)
{   
  fFileName=sFileName;
  fDetectors=0;
// Create main frame       
  fMain=new TGMainFrame(gClient->GetRoot(),500,400);
//  fMain->Connect("CloseWindow()","KirConfig",this,"CloseWindow()");   
  fMain->AddFrame(pHorFrame=new TGHorizontalFrame(fMain,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);
//Generator  
  pVerFrame->AddFrame(pGenGrpFrm=new TGGroupFrame(pHorFrame,"Generator"));
  pGenGrpFrm->AddFrame(fGenTypeCombo=new TGComboBox(pGenGrpFrm,100));
  fGenTypeCombo->AddEntry("gun to single chamber",kGun1);  fGenTypeCombo->AddEntry("gun to all chambers",kGun7);
  fGenTypeCombo->AddEntry("7 guns on top of Pythia",kPythia7);
  fGenTypeCombo->AddEntry("HIJING",kHijing);                fGenTypeCombo->AddEntry("parametrized HIJING",kHijingPara);
  fGenTypeCombo->Select(kHijingPara);
  fGenTypeCombo->Resize(160,20);
  
  pGenGrpFrm->AddFrame(fGenPartIdCombo=new TGComboBox(pGenGrpFrm,100)); //PID for guns
  fGenPartIdCombo->AddEntry("Pion+",kPiPlus);
  fGenPartIdCombo->AddEntry("Pion-",kPiMinus);
  fGenPartIdCombo->AddEntry("Kaon+",kKPlus);
  fGenPartIdCombo->AddEntry("Kaon-",kKMinus);
  fGenPartIdCombo->AddEntry("Proton",kProton);
  fGenPartIdCombo->AddEntry("AntiProton",kProtonBar);
  fGenPartIdCombo->Select(kPiPlus);  fGenPartIdCombo->Resize(160,20);

  pGenGrpFrm->AddFrame(fGenMomCombo=new TGComboBox(pGenGrpFrm,100)); //particle energy for guns
  fGenMomCombo->AddEntry("1.5 GeV",15);
  fGenMomCombo->AddEntry("2.0 Gev",20);
  fGenMomCombo->AddEntry("2.5 GeV",25);
  fGenMomCombo->AddEntry("3.0 GeV",30);
  fGenMomCombo->AddEntry("3.5 GeV",35);
  fGenMomCombo->AddEntry("4.0 GeV",40);
  fGenMomCombo->AddEntry("4.5 GeV",45);
  fGenMomCombo->Select(40);  fGenMomCombo->Resize(160,20);
  
  pGenGrpFrm->AddFrame(fGenChamberCombo=new TGComboBox(pGenGrpFrm,100)); //chamber number in case of gun1
  for(int i=1;i<=7;i++) fGenChamberCombo->AddEntry(Form("Chamber %i",i),i);
  fGenChamberCombo->Select(4); fGenChamberCombo->Resize(160,20);
  
  pGenGrpFrm->AddFrame(pGenNprimFrm=new TGGroupFrame(pGenGrpFrm,"Number of primiries"));//number of primiries in case of HIJING
  pGenNprimFrm->AddFrame(fGenNprimEntry=new TGNumberEntry(pGenNprimFrm,500));
  
// Magnetic Field
  pVerFrame->AddFrame(pFldGrpFrm=new TGGroupFrame(pHorFrame,"Magnetic Field"));
  pFldGrpFrm->AddFrame(fMagFldChkBtn=new TGCheckButton(pFldGrpFrm,"On/Off"));
  fMagFldChkBtn->SetState(kButtonUp);
//Detectors
  pHorFrame->AddFrame(fDetButGrp=new TGButtonGroup(pHorFrame,"Detectors"));
  fDetButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddDetector(Int_t)");
  fDetButGrp->Connect("Released(Int_t)","KirConfig",this,"RemoveDetector(Int_t)");
  new TGCheckButton(fDetButGrp,"PIPE"  ,kPIPE));         
  new TGCheckButton(fDetButGrp,"ITS"   ,kITS));         
  new TGCheckButton(fDetButGrp,"TPC"   ,kTPC));
  new TGCheckButton(fDetButGrp,"TRD"   ,kTRD));
  new TGCheckButton(fDetButGrp,"TOF"   ,kTOF));         
  new TGCheckButton(fDetButGrp,"FRAME" ,kFRAME));         
  new TGCheckButton(fDetButGrp,"MAG"   ,kMAG));         
  new TGCheckButton(fDetButGrp,"CRT"   ,kCRT));         
  new TGCheckButton(fDetButGrp,"HALL"  ,kHALL));         
  new TGCheckButton(fDetButGrp,"PHOS"  ,kPHOS));         
  new TGCheckButton(fDetButGrp,"START" ,kSTART));         
  new TGCheckButton(fDetButGrp,"FMD"   ,kFMD));         
  new TGCheckButton(fDetButGrp,"ABSO"  ,kABSO));         
  new TGCheckButton(fDetButGrp,"PMD"   ,kPMD));         
  new TGCheckButton(fDetButGrp,"DIPO"  ,kDIPO));         
  new TGCheckButton(fDetButGrp,"EMCAL" ,kEMCAL));         
  new TGCheckButton(fDetButGrp,"VZERO" ,kVZERO));         
  new TGCheckButton(fDetButGrp,"MUON"  ,kMUON));         
  new TGCheckButton(fDetButGrp,"ZDC"   ,kZDC));         
  new TGCheckButton(fDetButGrp,"SHILD" ,kSHILD));         
//Processes  
  pHorFrame->AddFrame(pProcButGrp=new TGButtonGroup(pHorFrame,"Processes"));
  pProcButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddProcess(Int_t)");
  pProcButGrp->Connect("Released(Int_t)","KirConfig",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);       
//File    
  fMain->AddFrame(pFileHorFrm=new TGHorizontalFrame(fMain,100,200));
  pFileHorFrm->AddFrame(pCreateBtn=new TGTextButton(pFileHorFrm,"Create"));
  pCreateBtn->Connect("Clicked()","KirConfig",this,"CreateConfigFile()");                                 
  pFileHorFrm->AddFrame(new TGLabel(pFileHorFrm,Form(" config file as %s",fFileName)));  
  
  fMain->MapSubwindows();   
  fMain->Layout();
  fMain->SetWindowName("Create AliROOT Config script");
  fMain->MapWindow();      
}//KirCondig::ctor
          
void KirConfig::CreateConfigFile()
{   
  FILE *fp=fopen(fFileName,"w"); if(!fp){Info("CreateConfigFile","Cannot open output file:%sn",fFileName);return;}
  
  fprintf(fp,"void Config()\n");
  fprintf(fp,"{\n");
  fprintf(fp,"  ::Info(\"RICH private config\",\"Start\");\n\n"); 
//Random
  fprintf(fp,"  gRandom->SetSeed(123456);//put 0 to use system time\n\n");    
//Geant  
  fprintf(fp,"  gSystem->Load(\"libgeant321\");\n");
  fprintf(fp,"  new TGeant3(\"C++ Interface to Geant3\");\n\n");
//File
  fprintf(fp,"  AliRunLoader *pAL=AliRunLoader::Open(\"galice.root\",AliConfig::fgkDefaultEventFolderName,\"recreate\");\n");    
  fprintf(fp,"  pAL->SetCompressionLevel(2);\n");
  fprintf(fp,"  pAL->SetNumberOfEventsPerFile(1000);\n");
  fprintf(fp,"  gAlice->SetRunLoader(pAL);\n\n");
//Decayer  
  fprintf(fp,"  TVirtualMCDecayer *pDecayer=new AliDecayerPythia();\n");
  fprintf(fp,"  pDecayer->SetForceDecay(kAll);\n"); 
  fprintf(fp,"  pDecayer->Init();\n"); 
  fprintf(fp,"  gMC->SetExternalDecayer(pDecayer);\n\n");
//Physics
  if(IsProcessOn(kDCAY)) fprintf(fp,"  gMC->SetProcess(\"DCAY\",1);");  else fprintf(fp,"  gMC->SetProcess(\"DCAY\",0);");
  if(IsProcessOn(kPAIR)) fprintf(fp,"  gMC->SetProcess(\"PAIR\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"PAIR\",0);\n");
  if(IsProcessOn(kCOMP)) fprintf(fp,"  gMC->SetProcess(\"COMP\",1);");  else fprintf(fp,"  gMC->SetProcess(\"COMP\",0);");
  if(IsProcessOn(kPHOT)) fprintf(fp,"  gMC->SetProcess(\"PHOT\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"PHOT\",0);\n");
  if(IsProcessOn(kPFIS)) fprintf(fp,"  gMC->SetProcess(\"PFIS\",1);");  else fprintf(fp,"  gMC->SetProcess(\"PFIS\",0);");
  if(IsProcessOn(kDRAY)) fprintf(fp,"  gMC->SetProcess(\"DRAY\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"DRAY\",0);\n");
  if(IsProcessOn(kANNI)) fprintf(fp,"  gMC->SetProcess(\"ANNI\",1);");  else fprintf(fp,"  gMC->SetProcess(\"ANNI\",0);");
  if(IsProcessOn(kBREM)) fprintf(fp,"  gMC->SetProcess(\"BREM\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"BREM\",0);\n");
  if(IsProcessOn(kMUNU)) fprintf(fp,"  gMC->SetProcess(\"MUNU\",1);");  else fprintf(fp,"  gMC->SetProcess(\"MUNU\",0);");
  if(IsProcessOn(kCKOV)) fprintf(fp,"  gMC->SetProcess(\"CKOV\",1);\n");else fprintf(fp,"  gMC->SetProcess(\"CKOV\",0);\n");
  if(IsProcessOn(kHADR)) fprintf(fp,"  gMC->SetProcess(\"HADR\",1);");  else fprintf(fp,"  gMC->SetProcess(\"HADR\",0);");
  if(IsProcessOn(kLOSS)) fprintf(fp,"  gMC->SetProcess(\"LOSS\",2);\n");else fprintf(fp,"  gMC->SetProcess(\"LOSS\",0);\n");
  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,"  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");
  fprintf(fp,"  gMC->SetCut(\"BCUTM\" ,0.001); ");  fprintf(fp,"  gMC->SetCut(\"DCUTE\" ,0.001); ");
  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");
  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");
    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;   
{'fraction_non_alphanumeric': 0.19103274148884183, 'fraction_numerical': 0.025981430200358365, 'mean_word_length': 5.096573982125124, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 271, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5067864', 'n_tokens_mistral': 10340, 'n_tokens_neox': 9834, 'n_words': 1106}