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