No TRD holes in front of RICH forseen
[u/mrichter/AliRoot.git] / RICH / RichConfig.C
CommitLineData
9e26f77a 1class RichConfig : public TGMainFrame
473cb33a 2{
3RQ_OBJECT()
4public:
5
6 RichConfig(const char*sFileName);
9e26f77a 7 ~RichConfig() {Info("ctor","");Cleanup();}
473cb33a 8//protected:
8493d0aa 9 enum EVersOpts {kNo=-1,kVer0,kVer1,kTestBeam,kTestRadio,kOnTop,kDeclust=301,kSagita,kFeedback};
101624cd 10 enum EGenTypes {kGunAlongZ=100,kBox1,kBox7,kGun7,kPythia7,kHijing,kHijingPara,kRichLib,kSignalHijing,kHijingPara2Proton};
473cb33a 11
101624cd 12 enum EDetectors {kPIPE=1,kITS,kTPC,kTRD,kTOF,kFRAME,kMAG,kCRT,kHALL,kPHOS,kSTART,kFMD,kABSO,kPMD,kDIPO,kEMCAL,kVZERO,kMUON,kZDC,kSHILD,kRICH};
473cb33a 13 enum EProcesses {kDCAY=1,kPAIR,kCOMP,kPHOT,kPFIS,kDRAY,kANNI,kBREM,kMUNU,kCKOV,kHADR,kLOSS,kMULS,kRAYL,kALL};
0fe8fa07 14 enum EBatchFlags{kNoRaw=0,kRawDdl,kRawDate,kRawRoot,kRecon,kFillEsd};
8493d0aa 15//SLOTS
473cb33a 16 void AddDetector(Int_t id) {if(id==kTRD || id==kTOF) fDetBG->SetButton(kFRAME);}
17 void RemoveDetector(Int_t id) {if(id==kFRAME) {fDetBG->SetButton(kTRD,kFALSE);fDetBG->SetButton(kTOF,kFALSE);}}
18
19 void AddProcess(Int_t id) {if(id==kALL) for(int i=1;i<=fProcBG->GetCount();i++) fProcBG->SetButton(i,kButtonDown);}
20 void RemoveProcess(Int_t id) {if(id==kALL) for(int i=1;i<=fProcBG->GetCount();i++) fProcBG->SetButton(i,kButtonUp);}
8493d0aa 21 void GeneratorSlot(Int_t type);
22 void VerSlot(Int_t ver) {if(ver==kTestBeam){ fMagCB->SetState(kButtonUp); fGenTypeCO->Select(kGunAlongZ);}}
473cb33a 23
24 Float_t Eta2Theta(Float_t arg) const{return (180./TMath::Pi())*2.*TMath::ATan(TMath::Exp(-arg));}
25 void CreateConfig();
26 void CreateRichBatch();
27 void Exit();
28
8493d0aa 29 TGComboBox *fRichCO; TGButtonGroup *fRichBG; //RICH
8493d0aa 30 TGButton *fMagCB; //MAG
0fe8fa07 31 TGComboBox *fGenTypeCO,*fGenPidCO,*fGenMinMomCO,*fGenMaxMomCO,*fGenChamberCO; TGGroupFrame *fGenGF,*fGenOptGF,*fGenPrimGF; TGNumberEntry *fGenPrimNE; //GEN
8493d0aa 32 TGButtonGroup *fDetBG; //DETECTORS
33 TGButtonGroup *fProcBG; //PROCESSES
34 TGButtonGroup *fRawBG; //RAW
0fe8fa07 35 TGButtonGroup *fRecoBG; //RAW
473cb33a 36 char *fFileName;
37};//class RichConfig
38//__________________________________________________________________________________________________
8493d0aa 39RichConfig::RichConfig(const char *sFileName):TGMainFrame(gClient->GetRoot(),700,400)
473cb33a 40{// creates configuration file
41 fFileName=sFileName;
9e26f77a 42
8493d0aa 43// --------------------
44// | |--------------------
45// | ||-------|
46// | || |
47// | ||-------|
48// | |
49// | ||-------|
50
51// | |--------------------
52// | ---------------------
53
54// Connect("CloseWindow()","RichConfig",this,"CloseWindow()");
55 AddFrame(pMainHF=new TGHorizontalFrame(this,100,200)); //main horizontal frame
101624cd 56//Left vertical frame containing RICH and MagField
8493d0aa 57 pMainHF->AddFrame(pLeftVF=new TGVerticalFrame(pMainHF,100,200));
473cb33a 58//RICH
8493d0aa 59 pLeftVF->AddFrame(pRichGF=new TGGroupFrame(pLeftVF,"RICH"));
60 pRichGF->AddFrame(fRichCO=new TGComboBox(pRichGF,100));
61 fRichCO->Connect("Selected(Int_t)" ,"RichConfig",this,"VerSlot(Int_t)");
62 fRichCO->AddEntry("no RICH" ,kNo);
63 fRichCO->AddEntry("debug RICH 0" ,kVer0);
64 fRichCO->AddEntry("normal RICH 1",kVer1);
65 fRichCO->AddEntry("RICH on top" ,kOnTop);
66 fRichCO->AddEntry("test beam" ,kTestBeam);
67 fRichCO->AddEntry("radio source" ,kTestRadio);
68 fRichCO->Select(kVer1);
69 fRichCO->Resize(150,20);
70 pRichGF->AddFrame(fRichBG=new TGButtonGroup(pRichGF,"Options"));
71 new TGCheckButton(fRichBG,"Decluster?" ,kDeclust); fRichBG->SetButton(kDeclust);
72 new TGCheckButton(fRichBG,"Wire sagita?" ,kSagita); fRichBG->SetButton(kSagita);
73 new TGCheckButton(fRichBG,"Feedbacks?" ,kFeedback); fRichBG->SetButton(kFeedback);
8493d0aa 74// Magnetic Field
75 pLeftVF->AddFrame(pMagGF=new TGGroupFrame(pLeftVF,"Magnetic Field"));
76 pMagGF->AddFrame(fMagCB=new TGCheckButton(pMagGF,"On/Off"));
77 fMagCB->SetState(kButtonDown);
473cb33a 78//Generator
8493d0aa 79 pMainHF->AddFrame(fGenGF=new TGGroupFrame(pMainHF,"Generator"));
80 fGenGF->AddFrame(fGenTypeCO=new TGComboBox(fGenGF,100));
81 fGenTypeCO->Connect("Selected(Int_t)" ,"RichConfig",this,"GeneratorSlot(Int_t)");
82 fGenTypeCO->AddEntry("gun along z" ,kGunAlongZ);
83 fGenTypeCO->AddEntry("box gun to single chamber" ,kBox1);
84 fGenTypeCO->AddEntry("gun to all chambers" ,kGun7);
101624cd 85 fGenTypeCO->AddEntry("box to all chambers" ,kBox7);
8493d0aa 86 fGenTypeCO->AddEntry("7 guns+Pythia" ,kPythia7);
87 fGenTypeCO->AddEntry("HIJING" ,kHijing);
88 fGenTypeCO->AddEntry("HIJING para" ,kHijingPara);
89 fGenTypeCO->AddEntry("2 p+HIJING" ,kHijingPara2Proton);
90 fGenTypeCO->AddEntry("Sr90 source" ,kSr90);
91 fGenTypeCO->AddEntry("RICH lib" ,kRichLib);
92 fGenTypeCO->AddEntry("RICH lib+HIJING" ,kSignalHijing);
0fe8fa07 93 fGenTypeCO->Select(kHijing);
8493d0aa 94 fGenTypeCO->Resize(160,20);
95
473cb33a 96
8493d0aa 97 fGenGF->AddFrame(fGenOptGF=new TGGroupFrame(fGenGF,"Options")); //PID for guns
473cb33a 98
473cb33a 99
8493d0aa 100 fGenOptGF->AddFrame(fGenPidCO=new TGComboBox(fGenOptGF,100)); //PID for guns
101 fGenPidCO->AddEntry("Pion+" ,kPiPlus);
102 fGenPidCO->AddEntry("Pion-" ,kPiMinus);
103 fGenPidCO->AddEntry("Kaon+" ,kKPlus);
104 fGenPidCO->AddEntry("Kaon-" ,kKMinus);
105 fGenPidCO->AddEntry("K0s" ,kK0Short);
106 fGenPidCO->AddEntry("Proton" ,kProton);
107 fGenPidCO->AddEntry("ProtonBar" ,kProtonBar);
108 fGenPidCO->AddEntry("Lambda" ,kLambda0);
109 fGenPidCO->AddEntry("LambdaBar" ,kLambda0Bar);
110 fGenPidCO->Select(kProton); fGenPidCO->Resize(160,20);
111
112 fGenOptGF->AddFrame(fGenMinMomCO=new TGComboBox(fGenOptGF,100)); //particle energy for guns
473cb33a 113 for(Int_t i=5;i<=95;i+=5)
8493d0aa 114 fGenMinMomCO->AddEntry(Form("%3.1f GeV",0.1*i), i);
115 fGenMinMomCO->Select(15); fGenMinMomCO->Resize(160,20);
473cb33a 116
8493d0aa 117 fGenOptGF->AddFrame(fGenMaxMomCO=new TGComboBox(fGenOptGF,100)); //particle energy for guns
473cb33a 118 for(Int_t i=10;i<=95;i+=5)
8493d0aa 119 fGenMaxMomCO->AddEntry(Form("%3.1f GeV",0.1*i), i);
120 fGenMaxMomCO->Select(40); fGenMaxMomCO->Resize(160,20);
473cb33a 121
8493d0aa 122 fGenOptGF->AddFrame(fGenChamberCO=new TGComboBox(fGenOptGF,100)); //chamber number in case of gun1
123 for(int i=1;i<=7;i++) fGenChamberCO->AddEntry(Form("Chamber %i",i),i);
124 fGenChamberCO->Select(4); fGenChamberCO->Resize(160,20);
473cb33a 125
0fe8fa07 126 fGenOptGF->AddFrame(fGenPrimGF=new TGGroupFrame(fGenOptGF,"Number of primaries"));
127 fGenPrimGF->AddFrame(fGenPrimNE=new TGNumberEntry(fGenPrimGF,500));
473cb33a 128//Detectors
8493d0aa 129 pMainHF->AddFrame(fDetBG=new TGButtonGroup(pMainHF,"Detectors"));
473cb33a 130 fDetBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"AddDetector(Int_t)");
131 fDetBG->Connect("Released(Int_t)","RichConfig",this,"RemoveDetector(Int_t)");
132 new TGCheckButton(fDetBG,"PIPE" ,kPIPE));
133 new TGCheckButton(fDetBG,"ITS" ,kITS));
134 new TGCheckButton(fDetBG,"TPC" ,kTPC));
135 new TGCheckButton(fDetBG,"TRD" ,kTRD));
136 new TGCheckButton(fDetBG,"TOF" ,kTOF));
137 new TGCheckButton(fDetBG,"FRAME" ,kFRAME));
138 new TGCheckButton(fDetBG,"MAG" ,kMAG));
139 new TGCheckButton(fDetBG,"CRT" ,kCRT));
140 new TGCheckButton(fDetBG,"HALL" ,kHALL));
141 new TGCheckButton(fDetBG,"PHOS" ,kPHOS));
142 new TGCheckButton(fDetBG,"START" ,kSTART));
143 new TGCheckButton(fDetBG,"FMD" ,kFMD));
144 new TGCheckButton(fDetBG,"ABSO" ,kABSO));
145 new TGCheckButton(fDetBG,"PMD" ,kPMD));
146 new TGCheckButton(fDetBG,"DIPO" ,kDIPO));
147 new TGCheckButton(fDetBG,"EMCAL" ,kEMCAL));
148 new TGCheckButton(fDetBG,"VZERO" ,kVZERO));
149 new TGCheckButton(fDetBG,"MUON" ,kMUON));
150 new TGCheckButton(fDetBG,"ZDC" ,kZDC));
151 new TGCheckButton(fDetBG,"SHILD" ,kSHILD));
152//Processes
8493d0aa 153 pMainHF->AddFrame(fProcBG=new TGButtonGroup(pMainHF,"Processes"));
473cb33a 154 fProcBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"AddProcess(Int_t)");
155 fProcBG->Connect("Released(Int_t)","RichConfig",this,"RemoveProcess(Int_t)");
156 new TGCheckButton(fProcBG,"ALL ON/OFF" ,kALL)) ;
157 new TGCheckButton(fProcBG,"DCAY Decay" ,kDCAY)); fProcBG->SetButton(kDCAY);
158 new TGCheckButton(fProcBG,"PAIR Pair production" ,kPAIR)); fProcBG->SetButton(kPAIR);
159 new TGCheckButton(fProcBG,"COMP Compton" ,kCOMP)); fProcBG->SetButton(kCOMP);
160 new TGCheckButton(fProcBG,"PHOT" ,kPHOT)); fProcBG->SetButton(kPHOT);
161 new TGCheckButton(fProcBG,"PFIS Photofission" ,kPFIS));
162 new TGCheckButton(fProcBG,"DRAY Delta electrons" ,kDRAY));
163 new TGCheckButton(fProcBG,"ANNI Annihilation" ,kANNI)); fProcBG->SetButton(kANNI);
164 new TGCheckButton(fProcBG,"BREM Bremstraslung" ,kBREM)); fProcBG->SetButton(kBREM);
165 new TGCheckButton(fProcBG,"MUNU Muon-Nuclear" ,kMUNU)); fProcBG->SetButton(kMUNU);
166 new TGCheckButton(fProcBG,"CKOV Cerenkovs" ,kCKOV)); fProcBG->SetButton(kCKOV);
167 new TGCheckButton(fProcBG,"HADR Hadronic interactions " ,kHADR)); fProcBG->SetButton(kHADR);
168 new TGCheckButton(fProcBG,"LOSS Energy losses" ,kLOSS)); fProcBG->SetButton(kLOSS);
169 new TGCheckButton(fProcBG,"MULS Multiple scattering" ,kMULS)); fProcBG->SetButton(kMULS);
170 new TGCheckButton(fProcBG,"RAYL" ,kRAYL)); fProcBG->SetButton(kRAYL);
0fe8fa07 171//RichBatch part
172 pMainHF->AddFrame(pBatchVF=new TGVerticalFrame(pMainHF));
173 pBatchVF->AddFrame(fRawBG=new TGButtonGroup(pBatchVF,"RichBatch"));
8493d0aa 174 new TGRadioButton(fRawBG,"No RAW files" ,kNoRaw)) ; fRawBG->SetButton(kNoRaw);
175 new TGRadioButton(fRawBG,"RAW DDL" ,kRawDdl)) ;
176 new TGRadioButton(fRawBG,"RAW DATE" ,kRawDate)) ;
177 new TGRadioButton(fRawBG,"RAW ROOT" ,kRawRoot)) ;
0fe8fa07 178 fRawBG->AddFrame(fRecoBG=new TGButtonGroup(fRawBG,""));
101624cd 179 new TGCheckButton(fRecoBG,"Reconstruct" ,kRecon)) ; fRecoBG->SetButton(kRecon);
180 new TGCheckButton(fRecoBG,"Fill ESD" ,kFillEsd)) ; fRecoBG->SetButton(kFillEsd);
473cb33a 181//File
8493d0aa 182 AddFrame(pFileHF=new TGHorizontalFrame(this,100,200));
183 pFileHF->AddFrame(pCrtTB=new TGTextButton(pFileHF,"Create"));
184 pCrtTB->Connect("Clicked()","RichConfig",this,"Exit()");
185 pFileHF->AddFrame(new TGLabel(pFileHF,Form(" config file as %s",fFileName)));
473cb33a 186
9e26f77a 187 MapSubwindows();
8493d0aa 188 //Layout();
189 Resize(GetDefaultSize());
9e26f77a 190 SetWindowName("Create AliROOT scripts");
191 MapWindow();
473cb33a 192}//KirCondig::ctor
8493d0aa 193//__________________________________________________________________________________________________
194void RichConfig::GeneratorSlot(Int_t type)
195{//enable-disable generator widegets according to generator type
196 if(type==kHijing) fGenGF->HideFrame(fGenOptGF);
197
198 if(type==kHijingPara){
199 fGenGF->ShowFrame(fGenOptGF);
0fe8fa07 200 fGenOptGF->ShowFrame(fGenPrimGF);
201 fGenOptGF->HideFrame(fGenPidCO);
202 fGenOptGF->HideFrame(fGenMinMomCO);
203 fGenOptGF->HideFrame(fGenMaxMomCO);
204 fGenOptGF->HideFrame(fGenChamberCO);
8493d0aa 205 }
206
207 if(type==kGunAlongZ) {
0fe8fa07 208 fGenGF->ShowFrame(fGenOptGF);
209 fGenOptGF->ShowFrame(fGenPidCO);
210 fGenOptGF->ShowFrame(fGenMinMomCO);
211 fGenOptGF->HideFrame(fGenMaxMomCO);
212 fGenOptGF->HideFrame(fGenChamberCO);
213 fGenOptGF->HideFrame(fGenPrimGF);
8493d0aa 214 }
0fe8fa07 215}//GeneratorSlot()
473cb33a 216//__________________________________________________________________________________________________
217void RichConfig::CreateConfig()
218{
219 FILE *fp=fopen(fFileName,"w"); if(!fp){Info("CreateConfigFile","Cannot open output file:%sn",fFileName);return;}
220
221 fprintf(fp,"void Config()\n");
222 fprintf(fp,"{\n");
223 fprintf(fp," ::Info(\"RICH private config\",\"Start\");\n\n");
224//Random
225 fprintf(fp," gRandom->SetSeed(123456);//put 0 to use system time\n\n");
226//Geant
227 fprintf(fp," gSystem->Load(\"libgeant321\");\n");
ad65fcfe 228 fprintf(fp," new TGeant3TGeo(\"C++ Interface to Geant3\");\n\n");
473cb33a 229//File
230 fprintf(fp," AliRunLoader *pAL=AliRunLoader::Open(\"galice.root\",AliConfig::GetDefaultEventFolderName(),\"recreate\");\n");
231 fprintf(fp," pAL->SetCompressionLevel(2);\n");
232 fprintf(fp," pAL->SetNumberOfEventsPerFile(1000);\n");
233 fprintf(fp," gAlice->SetRunLoader(pAL);\n\n");
234//Decayer
235 fprintf(fp," TVirtualMCDecayer *pDecayer=new AliDecayerPythia();\n");
236 fprintf(fp," pDecayer->SetForceDecay(kAll);\n");
237 fprintf(fp," pDecayer->Init();\n");
238 fprintf(fp," gMC->SetExternalDecayer(pDecayer);\n\n");
239//Physics
240 if(fProcBG->GetButton(kDCAY)->GetState()) fprintf(fp," gMC->SetProcess(\"DCAY\",1);"); else fprintf(fp," gMC->SetProcess(\"DCAY\",0);");
241 if(fProcBG->GetButton(kPAIR)->GetState()) fprintf(fp," gMC->SetProcess(\"PAIR\",1);\n");else fprintf(fp," gMC->SetProcess(\"PAIR\",0);\n");
242 if(fProcBG->GetButton(kCOMP)->GetState()) fprintf(fp," gMC->SetProcess(\"COMP\",1);"); else fprintf(fp," gMC->SetProcess(\"COMP\",0);");
243 if(fProcBG->GetButton(kPHOT)->GetState()) fprintf(fp," gMC->SetProcess(\"PHOT\",1);\n");else fprintf(fp," gMC->SetProcess(\"PHOT\",0);\n");
244 if(fProcBG->GetButton(kPFIS)->GetState()) fprintf(fp," gMC->SetProcess(\"PFIS\",1);"); else fprintf(fp," gMC->SetProcess(\"PFIS\",0);");
245 if(fProcBG->GetButton(kDRAY)->GetState()) fprintf(fp," gMC->SetProcess(\"DRAY\",1);\n");else fprintf(fp," gMC->SetProcess(\"DRAY\",0);\n");
246 if(fProcBG->GetButton(kANNI)->GetState()) fprintf(fp," gMC->SetProcess(\"ANNI\",1);"); else fprintf(fp," gMC->SetProcess(\"ANNI\",0);");
247 if(fProcBG->GetButton(kBREM)->GetState()) fprintf(fp," gMC->SetProcess(\"BREM\",1);\n");else fprintf(fp," gMC->SetProcess(\"BREM\",0);\n");
248 if(fProcBG->GetButton(kMUNU)->GetState()) fprintf(fp," gMC->SetProcess(\"MUNU\",1);"); else fprintf(fp," gMC->SetProcess(\"MUNU\",0);");
249 if(fProcBG->GetButton(kCKOV)->GetState()) fprintf(fp," gMC->SetProcess(\"CKOV\",1);\n");else fprintf(fp," gMC->SetProcess(\"CKOV\",0);\n");
250 if(fProcBG->GetButton(kHADR)->GetState()) fprintf(fp," gMC->SetProcess(\"HADR\",1);"); else fprintf(fp," gMC->SetProcess(\"HADR\",0);");
251 if(fProcBG->GetButton(kLOSS)->GetState()) fprintf(fp," gMC->SetProcess(\"LOSS\",2);\n");else fprintf(fp," gMC->SetProcess(\"LOSS\",0);\n");
252 if(fProcBG->GetButton(kMULS)->GetState()) fprintf(fp," gMC->SetProcess(\"MULS\",1);"); else fprintf(fp," gMC->SetProcess(\"MULS\",0);");
253 if(fProcBG->GetButton(kRAYL)->GetState()) fprintf(fp," gMC->SetProcess(\"RAYL\",1);\n");else fprintf(fp," gMC->SetProcess(\"RAYL\",0);\n");
254
255 fprintf(fp,"\n");
256 fprintf(fp," gMC->SetCut(\"CUTGAM\",0.001); "); fprintf(fp," gMC->SetCut(\"CUTELE\",0.001); ");
257 fprintf(fp," gMC->SetCut(\"CUTNEU\",0.001);\n"); fprintf(fp," gMC->SetCut(\"CUTHAD\",0.001); ");
258 fprintf(fp," gMC->SetCut(\"CUTMUO\",0.001); "); fprintf(fp," gMC->SetCut(\"BCUTE\" ,0.001);\n");
259 fprintf(fp," gMC->SetCut(\"BCUTM\" ,0.001); "); fprintf(fp," gMC->SetCut(\"DCUTE\" ,0.001); ");
260 fprintf(fp," gMC->SetCut(\"DCUTM\" ,0.001);\n"); fprintf(fp," gMC->SetCut(\"PPCUTM\",0.001); ");
261 fprintf(fp," gMC->SetCut(\"TOFMAX\",1e10);\n\n");
262//Field
8493d0aa 263 if(fMagCB->GetState()==kButtonDown) fprintf(fp," gAlice->SetField();\n\n");else fprintf(fp," gAlice->SetField(0);\n\n");
473cb33a 264 fprintf(fp," pAL->CdGAFile();\n\n"); //????
265//BODY-ALIC
266 fprintf(fp," new AliBODY(\"BODY\",\"Alice envelop\");\n\n");
267//RICH
8493d0aa 268 if(!fRichBG->GetButton(kDeclust)->GetState()) fprintf(fp," AliRICHParam::SetDeclustering(kFALSE);\n");
269 if(!fRichBG->GetButton(kSagita)->GetState()) fprintf(fp," AliRICHParam::SetWireSag(kFALSE);\n") ;
270 switch(fRichCO->GetSelected()){
271 case kNo: break;
272 case kVer0: fprintf(fp," AliRICH *pRICH=new AliRICHv0(\"RICH\",\"Rich with debug StepManager\");\n\n"); break;
273 case kVer1: fprintf(fp," AliRICH *pRICH=new AliRICHv1(\"RICH\",\"Normal\");\n\n"); break;
ad65fcfe 274 }//switch RICH
473cb33a 275//Generator
8493d0aa 276 switch(fGenTypeCO->GetSelected()){
473cb33a 277 case kHijingPara:
8493d0aa 278 fprintf(fp," AliGenHIJINGpara *pGen=new AliGenHIJINGpara(%i);\n",(int)fGenPrimNE->GetNumber());
473cb33a 279 fprintf(fp," pGen->SetMomentumRange(0,999); pGen->SetThetaRange(%f,%f); pGen->SetPhiRange(0,360);\n",Eta2Theta(8),Eta2Theta(-8));
280 fprintf(fp," pGen->SetOrigin(0,0,0); pGen->SetSigma(0,0,0);\n");
281 fprintf(fp," pGen->Init();\n");
282 break;
283 case kBox1:
284 fprintf(fp," AliGenBox *pGen=new AliGenBox(1);\n");
8493d0aa 285 fprintf(fp," pGen->SetPart(%i); pGen->SetOrigin(0,0,0);\n",fGenPidCO->GetSelected());
0fe8fa07 286 fprintf(fp," pGen->SetMomentumRange(%.1f,%.1f); \n",float(fGenMinMomCO->GetSelected())/10, float(fGenMaxMomCO->GetSelected())/10);
8493d0aa 287 fprintf(fp," pGen->SetThetaRange(pRICH->C(%i)->ThetaD()-3,pRICH->C(%i)->ThetaD()-1); \n",fGenChamberCO->GetSelected(),fGenChamberCO->GetSelected());
288 fprintf(fp," pGen->SetPhiRange(pRICH->C(%i)->PhiD()-1,pRICH->C(%i)->PhiD()+1); \n",fGenChamberCO->GetSelected(),fGenChamberCO->GetSelected());
473cb33a 289 fprintf(fp," pGen->Init();\n");
290 break;
101624cd 291 case kBox7:
292 fprintf(fp," AliGenCocktail *pCocktail=new AliGenCocktail();\n");
293 fprintf(fp," for(int i=1;i<=7;i++){\n");
294 fprintf(fp," AliGenBox *pBox=new AliGenBox(1);\n");
295 fprintf(fp," pBox->SetMomentumRange(%.1f,%.1f); \n",float(fGenMinMomCO->GetSelected())/10, float(fGenMaxMomCO->GetSelected())/10);
296 fprintf(fp," pBox->SetPart(%i); pBox->SetOrigin(0,0,0);\n",fGenPidCO->GetSelected());
297 fprintf(fp," pBox->SetThetaRange(pRICH->C(i)->ThetaD()-3,pRICH->C(i)->ThetaD()-1); \n");
298 fprintf(fp," pBox->SetPhiRange(pRICH->C(i)->PhiD()-1,pRICH->C(i)->PhiD()+1); \n");
299 fprintf(fp," pCocktail->AddGenerator(pBox,Form(\"Box %i\",i),1);\n }\n");
300 fprintf(fp," pCocktail->Init();\n");
301 break;
8493d0aa 302 case kGunAlongZ:
ad65fcfe 303 fprintf(fp," AliGenFixed *pGen=new AliGenFixed(1);\n");
0fe8fa07 304 fprintf(fp," pGen->SetPart(%i); pGen->SetOrigin(0,0,0); pGen->SetMomentum(%.1f); pGen->SetTheta(0);\n",fGenPidCO->GetSelected(),float(fGenMinMomCO->GetSelected())/10);
ad65fcfe 305 fprintf(fp," pGen->Init();\n");
473cb33a 306 break;
307 case kGun7:
308 fprintf(fp," AliGenCocktail *pCocktail=new AliGenCocktail();\n");
309 fprintf(fp," for(int i=1;i<=7;i++){\n");
310 fprintf(fp," AliGenFixed *pFixed=new AliGenFixed(1);\n");
8493d0aa 311 fprintf(fp," pFixed->SetPart(%i); pFixed->SetMomentum(1.0+i*0.5); pFixed->SetOrigin(0,0,0);\n",fGenPidCO->GetSelected());
473cb33a 312 fprintf(fp," pFixed->SetPhi(pRICH->C(i)->PhiD()); pFixed->SetTheta(pRICH->C(i)->ThetaD()-2);\n");
313 fprintf(fp," pCocktail->AddGenerator(pFixed,Form(\"Fixed %i\",i),1);\n }\n");
314 fprintf(fp," pCocktail->Init();\n");
315 break;
316 case kPythia7:
317 fprintf(fp," AliGenCocktail *pCocktail=new AliGenCocktail();\n");
318 fprintf(fp," for(int i=1;i<=7;i++){\n");
319 fprintf(fp," AliGenFixed *pFixed=new AliGenFixed(1);\n");
8493d0aa 320 fprintf(fp," pFixed->SetPart(%i); pFixed->SetMomentum(2.5+i*0.4); pFixed->SetOrigin(0,0,0);\n",fGenPidCO->GetSelected());
473cb33a 321 fprintf(fp," pFixed->SetPhiRange(pRICH->C(i)->PhiD()); pFixed->SetThetaRange(pRICH->C(i)->ThetaD()-2);\n");
322 fprintf(fp," pCocktail->AddGenerator(pFixed,Form(\"Fixed %i\",i),1);\n }\n");
323 fprintf(fp," AliGenPythia *pPythia = new AliGenPythia(-1);\n");
324 fprintf(fp," pPythia->SetMomentumRange(0,999999); pPythia->SetPhiRange(20,80); pPythia->SetThetaRange(75,115);\n");
325 fprintf(fp," pPythia->SetYRange(-12,12); pPythia->SetPtRange(0,1000); pPythia->SetStrucFunc(kCTEQ4L);\n");
326 fprintf(fp," pPythia->SetProcess(kPyMb); pPythia->SetEnergyCMS(14000);\n");
327 fprintf(fp," pCocktail->AddGenerator(pPythia,\"Pythia\",1);\n");
328 fprintf(fp," pCocktail->Init();\n");
329 case kSr90:
330 fprintf(fp," AliGenRadioactive *pGen=new AliGenRadioactive(kSr90,%i);\n",(int)fGenNprimEntry->GetNumber());
331 fprintf(fp," pGen->SetOrigin(0,0,0); pGen->SetSigma(0.1,0.1,0.05);\n");
332 fprintf(fp," pGen->Init();\n");
333 break;
334 case kHijing:
335 fprintf(fp," AliGenHijing *pGen=new AliGenHijing(-1); pGen->SetEnergyCMS(5500); pGen->SetReferenceFrame(\"CMS\");\n");
336 fprintf(fp," pGen->SetProjectile(\"A\", 208, 82); pGen->SetTarget(\"A\", 208, 82);\n");
337 fprintf(fp," pGen->SetJetQuenching(0); pGen->SetShadowing(0);\n");
338 fprintf(fp," pGen->KeepFullEvent(); pGen->SetSelectAll(0); \n");
339 fprintf(fp," pGen->SetImpactParameterRange(0., 5.);\n");
340 fprintf(fp," pGen->Init();\n");
341 break;
342 case kHijingPara2Proton:
343 fprintf(fp," AliGenCocktail *pCocktail=new AliGenCocktail();\n");
344 fprintf(fp," for(int i=1;i<=7;i++){\n");
345 fprintf(fp," AliGenFixed *pProton1=new AliGenFixed(1);\n");
346 fprintf(fp," AliGenFixed *pProton2=new AliGenFixed(1);\n");
347 fprintf(fp," pProton1->SetPart(kProton); pProton1->SetMomentum(2.0+i*0.5); pProton1->SetOrigin(0,0,0);\n");
348 fprintf(fp," pProton2->SetPart(kProton); pProton2->SetMomentum(2.0+i*0.5); pProton2->SetOrigin(0,0,0);\n");
349 fprintf(fp," pProton1->SetPhiRange(pRICH->C(i)->PhiD()); pProton1->SetThetaRange(pRICH->C(i)->ThetaD());\n");
350 fprintf(fp," pProton2->SetPhiRange(pRICH->C(i)->PhiD()); pProton2->SetThetaRange(pRICH->C(i)->ThetaD()-4);\n");
351 fprintf(fp," pCocktail->AddGenerator(pProton1,Form(\"proton1 %i\",i),1);\n");
352 fprintf(fp," pCocktail->AddGenerator(pProton2,Form(\"proton2 %i\",i),1);\n }\n");
353
354 fprintf(fp," AliGenHIJINGpara *pHijingPara=new AliGenHIJINGpara(510);\n");
355 fprintf(fp," pHijingPara->SetMomentumRange(0,99); pHijingPara->SetThetaRange(60,120); pHijingPara->SetPhiRange(0,60);\n");
356 fprintf(fp," pHijingPara->SetOrigin(0,0,0); pHijingPara->SetSigma(0,0,0);\n");
357 fprintf(fp," pCocktail->AddGenerator(pHijingPara,\"HijingPara\",1);\n");
358 fprintf(fp," pCocktail->Init();\n");
359 break;
360 case kRichLib:
8493d0aa 361 fprintf(fp," AliGenParam *pGen=new AliGenParam(2,new AliGenRICHlib,%i,\"EXP\"); \n",fGenPidCO->GetSelected());
362 fprintf(fp," pGen->SetPtRange(%3.1f,%3.1f); \n",fGenMinMomCO->GetSelected()/10,fGenMaxMomCO->GetSelected()/10);
473cb33a 363 fprintf(fp," pGen->SetYRange(-0.6,0.6); \n");
364 fprintf(fp," pGen->SetPhiRange(0.,60.); \n");
365 fprintf(fp," pGen->SetForceDecay(kAll); \n");
366 fprintf(fp," pGen->Init();\n");
367 break;
368 case kSignalHijing:
8493d0aa 369 fprintf(fp," AliGenParam *pRichLib=new AliGenParam(2,new AliGenRICHlib,%i,\"FLAT\"); \n",fGenPidCO->GetSelected());
370 fprintf(fp," pRichLib->SetPtRange(%3.1f,%3.1f); \n",fGenMinMomCO->GetSelected()/10,fGenMaxMomCO->GetSelected()/10);
473cb33a 371 fprintf(fp," pRichLib->SetYRange(-0.6,0.6); \n");
372 fprintf(fp," pRichLib->SetPhiRange(0.,60.); \n");
373 fprintf(fp," pRichLib->SetForceDecay(kPhiKK); \n");
374
375 fprintf(fp," AliGenHijing *pHijing=new AliGenHijing(-1); pHijing->SetEnergyCMS(5500); pHijing->SetReferenceFrame(\"CMS\");\n");
376 fprintf(fp," pHijing->SetProjectile(\"A\", 208, 82); pHijing->SetTarget(\"A\", 208, 82);\n");
377 fprintf(fp," pHijing->SetJetQuenching(0); pHijing->SetShadowing(0);\n");
378 fprintf(fp," pHijing->KeepFullEvent(); pHijing->SetSelectAll(0); \n");
379 fprintf(fp," pHijing->SetImpactParameterRange(0., 5.);\n");
380
381 fprintf(fp," AliGenCocktail *pCocktail=new AliGenCocktail();\n");
382 fprintf(fp," pCocktail->AddGenerator(pRichLib,\"RichLib\",1);\n");
383 fprintf(fp," pCocktail->AddGenerator(pHijing,\"Hijing\",1);\n");
384 fprintf(fp," pCocktail->Init();\n");
385 break;
386 }
387//central before RICH detectors
388 if(fDetBG->GetButton(kPIPE )->GetState()) fprintf(fp,"\n new AliPIPEv0(\"PIPE\",\"Beam Pipe\");\n");
389 if(fDetBG->GetButton(kSHILD)->GetState()) fprintf(fp,"\n new AliSHILv2(\"SHIL\",\"Shielding Version 2\");\n");
390 if(fDetBG->GetButton(kITS )->GetState()){
391 fprintf(fp,"\n AliITSvPPRasymmFMD *pIts =new AliITSvPPRasymmFMD(\"ITS\",\"ITS PPR detailed version\");\n");
392 fprintf(fp," pIts->SetMinorVersion(2); pIts->SetReadDet(kTRUE);\n");
393 fprintf(fp," pIts->SetThicknessDet1(200.); pIts->SetThicknessDet2(200.);\n");
394 fprintf(fp," pIts->SetThicknessChip1(200.); pIts->SetThicknessChip2(200.);\n");
395 fprintf(fp," pIts->SetRails(0); pIts->SetCoolingFluid(1);\n");
396 fprintf(fp," pIts->SetEUCLID(0);\n");
397 }
398 if(fDetBG->GetButton(kTPC )->GetState()) {fprintf(fp,"\n AliTPC *pTpc=new AliTPCv2(\"TPC\",\"Default\"); pTpc->SetSecAU(-1);pTpc->SetSecAL(-1);\n");}
399 if(fDetBG->GetButton(kFRAME)->GetState()) fprintf(fp,"\n AliFRAMEv2 *pFrame=new AliFRAMEv2(\"FRAME\",\"Space Frame\"); pFrame->SetHoles(1);\n");
400 if(fDetBG->GetButton(kTRD )->GetState()) {
401 fprintf(fp,"\n AliTRD *pTrd=new AliTRDv1(\"TRD\",\"TRD slow simulator\");\n");
d6a161f1 402 fprintf(fp," pTrd->SetGasMix(1); pTrd->SetPHOShole();pTrd->CreateTR();\n");
473cb33a 403 }
404 if(fDetBG->GetButton(kTOF )->GetState()) fprintf(fp,"\n new AliTOFv4T0(\"TOF\", \"normal TOF\");\n");
405//central after RICH detectors
406 if(fDetBG->GetButton(kMAG )->GetState()) fprintf(fp,"\n new AliMAG(\"MAG\",\"Magnet\");\n");
407 if(fDetBG->GetButton(kHALL )->GetState()) fprintf(fp,"\n new AliHALL(\"HALL\",\"Alice Hall\");\n");
408//forward detectors
409 if(fDetBG->GetButton(kFMD )->GetState()) fprintf(fp,"\n new AliFMDv1(\"FMD\",\"normal FMD\");\n");
410 if(fDetBG->GetButton(kABSO )->GetState()) fprintf(fp,"\n new AliABSOv0(\"ABSO\",\"Muon absorber\");\n");
411 if(fDetBG->GetButton(kDIPO )->GetState()) fprintf(fp,"\n new AliDIPOv2(\"DIPO\",\"Dipole version 2\");\n");
412 if(fDetBG->GetButton(kMUON )->GetState()) fprintf(fp,"\n new AliMUONv1(\"MUON\",\"default\");\n");
413 if(fDetBG->GetButton(kPMD )->GetState()) fprintf(fp,"\n new AliPMDv1(\"PMD\",\"normal PMD\");\n");
414 if(fDetBG->GetButton(kSTART)->GetState()) fprintf(fp,"\n new AliSTARTv1(\"START\",\"START Detector\");\n");
415 if(fDetBG->GetButton(kVZERO)->GetState()) fprintf(fp,"\n new AliVZEROv2(\"VZERO\",\"normal VZERO\");\n");
416 if(fDetBG->GetButton(kZDC )->GetState()) fprintf(fp,"\n new AliZDCv2(\"ZDC\",\"normal ZDC\");\n");
417//different phase space detectors
418 if(fDetBG->GetButton(kPHOS )->GetState()) fprintf(fp,"\n new AliPHOSv1(\"PHOS\",\"IHEP\");\n");
419 if(fDetBG->GetButton(kEMCAL)->GetState()) fprintf(fp,"\n new AliEMCALv1(\"EMCAL\",\"G56_2_55_19_104_14\");\n");
420 if(fDetBG->GetButton(kCRT )->GetState()) fprintf(fp,"\n new AliCRTv0(\"CRT\",\"normal ACORDE\");\n");
421
422 fprintf(fp,"\n ::Info(\"RICH private config\",\"Stop\");\n");
423 fprintf(fp,"}\n");
424out:
425 fclose(fp);
9e26f77a 426// CloseWindow();
473cb33a 427}//CreateConfig
428//__________________________________________________________________________________________________
429void RichConfig::CreateRichBatch()
430{//creates RichBatch.C file
431 FILE *fp=fopen("RichBatch.C","w"); if(!fp){Info("CreateRichBatch","Cannot open output file: RichBatch.C");return;}
9e26f77a 432//header and debug
473cb33a 433 fprintf(fp,"void RichBatch(const Int_t iNevents,const Bool_t isDebug,const char *sConfigFileName)\n");
434 fprintf(fp,"{\n");
9e26f77a 435 fprintf(fp," gSystem->Exec(\"rm -rf *.root hlt hough fort* raw* ZZZ*\");\n");
473cb33a 436 fprintf(fp," if(isDebug) AliLog::SetGlobalDebugLevel(AliLog::kDebug);\n");
8493d0aa 437 fprintf(fp," gBenchmark->Start(\"ALICE\");\n TDatime time;\n\n");
9e26f77a 438//simulation section
473cb33a 439 fprintf(fp," AliSimulation *pSim=new AliSimulation(sConfigFileName);\n");
8493d0aa 440 if(fGenTypeCO->GetSelected()==kBox1||fGenTypeCO->GetSelected()==kGun7) {
473cb33a 441 fprintf(fp," pSim->SetRegionOfInterest(kTRUE);\n");
442 fprintf(fp," pSim->SetMakeSDigits(\"TOF RICH\");\n");
443 fprintf(fp," pSim->SetMakeDigitsFromHits(\"ITS TPC TRD\");\n");
444 }
9e26f77a 445//RAW data generation
8493d0aa 446 if (fRawBG->GetButton(kRawDdl)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ALL\");\n");
447 else if(fRawBG->GetButton(kRawDate)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ALL\",\".date\");\n");
448 else if(fRawBG->GetButton(kRawRoot)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ALL\",\".root\");\n");
9e26f77a 449
8493d0aa 450 fprintf(fp," pSim->Run(iNevents);\n delete pSim;\n\n");
9e26f77a 451//reconstraction section
0fe8fa07 452 if(fRecoBG->GetButton(kRecon)->GetState()){
473cb33a 453 fprintf(fp," AliReconstruction *pRec=new AliReconstruction;\n");
101624cd 454 fprintf(fp," pRec->SetRunLocalReconstruction(\"ITS TPC TRD TOF RICH\");\n");
0fe8fa07 455 if(fRecoBG->GetButton(kFillEsd)->GetState())
101624cd 456 fprintf(fp," pRec->SetFillESD(\"ITS TPC TRD TOF RICH\");\n");
0fe8fa07 457 fprintf(fp," pRec->Run();\n");
458 fprintf(fp," delete pRec;\n\n");
473cb33a 459 }
9e26f77a 460//benchmarks
473cb33a 461 fprintf(fp," cout<<\"!!!!!!!!!!!!Info in <my/RichBatch.C>: Start time: \";time.Print();\n");
462 fprintf(fp," cout<<\"!!!!!!!!!!!!Info in <my/RichBatch.C>: Stop time: \";time.Set(); time.Print();\n");
8493d0aa 463 fprintf(fp," gBenchmark->Show(\"ALICE\");\n");
9e26f77a 464//indicate end of job
473cb33a 465 fprintf(fp," gSystem->Exec(\"touch ZZZ______finished_______ZZZ\");\n");
466 fprintf(fp," gSystem->Exec(\"playwave ~/bin/end.wav\");\n");
467 fprintf(fp,"}\n");
468
469 fclose(fp);
470}//CreateRichBatch()
471//__________________________________________________________________________________________________
472void RichConfig::Exit()
473{
474//slot to be invoked by clik on the Create button
475 CreateConfig();
476 CreateRichBatch();
8493d0aa 477 SendCloseMessage();
473cb33a 478}
479//__________________________________________________________________________________________________
480RichConfig *rc;
481void RichConfig()
482{
483 rc=new RichConfig("Config.C");
484}
485