#include class RichConfig : public TGMainFrame { RQ_OBJECT() public: RichConfig(const char*sFileName); ~RichConfig() {Info("ctor","");Cleanup();} enum EVersOpts {kNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kSecRad,kQe0=400,kQeNorm,kOptics}; enum EGenTypes {kGunZ=1,kGun1,kGun7,kBox1,kBox7,kHijing,kHijingPara,kPythia,kRichLib,kNotUsed=999}; enum EDetectors {kPIPE=1,kITS,kTPC,kTRD,kTOF,kFRAME,kMAG,kCRT,kHALL,kPHOS,kSTART,kFMD,kABSO,kPMD,kDIPO,kEMCAL,kVZERO,kMUON,kZDC,kSHILD}; enum EProcesses {kDCAY=1,kPAIR,kCOMP,kPHOT,kPFIS,kDRAY,kANNI,kBREM,kMUNU,kCKOV,kHADR,kLOSS,kMULS,kRAYL,kALL}; enum EBatchFlags{kPrim=555,kTransport,kAll,kOnly,kRawDdl,kRawDate,kRawRoot,kVertex,kTrack,kEsd}; Float_t Eta2Theta (Float_t arg) const{return (180./TMath::Pi())*2.*TMath::ATan(TMath::Exp(-arg));} void GuiRich (TGHorizontalFrame *pMainF); void WriteRich (FILE *pF); void RichSlot (Int_t ver); void GuiPhys (TGHorizontalFrame *pMainF); void WritePhys (FILE *pF); void PhysAddSlot(Int_t id); void PhysRemSlot(Int_t id); void GuiGen (TGCompositeFrame *pMainF); void WriteGen (FILE *pF); void GenAddSlot (Int_t id); void GenRemSlot (Int_t id); void GuiDet (TGHorizontalFrame *pMainF); void WriteDet (FILE *pF); void DetAddSlot (Int_t id); void DetRemSlot (Int_t id); void GuiBatch(TGHorizontalFrame *pMainF); void WriteBatch( ); void WriteConfig(); void ExitSlot(); TGButtonGroup *fVerBG,*fOptBG,*fQeBG; //Rich widgets TGButton *fMagB; //magnet field widgets TGComboBox *fGenPidCO,*fGenPminCO,*fGenPmaxCO,*fGenChamCO,*fGenNprimCO; //generator widgets combos TGCompositeFrame *fGenF; //generator widgets frames TGButtonGroup *fGenBG; //generator widgets TGButtonGroup *fDetBG,*fProcBG; //detectors and processes widgets TGButtonGroup *fSimBG,*fSDigBG,*fDigBG,*fRawBG,*fClusBG,*fRecoBG; //batch control widgets char *fFileName; };//class RichConfig //__________________________________________________________________________________________________ RichConfig::RichConfig(const char *sFileName):TGMainFrame(gClient->GetRoot(),700,400) { fFileName=sFileName; AddFrame(pMainF=new TGHorizontalFrame(this,100,200)); //main horizontal frame // Magnetic Field pMainF->AddFrame(fMagB=new TGCheckButton(pMainF,"Mag field On/Off")); fMagB->SetState(kButtonDown); GuiRich (pMainF); GuiGen (pMainF); GuiDet (pMainF); GuiPhys (pMainF); GuiBatch(pMainF); //File AddFrame(pFileHF=new TGHorizontalFrame(this,100,200)); pFileHF->AddFrame(pCrtTB=new TGTextButton(pFileHF,"Create")); pCrtTB->Connect("Clicked()","RichConfig",this,"ExitSlot()"); pFileHF->AddFrame(new TGLabel(pFileHF,Form(" config file as %s",fFileName))); MapSubwindows(); Resize(GetDefaultSize()); SetWindowName("Create AliROOT scripts"); MapWindow(); }//KirCondig::ctor //__________________________________________________________________________________________________ void RichConfig::GuiRich(TGHorizontalFrame *pMainHF) { pMainHF->AddFrame(pLeftVF=new TGVerticalFrame(pMainHF,100,200)); pLeftVF->AddFrame(pRichGF=new TGGroupFrame(pLeftVF,"RICH")); pRichGF->AddFrame(fVerBG=new TGButtonGroup(pRichGF,"")); fVerBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"RichVerSlot(Int_t)"); new TGRadioButton(fVerBG, "No" ,kNo )); new TGRadioButton(fVerBG, "ver0" ,kVer0 )); new TGRadioButton(fVerBG, "ver1" ,kVer1 )); fVerBG->SetButton(kVer1); new TGRadioButton(fVerBG, "ver2" ,kVer2 )); pRichGF->AddFrame(fOptBG=new TGButtonGroup(pRichGF,"")); fOptBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"RichVerSlot(Int_t)"); new TGCheckButton(fOptBG,"Test beam position?" ,kTest); new TGCheckButton(fOptBG,"Second radiator?" ,kSecRad); new TGCheckButton(fOptBG,"Decluster?" ,kDeclust); fOptBG->SetButton(kDeclust); new TGCheckButton(fOptBG,"Wire sagita?" ,kSagita); fOptBG->SetButton(kSagita); new TGCheckButton(fOptBG,"Feedbacks?" ,kFeedback); fOptBG->SetButton(kFeedback); new TGCheckButton(fOptBG,"Plot optics?" ,kOptics); pRichGF->AddFrame(fQeBG=new TGButtonGroup(pRichGF,"")); new TGRadioButton(fQeBG,"QE=0" ,kQe0); new TGRadioButton(fQeBG,"QE normal" ,kQeNorm); fQeBG->SetButton(kQeNorm); }//Rich() //__________________________________________________________________________________________________ void RichConfig::RichVerSlot(Int_t ver) { if(ver==kTest) {fMagB->SetState(kButtonUp); fGenBG->SetButton(kGunZ); } } //__________________________________________________________________________________________________ void RichConfig::WriteRich(FILE *pF) { if(!fVerBG->GetButton(kNo)->GetState()){ if( fOptBG->GetButton(kSecRad)->GetState()) fprintf(pF," AliRICHParam::fgIsSecondRadiator=kTRUE;\n"); if(!fOptBG->GetButton(kSagita)->GetState()) fprintf(pF," AliRICHParam::fgIsWireSagita=kFALSE;\n"); if( fOptBG->GetButton(kTest) ->GetState()) fprintf(pF," AliRICHParam::fgIsTestBeam=kTRUE;\n"); if( fOptBG->GetButton(kTest) ->GetState()) fprintf(pF," AliRICHParam::fgIsOptDisp=kTRUE;\n"); if (fVerBG->GetButton(kVer0)->GetState()) fprintf(pF," AliRICH *pRICH=new AliRICHv0(\"Debug\");\n\n"); else if(fVerBG->GetButton(kVer1)->GetState()) fprintf(pF," AliRICH *pRICH=new AliRICHv1(\"RICH\",\"Normal RICH\");\n\n"); else if(fVerBG->GetButton(kVer2)->GetState()) fprintf(pF," AliRICH *pRICH=new AliRICHv2(\"New Rich\");\n\n"); } } //__________________________________________________________________________________________________ void RichConfig::GuiPhys(TGHorizontalFrame *pMainHF) { pMainHF->AddFrame(fProcBG=new TGButtonGroup(pMainHF,"Processes")); fProcBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"PhysAddSlot(Int_t)"); fProcBG->Connect("Released(Int_t)","RichConfig",this,"PhysRemSlot(Int_t)"); new TGCheckButton(fProcBG,"ALL ON/OFF" ,kALL)) ; new TGCheckButton(fProcBG,"DCAY Decay" ,kDCAY)); fProcBG->SetButton(kDCAY); new TGCheckButton(fProcBG,"PAIR Pair production" ,kPAIR)); fProcBG->SetButton(kPAIR); new TGCheckButton(fProcBG,"COMP Compton" ,kCOMP)); fProcBG->SetButton(kCOMP); new TGCheckButton(fProcBG,"PHOT" ,kPHOT)); fProcBG->SetButton(kPHOT); new TGCheckButton(fProcBG,"PFIS Photofission" ,kPFIS)); new TGCheckButton(fProcBG,"DRAY Delta electrons" ,kDRAY)); new TGCheckButton(fProcBG,"ANNI Annihilation" ,kANNI)); fProcBG->SetButton(kANNI); new TGCheckButton(fProcBG,"BREM Bremstraslung" ,kBREM)); fProcBG->SetButton(kBREM); new TGCheckButton(fProcBG,"MUNU Muon-Nuclear" ,kMUNU)); fProcBG->SetButton(kMUNU); new TGCheckButton(fProcBG,"CKOV Cerenkovs" ,kCKOV)); fProcBG->SetButton(kCKOV); new TGCheckButton(fProcBG,"HADR Hadronic interactions " ,kHADR)); fProcBG->SetButton(kHADR); new TGCheckButton(fProcBG,"LOSS Energy losses" ,kLOSS)); fProcBG->SetButton(kLOSS); new TGCheckButton(fProcBG,"MULS Multiple scattering" ,kMULS)); fProcBG->SetButton(kMULS); new TGCheckButton(fProcBG,"RAYL Rayleigh scattering" ,kRAYL)); fProcBG->SetButton(kRAYL); } //__________________________________________________________________________________________________ void RichConfig::PhysAddSlot(Int_t id) {//slot is invoked when any of physics check button is pressed if(id==kALL) //if the pressed check button is kALL then switch on all the buttons for(int i=1;i<=fProcBG->GetCount();i++) fProcBG->SetButton(i,kButtonDown); } //__________________________________________________________________________________________________ void RichConfig::PhysRemSlot(Int_t id) {//slot is invoked when any of physics check button is released if(id==kALL) //if the released check button is kALL then switch off all the buttons for(int i=1;i<=fProcBG->GetCount();i++) fProcBG->SetButton(i,kButtonUp); } //__________________________________________________________________________________________________ void RichConfig::WritePhys(FILE *pF) { if(fProcBG->GetButton(kDCAY)->GetState()) fprintf(pF," gMC->SetProcess(\"DCAY\",1); ");else fprintf(pF," gMC->SetProcess(\"DCAY\",0); "); if(fProcBG->GetButton(kPAIR)->GetState()) fprintf(pF," gMC->SetProcess(\"PAIR\",1); ");else fprintf(pF," gMC->SetProcess(\"PAIR\",0); "); if(fProcBG->GetButton(kCOMP)->GetState()) fprintf(pF," gMC->SetProcess(\"COMP\",1);\n");else fprintf(pF," gMC->SetProcess(\"COMP\",0);\n"); if(fProcBG->GetButton(kPHOT)->GetState()) fprintf(pF," gMC->SetProcess(\"PHOT\",1); ");else fprintf(pF," gMC->SetProcess(\"PHOT\",0); "); if(fProcBG->GetButton(kPFIS)->GetState()) fprintf(pF," gMC->SetProcess(\"PFIS\",1); ");else fprintf(pF," gMC->SetProcess(\"PFIS\",0); "); if(fProcBG->GetButton(kDRAY)->GetState()) fprintf(pF," gMC->SetProcess(\"DRAY\",1);\n");else fprintf(pF," gMC->SetProcess(\"DRAY\",0);\n"); if(fProcBG->GetButton(kANNI)->GetState()) fprintf(pF," gMC->SetProcess(\"ANNI\",1); ");else fprintf(pF," gMC->SetProcess(\"ANNI\",0); "); if(fProcBG->GetButton(kBREM)->GetState()) fprintf(pF," gMC->SetProcess(\"BREM\",1); ");else fprintf(pF," gMC->SetProcess(\"BREM\",0); "); if(fProcBG->GetButton(kMUNU)->GetState()) fprintf(pF," gMC->SetProcess(\"MUNU\",1);\n");else fprintf(pF," gMC->SetProcess(\"MUNU\",0);\n"); if(fProcBG->GetButton(kCKOV)->GetState()) fprintf(pF," gMC->SetProcess(\"CKOV\",1); ");else fprintf(pF," gMC->SetProcess(\"CKOV\",0); "); if(fProcBG->GetButton(kHADR)->GetState()) fprintf(pF," gMC->SetProcess(\"HADR\",1); ");else fprintf(pF," gMC->SetProcess(\"HADR\",0); "); if(fProcBG->GetButton(kLOSS)->GetState()) fprintf(pF," gMC->SetProcess(\"LOSS\",2);\n");else fprintf(pF," gMC->SetProcess(\"LOSS\",0);\n"); if(fProcBG->GetButton(kMULS)->GetState()) fprintf(pF," gMC->SetProcess(\"MULS\",1); ");else fprintf(pF," gMC->SetProcess(\"MULS\",0); "); if(fProcBG->GetButton(kRAYL)->GetState()) fprintf(pF," gMC->SetProcess(\"RAYL\",1);\n");else fprintf(pF," gMC->SetProcess(\"RAYL\",0);\n"); fprintf(pF,"\n"); fprintf(pF," gMC->SetCut(\"CUTGAM\",0.001); "); fprintf(pF," gMC->SetCut(\"CUTELE\",0.001); "); fprintf(pF," gMC->SetCut(\"CUTNEU\",0.001);\n"); fprintf(pF," gMC->SetCut(\"CUTHAD\",0.001); "); fprintf(pF," gMC->SetCut(\"CUTMUO\",0.001); "); fprintf(pF," gMC->SetCut(\"BCUTE\" ,0.001);\n"); fprintf(pF," gMC->SetCut(\"BCUTM\" ,0.001); "); fprintf(pF," gMC->SetCut(\"DCUTE\" ,0.001); "); fprintf(pF," gMC->SetCut(\"DCUTM\" ,0.001);\n"); fprintf(pF," gMC->SetCut(\"PPCUTM\",0.001); "); fprintf(pF," gMC->SetCut(\"TOFMAX\",1e10);\n\n"); }//WritePhys() //__________________________________________________________________________________________________ void RichConfig::GuiGen(TGCompositeFrame *pMainF) {//generator configurator implemented as group of radio buttons pMainF->AddFrame(fGenF=new TGVerticalFrame(pMainF));//add generator vertical frame to horizontal main frame fGenF->AddFrame(fGenBG=new TGButtonGroup(fGenF,"Generator"));//add type button group to vertical generator frame fGenBG->Connect("Pressed(Int_t)","RichConfig",this,"GenAddSlot(Int_t)"); fGenBG->Connect("Released(Int_t)","RichConfig",this,"GenRemSlot(Int_t)"); new TGCheckButton(fGenBG,"gun along z" ,kGunZ); new TGCheckButton(fGenBG,"gun to 1 chamber" ,kGun1); new TGCheckButton(fGenBG,"gun to 7 chambers" ,kGun7); new TGCheckButton(fGenBG,"box to 1 chamber" ,kBox1); new TGCheckButton(fGenBG,"box to 7 chambers" ,kBox7); new TGCheckButton(fGenBG,"HIJING" ,kHijing); new TGCheckButton(fGenBG,"HIJING para" ,kHijingPara); new TGCheckButton(fGenBG,"Pythia" ,kPythia); new TGCheckButton(fGenBG,"RICH lib" ,kRichLib); //N prims for box and Hijing para fGenF->AddFrame(fGenNprimCO=new TGComboBox(fGenF,100)); //add N prims combo to generator vertical frame fGenNprimCO->AddEntry("not used" ,kNotUsed); fGenNprimCO->AddEntry("N prim=1" ,1); fGenNprimCO->AddEntry("N prim=2" ,2); fGenNprimCO->AddEntry("N prim=5" ,5); fGenNprimCO->AddEntry("N prim=500" ,5); fGenNprimCO->AddEntry("N prim=80000",80000); fGenNprimCO->Resize(160,20); fGenNprimCO->Select(kNotUsed); //PID fGenF->AddFrame(fGenPidCO=new TGComboBox(fGenF,100)); //add pid combo to generator vertical frame fGenPidCO->AddEntry("not used" ,kNotUsed); fGenPidCO->AddEntry("electron" ,kElectron); fGenPidCO->AddEntry("positron" ,kPositron); fGenPidCO->AddEntry("pion +" ,kPiPlus); fGenPidCO->AddEntry("pion -" ,kPiMinus); fGenPidCO->AddEntry("kaon +" ,kKPlus); fGenPidCO->AddEntry("kaon -" ,kKMinus); fGenPidCO->AddEntry("kaon 0" ,kK0Short); fGenPidCO->AddEntry("proton" ,kProton); fGenPidCO->AddEntry("antiproton" ,kProtonBar); fGenPidCO->AddEntry("lambda" ,kLambda0); fGenPidCO->AddEntry("antilambda" ,kLambda0Bar); fGenPidCO->Resize(160,20); fGenPidCO->Select(kNotUsed); //Pmin fGenF->AddFrame(fGenPminCO=new TGComboBox(fGenF,100)); //add Pmin combo to generator vertical frame fGenPminCO->AddEntry("not used",kNotUsed); for(Int_t i=5;i<=295;i+=5) fGenPminCO->AddEntry(Form("Pmin=%3.1f GeV",0.1*i), i); fGenPminCO->Resize(160,20); fGenPminCO->Select(kNotUsed); //Pmax fGenF->AddFrame(fGenPmaxCO=new TGComboBox(fGenF,100)); //add Pmax combo to generator vertical frame fGenPmaxCO->AddEntry("not used",kNotUsed); for(Int_t i=10;i<=295;i+=5) fGenPmaxCO->AddEntry(Form("Pmax=%3.1f GeV",0.1*i), i); fGenPmaxCO->Resize(160,20); fGenPmaxCO->Select(kNotUsed); //Chamber number fGenF->AddFrame(fGenChamCO=new TGComboBox(fGenF,100)); //add chamber number combo to generator vertical frame fGenChamCO->AddEntry("not used",kNotUsed); for(int i=1;i<=7;i++) fGenChamCO->AddEntry(Form("Chamber %i",i),i); fGenChamCO->Resize(160,20); fGenChamCO->Select(kNotUsed); }//GuiGen() //__________________________________________________________________________________________________ void RichConfig::GenAddSlot(Int_t id) {//is invoked when any of generator check button is pressed if(id==kGunZ){ fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenF->HideFrame(fGenNprimCO); fGenBG->GetButton(kGun7)->SetEnabled(kFALSE); fGenPidCO->Select(kProton); fGenBG->GetButton(kBox1)->SetEnabled(kFALSE); fGenF->HideFrame(fGenPmaxCO); fGenPminCO->Select(25); fGenBG->GetButton(kBox7)->SetEnabled(kFALSE); fGenF->HideFrame(fGenChamCO); } if(id==kGun1){ fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenF->HideFrame(fGenNprimCO); fGenBG->GetButton(kGun7)->SetEnabled(kFALSE); fGenF->HideFrame(fGenPmaxCO); fGenBG->GetButton(kBox1)->SetEnabled(kFALSE); fGenBG->GetButton(kBox7)->SetEnabled(kFALSE); fGenPidCO->Select(kProton); fGenPminCO->Select(25); fGenChamCO->Select(4); } if(id==kGun7){ fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenF->HideFrame(fGenNprimCO); fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenPidCO->Select(kProton); fGenBG->GetButton(kBox1)->SetEnabled(kFALSE); fGenF->HideFrame(fGenPmaxCO); fGenPminCO->Select(25); fGenBG->GetButton(kBox7)->SetEnabled(kFALSE); fGenF->HideFrame(fGenChamCO); } if(id==kBox1){ fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenNprimCO->Select(1); fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenPidCO ->Select(kProton); fGenBG->GetButton(kGun7)->SetEnabled(kFALSE); fGenPminCO ->Select(5); fGenPmaxCO->Select(25); fGenBG->GetButton(kBox7)->SetEnabled(kFALSE); fGenChamCO ->Select(4); } if(id==kBox7){ fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenNprimCO->Select(1); fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenPidCO ->Select(kProton); fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenPminCO ->Select(5); fGenPmaxCO->Select(25); fGenBG->GetButton(kBox1)->SetEnabled(kFALSE); fGenF->HideFrame(fGenChamCO); } if(id==kHijing){ fGenBG->GetButton(kHijing)->ChangeBackground(0xff0000); fGenBG->GetButton(kHijingPara)->SetEnabled(kFALSE); fGenBG->GetButton(kPythia)->SetEnabled(kFALSE); } if(id==kHijingPara){ fGenBG->GetButton(kHijing)->SetEnabled(kFALSE); fGenBG->GetButton(kPythia)->SetEnabled(kFALSE); } if(id==kPythia){ fGenBG->GetButton(kHijing)->SetEnabled(kFALSE); fGenBG->GetButton(kHijingPara)->SetEnabled(kFALSE); } }//GenAddSlot() //__________________________________________________________________________________________________ void RichConfig::GenRemSlot(Int_t id) {//is invoked when any of generator check button is released if(id==kGunZ){ fGenBG->GetButton(kGun1)->SetEnabled(); fGenF->ShowFrame(fGenNprimCO); fGenBG->GetButton(kGun7)->SetEnabled(); fGenPidCO ->Select(kNotUsed); fGenBG->GetButton(kBox1)->SetEnabled(); fGenF->ShowFrame(fGenPmaxCO); fGenPminCO ->Select(kNotUsed); fGenBG->GetButton(kBox7)->SetEnabled(); fGenF->ShowFrame(fGenChamCO); } if(id==kGun1){ fGenBG->GetButton(kGunZ)->SetEnabled(); fGenF->ShowFrame(fGenNprimCO); fGenBG->GetButton(kGun7)->SetEnabled(); fGenPidCO ->Select(kNotUsed); fGenBG->GetButton(kBox1)->SetEnabled(); fGenF->ShowFrame(fGenPmaxCO); fGenPminCO ->Select(kNotUsed); fGenBG->GetButton(kBox7)->SetEnabled(); fGenChamCO ->Select(kNotUsed); } if(id==kGun7){ fGenBG->GetButton(kGunZ)->SetEnabled(); fGenF->ShowFrame(fGenNprimCO); fGenBG->GetButton(kGun1)->SetEnabled(); fGenPidCO ->Select(kNotUsed); fGenBG->GetButton(kBox1)->SetEnabled(); fGenF->ShowFrame(fGenPmaxCO); fGenPminCO ->Select(kNotUsed); fGenBG->GetButton(kBox7)->SetEnabled(); fGenF->ShowFrame(fGenChamCO); } if(id==kBox1){ fGenBG->GetButton(kGunZ)->SetEnabled(); fGenNprimCO->Select(kNotUsed); fGenBG->GetButton(kGun1)->SetEnabled(); fGenPidCO ->Select(kNotUsed); fGenBG->GetButton(kGun7)->SetEnabled(); fGenPminCO ->Select(kNotUsed); fGenPmaxCO->Select(kNotUsed); fGenBG->GetButton(kBox7)->SetEnabled(); fGenChamCO ->Select(kNotUsed); } if(id==kBox7){ fGenBG->GetButton(kGunZ)->SetEnabled(); fGenNprimCO->Select(kNotUsed); fGenBG->GetButton(kGun1)->SetEnabled(); fGenPidCO ->Select(kNotUsed); fGenBG->GetButton(kGun1)->SetEnabled(); fGenPminCO ->Select(kNotUsed); fGenPmaxCO->Select(kNotUsed); fGenBG->GetButton(kBox1)->SetEnabled(); fGenF->ShowFrame(fGenChamCO); } if(id==kHijing){ fGenBG->GetButton(kHijing)->ChangeBackground(0xbebebe); fGenBG->GetButton(kHijingPara)->SetEnabled(); fGenBG->GetButton(kPythia)->SetEnabled(); } if(id==kHijingPara){ fGenBG->GetButton(kHijing)->SetEnabled(); fGenBG->GetButton(kPythia)->SetEnabled(); } if(id==kPythia){ fGenBG->GetButton(kHijing)->SetEnabled(); fGenBG->GetButton(kHijingPara)->SetEnabled(); } }//GenRemSlot() //__________________________________________________________________________________________________ void RichConfig::WriteGen(FILE *pF) { fprintf(pF," AliGenCocktail *pCocktail=new AliGenCocktail();\n\n"); if(fGenBG->GetButton(kGunZ)->GetState()==kButtonDown){//1 particle along Z axis fprintf(pF," AliGenFixed *pGunZ=new AliGenFixed(1);\n"); fprintf(pF," pGunZ->SetPart(%i); pGunZ->SetMomentum(%.1f); pGunZ->SetOrigin(0,0,-200);\n",fGenPidCO->GetSelected(),float(fGenPminCO->GetSelected())/10); fprintf(pF," pCocktail->AddGenerator(pGunZ,\"gunZ\",1);\n\n"); } if(fGenBG->GetButton(kGun1)->GetState()==kButtonDown){//1 gun towards 1 RICH chamber fprintf(pF," AliGenFixed *pGun1=new AliGenFixed(1);\n"); fprintf(pF," pGun1->SetPart(%i); pGun1->SetMomentum(%.1f);\n",fGenPidCO->GetSelected(),float(fGenPminCO->GetSelected())/10); fprintf(pF," pGun1->SetTheta(pRICH->C(%i)->ThetaD()-2); pGun1->SetPhi(pRICH->C(%i)->PhiD()-2); \n",fGenChamCO->GetSelected(),fGenChamCO->GetSelected()); fprintf(pF," pCocktail->AddGenerator(pGun1,\"gun1\",1);\n\n"); } if(fGenBG->GetButton(kGun7)->GetState()==kButtonDown){//7 guns towards 7 RICH chambers fprintf(pF," for(int i=1;i<=7;i++){\n"); fprintf(pF," AliGenFixed *pGun7=new AliGenFixed(1);\n"); fprintf(pF," pGun7->SetPart(%i); pGun7->SetMomentum(1.0+i*0.5);\n",fGenPidCO->GetSelected()); fprintf(pF," pGun7->SetTheta(pRICH->C(i)->ThetaD()-2); pGun7->SetPhi(pRICH->C(i)->PhiD()); \n"); fprintf(pF," pCocktail->AddGenerator(pGun7,Form(\"gun7-%%i\",i),1);\n }\n\n"); } if(fGenBG->GetButton(kBox1)->GetState()==kButtonDown){//1 box towards 1 RICH chamber fprintf(pF," AliGenBox *pBox1=new AliGenBox(1);\n"); fprintf(pF," pBox1->SetPart(%i); pBox1->SetMomentumRange(%.1f,%.1f);\n",fGenPidCO->GetSelected(),float(fGenPminCO->GetSelected())/10,float(fGenPmaxCO->GetSelected())/10); fprintf(pF," pBox1->SetThetaRange(pRICH->C(%i)->ThetaD()-3,pRICH->C(%i)->ThetaD()-1); \n",fGenChamCO->GetSelected(),fGenChamCO->GetSelected()); fprintf(pF," pBox1->SetPhiRange(pRICH->C(%i)->PhiD()-1,pRICH->C(%i)->PhiD()+1); \n",fGenChamCO->GetSelected(),fGenChamCO->GetSelected()); fprintf(pF," pCocktail->AddGenerator(pBox1,\"box1\",1);\n\n"); } if(fGenBG->GetButton(kBox7)->GetState()==kButtonDown){//7 boxes towards 7 RICH chambers fprintf(pF," AliGenCocktail *pCocktail=new AliGenCocktail();\n"); fprintf(pF," for(int i=1;i<=7;i++){\n"); fprintf(pF," AliGenBox *pGen=new AliGenBox(1);\n"); fprintf(pF," pGen->SetPart(%i); pGen->SetMomentumRange(%.1f,%.1f); \n",fGenPidCO->GetSelected(),float(fGenPminCO->GetSelected())/10,float(fGenPmaxCO->GetSelected())/10); fprintf(pF," pGen->SetThetaRange(pRICH->C(i)->ThetaD()-3,pRICH->C(i)->ThetaD()-1); pGen->SetPhiRange(pRICH->C(i)->PhiD()-1,pRICH->C(i)->PhiD()+1); \n"); fprintf(pF," pCocktail->AddGenerator(pGen,Form(\"Box %i\",i),1);\n }\n\n"); } if(fGenBG->GetButton(kHijing)->GetState()==kButtonDown){//normal HIJING fprintf(pF," AliGenHijing *pHij=new AliGenHijing(-1); pHij->SetEnergyCMS(5500); pHij->SetReferenceFrame(\"CMS\");\n"); fprintf(pF," pHij->SetProjectile(\"A\", 208, 82); pHij->SetTarget(\"A\", 208, 82);\n"); fprintf(pF," pHij->SetJetQuenching(0); pHij->SetShadowing(0);\n"); fprintf(pF," pHij->KeepFullEvent(); pHij->SetSelectAll(0); \n"); fprintf(pF," pHij->SetImpactParameterRange(0, 5); //fermi\n"); fprintf(pF," pCocktail->AddGenerator(pHij,\"hijing\",1);\n\n"); } if(fGenBG->GetButton(kHijingPara)->GetState()==kButtonDown){//parametrized HIJING fprintf(pF," AliGenHIJINGpara *pGen=new AliGenHIJINGpara(%i);\n",(int)fGenNprimCO->GetSelected()); fprintf(pF," pHijPara->SetMomentumRange(0,999); pHijPara->SetThetaRange(%f,%f); pHijPara->SetPhiRange(0,360);\n",Eta2Theta(8),Eta2Theta(-8)); fprintf(pF," pCocktail->AddGenerator(pHijPara,\"hijing para\",1);\n\n"); } if(fGenBG->GetButton(kPythia)->GetState()==kButtonDown){//Pythia + 7 guns towards 7 RICH chambers fprintf(pF," AliGenPythia *pPythia = new AliGenPythia(-1);\n"); fprintf(pF," pPythia->SetMomentumRange(0,999); pPythia->SetPhiRange(20,80); pPythia->SetThetaRange(75,115);\n"); fprintf(pF," pPythia->SetYRange(-12,12); pPythia->SetPtRange(0,1000); pPythia->SetStrucFunc(kCTEQ4L);\n"); fprintf(pF," pPythia->SetProcess(kPyMb); pPythia->SetEnergyCMS(14000);\n"); fprintf(pF," pCocktail->AddGenerator(pPythia,\"Pythia\",1);\n\n"); } fprintf(pF," pCocktail->Init();\n"); }//WriteGenerator() //__________________________________________________________________________________________________ void RichConfig::GuiDet(TGHorizontalFrame *pMainHF) { pMainHF->AddFrame(fDetBG=new TGButtonGroup(pMainHF,"Detectors")); fDetBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"DetAddSlot(Int_t)"); fDetBG->Connect("Released(Int_t)","RichConfig",this,"DetRemSlot(Int_t)"); new TGCheckButton(fDetBG,"PIPE" ,kPIPE)); new TGCheckButton(fDetBG,"ITS" ,kITS)); new TGCheckButton(fDetBG,"TPC" ,kTPC)); new TGCheckButton(fDetBG,"TRD" ,kTRD)); new TGCheckButton(fDetBG,"TOF" ,kTOF)); new TGCheckButton(fDetBG,"FRAME" ,kFRAME)); new TGCheckButton(fDetBG,"MAG" ,kMAG)); new TGCheckButton(fDetBG,"CRT" ,kCRT)); new TGCheckButton(fDetBG,"HALL" ,kHALL)); new TGCheckButton(fDetBG,"PHOS" ,kPHOS)); new TGCheckButton(fDetBG,"START" ,kSTART)); new TGCheckButton(fDetBG,"FMD" ,kFMD)); new TGCheckButton(fDetBG,"ABSO" ,kABSO)); new TGCheckButton(fDetBG,"PMD" ,kPMD)); new TGCheckButton(fDetBG,"DIPO" ,kDIPO)); new TGCheckButton(fDetBG,"EMCAL" ,kEMCAL)); new TGCheckButton(fDetBG,"VZERO" ,kVZERO)); new TGCheckButton(fDetBG,"MUON" ,kMUON)); new TGCheckButton(fDetBG,"ZDC" ,kZDC)); new TGCheckButton(fDetBG,"SHILD" ,kSHILD)); } //__________________________________________________________________________________________________ void RichConfig::DetAddSlot(Int_t id) {//slot is invoked when any detector check button is pressed if(id==kTRD || id==kTOF) //TRD and TOF geometries depend on FRAME fDetBG->SetButton(kFRAME); } //__________________________________________________________________________________________________ void RichConfig::DetRemSlot(Int_t id) {//slot is invoked when any detector check button is released if(id==kFRAME){ fDetBG->SetButton(kTRD,kFALSE); //switch off TRD and TOF when FRAME is switched off by user hence TRD&TOF depend on FRAME fDetBG->SetButton(kTOF,kFALSE); } } //__________________________________________________________________________________________________ void RichConfig::WriteDet(FILE *pF) { //central detectors if(fDetBG->GetButton(kPIPE )->GetState()) fprintf(pF,"\n new AliPIPEv0(\"PIPE\",\"Beam Pipe\");\n"); if(fDetBG->GetButton(kSHILD)->GetState()) fprintf(pF,"\n new AliSHILv2(\"SHIL\",\"Shielding Version 2\");\n"); if(fDetBG->GetButton(kITS )->GetState()){ fprintf(pF,"\n AliITSvPPRasymmFMD *pIts =new AliITSvPPRasymmFMD(\"ITS\",\"ITS PPR detailed version\");\n"); fprintf(pF," pIts->SetMinorVersion(2); pIts->SetReadDet(kTRUE);\n"); fprintf(pF," pIts->SetThicknessDet1(200.); pIts->SetThicknessDet2(200.);\n"); fprintf(pF," pIts->SetThicknessChip1(200.); pIts->SetThicknessChip2(200.);\n"); fprintf(pF," pIts->SetRails(0); pIts->SetCoolingFluid(1);\n"); fprintf(pF," pIts->SetEUCLID(0);\n"); } if(fDetBG->GetButton(kTPC )->GetState()) {fprintf(pF,"\n AliTPC *pTpc=new AliTPCv2(\"TPC\",\"Default\"); pTpc->SetSecAU(-1);pTpc->SetSecAL(-1);\n");} if(fDetBG->GetButton(kFRAME)->GetState()) fprintf(pF,"\n AliFRAMEv2 *pFrame=new AliFRAMEv2(\"FRAME\",\"Space Frame\"); pFrame->SetHoles(1);\n"); if(fDetBG->GetButton(kTRD )->GetState()) { fprintf(pF,"\n AliTRD *pTrd=new AliTRDv1(\"TRD\",\"TRD slow simulator\");\n"); fprintf(pF," pTrd->SetGasMix(1); pTrd->SetPHOShole(); pTrd->SetRICHhole();pTrd->CreateTR();\n"); } if(fDetBG->GetButton(kTOF )->GetState()) fprintf(pF,"\n new AliTOFv4T0(\"TOF\", \"normal TOF\");\n"); //central detectors if(fDetBG->GetButton(kMAG )->GetState()) fprintf(pF,"\n new AliMAG(\"MAG\",\"Magnet\");\n"); if(fDetBG->GetButton(kHALL )->GetState()) fprintf(pF,"\n new AliHALL(\"HALL\",\"Alice Hall\");\n"); //forward detectors if(fDetBG->GetButton(kFMD )->GetState()) fprintf(pF,"\n new AliFMDv1(\"FMD\",\"normal FMD\");\n"); if(fDetBG->GetButton(kABSO )->GetState()) fprintf(pF,"\n new AliABSOv0(\"ABSO\",\"Muon absorber\");\n"); if(fDetBG->GetButton(kDIPO )->GetState()) fprintf(pF,"\n new AliDIPOv2(\"DIPO\",\"Dipole version 2\");\n"); if(fDetBG->GetButton(kMUON )->GetState()) fprintf(pF,"\n new AliMUONv1(\"MUON\",\"default\");\n"); if(fDetBG->GetButton(kPMD )->GetState()) fprintf(pF,"\n new AliPMDv1(\"PMD\",\"normal PMD\");\n"); if(fDetBG->GetButton(kSTART)->GetState()) fprintf(pF,"\n new AliSTARTv1(\"START\",\"START Detector\");\n"); if(fDetBG->GetButton(kVZERO)->GetState()) fprintf(pF,"\n new AliVZEROv2(\"VZERO\",\"normal VZERO\");\n"); if(fDetBG->GetButton(kZDC )->GetState()) fprintf(pF,"\n new AliZDCv2(\"ZDC\",\"normal ZDC\");\n"); //different phase space detectors if(fDetBG->GetButton(kPHOS )->GetState()) fprintf(pF,"\n new AliPHOSv1(\"PHOS\",\"IHEP\");\n"); if(fDetBG->GetButton(kEMCAL)->GetState()) fprintf(pF,"\n new AliEMCALv1(\"EMCAL\",\"G56_2_55_19_104_14\");\n"); if(fDetBG->GetButton(kCRT )->GetState()) fprintf(pF,"\n new AliCRTv0(\"CRT\",\"normal ACORDE\");\n"); } //__________________________________________________________________________________________________ void RichConfig::GuiBatch(TGHorizontalFrame *pMainF) { TGGroupFrame *pSimF=new TGGroupFrame(pMainF,"Simu"); pMainF->AddFrame(pSimF); pSimF->AddFrame(fSimBG=new TGButtonGroup(pSimF,"" )); new TGCheckButton(fSimBG, "Primary" ,kPrim )); fSimBG->SetButton(kPrim); new TGCheckButton(fSimBG, "Transport" ,kTransport)); fSimBG->SetButton(kTransport); pSimF->AddFrame (fSDigBG=new TGButtonGroup(pSimF,"" )); new TGRadioButton(fSDigBG, "No SDigits" ,kNo )); new TGRadioButton(fSDigBG, "SDigits ALL" ,kAll )); new TGRadioButton(fSDigBG, "SDigits RICH" ,kOnly )); fSDigBG->SetButton(kOnly); pSimF->AddFrame (fDigBG=new TGButtonGroup(pSimF,"" )); new TGRadioButton(fDigBG, "No Digits" ,kNo )); new TGRadioButton(fDigBG, "Digits ALL" ,kAll )); new TGRadioButton(fDigBG, "Digits RICH" ,kOnly )); fDigBG->SetButton(kOnly); pSimF->AddFrame(fRawBG=new TGButtonGroup(pSimF,"" )); new TGRadioButton(fRawBG, "No RAW files" ,kNo )); fRawBG->SetButton(kNo); new TGRadioButton(fRawBG, "RAW DDL" ,kRawDdl )); new TGRadioButton(fRawBG, "RAW DATE" ,kRawDate )); new TGRadioButton(fRawBG, "RAW ROOT" ,kRawRoot )); TGCompositeFrame *pRecF=new TGGroupFrame(pMainF,"Reco"); pMainF->AddFrame(pRecF); pRecF->AddFrame(fClusBG=new TGButtonGroup(pRecF,"" )); new TGRadioButton(fClusBG, "No Clusters" ,kNo )); new TGRadioButton(fClusBG, "Clusters ALL" ,kAll )); new TGRadioButton(fClusBG, "Clusters RICH" ,kOnly )); fClusBG->SetButton(kOnly); pRecF->AddFrame(fRecoBG=new TGButtonGroup(pRecF,"" )); new TGCheckButton(fRecoBG, "Find vertex" ,kVertex )); new TGCheckButton(fRecoBG, "Find ESD tracks" ,kTrack )); new TGCheckButton(fRecoBG, "Add info ESD" ,kEsd )); } //__________________________________________________________________________________________________ void RichConfig::WriteBatch() {//creates Batch.C file char *sBatchName="RichBatch"; FILE *fp=fopen(Form("%s.C",sBatchName),"w"); if(!fp){Info("CreateBatch","Cannot open output file: %s.C",sBatchName);return;} //header and debug fprintf(fp,"void %s(const Int_t iNevents,const Bool_t isDebug,const char *sConfigFileName)\n{\n",sBatchName); fprintf(fp," gSystem->Exec(\"rm -rf *.root hlt hough fort* raw* ZZZ*\");\n"); fprintf(fp," if(isDebug) AliLog::SetGlobalDebugLevel(AliLog::kDebug);\n"); fprintf(fp," gBenchmark->Start(\"ALICE\");\n TDatime time;\n\n"); //simulation section fprintf(fp," AliSimulation *pSim=new AliSimulation(sConfigFileName);\n"); //generate initial kinematics if(fSimBG->GetButton(kPrim)->GetState()) fprintf(fp," pSim->SetRunGeneration(kTRUE); //initial kinematics generated\n"); else fprintf(fp," pSim->SetRunGeneration(kFALSE); //no initial kinematics generated\n"); //transport and hit creations if(fSimBG->GetButton(kTransport)->GetState()) fprintf(fp," pSim->SetRunSimulation(kTRUE); //transport and hits creation\n"); else fprintf(fp," pSim->SetRunSimulation(kFALSE); //no transport and hits creation\n"); //sdigits if (fSDigBG->GetButton(kNo) ->GetState()) fprintf(fp," pSim->SetMakeSDigits(\"\"); //no sdigits created\n"); else if(fSDigBG->GetButton(kAll) ->GetState()) fprintf(fp," pSim->SetMakeSDigits(\"ALL\"); //sdigits created for ALL\n"); else if(fSDigBG->GetButton(kOnly) ->GetState()) fprintf(fp," pSim->SetMakeSDigits(\"RICH\"); //sdigits created for RICH\n"); //digits if (fDigBG->GetButton(kNo) ->GetState()) fprintf(fp," pSim->SetMakeDigits(\"\"); //no digits created\n"); else if(fDigBG->GetButton(kAll) ->GetState()) fprintf(fp," pSim->SetMakeDigits(\"ALL\"); //digits created for all detectors\n"); else if(fDigBG->GetButton(kOnly) ->GetState()) fprintf(fp," pSim->SetMakeDigits(\"RICH\"); //digits created for RICH\n"); //raw data generation if (fRawBG->GetButton(kRawDdl)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ALL\"); //raw data in DDL format for ALL\n"); else if(fRawBG->GetButton(kRawDate)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ALL\",\".date\");//raw data in DATE format for ALL\n"); else if(fRawBG->GetButton(kRawRoot)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ALL\",\".root\");//raw data in ROOT format for ALL\n"); fprintf(fp," pSim->Run(iNevents);\n delete pSim;\n\n"); //reconstraction section if(!fClusBG->GetButton(kNo)->GetState()){ fprintf(fp," AliReconstruction *pRec=new AliReconstruction;\n"); if (fClusBG->GetButton(kAll) ->GetState()) fprintf(fp," pRec->SetRunLocalReconstruction(\"ALL\"); //run cluster creation for ALL\n"); else if(fClusBG->GetButton(kOnly) ->GetState()) fprintf(fp," pRec->SetRunLocalReconstruction(\"RICH\"); //run cluster creation for RICH\n"); if(fRecoBG->GetButton(kVertex)->GetState()) fprintf(fp," pRec->SetRunVertexFinder(kTRUE); //run ESD vertex task\n"); else fprintf(fp," pRec->SetRunVertexFinder(kFALSE); //not run ESD vertex task\n"); if(fRecoBG->GetButton(kTrack)->GetState()) fprintf(fp," pRec->SetRunTracking(\"ITS TPC TRD TOF RICH\"); //run ESD track task\n"); else fprintf(fp," pRec->SetRunTracking(\"\"); //not run ESD track task\n"); if(fRecoBG->GetButton(kEsd)->GetState()) fprintf(fp," pRec->SetFillESD(\"ITS TPC TRD TOF RICH\"); //run ESD add info task\n"); else fprintf(fp," pRec->SetFillESD(\"\"); //not run ESD add info task\n"); fprintf(fp," pRec->Run();delete pRec;\n\n"); } //benchmarks fprintf(fp," cout<<\"!!!!!!!!!!!!Info in : Start time: \";time.Print();\n"); fprintf(fp," cout<<\"!!!!!!!!!!!!Info in : Stop time: \";time.Set(); time.Print();\n"); fprintf(fp," gBenchmark->Show(\"ALICE\");\n"); fprintf(fp," gSystem->Exec(\"play -c 2 ~/.kde/my/end.wav\");\n"); fprintf(fp," gSystem->Exec(\"touch ZZZ______finished_______ZZZ\");\n}\n"); fclose(fp); }//WriteBatch() //__________________________________________________________________________________________________ void RichConfig::ExitSlot() { //slot to be invoked by clik on the Create button WriteConfig(); WriteBatch(); SendCloseMessage(); gApplication->Terminate(0); } //__________________________________________________________________________________________________ void RichConfig::WriteConfig() { FILE *pF=fopen(fFileName,"w"); if(!pF){Info("CreateConfigFile","Cannot open output file:%sn",fFileName);return;} fprintf(pF,"void Config()\n"); fprintf(pF,"{\n"); fprintf(pF,"\n ::Info(\"\\n\\n\\n----------> RICH private config\",\"Start\");\n"); //Random fprintf(pF," gRandom->SetSeed(123456);//put 0 to use system time\n\n"); //Geant fprintf(pF," gSystem->Load(\"libgeant321\");\n"); fprintf(pF," new TGeant3TGeo(\"C++ Interface to Geant3\");\n\n"); //File fprintf(pF," AliRunLoader *pAL=AliRunLoader::Open(\"galice.root\",AliConfig::GetDefaultEventFolderName(),\"recreate\");\n"); fprintf(pF," pAL->SetCompressionLevel(2);\n"); fprintf(pF," pAL->SetNumberOfEventsPerFile(1000);\n"); fprintf(pF," gAlice->SetRunLoader(pAL);\n\n"); //Decayer fprintf(pF," TVirtualMCDecayer *pDecayer=new AliDecayerPythia();\n"); fprintf(pF," pDecayer->SetForceDecay(kAll);\n"); fprintf(pF," pDecayer->Init();\n"); fprintf(pF," gMC->SetExternalDecayer(pDecayer);\n\n"); WritePhys(pF); //physics processes //Field if(fMagB->GetState()==kButtonDown) fprintf(pF," gAlice->SetField();\n\n"); else fprintf(pF," gAlice->SetField(0);\n\n"); fprintf(pF," pAL->CdGAFile();\n\n"); //???? //BODY-ALIC fprintf(pF," new AliBODY(\"BODY\",\"Alice envelop\");\n\n"); WriteRich(pF); //private RICH part WriteGen(pF);//generator WriteDet(pF); //other detectors //end of Config.C file: fprintf(pF,"\n ::Info(\"----------> RICH private config\",\"Stop\\n\\n\\n\");\n"); fprintf(pF,"}\n"); fclose(pF); }//WriteConfig() RichConfig *kir=0; //__________________________________________________________________________________________________ void RichConfig() { kir=new RichConfig("Config.C"); }