Store in ESD mip Q as pTrk->SetRICHnclusters(100000*Q+nphots)
[u/mrichter/AliRoot.git] / RICH / RichConfig.C
CommitLineData
0422a446 1#include <TPDGCode.h>
2
9e26f77a 3class RichConfig : public TGMainFrame
473cb33a 4{
5RQ_OBJECT()
6public:
473cb33a 7 RichConfig(const char*sFileName);
9e26f77a 8 ~RichConfig() {Info("ctor","");Cleanup();}
f47d03bc 9
10 enum EVersOpts {kNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kSecRad,kQe0=400,kQeNorm,kOptics};
db910db9 11 enum EGenTypes {kGunZ=1,kGun1,kGun7,kBox,kHijing,kHijingPara,kPythia,kRichLib,kNotUsed=999};
473cb33a 12
f47d03bc 13 enum EDetectors {kPIPE=1,kITS,kTPC,kTRD,kTOF,kFRAME,kMAG,kCRT,kHALL,kPHOS,kSTART,kFMD,kABSO,kPMD,kDIPO,kEMCAL,kVZERO,kMUON,kZDC,kSHILD};
473cb33a 14 enum EProcesses {kDCAY=1,kPAIR,kCOMP,kPHOT,kPFIS,kDRAY,kANNI,kBREM,kMUNU,kCKOV,kHADR,kLOSS,kMULS,kRAYL,kALL};
a5592834 15 enum EBatchFlags{kPrim=555,kTransport,kAll,kOnly,kRawDdl,kRawDate,kRawRoot,kVertex,kTrack,kHlt,kEsd};
911408e4 16 enum EMagField {kFld0,kFld2,kFld4,kFld5,kFld_2,kFld_4,kFld_5};
473cb33a 17
f47d03bc 18 Float_t Eta2Theta (Float_t arg) const{return (180./TMath::Pi())*2.*TMath::ATan(TMath::Exp(-arg));}
473cb33a 19
f47d03bc 20 void GuiRich (TGHorizontalFrame *pMainF); void WriteRich (FILE *pF); void RichSlot (Int_t ver);
21 void GuiPhys (TGHorizontalFrame *pMainF); void WritePhys (FILE *pF); void PhysAddSlot(Int_t id); void PhysRemSlot(Int_t id);
22 void GuiGen (TGCompositeFrame *pMainF); void WriteGen (FILE *pF); void GenAddSlot (Int_t id); void GenRemSlot (Int_t id);
23 void GuiDet (TGHorizontalFrame *pMainF); void WriteDet (FILE *pF); void DetAddSlot (Int_t id); void DetRemSlot (Int_t id);
370e070a 24 void GuiBatch(TGHorizontalFrame *pMainF); void WriteBatch( ); void SlotBatch (Int_t id);
f47d03bc 25
26 void WriteConfig();
27 void ExitSlot();
473cb33a 28
f47d03bc 29 TGButtonGroup *fVerBG,*fOptBG,*fQeBG; //Rich widgets
a5592834 30 TGButtonGroup *fMagBG; //mag field widgets
31 TGButton *fDecayerB; //external decayer widgets
f47d03bc 32
33 TGComboBox *fGenPidCO,*fGenPminCO,*fGenPmaxCO,*fGenChamCO,*fGenNprimCO; //generator widgets combos
34 TGCompositeFrame *fGenF; //generator widgets frames
35 TGButtonGroup *fGenBG; //generator widgets
36
37 TGButtonGroup *fDetBG,*fProcBG; //detectors and processes widgets
38 TGButtonGroup *fSimBG,*fSDigBG,*fDigBG,*fRawBG,*fClusBG,*fRecoBG; //batch control widgets
39
40 char *fFileName;
473cb33a 41};//class RichConfig
370e070a 42//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8493d0aa 43RichConfig::RichConfig(const char *sFileName):TGMainFrame(gClient->GetRoot(),700,400)
f47d03bc 44{
473cb33a 45 fFileName=sFileName;
9e26f77a 46
f47d03bc 47 AddFrame(pMainF=new TGHorizontalFrame(this,100,200)); //main horizontal frame
8493d0aa 48
f47d03bc 49 GuiRich (pMainF);
50 GuiGen (pMainF);
51 GuiDet (pMainF);
52 GuiPhys (pMainF);
53 GuiBatch(pMainF);
473cb33a 54
f47d03bc 55//File
56 AddFrame(pFileHF=new TGHorizontalFrame(this,100,200));
57 pFileHF->AddFrame(pCrtTB=new TGTextButton(pFileHF,"Create"));
58 pCrtTB->Connect("Clicked()","RichConfig",this,"ExitSlot()");
59 pFileHF->AddFrame(new TGLabel(pFileHF,Form(" config file as %s",fFileName)));
473cb33a 60
f47d03bc 61 MapSubwindows();
62 Resize(GetDefaultSize());
63 SetWindowName("Create AliROOT scripts");
64 MapWindow();
370e070a 65}//ctor
66//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 67void RichConfig::GuiRich(TGHorizontalFrame *pMainHF)
68{
69 pMainHF->AddFrame(pLeftVF=new TGVerticalFrame(pMainHF,100,200));
70 pLeftVF->AddFrame(pRichGF=new TGGroupFrame(pLeftVF,"RICH"));
71 pRichGF->AddFrame(fVerBG=new TGButtonGroup(pRichGF,"")); fVerBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"RichVerSlot(Int_t)");
72 new TGRadioButton(fVerBG, "No" ,kNo ));
73 new TGRadioButton(fVerBG, "ver0" ,kVer0 ));
74 new TGRadioButton(fVerBG, "ver1" ,kVer1 )); fVerBG->SetButton(kVer1);
75 new TGRadioButton(fVerBG, "ver2" ,kVer2 ));
76 pRichGF->AddFrame(fOptBG=new TGButtonGroup(pRichGF,"")); fOptBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"RichVerSlot(Int_t)");
77 new TGCheckButton(fOptBG,"Test beam position?" ,kTest);
78 new TGCheckButton(fOptBG,"Second radiator?" ,kSecRad);
79 new TGCheckButton(fOptBG,"Decluster?" ,kDeclust); fOptBG->SetButton(kDeclust);
80 new TGCheckButton(fOptBG,"Wire sagita?" ,kSagita); fOptBG->SetButton(kSagita);
81 new TGCheckButton(fOptBG,"Feedbacks?" ,kFeedback); fOptBG->SetButton(kFeedback);
82 new TGCheckButton(fOptBG,"Plot optics?" ,kOptics);
83 pRichGF->AddFrame(fQeBG=new TGButtonGroup(pRichGF,""));
84 new TGRadioButton(fQeBG,"QE=0" ,kQe0);
85 new TGRadioButton(fQeBG,"QE normal" ,kQeNorm); fQeBG->SetButton(kQeNorm);
a5592834 86 pLeftVF->AddFrame(fDecayerB=new TGCheckButton(pLeftVF,"Puthia decayer On/Off")); fDecayerB->SetState(kButtonDown);
911408e4 87 pLeftVF->AddFrame(fMagBG=new TGButtonGroup(pLeftVF,"Mag field"));
88 new TGRadioButton(fMagBG, "0.5 T" ,kFld5 ));
89 new TGRadioButton(fMagBG, "0.4 T" ,kFld4 ));
90 new TGRadioButton(fMagBG, "0.2 T" ,kFld2 )); fMagBG->SetButton(kFld2);
91 new TGRadioButton(fMagBG, "0 T" ,kFld0 ));
92 new TGRadioButton(fMagBG, "-0.2 T" ,kFld_2 ));
93 new TGRadioButton(fMagBG, "-0.4 T" ,kFld_4 ));
94 new TGRadioButton(fMagBG, "-0.5 T" ,kFld_5 ));
f47d03bc 95}//Rich()
370e070a 96//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 97void RichConfig::RichVerSlot(Int_t ver)
98{
911408e4 99 if(ver==kTest) {fMagBG->SetButton(kFld0); fGenBG->SetButton(kGunZ); }
f47d03bc 100}
370e070a 101//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 102void RichConfig::WriteRich(FILE *pF)
103{
104 if(!fVerBG->GetButton(kNo)->GetState()){
a5592834 105 TString title;
106 if( fOptBG->GetButton(kSecRad)->GetState()) title+=" Radiator2 ";
f47d03bc 107 if(!fOptBG->GetButton(kSagita)->GetState()) fprintf(pF," AliRICHParam::fgIsWireSagita=kFALSE;\n");
a5592834 108 if( fOptBG->GetButton(kTest) ->GetState()) title+=" TestBeam ";
109 if( fOptBG->GetButton(kOptics)->GetState()) title+=" ShowOptics ";
110 if(title.Length()==0) title="Default";
f47d03bc 111
a5592834 112 if (fVerBG->GetButton(kVer0)->GetState()) fprintf(pF," new AliRICHv0(\"Gel %s\");\n\n",title.Data());
113 else if(fVerBG->GetButton(kVer1)->GetState()) fprintf(pF," new AliRICHv1(\"RICH\",\"%s\");\n\n",title.Data());
114 else if(fVerBG->GetButton(kVer2)->GetState()) fprintf(pF," new AliRICHv2(\"Tic %s\");\n\n",title.Data());
f47d03bc 115 }
116}
370e070a 117//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 118void RichConfig::GuiPhys(TGHorizontalFrame *pMainHF)
119{
a5592834 120 pMainHF->AddFrame(fProcBG=new TGButtonGroup(pMainHF,"Procs"));
f47d03bc 121 fProcBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"PhysAddSlot(Int_t)");
122 fProcBG->Connect("Released(Int_t)","RichConfig",this,"PhysRemSlot(Int_t)");
473cb33a 123 new TGCheckButton(fProcBG,"ALL ON/OFF" ,kALL)) ;
124 new TGCheckButton(fProcBG,"DCAY Decay" ,kDCAY)); fProcBG->SetButton(kDCAY);
125 new TGCheckButton(fProcBG,"PAIR Pair production" ,kPAIR)); fProcBG->SetButton(kPAIR);
126 new TGCheckButton(fProcBG,"COMP Compton" ,kCOMP)); fProcBG->SetButton(kCOMP);
127 new TGCheckButton(fProcBG,"PHOT" ,kPHOT)); fProcBG->SetButton(kPHOT);
128 new TGCheckButton(fProcBG,"PFIS Photofission" ,kPFIS));
129 new TGCheckButton(fProcBG,"DRAY Delta electrons" ,kDRAY));
130 new TGCheckButton(fProcBG,"ANNI Annihilation" ,kANNI)); fProcBG->SetButton(kANNI);
131 new TGCheckButton(fProcBG,"BREM Bremstraslung" ,kBREM)); fProcBG->SetButton(kBREM);
132 new TGCheckButton(fProcBG,"MUNU Muon-Nuclear" ,kMUNU)); fProcBG->SetButton(kMUNU);
133 new TGCheckButton(fProcBG,"CKOV Cerenkovs" ,kCKOV)); fProcBG->SetButton(kCKOV);
134 new TGCheckButton(fProcBG,"HADR Hadronic interactions " ,kHADR)); fProcBG->SetButton(kHADR);
135 new TGCheckButton(fProcBG,"LOSS Energy losses" ,kLOSS)); fProcBG->SetButton(kLOSS);
136 new TGCheckButton(fProcBG,"MULS Multiple scattering" ,kMULS)); fProcBG->SetButton(kMULS);
f47d03bc 137 new TGCheckButton(fProcBG,"RAYL Rayleigh scattering" ,kRAYL)); fProcBG->SetButton(kRAYL);
138}
370e070a 139//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 140void RichConfig::PhysAddSlot(Int_t id)
141{//slot is invoked when any of physics check button is pressed
142 if(id==kALL) //if the pressed check button is kALL then switch on all the buttons
143 for(int i=1;i<=fProcBG->GetCount();i++)
144 fProcBG->SetButton(i,kButtonDown);
145}
370e070a 146//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 147void RichConfig::PhysRemSlot(Int_t id)
148{//slot is invoked when any of physics check button is released
149 if(id==kALL) //if the released check button is kALL then switch off all the buttons
150 for(int i=1;i<=fProcBG->GetCount();i++)
151 fProcBG->SetButton(i,kButtonUp);
152}
370e070a 153//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 154void RichConfig::WritePhys(FILE *pF)
155{
156 if(fProcBG->GetButton(kDCAY)->GetState()) fprintf(pF," gMC->SetProcess(\"DCAY\",1); ");else fprintf(pF," gMC->SetProcess(\"DCAY\",0); ");
157 if(fProcBG->GetButton(kPAIR)->GetState()) fprintf(pF," gMC->SetProcess(\"PAIR\",1); ");else fprintf(pF," gMC->SetProcess(\"PAIR\",0); ");
158 if(fProcBG->GetButton(kCOMP)->GetState()) fprintf(pF," gMC->SetProcess(\"COMP\",1);\n");else fprintf(pF," gMC->SetProcess(\"COMP\",0);\n");
159 if(fProcBG->GetButton(kPHOT)->GetState()) fprintf(pF," gMC->SetProcess(\"PHOT\",1); ");else fprintf(pF," gMC->SetProcess(\"PHOT\",0); ");
160 if(fProcBG->GetButton(kPFIS)->GetState()) fprintf(pF," gMC->SetProcess(\"PFIS\",1); ");else fprintf(pF," gMC->SetProcess(\"PFIS\",0); ");
161 if(fProcBG->GetButton(kDRAY)->GetState()) fprintf(pF," gMC->SetProcess(\"DRAY\",1);\n");else fprintf(pF," gMC->SetProcess(\"DRAY\",0);\n");
162 if(fProcBG->GetButton(kANNI)->GetState()) fprintf(pF," gMC->SetProcess(\"ANNI\",1); ");else fprintf(pF," gMC->SetProcess(\"ANNI\",0); ");
163 if(fProcBG->GetButton(kBREM)->GetState()) fprintf(pF," gMC->SetProcess(\"BREM\",1); ");else fprintf(pF," gMC->SetProcess(\"BREM\",0); ");
164 if(fProcBG->GetButton(kMUNU)->GetState()) fprintf(pF," gMC->SetProcess(\"MUNU\",1);\n");else fprintf(pF," gMC->SetProcess(\"MUNU\",0);\n");
165 if(fProcBG->GetButton(kCKOV)->GetState()) fprintf(pF," gMC->SetProcess(\"CKOV\",1); ");else fprintf(pF," gMC->SetProcess(\"CKOV\",0); ");
166 if(fProcBG->GetButton(kHADR)->GetState()) fprintf(pF," gMC->SetProcess(\"HADR\",1); ");else fprintf(pF," gMC->SetProcess(\"HADR\",0); ");
167 if(fProcBG->GetButton(kLOSS)->GetState()) fprintf(pF," gMC->SetProcess(\"LOSS\",2);\n");else fprintf(pF," gMC->SetProcess(\"LOSS\",0);\n");
168 if(fProcBG->GetButton(kMULS)->GetState()) fprintf(pF," gMC->SetProcess(\"MULS\",1); ");else fprintf(pF," gMC->SetProcess(\"MULS\",0); ");
169 if(fProcBG->GetButton(kRAYL)->GetState()) fprintf(pF," gMC->SetProcess(\"RAYL\",1);\n");else fprintf(pF," gMC->SetProcess(\"RAYL\",0);\n");
8493d0aa 170
f47d03bc 171 fprintf(pF,"\n");
172 fprintf(pF," gMC->SetCut(\"CUTGAM\",0.001); "); fprintf(pF," gMC->SetCut(\"CUTELE\",0.001); "); fprintf(pF," gMC->SetCut(\"CUTNEU\",0.001);\n");
173 fprintf(pF," gMC->SetCut(\"CUTHAD\",0.001); "); fprintf(pF," gMC->SetCut(\"CUTMUO\",0.001); "); fprintf(pF," gMC->SetCut(\"BCUTE\" ,0.001);\n");
174 fprintf(pF," gMC->SetCut(\"BCUTM\" ,0.001); "); fprintf(pF," gMC->SetCut(\"DCUTE\" ,0.001); "); fprintf(pF," gMC->SetCut(\"DCUTM\" ,0.001);\n");
175 fprintf(pF," gMC->SetCut(\"PPCUTM\",0.001); "); fprintf(pF," gMC->SetCut(\"TOFMAX\",1e10);\n\n");
176}//WritePhys()
370e070a 177//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 178void RichConfig::GuiGen(TGCompositeFrame *pMainF)
179{//generator configurator implemented as group of radio buttons
180 pMainF->AddFrame(fGenF=new TGVerticalFrame(pMainF));//add generator vertical frame to horizontal main frame
a5592834 181 fGenF->AddFrame(fGenBG=new TGButtonGroup(fGenF,"Gene"));//add type button group to vertical generator frame
f47d03bc 182 fGenBG->Connect("Pressed(Int_t)","RichConfig",this,"GenAddSlot(Int_t)"); fGenBG->Connect("Released(Int_t)","RichConfig",this,"GenRemSlot(Int_t)");
183 new TGCheckButton(fGenBG,"gun along z" ,kGunZ);
184 new TGCheckButton(fGenBG,"gun to 1 chamber" ,kGun1);
185 new TGCheckButton(fGenBG,"gun to 7 chambers" ,kGun7);
db910db9 186 new TGCheckButton(fGenBG,"box RICH phase space" ,kBox );
f47d03bc 187 new TGCheckButton(fGenBG,"HIJING" ,kHijing);
188 new TGCheckButton(fGenBG,"HIJING para" ,kHijingPara);
189 new TGCheckButton(fGenBG,"Pythia" ,kPythia);
190 new TGCheckButton(fGenBG,"RICH lib" ,kRichLib);
191//N prims for box and Hijing para
192 fGenF->AddFrame(fGenNprimCO=new TGComboBox(fGenF,100)); //add N prims combo to generator vertical frame
193 fGenNprimCO->AddEntry("not used" ,kNotUsed);
194 fGenNprimCO->AddEntry("N prim=1" ,1);
195 fGenNprimCO->AddEntry("N prim=2" ,2);
196 fGenNprimCO->AddEntry("N prim=5" ,5);
db910db9 197 fGenNprimCO->AddEntry("N prim=100" ,100);
a5592834 198 fGenNprimCO->AddEntry("N prim=500" ,500);
db910db9 199 fGenNprimCO->AddEntry("N prim=1000" ,1000);
200 fGenNprimCO->AddEntry("N prim=10000",10000);
f47d03bc 201 fGenNprimCO->AddEntry("N prim=80000",80000); fGenNprimCO->Resize(160,20); fGenNprimCO->Select(kNotUsed);
202//PID
203 fGenF->AddFrame(fGenPidCO=new TGComboBox(fGenF,100)); //add pid combo to generator vertical frame
204 fGenPidCO->AddEntry("not used" ,kNotUsed);
205 fGenPidCO->AddEntry("electron" ,kElectron);
206 fGenPidCO->AddEntry("positron" ,kPositron);
207 fGenPidCO->AddEntry("pion +" ,kPiPlus);
208 fGenPidCO->AddEntry("pion -" ,kPiMinus);
209 fGenPidCO->AddEntry("kaon +" ,kKPlus);
210 fGenPidCO->AddEntry("kaon -" ,kKMinus);
211 fGenPidCO->AddEntry("kaon 0" ,kK0Short);
212 fGenPidCO->AddEntry("proton" ,kProton);
213 fGenPidCO->AddEntry("antiproton" ,kProtonBar);
214 fGenPidCO->AddEntry("lambda" ,kLambda0);
215 fGenPidCO->AddEntry("antilambda" ,kLambda0Bar); fGenPidCO->Resize(160,20); fGenPidCO->Select(kNotUsed);
216//Pmin
217 fGenF->AddFrame(fGenPminCO=new TGComboBox(fGenF,100)); //add Pmin combo to generator vertical frame
218 fGenPminCO->AddEntry("not used",kNotUsed);
219 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);
220//Pmax
221 fGenF->AddFrame(fGenPmaxCO=new TGComboBox(fGenF,100)); //add Pmax combo to generator vertical frame
222 fGenPmaxCO->AddEntry("not used",kNotUsed);
223 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);
224//Chamber number
225 fGenF->AddFrame(fGenChamCO=new TGComboBox(fGenF,100)); //add chamber number combo to generator vertical frame
226 fGenChamCO->AddEntry("not used",kNotUsed);
227 for(int i=1;i<=7;i++) fGenChamCO->AddEntry(Form("Chamber %i",i),i); fGenChamCO->Resize(160,20); fGenChamCO->Select(kNotUsed);
228}//GuiGen()
370e070a 229//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 230void RichConfig::GenAddSlot(Int_t id)
231{//is invoked when any of generator check button is pressed
232 if(id==kGunZ){
370e070a 233 fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenF->HideFrame(fGenNprimCO); fGenF->HideFrame(fGenPmaxCO);
234 fGenBG->GetButton(kGun7)->SetEnabled(kFALSE);
235 fGenBG->GetButton(kBox )->SetEnabled(kFALSE); fGenPidCO->Select(kProton); fGenPminCO->Select(25);
f47d03bc 236 }
237 if(id==kGun1){
370e070a 238 fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenF->HideFrame(fGenNprimCO); fGenF->HideFrame(fGenPmaxCO);
239 fGenBG->GetButton(kGun7)->SetEnabled(kFALSE); fGenPidCO->Select(kProton); fGenPminCO->Select(25); fGenChamCO->Select(4);
db910db9 240 fGenBG->GetButton(kBox )->SetEnabled(kFALSE);
8493d0aa 241 }
f47d03bc 242 if(id==kGun7){
243 fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenF->HideFrame(fGenNprimCO);
244 fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenPidCO->Select(kProton);
db910db9 245 fGenBG->GetButton(kBox )->SetEnabled(kFALSE); fGenF->HideFrame(fGenPmaxCO); fGenPminCO->Select(25);
246 fGenF->HideFrame(fGenChamCO);
f47d03bc 247 }
db910db9 248 if(id==kBox){
249 fGenBG->GetButton(kGunZ)->SetEnabled(kFALSE); fGenNprimCO->Select(500);
f47d03bc 250 fGenBG->GetButton(kGun1)->SetEnabled(kFALSE); fGenPidCO ->Select(kProton);
db910db9 251 fGenBG->GetButton(kGun7)->SetEnabled(kFALSE); fGenPminCO ->Select(15); fGenPmaxCO->Select(15);
f47d03bc 252 }
253 if(id==kHijing){
254 fGenBG->GetButton(kHijing)->ChangeBackground(0xff0000);
255 fGenBG->GetButton(kHijingPara)->SetEnabled(kFALSE);
256 fGenBG->GetButton(kPythia)->SetEnabled(kFALSE);
257 }
258 if(id==kHijingPara){
a5592834 259 fGenBG->GetButton(kHijing)->SetEnabled(kFALSE); fGenNprimCO->Select(500);
f47d03bc 260 fGenBG->GetButton(kPythia)->SetEnabled(kFALSE);
261 }
262 if(id==kPythia){
263 fGenBG->GetButton(kHijing)->SetEnabled(kFALSE);
264 fGenBG->GetButton(kHijingPara)->SetEnabled(kFALSE);
265 }
266}//GenAddSlot()
370e070a 267//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 268void RichConfig::GenRemSlot(Int_t id)
269{//is invoked when any of generator check button is released
270 if(id==kGunZ){
271 fGenBG->GetButton(kGun1)->SetEnabled(); fGenF->ShowFrame(fGenNprimCO);
272 fGenBG->GetButton(kGun7)->SetEnabled(); fGenPidCO ->Select(kNotUsed);
db910db9 273 fGenBG->GetButton(kBox )->SetEnabled(); fGenF->ShowFrame(fGenPmaxCO); fGenPminCO ->Select(kNotUsed);
f47d03bc 274 }
275 if(id==kGun1){
276 fGenBG->GetButton(kGunZ)->SetEnabled(); fGenF->ShowFrame(fGenNprimCO);
277 fGenBG->GetButton(kGun7)->SetEnabled(); fGenPidCO ->Select(kNotUsed);
db910db9 278 fGenBG->GetButton(kBox )->SetEnabled(); fGenF->ShowFrame(fGenPmaxCO); fGenPminCO ->Select(kNotUsed);
f47d03bc 279 }
280 if(id==kGun7){
281 fGenBG->GetButton(kGunZ)->SetEnabled(); fGenF->ShowFrame(fGenNprimCO);
282 fGenBG->GetButton(kGun1)->SetEnabled(); fGenPidCO ->Select(kNotUsed);
db910db9 283 fGenBG->GetButton(kBox )->SetEnabled(); fGenF->ShowFrame(fGenPmaxCO); fGenPminCO ->Select(kNotUsed);
284 fGenF->ShowFrame(fGenChamCO);
f47d03bc 285 }
db910db9 286 if(id==kBox){
f47d03bc 287 fGenBG->GetButton(kGunZ)->SetEnabled(); fGenNprimCO->Select(kNotUsed);
288 fGenBG->GetButton(kGun1)->SetEnabled(); fGenPidCO ->Select(kNotUsed);
289 fGenBG->GetButton(kGun7)->SetEnabled(); fGenPminCO ->Select(kNotUsed); fGenPmaxCO->Select(kNotUsed);
db910db9 290 fGenChamCO ->Select(kNotUsed);
f47d03bc 291 }
292 if(id==kHijing){
293 fGenBG->GetButton(kHijing)->ChangeBackground(0xbebebe);
294 fGenBG->GetButton(kHijingPara)->SetEnabled();
295 fGenBG->GetButton(kPythia)->SetEnabled();
296 }
297 if(id==kHijingPara){
298 fGenBG->GetButton(kHijing)->SetEnabled();
299 fGenBG->GetButton(kPythia)->SetEnabled();
300 }
301 if(id==kPythia){
302 fGenBG->GetButton(kHijing)->SetEnabled();
303 fGenBG->GetButton(kHijingPara)->SetEnabled();
304 }
305}//GenRemSlot()
370e070a 306//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 307void RichConfig::WriteGen(FILE *pF)
308{
db910db9 309 Int_t pid=fGenPidCO->GetSelected();
310 Float_t pmin=0.1*fGenPminCO->GetSelected(); //particle momentum, GeV
311 Float_t pmax=0.1*fGenPmaxCO->GetSelected(); //particle momentum, GeV
312
313 fprintf(pF," AliGenCocktail *pG=new AliGenCocktail();\n\n");
314
315 if(fGenBG->GetButton(kGunZ)->GetState()==kButtonDown)//1 particle along Z axis
316 fprintf(pF," AliGenFixed *pGz=new AliGenFixed(1); pGz->SetPart(%i); pGz->SetMomentum(%.1f); pGz->SetOrigin(0,0,-200); pG->AddGenerator(pGz,\"Gz\",1);\n",pid,p);
317
f47d03bc 318 if(fGenBG->GetButton(kGun1)->GetState()==kButtonDown){//1 gun towards 1 RICH chamber
db910db9 319 switch(fGenChamCO->GetSelected()){
320 case 1: fprintf(pF," AliGenFixed *pG1=new AliGenFixed(1); pG1->SetPart(%i); pG1->SetMomentum(%.1f);\n",pid,pmin);
321 fprintf(pF," pG1->SetTheta(109.5); pG1->SetPhi(10); pG->AddGenerator(pG1,\"g1\",1);\n"); break;
322 case 2: fprintf(pF," AliGenFixed *pG2=new AliGenFixed(1); pG2->SetPart(%i); pG2->SetMomentum(%.1f);\n",pid,pmin);
323 fprintf(pF," pG2->SetTheta( 90.0); pG2->SetPhi(10); pG->AddGenerator(pG2,\"g2\",1);\n"); break;
324 case 3: fprintf(pF," AliGenFixed *pG3=new AliGenFixed(1); pG3->SetPart(%i); pG3->SetMomentum(%.1f);\n",pid,pmin);
325 fprintf(pF," pG3->SetTheta(109.5); pG3->SetPhi(30); pG->AddGenerator(pG3,\"g3\",1);\n"); break;
326 case 4: fprintf(pF," AliGenFixed *pG4=new AliGenFixed(1); pG4->SetPart(%i); pG4->SetMomentum(%.1f);\n",pid,pmin);
327 fprintf(pF," pG4->SetTheta( 90.0); pG4->SetPhi(30); pG->AddGenerator(pG4,\"g4\",1);\n"); break;
328 case 5: fprintf(pF," AliGenFixed *pG5=new AliGenFixed(1); pG5->SetPart(%i); pG5->SetMomentum(%.1f);\n",pid,pmin);
329 fprintf(pF," pG5->SetTheta( 70.5); pG5->SetPhi(30); pG->AddGenerator(pG5,\"g5\",1);\n"); break;
330 case 6: fprintf(pF," AliGenFixed *pG6=new AliGenFixed(1); pG6->SetPart(%i); pG6->SetMomentum(%.1f);\n",pid,pmin);
331 fprintf(pF," pG6->SetTheta( 90.0); pG6->SetPhi(50); pG->AddGenerator(pG6,\"g6\",1);\n"); break;
332 case 7: fprintf(pF," AliGenFixed *pG7=new AliGenFixed(1); pG7->SetPart(%i); pG7->SetMomentum(%.1f);\n",pid,pmin);
333 fprintf(pF," pG7->SetTheta( 70.5); pG7->SetPhi(50); pG->AddGenerator(pG7,\"g7\",1);\n"); break;
334 }
f47d03bc 335 }
db910db9 336
f47d03bc 337 if(fGenBG->GetButton(kGun7)->GetState()==kButtonDown){//7 guns towards 7 RICH chambers
4a1b0f92 338 fprintf(pF," AliGenFixed *pG1=new AliGenFixed(1); pG1->SetPart(%i); pG1->SetMomentum(%.1f);pG1->SetTheta(109.5-3); pG1->SetPhi(10);\n",pid,pmin);
db910db9 339 fprintf(pF," pG->AddGenerator(pG1,\"g1\",1);\n");
4a1b0f92 340 fprintf(pF," AliGenFixed *pG2=new AliGenFixed(1); pG2->SetPart(%i); pG2->SetMomentum(%.1f);pG2->SetTheta( 90.0-3); pG2->SetPhi(10);\n",pid,pmin);
db910db9 341 fprintf(pF," pG->AddGenerator(pG2,\"g2\",1);\n");
4a1b0f92 342 fprintf(pF," AliGenFixed *pG3=new AliGenFixed(1); pG3->SetPart(%i); pG3->SetMomentum(%.1f);pG3->SetTheta(109.5-3); pG3->SetPhi(30);\n",pid,pmin);
db910db9 343 fprintf(pF," pG->AddGenerator(pG3,\"g3\",1);\n");
4a1b0f92 344 fprintf(pF," AliGenFixed *pG4=new AliGenFixed(1); pG4->SetPart(%i); pG4->SetMomentum(%.1f);pG4->SetTheta( 90.0-3); pG4->SetPhi(30);\n",pid,pmin);
db910db9 345 fprintf(pF," pG->AddGenerator(pG4,\"g4\",1);\n");
4a1b0f92 346 fprintf(pF," AliGenFixed *pG5=new AliGenFixed(1); pG5->SetPart(%i); pG5->SetMomentum(%.1f);pG5->SetTheta( 70.0-3); pG5->SetPhi(30);\n",pid,pmin);
db910db9 347 fprintf(pF," pG->AddGenerator(pG5,\"g5\",1);\n");
4a1b0f92 348 fprintf(pF," AliGenFixed *pG6=new AliGenFixed(1); pG6->SetPart(%i); pG6->SetMomentum(%.1f);pG6->SetTheta( 90.0-3); pG6->SetPhi(50);\n",pid,pmin);
db910db9 349 fprintf(pF," pG->AddGenerator(pG6,\"g6\",1);\n");
4a1b0f92 350 fprintf(pF," AliGenFixed *pG7=new AliGenFixed(1); pG7->SetPart(%i); pG7->SetMomentum(%.1f);pG7->SetTheta( 70.0-3); pG7->SetPhi(50);\n",pid,pmin);
db910db9 351 fprintf(pF," pG->AddGenerator(pG7,\"g7\",1);\n");
352 }
353
354 if(fGenBG->GetButton(kBox)->GetState()==kButtonDown){// box towards RICH phase space
355 fprintf(pF," AliGenBox *pB=new AliGenBox(%i); pB->SetPart(%i); pB->SetMomentumRange(%.1f,%.1f);\n",(int)fGenNprimCO->GetSelected(),pid,pmin,pmax);
356 fprintf(pF," pB->SetThetaRange(65,115); pB->SetPhiRange(5,55); pG->AddGenerator(pB,\"b\",1);\n");
f47d03bc 357 }
db910db9 358
f47d03bc 359 if(fGenBG->GetButton(kHijing)->GetState()==kButtonDown){//normal HIJING
db910db9 360 fprintf(pF," AliGenHijing *pH=new AliGenHijing(-1); pH->SetEnergyCMS(5500); pH->SetReferenceFrame(\"CMS\");\n");
361 fprintf(pF," pH->SetProjectile(\"A\", 208, 82); pH->SetTarget(\"A\", 208, 82); pH->SetJetQuenching(0);\n");
362 fprintf(pF," pH->SetShadowing(0); pH->KeepFullEvent(); pH->SetSelectAll(0);\n");
363 fprintf(pF," pH->SetImpactParameterRange(0, 5); //fermi\n");
364 fprintf(pF," pG->AddGenerator(pH,\"h\",1);\n\n");
f47d03bc 365 }
db910db9 366
f47d03bc 367 if(fGenBG->GetButton(kHijingPara)->GetState()==kButtonDown){//parametrized HIJING
db910db9 368 fprintf(pF," AliGenHIJINGpara *pHP=new AliGenHIJINGpara(%i);\n",(int)fGenNprimCO->GetSelected());
369 fprintf(pF," pHP->SetMomentumRange(0,999); pHP->SetThetaRange(%f,%f); pHP->SetPhiRange(0,360);\n",Eta2Theta(8),Eta2Theta(-8));
370 fprintf(pF," pG->AddGenerator(pHP,\"hp\",1);\n\n");
f47d03bc 371 }
db910db9 372
373 if(fGenBG->GetButton(kPythia)->GetState()==kButtonDown){//Pythia
374 fprintf(pF," AliGenPythia *pP=new AliGenPythia(-1);\n");
375 fprintf(pF," pP->SetMomentumRange(0,999); pP->SetPhiRange(20,80); pP->SetThetaRange(75,115);\n");
376 fprintf(pF," pP->SetYRange(-12,12); pP->SetPtRange(0,1000); pP->SetStrucFunc(kCTEQ4L);\n");
377 fprintf(pF," pP->SetProcess(kPyMb); pP->SetEnergyCMS(14000);\n");
378 fprintf(pF," pG->AddGenerator(pP,\"p\",1);\n\n");
379 }
380 fprintf(pF," pG->Init();\n\n");
f47d03bc 381}//WriteGenerator()
370e070a 382//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 383void RichConfig::GuiDet(TGHorizontalFrame *pMainHF)
384{
a5592834 385 pMainHF->AddFrame(fDetBG=new TGButtonGroup(pMainHF,"Dets"));
f47d03bc 386 fDetBG->Connect("Pressed(Int_t)" ,"RichConfig",this,"DetAddSlot(Int_t)");
387 fDetBG->Connect("Released(Int_t)","RichConfig",this,"DetRemSlot(Int_t)");
388 new TGCheckButton(fDetBG,"PIPE" ,kPIPE)); new TGCheckButton(fDetBG,"ITS" ,kITS)); new TGCheckButton(fDetBG,"TPC" ,kTPC));
389 new TGCheckButton(fDetBG,"TRD" ,kTRD)); new TGCheckButton(fDetBG,"TOF" ,kTOF)); new TGCheckButton(fDetBG,"FRAME" ,kFRAME));
390 new TGCheckButton(fDetBG,"MAG" ,kMAG)); new TGCheckButton(fDetBG,"CRT" ,kCRT)); new TGCheckButton(fDetBG,"HALL" ,kHALL));
391 new TGCheckButton(fDetBG,"PHOS" ,kPHOS)); new TGCheckButton(fDetBG,"START" ,kSTART)); new TGCheckButton(fDetBG,"FMD" ,kFMD));
392 new TGCheckButton(fDetBG,"ABSO" ,kABSO)); new TGCheckButton(fDetBG,"PMD" ,kPMD)); new TGCheckButton(fDetBG,"DIPO" ,kDIPO));
393 new TGCheckButton(fDetBG,"EMCAL" ,kEMCAL)); new TGCheckButton(fDetBG,"VZERO" ,kVZERO)); new TGCheckButton(fDetBG,"MUON" ,kMUON));
394 new TGCheckButton(fDetBG,"ZDC" ,kZDC)); new TGCheckButton(fDetBG,"SHILD" ,kSHILD));
395}
370e070a 396//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 397void RichConfig::DetAddSlot(Int_t id)
398{//slot is invoked when any detector check button is pressed
399 if(id==kTRD || id==kTOF) //TRD and TOF geometries depend on FRAME
400 fDetBG->SetButton(kFRAME);
401}
370e070a 402//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 403void RichConfig::DetRemSlot(Int_t id)
404{//slot is invoked when any detector check button is released
405 if(id==kFRAME){
406 fDetBG->SetButton(kTRD,kFALSE); //switch off TRD and TOF when FRAME is switched off by user hence TRD&TOF depend on FRAME
407 fDetBG->SetButton(kTOF,kFALSE);
408 }
409}
370e070a 410//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 411void RichConfig::WriteDet(FILE *pF)
412{
370e070a 413//CORE detectors
f47d03bc 414 if(fDetBG->GetButton(kPIPE )->GetState()) fprintf(pF,"\n new AliPIPEv0(\"PIPE\",\"Beam Pipe\");\n");
415 if(fDetBG->GetButton(kSHILD)->GetState()) fprintf(pF,"\n new AliSHILv2(\"SHIL\",\"Shielding Version 2\");\n");
0422a446 416 if(fDetBG->GetButton(kITS )->GetState()){
f47d03bc 417 fprintf(pF,"\n AliITSvPPRasymmFMD *pIts =new AliITSvPPRasymmFMD(\"ITS\",\"ITS PPR detailed version\");\n");
7be84232 418 fprintf(pF," pIts->SetMinorVersion(2); pIts->SetReadDet(kFALSE);\n");
f47d03bc 419 fprintf(pF," pIts->SetThicknessDet1(200.); pIts->SetThicknessDet2(200.);\n");
7be84232 420 fprintf(pF," pIts->SetThicknessChip1(150.); pIts->SetThicknessChip2(150.);\n");
f47d03bc 421 fprintf(pF," pIts->SetRails(0); pIts->SetCoolingFluid(1);\n");
422 fprintf(pF," pIts->SetEUCLID(0);\n");
0422a446 423 }
a5592834 424 if(fDetBG->GetButton(kTPC )->GetState()) fprintf(pF,"\n new AliTPCv2(\"TPC\",\"Default\");\n");
425 if(fDetBG->GetButton(kFRAME)->GetState()) fprintf(pF,"\n AliFRAMEv2 *pFrame=new AliFRAMEv2(\"FRAME\",\"Space Frame\"); pFrame->SetHoles(1);\n");
370e070a 426 if(fDetBG->GetButton(kTRD )->GetState()) fprintf(pF,"\n AliTRD *pTrd=new AliTRDv1(\"TRD\",\"TRD slow simulator\");\n");
f47d03bc 427 if(fDetBG->GetButton(kTOF )->GetState()) fprintf(pF,"\n new AliTOFv4T0(\"TOF\", \"normal TOF\");\n");
370e070a 428//central detectors behind RICH
f47d03bc 429 if(fDetBG->GetButton(kMAG )->GetState()) fprintf(pF,"\n new AliMAG(\"MAG\",\"Magnet\");\n");
430 if(fDetBG->GetButton(kHALL )->GetState()) fprintf(pF,"\n new AliHALL(\"HALL\",\"Alice Hall\");\n");
0422a446 431//forward detectors
f47d03bc 432 if(fDetBG->GetButton(kFMD )->GetState()) fprintf(pF,"\n new AliFMDv1(\"FMD\",\"normal FMD\");\n");
433 if(fDetBG->GetButton(kABSO )->GetState()) fprintf(pF,"\n new AliABSOv0(\"ABSO\",\"Muon absorber\");\n");
434 if(fDetBG->GetButton(kDIPO )->GetState()) fprintf(pF,"\n new AliDIPOv2(\"DIPO\",\"Dipole version 2\");\n");
435 if(fDetBG->GetButton(kMUON )->GetState()) fprintf(pF,"\n new AliMUONv1(\"MUON\",\"default\");\n");
436 if(fDetBG->GetButton(kPMD )->GetState()) fprintf(pF,"\n new AliPMDv1(\"PMD\",\"normal PMD\");\n");
437 if(fDetBG->GetButton(kSTART)->GetState()) fprintf(pF,"\n new AliSTARTv1(\"START\",\"START Detector\");\n");
438 if(fDetBG->GetButton(kVZERO)->GetState()) fprintf(pF,"\n new AliVZEROv2(\"VZERO\",\"normal VZERO\");\n");
439 if(fDetBG->GetButton(kZDC )->GetState()) fprintf(pF,"\n new AliZDCv2(\"ZDC\",\"normal ZDC\");\n");
0422a446 440//different phase space detectors
f47d03bc 441 if(fDetBG->GetButton(kPHOS )->GetState()) fprintf(pF,"\n new AliPHOSv1(\"PHOS\",\"IHEP\");\n");
442 if(fDetBG->GetButton(kEMCAL)->GetState()) fprintf(pF,"\n new AliEMCALv1(\"EMCAL\",\"G56_2_55_19_104_14\");\n");
443 if(fDetBG->GetButton(kCRT )->GetState()) fprintf(pF,"\n new AliCRTv0(\"CRT\",\"normal ACORDE\");\n");
444}
370e070a 445//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 446void RichConfig::GuiBatch(TGHorizontalFrame *pMainF)
0422a446 447{
f47d03bc 448 TGGroupFrame *pSimF=new TGGroupFrame(pMainF,"Simu"); pMainF->AddFrame(pSimF);
449 pSimF->AddFrame(fSimBG=new TGButtonGroup(pSimF,"" ));
450 new TGCheckButton(fSimBG, "Primary" ,kPrim )); fSimBG->SetButton(kPrim);
451 new TGCheckButton(fSimBG, "Transport" ,kTransport)); fSimBG->SetButton(kTransport);
452 pSimF->AddFrame (fSDigBG=new TGButtonGroup(pSimF,"" ));
453 new TGRadioButton(fSDigBG, "No SDigits" ,kNo ));
370e070a 454 new TGRadioButton(fSDigBG, "SDigits CORE" ,kAll ));
f47d03bc 455 new TGRadioButton(fSDigBG, "SDigits RICH" ,kOnly )); fSDigBG->SetButton(kOnly);
456 pSimF->AddFrame (fDigBG=new TGButtonGroup(pSimF,"" ));
457 new TGRadioButton(fDigBG, "No Digits" ,kNo ));
370e070a 458 new TGRadioButton(fDigBG, "Digits CORE" ,kAll ));
f47d03bc 459 new TGRadioButton(fDigBG, "Digits RICH" ,kOnly )); fDigBG->SetButton(kOnly);
460 pSimF->AddFrame(fRawBG=new TGButtonGroup(pSimF,"" ));
461 new TGRadioButton(fRawBG, "No RAW files" ,kNo )); fRawBG->SetButton(kNo);
462 new TGRadioButton(fRawBG, "RAW DDL" ,kRawDdl ));
463 new TGRadioButton(fRawBG, "RAW DATE" ,kRawDate ));
464 new TGRadioButton(fRawBG, "RAW ROOT" ,kRawRoot ));
465
466 TGCompositeFrame *pRecF=new TGGroupFrame(pMainF,"Reco"); pMainF->AddFrame(pRecF);
467 pRecF->AddFrame(fClusBG=new TGButtonGroup(pRecF,"" ));
468 new TGRadioButton(fClusBG, "No Clusters" ,kNo ));
370e070a 469 new TGRadioButton(fClusBG, "Clusters CORE" ,kAll ));
f47d03bc 470 new TGRadioButton(fClusBG, "Clusters RICH" ,kOnly )); fClusBG->SetButton(kOnly);
370e070a 471
472 pRecF->AddFrame(fRecoBG=new TGButtonGroup(pRecF,"" )); fRecoBG->Connect("Pressed(Int_t)","RichConfig",this,"SlotBatch(Int_t)");
f47d03bc 473 new TGCheckButton(fRecoBG, "Find ESD tracks" ,kTrack ));
370e070a 474 new TGCheckButton(fRecoBG, "Find vertex" ,kVertex ));
a847377e 475 new TGCheckButton(fRecoBG, "Fill ESD" ,kEsd ));
f47d03bc 476}
370e070a 477//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
478void RichConfig::SlotBatch(Int_t id)
479{//slot is invoked when any button in fRecoBG is pressed
480 if(id==kTrack){
006865a1 481 fSDigBG->SetButton(kAll);
370e070a 482 fDigBG->SetButton(kAll);
483 fClusBG->SetButton(kAll);
006865a1 484 fDetBG->SetButton(kITS);
485 fDetBG->SetButton(kTPC);
486 fDetBG->SetButton(kTRD);
370e070a 487 }
488}
489//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 490void RichConfig::WriteBatch()
491{//creates Batch.C file
492 char *sBatchName="RichBatch";
493 FILE *fp=fopen(Form("%s.C",sBatchName),"w"); if(!fp){Info("CreateBatch","Cannot open output file: %s.C",sBatchName);return;}
9e26f77a 494//header and debug
f47d03bc 495 fprintf(fp,"void %s(const Int_t iNevents,const Bool_t isDebug,const char *sConfigFileName)\n{\n",sBatchName);
496 fprintf(fp," gSystem->Exec(\"rm -rf *.root hlt hough fort* raw* ZZZ*\");\n");
497 fprintf(fp," if(isDebug) AliLog::SetGlobalDebugLevel(AliLog::kDebug);\n");
498 fprintf(fp," gBenchmark->Start(\"ALICE\");\n TDatime time;\n\n");
9e26f77a 499//simulation section
f47d03bc 500 fprintf(fp," AliSimulation *pSim=new AliSimulation(sConfigFileName);\n");
501//generate initial kinematics
502 if(fSimBG->GetButton(kPrim)->GetState())
503 fprintf(fp," pSim->SetRunGeneration(kTRUE); //initial kinematics generated\n");
504 else
505 fprintf(fp," pSim->SetRunGeneration(kFALSE); //no initial kinematics generated\n");
506//transport and hit creations
507 if(fSimBG->GetButton(kTransport)->GetState())
a5592834 508 fprintf(fp," pSim->SetRunSimulation(kTRUE); //transport and hits creation\n");
f47d03bc 509 else
a5592834 510 fprintf(fp," pSim->SetRunSimulation(kFALSE); //no transport and hits creation\n");
f47d03bc 511//sdigits
a5592834 512 if (fSDigBG->GetButton(kNo) ->GetState()) fprintf(fp," pSim->SetMakeSDigits(\"\"); //no sdigits created\n");
370e070a 513 else if(fSDigBG->GetButton(kAll) ->GetState()) fprintf(fp," pSim->SetMakeSDigits(\"ITS TPC TRD TOF RICH\"); //sdigits created for these detectors\n");
514 else if(fSDigBG->GetButton(kOnly) ->GetState()) fprintf(fp," pSim->SetMakeSDigits(\"RICH\"); //sdigits created for RICH only\n");
f47d03bc 515//digits
a5592834 516 if (fDigBG->GetButton(kNo) ->GetState()) fprintf(fp," pSim->SetMakeDigits(\"\"); //no digits created\n");
370e070a 517 else if(fDigBG->GetButton(kAll) ->GetState()) fprintf(fp," pSim->SetMakeDigits(\"ITS TPC TRD TOF RICH\"); //digits created for these detectors\n");
518 else if(fDigBG->GetButton(kOnly) ->GetState()) fprintf(fp," pSim->SetMakeDigits(\"RICH\"); //digits created for RICH only\n");
f47d03bc 519//raw data generation
370e070a 520 if (fRawBG->GetButton(kRawDdl)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ITS TPC TRD TOF RICH\");//raw data in DDL format for these detectors\n");
521 else if(fRawBG->GetButton(kRawDate)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ITS TPC TRD TOF RICH\",\".date\");//raw data in DATE format for these detectors\n");
522 else if(fRawBG->GetButton(kRawRoot)->GetState()) fprintf(fp," pSim->SetWriteRawData(\"ITS TPC TRD TOF RICH\",\".root\");//raw data in ROOT format for these detectors\n");
9e26f77a 523
f47d03bc 524 fprintf(fp," pSim->Run(iNevents);\n delete pSim;\n\n");
db910db9 525
526
527
a847377e 528//reconstraction section - cluster finder
f47d03bc 529 fprintf(fp," AliReconstruction *pRec=new AliReconstruction;\n");
a847377e 530 if (fClusBG->GetButton(kAll) ->GetState()) fprintf(fp," pRec->SetRunLocalReconstruction(\"ITS TPC TRD TOF RICH\"); //clusters created for these detectors\n");
531 else if(fClusBG->GetButton(kOnly) ->GetState()) fprintf(fp," pRec->SetRunLocalReconstruction(\"RICH\"); //clusters created for RICH only\n");
532 else if(fClusBG->GetButton(kNo) ->GetState()) fprintf(fp," pRec->SetRunLocalReconstruction(\"\"); //clusters are not created\n");
533//reconstraction section - vertex finder
534 if (fRecoBG->GetButton(kVertex)->GetState()) fprintf(fp," pRec->SetRunVertexFinder(kTRUE); //run vertex finder\n");
535 else fprintf(fp," pRec->SetRunVertexFinder(kFALSE); //do not run vertex finder\n");
536//reconstraction section - tracks finder
537 if (fRecoBG->GetButton(kTrack) ->GetState()) fprintf(fp," pRec->SetRunTracking(\"ITS TPC TRD TOF RICH\"); //run tracking for these detectors\n");
538 else fprintf(fp," pRec->SetRunTracking(\"\"); //do not run tracking\n");
539//reconstraction section - fill ESD (prob vector creator)
540 if (fRecoBG->GetButton(kEsd) ->GetState()) fprintf(fp," pRec->SetFillESD(\"ITS TPC TRD TOF RICH\"); //run fill ESD (prob vect)\n");
541 else fprintf(fp," pRec->SetFillESD(\"\"); //do not run fill ESD (prob vect)\n");
f47d03bc 542 fprintf(fp," pRec->Run();delete pRec;\n\n");
9e26f77a 543//benchmarks
f47d03bc 544 fprintf(fp," cout<<\"!!!!!!!!!!!!Info in <my/Batch.C>: Start time: \";time.Print();\n");
545 fprintf(fp," cout<<\"!!!!!!!!!!!!Info in <my/Batch.C>: Stop time: \";time.Set(); time.Print();\n");
546 fprintf(fp," gBenchmark->Show(\"ALICE\");\n");
473cb33a 547
a5592834 548 fprintf(fp," gSystem->Exec(\"play -c 2 ~/my/end.wav\");\n");
f47d03bc 549 fprintf(fp," gSystem->Exec(\"touch ZZZ______finished_______ZZZ\");\n}\n");
473cb33a 550 fclose(fp);
f47d03bc 551}//WriteBatch()
370e070a 552//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 553void RichConfig::ExitSlot()
473cb33a 554{
555//slot to be invoked by clik on the Create button
f47d03bc 556 WriteConfig();
557 WriteBatch();
8493d0aa 558 SendCloseMessage();
f47d03bc 559 gApplication->Terminate(0);
473cb33a 560}
370e070a 561//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f47d03bc 562void RichConfig::WriteConfig()
563{
564 FILE *pF=fopen(fFileName,"w"); if(!pF){Info("CreateConfigFile","Cannot open output file:%sn",fFileName);return;}
565
566 fprintf(pF,"void Config()\n");
567 fprintf(pF,"{\n");
568 fprintf(pF,"\n ::Info(\"\\n\\n\\n----------> RICH private config\",\"Start\");\n");
569//Random
570 fprintf(pF," gRandom->SetSeed(123456);//put 0 to use system time\n\n");
571//Geant
572 fprintf(pF," gSystem->Load(\"libgeant321\");\n");
573 fprintf(pF," new TGeant3TGeo(\"C++ Interface to Geant3\");\n\n");
574//File
575 fprintf(pF," AliRunLoader *pAL=AliRunLoader::Open(\"galice.root\",AliConfig::GetDefaultEventFolderName(),\"recreate\");\n");
576 fprintf(pF," pAL->SetCompressionLevel(2);\n");
577 fprintf(pF," pAL->SetNumberOfEventsPerFile(1000);\n");
578 fprintf(pF," gAlice->SetRunLoader(pAL);\n\n");
579//Decayer
a5592834 580 if(fDecayerB->GetState()==kButtonDown){
581 fprintf(pF," TVirtualMCDecayer *pDecayer=new AliDecayerPythia();\n");
582 fprintf(pF," pDecayer->SetForceDecay(kAll);\n");
583 fprintf(pF," pDecayer->Init();\n");
584 fprintf(pF," gMC->SetExternalDecayer(pDecayer);\n\n");
585 }
f47d03bc 586 WritePhys(pF); //physics processes
587
588//Field
911408e4 589 if(fMagBG->GetButton(kFld0)->GetState()) fprintf(pF," gAlice->SetField(0); //no field\n\n");
5ee78223 590 else if(fMagBG->GetButton(kFld2)->GetState()) fprintf(pF," gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,1,10,0));//0.2 Tesla field\n\n");
591 else if(fMagBG->GetButton(kFld4)->GetState()) fprintf(pF," gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,1,10,1));//0.4 Tesla field\n\n");
592 else if(fMagBG->GetButton(kFld5)->GetState()) fprintf(pF," gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,1,10,2));//0.5 Tesla field\n\n");
593 else if(fMagBG->GetButton(kFld_2)->GetState()) fprintf(pF," gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,-1,10,0));//-0.2 Tesla field\n\n");
594 else if(fMagBG->GetButton(kFld_4)->GetState()) fprintf(pF," gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,-1,10,1));//-0.4 Tesla field\n\n");
595 else if(fMagBG->GetButton(kFld_5)->GetState()) fprintf(pF," gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,-1,10,2));//-0.5 Tesla field\n\n");
911408e4 596
f47d03bc 597 fprintf(pF," pAL->CdGAFile();\n\n"); //????
a5592834 598//Generator
599 WriteGen(pF);//generator
f47d03bc 600//BODY-ALIC
601 fprintf(pF," new AliBODY(\"BODY\",\"Alice envelop\");\n\n");
a5592834 602//RICH
f47d03bc 603 WriteRich(pF); //private RICH part
f47d03bc 604 WriteDet(pF); //other detectors
605//end of Config.C file:
606 fprintf(pF,"\n ::Info(\"----------> RICH private config\",\"Stop\\n\\n\\n\");\n");
607 fprintf(pF,"}\n");
608 fclose(pF);
609}//WriteConfig()
370e070a 610//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
473cb33a 611void RichConfig()
612{
370e070a 613 new RichConfig("Config.C");
473cb33a 614}