fix AliHLTGlobalEsdConverterComponent
[u/mrichter/AliRoot.git] / HMPID / Hnew.C
CommitLineData
f298d50b 1#include <TGFrame.h>
2#include <TGToolBar.h>
3#include <TGTab.h>
4#include <TRootEmbeddedCanvas.h>
5#include <TCanvas.h>
6#include <TGStatusBar.h>
7#include <TApplication.h>
8#include <TGButton.h>
9#include <TGButtonGroup.h>
10#include <TGComboBox.h>
11#include <TPDGCode.h>
12#include <TMath.h>
13#include <Riostream.h>
14#include <AliESD.h>
15#include <TParticle.h>
16#include <TRandom.h>
17#include <TPolyMarker.h>
18#include "AliHMPIDTracker.h"
19#include "AliHMPIDParam.h"
20#include "AliHMPIDRecon.h"
21#include "AliHMPIDHit.h"
22#include "AliHMPIDCluster.h"
23#include <TLegend.h>
24#include <TLatex.h>
25
26class HmpGui: public TGMainFrame
27{
28public:
29 HmpGui();
30 virtual ~HmpGui() {Cleanup();}
31 void ToolBar ( );
32 void TstTab (TGCompositeFrame *pTab);
33 void RunTab (TGCompositeFrame *pTab);
34 virtual void CloseWindow ( ) {gApplication->Terminate(0);} //executed when user click cross button of main window
35 void DetSlot1 (Int_t id ) {if(id==kAllDet) for(Int_t i=1;i<=fDetBG->GetCount();i++) fDetBG->SetButton(i,kButtonDown);}
36 void DetSlot2 (Int_t id ) {if(id==kAllDet) for(Int_t i=1;i<=fDetBG->GetCount();i++) fDetBG->SetButton(i,kButtonUp);}
37 void ProSlot1 (Int_t id ) {if(id==kAllPro) for(Int_t i=1;i<=fProBG->GetCount();i++) fProBG->SetButton(i,kButtonDown);}
38 void ProSlot2 (Int_t id ) {if(id==kAllPro) for(Int_t i=1;i<=fProBG->GetCount();i++) fProBG->SetButton(i,kButtonUp);}
39 void CreateConfigC();
40 Float_t Eta2Theta (Float_t arg )const{return (180./TMath::Pi())*2.*TMath::ATan(TMath::Exp(-arg));}
41
42 void SimEvt ( );
43 static void SimEsd (AliESD *pEsd );
44 void Render ( );
45 void DoTstGo ( );
46 void DoZoom (Int_t evt,Int_t x,Int_t y,TObject *);
47 void MakeStorage ( ); //creates all containers and render elements
48 void DrawChamber(Int_t iCh);
49 void DrawLegend();
50protected:
51 enum EVersOpts {kVerNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kElNoise,kQe0=400,kQeNorm,kFlatIdx,kOptics};
52 enum EGenTypes {kGunZ=1,kGun1,kGun7,kBox,kHijing,kHijingPara,kPythia,kHmpLib,kNotUsed=999};
53 enum EDetectors {kAllDet=1,kPIPE,kITS,kTPC,kTRD,kTOF,kFRAME,kMAG,kACRD,kHALL,kPHOS,kT0,kFMD,kABSO,kPMD,kDIPO,kEMCAL,kVZERO,kMUON,kZDC,kSHILD};
54 enum EProcesses {kAllPro=1,kDCAY,kPAIR,kCOMP,kPHOT,kPFIS,kDRAY,kANNI,kBREM,kMUNU,kCKOV,kHADR,kLOSS,kMULS,kRAYL};
55 enum EBatchFlags{kNo,kAll,kHmp,kDdl,kDat,kRoo,kVtx,kTrk,kHlt,kPid,kAln};
56 enum EMagField {kFld0,kFld2,kFld4,kFld5,kFld_2,kFld_4,kFld_5};
57
58 AliESD *fEsd; TPolyMarker *fRenTxC[7]; TPolyMarker *fRenRin[7];
59 TClonesArray *fHitLst; TPolyMarker *fRenMip[7]; TPolyMarker *fRenCko[7]; TPolyMarker *fRenFee[7];
60 TClonesArray *fSdiLst;
61 TObjArray *fDigLst; TPolyMarker *fRenDig[7];
62 TObjArray *fCluLst; TPolyMarker *fRenClu[7];
63
64 TGStatusBar *fStatBar; // Status bar
65 TCanvas *fCanvas; // Hists canvas
66 TGButton *fTstGoB; //buttons of Tst Tab
67 TGButton *fSimB,*fRecB,*fTraB;
68 TGButtonGroup *fVerBG,*fOptBG,*fQeBG ,*fMagBG,*fGenBG,*fDetBG,*fProBG,*fSdiBG,*fDigBG,*fRawBG,*fInpBG,*fCluBG,*fTrkBG; //button groups for Conf Tab
69 TGComboBox *fPidCO,*fNprCO,*fPmiCO,*fPmaCO,*fChaCO; //combo bo
70
71 ClassDef(HmpGui,0)
72};
73
74ClassImp(HmpGui)
75
76//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
77HmpGui::HmpGui(): TGMainFrame(gClient->GetRoot(), 1000, 700)
78{//default ctor
79 ToolBar();
80
81 TGTab *pTab; AddFrame(pTab=new TGTab(this,580,360),new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
82 TstTab(pTab->AddTab("Test"));
83 RunTab(pTab->AddTab("Run"));
84
85 AddFrame(fStatBar=new TGStatusBar(this, 50, 10, kHorizontalFrame),new TGLayoutHints(kLHintsBottom| kLHintsExpandX, 0, 0, 0, 0));
86 Int_t parts[] = {45, 45, 10}; fStatBar->SetParts(parts, 3);
87 fStatBar->SetText("Waiting for commands...",0); fStatBar->SetText("No file",1);
88
89 SetCleanup(kDeepCleanup);
90 SetWindowName("HMPID Control panel");
91 MapSubwindows();
92 Resize(GetDefaultSize()); // this is used here to launch layout algorithm
93 MapWindow();
94
95 MakeStorage();
96}//ctor()
97//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
98void HmpGui::ToolBar()
99{//creates toolbar on main frame
100 TGToolBar *pTlb;
101 AddFrame(pTlb=new TGToolBar(this, 60, 20, kHorizontalFrame | kRaisedFrame),new TGLayoutHints(kLHintsTop | kLHintsExpandX,0,0,0,0));
102
103 ToolBarData_t b; b.fStayDown=kFALSE;
104 b.fPixmap="x_pic.xpm";b.fTipText="Run" ;b.fId=1;b.fButton=NULL;pTlb->AddButton(this,&b, 0);b.fButton->Connect("Pressed()","HmpGui",this,"DoRun()");
105 b.fPixmap="y_pic.xpm";b.fTipText="Info";b.fId++;b.fButton=NULL;pTlb->AddButton(this,&b,40);b.fButton->Connect("Pressed()","HmpGui",this,"DoInfo()");
106 b.fPixmap="z_pic.xpm";b.fTipText="Help";b.fId++;b.fButton=NULL;pTlb->AddButton(this,&b, 0);b.fButton->Connect("Pressed()","HmpGui",this,"DoHelp()");
107}//ToolBar()
108//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
109void HmpGui::TstTab(TGCompositeFrame *pTab)
110{// Create embedded canvas widget
111 TRootEmbeddedCanvas *pEmbCan; pTab->AddFrame(pEmbCan=new TRootEmbeddedCanvas("pEmbCnv",pTab,980,660),new TGLayoutHints(kLHintsTop|kLHintsLeft|kLHintsExpandX|kLHintsExpandY,2,2,2,2));
112 TGVerticalFrame *pV1; pTab->AddFrame(pV1=new TGVerticalFrame(pTab));
113 pV1 ->AddFrame(fTstGoB=new TGTextButton(pV1,"Go!")); fTstGoB ->Connect("Clicked()","HmpGui",this,"DoTstGo()");
114 fCanvas = pEmbCan->GetCanvas();
115 fCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","hmpGui",this,"ZoomSlot(Int_t,Int_t,Int_t,TObject*)");
116 fCanvas->Divide(3,3,0,0);
117}//TstTab()
118//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
119void HmpGui::RunTab(TGCompositeFrame *pTab)
120{
121 TGCompositeFrame *pH1; pTab->AddFrame(pH1 =new TGHorizontalFrame(pTab,100,200));
122 TGCompositeFrame *pV1; pH1 ->AddFrame(pV1 =new TGVerticalFrame (pTab,100,200)); //version and options
123 TGCompositeFrame *pV2; pH1 ->AddFrame(pV2 =new TGVerticalFrame (pTab,100,200)); //generator
124 pH1 ->AddFrame(fDetBG=new TGButtonGroup (pH1 ,"Dets"));
125 pH1 ->AddFrame(fProBG=new TGButtonGroup (pH1 ,"Procs"));
126 TGCompositeFrame *pV3; pH1 ->AddFrame(pV3 =new TGVerticalFrame (pH1,100,200));
127 TGGroupFrame *pS; pV3 ->AddFrame(pS =new TGGroupFrame (pV3,"Simu")); //simu
128 TGGroupFrame *pR; pV3 ->AddFrame(pR =new TGGroupFrame (pV3,"Reco")); //reco
129
130 pV1 ->AddFrame(fVerBG=new TGButtonGroup(pV1 ,"version")); pV2->AddFrame(fGenBG=new TGButtonGroup(pV2 ,"Type")); pS->AddFrame(fSimB =new TGCheckButton(pS,"Enable"));
131 pV1 ->AddFrame(fOptBG=new TGButtonGroup(pV1 ,"Options")); pV2->AddFrame(fNprCO=new TGComboBox (pV2,100)); pS->AddFrame(fTraB =new TGCheckButton(pS,"Trans"));
132 pV1 ->AddFrame(fQeBG =new TGButtonGroup(pV1 ,"QE")); pV2->AddFrame(fPidCO=new TGComboBox (pV2,100)); pS->AddFrame(fSdiBG=new TGButtonGroup(pS,""));
133 pV1 ->AddFrame(fMagBG=new TGButtonGroup(pV1 ,"Mag field")); pV2->AddFrame(fPmiCO=new TGComboBox (pV2,100)); pS->AddFrame(fDigBG=new TGButtonGroup(pS,""));
134 pV2->AddFrame(fPmaCO=new TGComboBox (pV2,100)); pS->AddFrame(fRawBG=new TGButtonGroup(pS,""));
135 pV2->AddFrame(fChaCO=new TGComboBox (pV2,100)); pR->AddFrame(fRecB =new TGCheckButton(pR,"Enable"));
136 pR->AddFrame(fInpBG=new TGButtonGroup(pR,"" ));
137 pR->AddFrame(fCluBG=new TGButtonGroup(pR,"" ));
138 pR->AddFrame(fTrkBG=new TGButtonGroup(pR,"" ));
139
140
141
142
143
144
145 fDetBG->Connect("Pressed(Int_t)" ,"HmpGui",this,"DetSlot1(Int_t)"); fDetBG->Connect("Released(Int_t)","HmpGui",this,"DetSlot2(Int_t)");
146 fProBG->Connect("Pressed(Int_t)" ,"HmpGui",this,"ProSlot1(Int_t)"); fProBG->Connect("Released(Int_t)","HmpGui",this,"ProSlot2(Int_t)");
147 fGenBG->Connect("Pressed(Int_t)" ,"HmpGui",this,"GenSlot1(Int_t)"); fGenBG->Connect("Released(Int_t)","HmpGui",this,"GenSlot2(Int_t)");
148 fSimB ->Connect("Toggled(Bool_t)","HmpGui",this,"SimSlot(Bool_t)");
149
150 new TGRadioButton(fVerBG,"No",kVerNo); new TGRadioButton(fVerBG,"ver0", kVer0); new TGRadioButton(fVerBG,"ver1",kVer1); new TGRadioButton(fVerBG,"ver2", kVer2);
151
152 new TGCheckButton(fOptBG,"Test pos" ,kTest); new TGCheckButton(fOptBG,"Unfold clus",kDeclust); new TGCheckButton(fOptBG,"Sagitta" ,kSagita);
153 new TGCheckButton(fOptBG,"Phot feed" ,kFeedback); new TGCheckButton(fOptBG,"Elec noise" ,kElNoise); new TGCheckButton(fOptBG,"N=1.292",kFlatIdx);
154 new TGCheckButton(fOptBG,"Plot optics",kOptics);
155
156 new TGRadioButton(fQeBG,"QE=0",kQe0); new TGRadioButton(fQeBG,"QE normal",kQeNorm);
157
158 new TGRadioButton(fMagBG,"0.5 T" ,kFld5 ); new TGRadioButton(fMagBG,"0.4 T" ,kFld4 ); new TGRadioButton(fMagBG,"0.2 T" ,kFld2);
159 new TGRadioButton(fMagBG,"0 T" ,kFld0 ); new TGRadioButton(fMagBG,"-0.2 T",kFld_2 ); new TGRadioButton(fMagBG,"-0.4 T",kFld_4);
160 new TGRadioButton(fMagBG,"-0.5 T",kFld_5 );
161
162 new TGCheckButton(fGenBG,"Z gun",kGunZ); new TGCheckButton(fGenBG,"gun 1" ,kGun1); new TGCheckButton(fGenBG,"gun 7",kGun7);
163 new TGCheckButton(fGenBG,"HMPID space",kBox ); new TGCheckButton(fGenBG,"HIJING",kHijing); new TGCheckButton(fGenBG,"HIJING para",kHijingPara);
164 new TGCheckButton(fGenBG,"Pythia" ,kPythia); new TGCheckButton(fGenBG,"HMPID lib",kHmpLib);
165
166 fNprCO->AddEntry("not used" ,kNotUsed); fNprCO->AddEntry("N prim=1" ,1); fNprCO->AddEntry("N prim=2" ,2); fNprCO->AddEntry("N prim=5" ,5);
167 fNprCO->AddEntry("N prim=100" ,100); fNprCO->AddEntry("N prim=500" ,500); fNprCO->AddEntry("N prim=1000" ,1000); fNprCO->AddEntry("N prim=10000",10000);
168 fNprCO->AddEntry("N prim=80000",80000);
169 fNprCO->Resize(160,20);
170
171 fPidCO->AddEntry("not used" ,kNotUsed);
172 fPidCO->AddEntry("e-",kElectron); fPidCO->AddEntry("pi+",kPiPlus); fPidCO->AddEntry("K+" ,kKPlus); fPidCO->AddEntry("p+" ,kProton);
173 fPidCO->AddEntry("e+",kPositron); fPidCO->AddEntry("pi-",kPiMinus); fPidCO->AddEntry("K-" ,kKMinus); fPidCO->AddEntry("p-" ,kProtonBar);
174 fPidCO->AddEntry("K0",kK0Short); fPidCO->AddEntry("lambda" ,kLambda0); fPidCO->AddEntry("antilambda" ,kLambda0Bar);
175 fPidCO->Resize(160,20); fPidCO->Select(kNotUsed);
176
177 fPmiCO->AddEntry("not used",kNotUsed); for(Int_t i= 5;i<=295;i+=5) fPmiCO->AddEntry(Form("Pmin=%3.1f GeV",0.1*i), i); fPmiCO->Resize(160,20);
178 fPmaCO->AddEntry("not used",kNotUsed); for(Int_t i=10;i<=295;i+=5) fPmaCO->AddEntry(Form("Pmax=%3.1f GeV",0.1*i), i); fPmaCO->Resize(160,20);
179 fChaCO->AddEntry("not used",kNotUsed); for(Int_t i= 1;i<= 7;i++ ) fChaCO->AddEntry(Form("Chamber %i",i),i); fChaCO->Resize(160,20);
180
181 new TGCheckButton(fProBG,"ALL ON/OFF" ,kAllPro );
182 new TGCheckButton(fProBG,"DCAY Decay" ,kDCAY); fProBG->SetButton(kDCAY);
183 new TGCheckButton(fProBG,"PAIR Pair production" ,kPAIR); fProBG->SetButton(kPAIR);
184 new TGCheckButton(fProBG,"COMP Compton" ,kCOMP); fProBG->SetButton(kCOMP);
185 new TGCheckButton(fProBG,"PHOT Photoelectric" ,kPHOT); fProBG->SetButton(kPHOT);
186 new TGCheckButton(fProBG,"PFIS Photofission" ,kPFIS);
187 new TGCheckButton(fProBG,"DRAY Delta electrons" ,kDRAY);
188 new TGCheckButton(fProBG,"ANNI Annihilation" ,kANNI); fProBG->SetButton(kANNI);
189 new TGCheckButton(fProBG,"BREM Bremstraslung" ,kBREM); fProBG->SetButton(kBREM);
190 new TGCheckButton(fProBG,"MUNU Muon-Nuclear" ,kMUNU); fProBG->SetButton(kMUNU);
191 new TGCheckButton(fProBG,"CKOV Cerenkovs" ,kCKOV); fProBG->SetButton(kCKOV);
192 new TGCheckButton(fProBG,"HADR Hadronic interactions " ,kHADR); fProBG->SetButton(kHADR);
193 new TGCheckButton(fProBG,"LOSS Energy losses" ,kLOSS); fProBG->SetButton(kLOSS);
194 new TGCheckButton(fProBG,"MULS Multiple scattering" ,kMULS); fProBG->SetButton(kMULS);
195 new TGCheckButton(fProBG,"RAYL Rayleigh scattering" ,kRAYL); fProBG->SetButton(kRAYL);
196
197 new TGCheckButton(fDetBG,"ALL" ,kAllDet ); new TGCheckButton(fDetBG,"PIPE" ,kPIPE); new TGCheckButton(fDetBG,"ITS" ,kITS); new TGCheckButton(fDetBG,"TPC" ,kTPC);
198 new TGCheckButton(fDetBG,"TRD" ,kTRD ); new TGCheckButton(fDetBG,"TOF" ,kTOF); new TGCheckButton(fDetBG,"FRAME",kFRAME); new TGCheckButton(fDetBG,"MAG" ,kMAG);
199 new TGCheckButton(fDetBG,"ACORDE",kACRD); new TGCheckButton(fDetBG,"HALL" ,kHALL); new TGCheckButton(fDetBG,"PHOS" ,kPHOS); new TGCheckButton(fDetBG,"T0" ,kT0);
200 new TGCheckButton(fDetBG,"FMD" ,kFMD); new TGCheckButton(fDetBG,"ABSO",kABSO); new TGCheckButton(fDetBG,"PMD" ,kPMD); new TGCheckButton(fDetBG,"DIPO",kDIPO);
201 new TGCheckButton(fDetBG,"EMCAL" ,kEMCAL); new TGCheckButton(fDetBG,"VZERO",kVZERO); new TGCheckButton(fDetBG,"MUON" ,kMUON); new TGCheckButton(fDetBG,"ZDC" ,kZDC);
202 new TGCheckButton(fDetBG,"SHILD" ,kSHILD);
203
204 new TGRadioButton(fSdiBG, "No Sdis" ,kNo); new TGRadioButton(fSdiBG,"Sdis CORE",kAll); new TGRadioButton(fSdiBG,"Sdis HMPID" ,kHmp);
205 new TGRadioButton(fDigBG, "No Digs" ,kNo); new TGRadioButton(fDigBG,"Digs CORE",kAll); new TGRadioButton(fDigBG,"Digs HMPID" ,kHmp);
206 new TGRadioButton(fRawBG, "No RAW" ,kNo); new TGRadioButton(fRawBG,"RAW DDL" ,kDdl); new TGRadioButton(fRawBG,"RAW DATE" ,kDat); new TGRadioButton(fRawBG,"RAW ROOT",kRoo);
207
208 new TGRadioButton(fInpBG,"From sim" ,kNo ); new TGRadioButton(fInpBG,"From DDL" ,kDdl); new TGRadioButton(fInpBG,"From DATE" ,kDat ); new TGRadioButton(fInpBG,"From ROOT" ,kRoo);
209 new TGRadioButton(fCluBG,"No Clus" ,kNo ); new TGRadioButton(fCluBG,"Clus CORE" ,kAll); new TGRadioButton(fCluBG,"Clus HMPID",kHmp );
210 new TGCheckButton(fTrkBG,"Load Align",kAln); new TGCheckButton(fTrkBG,"Prim vertex",kVtx); new TGCheckButton(fTrkBG,"ESD tracks",kTrk ); new TGCheckButton(fTrkBG,"Assign PID",kPid);
211
212 fSimB->SetState(kButtonDown); fTraB->SetState(kButtonDown); fSdiBG->SetButton(kHmp); fDigBG->SetButton(kHmp); fRawBG->SetButton(kNo);
213 fRecB->SetState(kButtonDown); fInpBG->SetButton(kNo); fCluBG->SetButton(kHmp);
214
215 fVerBG->SetButton(kVer1); fOptBG->SetButton(kDeclust); fOptBG->SetButton(kSagita); fOptBG->SetButton(kFeedback); fQeBG->SetButton(kQeNorm); fMagBG->SetButton(kFld2);
216 fNprCO->Select(kNotUsed); fPmiCO->Select(kNotUsed); fPmaCO->Select(kNotUsed); fChaCO->Select(kNotUsed);
217}//RunTab()
218//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
219void HmpGui::CreateConfigC()
220{
221 ofstream f; f.open("Config.C");
222
223 f<<Form("void Config()\n"); f<<Form("{\n"); f<<Form("\n ::Info(\"\\n\\n\\n----------> HMPID private config\",\"Start\");\n"); //start & info
224 f<<Form(" gRandom->SetSeed(123456);//put 0 to use system time\n\n"); //random seed
225 f<<Form(" gSystem->Load(\"libgeant321\");\n"); f<<Form(" new TGeant3TGeo(\"C++ Interface to Geant3\");\n\n"); //geant lib
226 f<<Form(" AliRunLoader *pAL=AliRunLoader::Open(\"galice.root\",AliConfig::GetDefaultEventFolderName(),\"recreate\");\n"); //run loader
227 f<<Form(" pAL->SetCompressionLevel(2);\n"); f<<Form(" pAL->SetNumberOfEventsPerFile(1000);\n"); f<<Form(" gAlice->SetRunLoader(pAL);\n\n");
228 f<<Form(" TVirtualMCDecayer *pDecayer=new AliDecayerPythia();\n");
229 f<<Form(" pDecayer->SetForceDecay(kAll);\n");
230 f<<Form(" pDecayer->Init();\n");
231 f<<Form(" gMC->SetExternalDecayer(pDecayer);\n\n");
232
233//Field
4642ac4b 234 if (fMagBG->GetButton(kFld0)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",0,0,AliMagF::k5kGUniform)); //no field\n\n");
235 else if(fMagBG->GetButton(kFld2)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",1,1,AliMagF::k2kG));//0.2 Tesla field\n\n");
236// else if(fMagBG->GetButton(kFld4)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",1,1,1));//0.4 Tesla field\n\n");
237 else if(fMagBG->GetButton(kFld5)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",1,1,AliMagF::k5kG));//0.5 Tesla field\n\n");
238 else if(fMagBG->GetButton(kFld_2)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",-1,-1,AliMagF::k2kG));//-0.2 Tesla field\n\n");
239 // else if(fMagBG->GetButton(kFld_4)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",-1,1,1));//-0.4 Tesla field\n\n");
240 else if(fMagBG->GetButton(kFld_5)->GetState()) f<<Form(" gAlice->SetField(new AliMagF(\"Maps\",\"Maps\",-1,-1,AliMagF::k5kG));//-0.5 Tesla field\n\n");
f298d50b 241
242 if(fProBG->GetButton(kDCAY)->GetState()) f<<Form(" gMC->SetProcess(\"DCAY\",1); ");else f<<Form(" gMC->SetProcess(\"DCAY\",0); ");
243 if(fProBG->GetButton(kPAIR)->GetState()) f<<Form(" gMC->SetProcess(\"PAIR\",1); ");else f<<Form(" gMC->SetProcess(\"PAIR\",0); ");
244 if(fProBG->GetButton(kCOMP)->GetState()) f<<Form(" gMC->SetProcess(\"COMP\",1);\n");else f<<Form(" gMC->SetProcess(\"COMP\",0);\n");
245 if(fProBG->GetButton(kPHOT)->GetState()) f<<Form(" gMC->SetProcess(\"PHOT\",1); ");else f<<Form(" gMC->SetProcess(\"PHOT\",0); ");
246 if(fProBG->GetButton(kPFIS)->GetState()) f<<Form(" gMC->SetProcess(\"PFIS\",1); ");else f<<Form(" gMC->SetProcess(\"PFIS\",0); ");
247 if(fProBG->GetButton(kDRAY)->GetState()) f<<Form(" gMC->SetProcess(\"DRAY\",1);\n");else f<<Form(" gMC->SetProcess(\"DRAY\",0);\n");
248 if(fProBG->GetButton(kANNI)->GetState()) f<<Form(" gMC->SetProcess(\"ANNI\",1); ");else f<<Form(" gMC->SetProcess(\"ANNI\",0); ");
249 if(fProBG->GetButton(kBREM)->GetState()) f<<Form(" gMC->SetProcess(\"BREM\",1); ");else f<<Form(" gMC->SetProcess(\"BREM\",0); ");
250 if(fProBG->GetButton(kMUNU)->GetState()) f<<Form(" gMC->SetProcess(\"MUNU\",1);\n");else f<<Form(" gMC->SetProcess(\"MUNU\",0);\n");
251 if(fProBG->GetButton(kCKOV)->GetState()) f<<Form(" gMC->SetProcess(\"CKOV\",1); ");else f<<Form(" gMC->SetProcess(\"CKOV\",0); ");
252 if(fProBG->GetButton(kHADR)->GetState()) f<<Form(" gMC->SetProcess(\"HADR\",1); ");else f<<Form(" gMC->SetProcess(\"HADR\",0); ");
253 if(fProBG->GetButton(kLOSS)->GetState()) f<<Form(" gMC->SetProcess(\"LOSS\",2);\n");else f<<Form(" gMC->SetProcess(\"LOSS\",0);\n");
254 if(fProBG->GetButton(kMULS)->GetState()) f<<Form(" gMC->SetProcess(\"MULS\",1); ");else f<<Form(" gMC->SetProcess(\"MULS\",0); ");
255 if(fProBG->GetButton(kRAYL)->GetState()) f<<Form(" gMC->SetProcess(\"RAYL\",1);\n");else f<<Form(" gMC->SetProcess(\"RAYL\",0);\n");
256
257 f<<Form("\n");
258 f<<Form(" gMC->SetCut(\"CUTGAM\",0.001); "); f<<Form(" gMC->SetCut(\"CUTELE\",0.001); "); f<<Form(" gMC->SetCut(\"CUTNEU\",0.001);\n");
259 f<<Form(" gMC->SetCut(\"CUTHAD\",0.001); "); f<<Form(" gMC->SetCut(\"CUTMUO\",0.001); "); f<<Form(" gMC->SetCut(\"BCUTE\" ,0.001);\n");
260 f<<Form(" gMC->SetCut(\"BCUTM\" ,0.001); "); f<<Form(" gMC->SetCut(\"DCUTE\" ,0.001); "); f<<Form(" gMC->SetCut(\"DCUTM\" ,0.001);\n");
261 f<<Form(" gMC->SetCut(\"PPCUTM\",0.001); "); f<<Form(" gMC->SetCut(\"TOFMAX\",1e10);\n\n");
262 f<<Form(" pAL->CdGAFile();\n\n"); //????
263
264 f<<Form(" AliGenCocktail *pG=new AliGenCocktail();\n\n"); //Generator
265 Int_t pid=fPidCO->GetSelected(); Float_t pmin=0.1*fPmiCO->GetSelected(); Float_t pmax=0.1*fPmaCO->GetSelected();
266
267 if(fGenBG->GetButton(kGunZ)->GetState()==kButtonDown)//1 particle along Z axis
268 f<<Form(" AliGenFixed *pGz=new AliGenFixed(1); pGz->SetPart(%i); pGz->SetMomentum(%.1f); pGz->SetOrigin(0,0,-200); pG->AddGenerator(pGz,\"Gz\",1);\n",pid,pmin);
269
270 if(fGenBG->GetButton(kGun1)->GetState()==kButtonDown){//1 gun towards 1 HMPID chamber
271 switch(fChaCO->GetSelected()){
272 case 1: f<<Form(" AliGenFixed *pG1=new AliGenFixed(1); pG1->SetPart(%i); pG1->SetMomentum(%.1f);\n",pid,pmin);
273 f<<Form(" pG1->SetTheta(109.5); pG1->SetPhi(10); pG->AddGenerator(pG1,\"g1\",1);\n"); break;
274 case 2: f<<Form(" AliGenFixed *pG2=new AliGenFixed(1); pG2->SetPart(%i); pG2->SetMomentum(%.1f);\n",pid,pmin);
275 f<<Form(" pG2->SetTheta( 90.0); pG2->SetPhi(10); pG->AddGenerator(pG2,\"g2\",1);\n"); break;
276 case 3: f<<Form(" AliGenFixed *pG3=new AliGenFixed(1); pG3->SetPart(%i); pG3->SetMomentum(%.1f);\n",pid,pmin);
277 f<<Form(" pG3->SetTheta(109.5); pG3->SetPhi(30); pG->AddGenerator(pG3,\"g3\",1);\n"); break;
278 case 4: f<<Form(" AliGenFixed *pG4=new AliGenFixed(1); pG4->SetPart(%i); pG4->SetMomentum(%.1f);\n",pid,pmin);
279 f<<Form(" pG4->SetTheta( 87.0); pG4->SetPhi(30); pG->AddGenerator(pG4,\"g4\",1);\n"); break;
280 case 5: f<<Form(" AliGenFixed *pG5=new AliGenFixed(1); pG5->SetPart(%i); pG5->SetMomentum(%.1f);\n",pid,pmin);
281 f<<Form(" pG5->SetTheta( 70.5); pG5->SetPhi(30); pG->AddGenerator(pG5,\"g5\",1);\n"); break;
282 case 6: f<<Form(" AliGenFixed *pG6=new AliGenFixed(1); pG6->SetPart(%i); pG6->SetMomentum(%.1f);\n",pid,pmin);
283 f<<Form(" pG6->SetTheta( 90.0); pG6->SetPhi(50); pG->AddGenerator(pG6,\"g6\",1);\n"); break;
284 case 7: f<<Form(" AliGenFixed *pG7=new AliGenFixed(1); pG7->SetPart(%i); pG7->SetMomentum(%.1f);\n",pid,pmin);
285 f<<Form(" pG7->SetTheta( 70.5); pG7->SetPhi(50); pG->AddGenerator(pG7,\"g7\",1);\n"); break;
286 }
287 }
288
289 if(fGenBG->GetButton(kGun7)->GetState()==kButtonDown){//7 guns towards 7 HMPID chambers
290 f<<Form(" AliGenFixed *pG1=new AliGenFixed(1); pG1->SetPart(%i); pG1->SetMomentum(%.1f);pG1->SetTheta(109.5-3); pG1->SetPhi(10);\n",pid,pmin);
291 f<<Form(" pG->AddGenerator(pG1,\"g1\",1);\n");
292 f<<Form(" AliGenFixed *pG2=new AliGenFixed(1); pG2->SetPart(%i); pG2->SetMomentum(%.1f);pG2->SetTheta( 90.0-3); pG2->SetPhi(10);\n",pid,pmin);
293 f<<Form(" pG->AddGenerator(pG2,\"g2\",1);\n");
294 f<<Form(" AliGenFixed *pG3=new AliGenFixed(1); pG3->SetPart(%i); pG3->SetMomentum(%.1f);pG3->SetTheta(109.5-3); pG3->SetPhi(30);\n",pid,pmin);
295 f<<Form(" pG->AddGenerator(pG3,\"g3\",1);\n");
296 f<<Form(" AliGenFixed *pG4=new AliGenFixed(1); pG4->SetPart(%i); pG4->SetMomentum(%.1f);pG4->SetTheta( 90.0-3); pG4->SetPhi(30);\n",pid,pmin);
297 f<<Form(" pG->AddGenerator(pG4,\"g4\",1);\n");
298 f<<Form(" AliGenFixed *pG5=new AliGenFixed(1); pG5->SetPart(%i); pG5->SetMomentum(%.1f);pG5->SetTheta( 70.0-3); pG5->SetPhi(30);\n",pid,pmin);
299 f<<Form(" pG->AddGenerator(pG5,\"g5\",1);\n");
300 f<<Form(" AliGenFixed *pG6=new AliGenFixed(1); pG6->SetPart(%i); pG6->SetMomentum(%.1f);pG6->SetTheta( 90.0-3); pG6->SetPhi(50);\n",pid,pmin);
301 f<<Form(" pG->AddGenerator(pG6,\"g6\",1);\n");
302 f<<Form(" AliGenFixed *pG7=new AliGenFixed(1); pG7->SetPart(%i); pG7->SetMomentum(%.1f);pG7->SetTheta( 70.0-3); pG7->SetPhi(50);\n",pid,pmin);
303 f<<Form(" pG->AddGenerator(pG7,\"g7\",1);\n");
304 }
305
306 if(fGenBG->GetButton(kBox)->GetState()==kButtonDown){// box towards HMPID phase space
307 f<<Form(" AliGenBox *pB=new AliGenBox(%i); pB->SetPart(%i); pB->SetMomentumRange(%.1f,%.1f);\n",(int)fNprCO->GetSelected(),pid,pmin,pmax);
308 f<<Form(" pB->SetThetaRange(65,115); pB->SetPhiRange(5,55); pG->AddGenerator(pB,\"b\",1);\n");
309 }
310
311 if(fGenBG->GetButton(kHijing)->GetState()==kButtonDown){//normal HIJING
312 f<<Form(" AliGenHijing *pH=new AliGenHijing(-1); pH->SetEnergyCMS(14000); pH->SetReferenceFrame(\"CMS\");\n");
313 f<<Form(" pH->SetProjectile(\"P\", 1, 1); pH->SetTarget(\"P\", 1, 1 ); pH->SetJetQuenching(0);\n");
314 f<<Form(" pH->SetShadowing(0); pH->KeepFullEvent(); pH->SetSelectAll(0);\n");
315 f<<Form(" pH->SetImpactParameterRange(0, 5); //fermi\n");
316 f<<Form(" pG->AddGenerator(pH,\"h\",1);\n\n");
317 }
318
319 if(fGenBG->GetButton(kHijingPara)->GetState()==kButtonDown){//parametrized HIJING
320 f<<Form(" AliGenHIJINGpara *pHP=new AliGenHIJINGpara(%i);\n",(int)fNprCO->GetSelected());
321 f<<Form(" pHP->SetMomentumRange(0,999); pHP->SetThetaRange(%f,%f); pHP->SetPhiRange(0,360);\n",Eta2Theta(8),Eta2Theta(-8));
322 f<<Form(" pG->AddGenerator(pHP,\"hp\",1);\n\n");
323 }
324
325 if(fGenBG->GetButton(kPythia)->GetState()==kButtonDown){//Pythia
326 f<<Form(" AliGenPythia *pP=new AliGenPythia(-1);\n");
327 f<<Form(" pP->SetMomentumRange(0,999); pP->SetPhiRange(20,80); pP->SetThetaRange(75,115);\n");
328 f<<Form(" pP->SetYRange(-12,12); pP->SetPtRange(0,1000); pP->SetStrucFunc(kCTEQ4L);\n");
329 f<<Form(" pP->SetProcess(kPyMb); pP->SetEnergyCMS(14000);\n");
330 f<<Form(" pG->AddGenerator(pP,\"p\",1);\n\n");
331 }
332 f<<Form(" pG->Init();\n\n");
333
334
335 f<<Form("\n new AliBODY (\"BODY\" ,\"Alice envelop\");"); //BODY-ALIC
336 if(fDetBG->GetButton(kPIPE )->GetState()) f<<Form("\n new AliPIPEv3 (\"PIPE\" ,\"Beam Pipe\");");
337 if(fDetBG->GetButton(kSHILD)->GetState()) f<<Form("\n new AliSHILv3 (\"SHIL\" ,\"Shielding Version 2\");");
338 if(fDetBG->GetButton(kITS )->GetState()) f<<Form("\n new AliITSvPPRasymmFMD(\"ITS\" ,\"ITS PPR\");");
339 if(fDetBG->GetButton(kTPC )->GetState()) f<<Form("\n new AliTPCv2 (\"TPC\" ,\"Default\");");
340 if(fDetBG->GetButton(kFRAME)->GetState()) f<<Form("\n new AliFRAMEv2 (\"FRAME\" ,\"Space Frame\");");
341 if(fDetBG->GetButton(kTRD )->GetState()) f<<Form("\n new AliTRDv1 (\"TRD\" ,\"TRD slow simulator\");");
342 if(fDetBG->GetButton(kTOF )->GetState()) f<<Form("\n new AliTOFv6T0 (\"TOF\" , \"normal TOF\");");
343 if(fDetBG->GetButton(kMAG )->GetState()) f<<Form("\n new AliMAG (\"MAG\" ,\"Magnet\");");
344 if(fDetBG->GetButton(kHALL )->GetState()) f<<Form("\n new AliHALL (\"HALL\" ,\"Alice Hall\");");
345 if(fDetBG->GetButton(kFMD )->GetState()) f<<Form("\n new AliFMDv1 (\"FMD\" ,\"normal FMD\");");
346 if(fDetBG->GetButton(kABSO )->GetState()) f<<Form("\n new AliABSOv3 (\"ABSO\" ,\"Muon absorber\");");
347 if(fDetBG->GetButton(kDIPO )->GetState()) f<<Form("\n new AliDIPOv3 (\"DIPO\" ,\"Dipole version 3\");");
348 if(fDetBG->GetButton(kMUON )->GetState()) f<<Form("\n new AliMUONv1 (\"MUON\" ,\"default\");");
349 if(fDetBG->GetButton(kPMD )->GetState()) f<<Form("\n new AliPMDv1 (\"PMD\" ,\"normal PMD\");");
350 if(fDetBG->GetButton(kT0 )->GetState()) f<<Form("\n new AliT0v1 (\"T0\" ,\"T0 Detector\");");
351 if(fDetBG->GetButton(kVZERO)->GetState()) f<<Form("\n new AliVZEROv7 (\"VZERO\" ,\"normal VZERO\");");
352 if(fDetBG->GetButton(kZDC )->GetState()) f<<Form("\n new AliZDCv2 (\"ZDC\" ,\"normal ZDC\");");
353 if(fDetBG->GetButton(kPHOS )->GetState()) f<<Form("\n new AliPHOSv1 (\"PHOS\" ,\"IHEP\");");
354 if(fDetBG->GetButton(kEMCAL)->GetState()) f<<Form("\n new AliEMCALv2 (\"EMCAL\" ,\"SHISH_77_TRD1_2X2_FINAL_110DEG\");");
f7882672 355 if(fDetBG->GetButton(kACRD )->GetState()) f<<Form("\n new AliACORDEv1 (\"ACORDE\",\"normal ACORDE\");");
f298d50b 356
357 f<<Form("\n ::Info(\"----------> HMPID private config\",\"Stop\\n\\n\\n\");\n"); f<<Form("}\n"); //end of Config.C file:
358 f.close();
359}//CreateConfigC()
360//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
361void HmpGui::SimEvt()
362{//simulates event
363 fEsd->Clear(); fHitLst->Clear(); fSdiLst->Clear(); for(Int_t ch=0;ch<=6;ch++) {fDigLst->At(ch)->Clear(); fCluLst->At(ch)->Clear();}
364 SimEsd(fEsd);
365// SimHits(fEsd,fHitLst);
366// AliHMPIDv1::Hit2Sdi(fHitLst,fSdiLst);
367// AliHMPIDDigitizer::Sdi2Dig(fSdiLst,fDigLst);
368// AliHMPIDReconstructor::Dig2Clu(fDigLst,fCluLst);
369// AliHMPIDTracker::Recon(fEsd,fCluLst,(TObjArray*)pNmeanEnt->GetObject());
370// AliCDBManager* pCDB = AliCDBManager::Instance(); pCDB->SetDefaultStorage("local://$HOME"); pCDB->SetRun(0);
371// AliCDBEntry *pNmeanEnt=pCDB->Get("HMPID/Calib/Nmean");
372
373}//SimEvt()
374//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
375void HmpGui::SimEsd(AliESD *pEsd)
376{
377 TParticle part; TLorentzVector mom;
378 for(Int_t iTrk=0;iTrk<100;iTrk++){//tracks loop
379 part.SetPdgCode(kProton); part.SetProductionVertex(0,0,0,0);
380 Double_t eta= -0.2+gRandom->Rndm()*0.4; //rapidity is random [-0.2,+0.2]
381 Double_t phi= gRandom->Rndm()*60.*TMath::DegToRad(); //phi is random [ 0 , 60 ] degrees
382 mom.SetPtEtaPhiM(5,eta,phi,part.GetMass()); part.SetMomentum(mom);
383 pEsd->AddTrack(new AliESDtrack(&part));
384 }//tracks loop
385}//SimEsd()
386//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
387void SimHits(AliESD *pEsd, TClonesArray *pHits)
388{//used by SimulateEvent to simulate hits out from provided ESD
389 const Int_t kCerenkov=50000050; const Int_t kFeedback=50000051;
390
391 AliHMPIDRecon rec;
392 Float_t eMip=200e-9,ePho=7.5e-9;
393 Int_t hc=0;
394 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop
395 AliESDtrack *pTrk=pEsd->GetTrack(iTrk);
396 Float_t xRa,yRa;
397 Int_t ch=AliHMPIDTracker::IntTrkCha(pTrk,xRa,yRa);
398 if(ch<0) continue; //this track does not hit HMPID
399 Float_t beta = pTrk->GetP()/(TMath::Sqrt(pTrk->GetP()*pTrk->GetP()+0.938*0.938));
400 Float_t ckov=TMath::ACos(1./(beta*1.292));
401
402 Float_t theta,phi,xPc,yPc,; pTrk->GetHMPIDtrk(xPc,yPc,theta,phi); rec.SetTrack(xRa,yRa,theta,phi);
403
404 if(!AliHMPIDParam::IsInDead(xPc,yPc)) new((*pHits)[hc++]) AliHMPIDHit(ch,eMip,kProton ,iTrk,xPc,yPc); //mip hit
405 Int_t nPhots = (Int_t)(20.*TMath::Power(TMath::Sin(ckov),2)/TMath::Power(TMath::Sin(TMath::ACos(1./1.292)),2));
406 for(int i=0;i<nPhots;i++){
407 TVector2 pos;
408 pos=rec.TracePhot(ckov,gRandom->Rndm()*TMath::TwoPi());
409 if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) new((*pHits)[hc++]) AliHMPIDHit(ch,ePho,kCerenkov,iTrk,pos.X(),pos.Y());
410 } //photon hits
411 for(int i=0;i<3;i++){//feedback photons
412 Float_t x=gRandom->Rndm()*160; Float_t y=gRandom->Rndm()*150;
413 if(!AliHMPIDParam::IsInDead(x,y)) new((*pHits)[hc++]) AliHMPIDHit(ch,ePho,kFeedback,iTrk,x,y); //feedback hits
414 }//photon hits loop
415 }//tracks loop
416}//SimHits()
417//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
418void HmpGui::DoTstGo()
419{
420
421 SimEvt();
422 Render();
423
424 for(Int_t iCh=0;iCh<=6;iCh++){//chambers loop
425 switch(iCh){
426 case 6: fCanvas->cd(1); break; case 5: fCanvas->cd(2); break;
427 case 4: fCanvas->cd(4); break; case 3: fCanvas->cd(5); break; case 2: fCanvas->cd(6); break;
428 case 1: fCanvas->cd(8); break; case 0: fCanvas->cd(9); break;
429 }
430 gPad->SetEditable(kTRUE); gPad->Clear(); DrawChamber(iCh);
431 fRenTxC[iCh]->Draw();
432 fRenMip[iCh]->Draw();
433 fRenFee[iCh]->Draw();
434 fRenCko[iCh]->Draw();
435 fRenRin[iCh]->Draw("CLP");
436 fRenDig[iCh]->Draw();
437 fRenClu[iCh]->Draw();
438 gPad->SetEditable(kFALSE);
439 }//chambers loop
440 fCanvas->Modified();fCanvas->Update();
441
442}//TstGoSlot()
443//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
444void HmpGui::Render()
445{//render all containers to polymarker structures, one per chamber
446 for(Int_t iCh=0;iCh<=6;iCh++){ //chambers loop
447 fRenTxC[iCh]->SetPolyMarker(0); fRenRin[iCh]->SetPolyMarker(0); //clear all renders alements for this chamber
448 fRenMip[iCh]->SetPolyMarker(0); fRenCko[iCh]->SetPolyMarker(0); fRenFee[iCh]->SetPolyMarker(0);
449 fRenDig[iCh]->SetPolyMarker(0); fRenClu[iCh]->SetPolyMarker(0);
450 TClonesArray *pDigCh=(TClonesArray*)fDigLst->At(iCh); TClonesArray *pCluCh=(TClonesArray*)fCluLst->At(iCh);
451 for(Int_t iDig=0;iDig<pDigCh->GetEntries();iDig++){AliHMPIDDigit *pDig = (AliHMPIDDigit*) pDigCh->At(iDig); fRenDig[iCh]->SetNextPoint(pDig->LorsX(),pDig->LorsY());}
452 for(Int_t iClu=0;iClu<pCluCh->GetEntries();iClu++){AliHMPIDCluster *pClu = (AliHMPIDCluster*)pCluCh->At(iClu); fRenClu[iCh]->SetNextPoint(pClu->X() ,pClu->Y()); }
453 }//chambers loop
454 for(Int_t iHit=0;iHit<fHitLst->GetEntries();iHit++){ //hits loop
455 AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(iHit); Int_t ch=pHit->Ch(); Float_t x=pHit->LorsX(); Float_t y=pHit->LorsY(); //get current hit
456 switch(pHit->Pid()){
457 case 50000050: fRenCko[ch]->SetNextPoint(x,y);break;
458 case 50000051: fRenFee[ch]->SetNextPoint(x,y);break;
459 default: fRenMip[ch]->SetNextPoint(x,y);break;
460 }//switch hit PID
461 }//hits loop
462 AliHMPIDRecon rec;
463 for(Int_t iTrk=0;iTrk<fEsd->GetNumberOfTracks();iTrk++){//tracks loop to collect cerenkov rings and intersection points
464 AliESDtrack *pTrk=fEsd->GetTrack(iTrk); Int_t ch=pTrk->GetHMPIDcluIdx(); //get track and chamber intersected by it
465 if(ch<0) continue; //this track does not intersect any chamber
466 Float_t thRa,phRa,xRa,yRa; pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa); //get info on current track
467 ch/=1000000;
468 Float_t xPc=0,yPc=0; AliHMPIDTracker::IntTrkCha(pTrk,xPc,yPc); //find again intersection of track with PC--> it is not stored in ESD!
469 fRenTxC[ch]->SetNextPoint(xPc,yPc); //add this intersection point
470 Float_t ckov=pTrk->GetHMPIDsignal(); //get ckov angle stored for this track
471 if(ckov>0){
472 rec.SetTrack(xRa,yRa,thRa,phRa);
473 for(Int_t j=0;j<100;j++){
474 TVector2 pos; pos=rec.TracePhot(ckov,j*0.0628);
475 if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) fRenRin[ch]->SetNextPoint(pos.X(),pos.Y());
476 }
477 }//if ckov is valid
478 }//tracks loop
479}//Render()
480//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
481void HmpGui::DoZoom(Int_t evt, Int_t px, Int_t py, TObject *)
482{
483 if(evt!=5 && evt!=6) return; //5- zoom in 6-zoom out
484 const Int_t minZoom=64;
485 const Int_t maxZoom=2;
486 static Int_t zoom=minZoom; //zoom level
487 if(evt==5&&zoom==maxZoom) return;
488 if(evt==6&&zoom==minZoom) return;
489
490 // if(!obj->IsA()->InheritsFrom("TPad")) return; //current object is not pad
491 TVirtualPad *pPad=gPad->GetSelectedPad();
492 if(pPad->GetNumber()==3 || pPad->GetNumber()==7) return; //current pad is wrong
493
494 // Printf("evt=%i (%i,%i) %s",evt,px,py,obj->GetName());
495
496 Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py);
497
498 if(evt==5){ zoom=zoom/2; pPad->Range(x-zoom*2,y-zoom*2,x+zoom*2,y+zoom*2);} //zoom in
499 else { zoom=zoom*2; pPad->Range(x-zoom*2,y-zoom*2,x+zoom*2,y+zoom*2);} //zoom out
500 if(zoom==minZoom) pPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5);
501 ((TCanvas *)gTQSender)->SetTitle(Form("zoom x%i",minZoom/zoom));
502 pPad->Modified();
503 pPad->Update();
504}//DoZoom()
505//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
506void HmpGui::MakeStorage()
507{//creates all render elements
508 fHitLst=new TClonesArray("AliHMPIDHit");
509 fSdiLst=new TClonesArray("AliHMPIDDigit");
510 fDigLst=new TObjArray(7);
511 fCluLst=new TObjArray(7);
512 fEsd =new AliESD;
513 for(Int_t ch=0;ch<7;ch++){
514 fDigLst->AddAt(new TClonesArray("AliHMPIDDigit"),ch); fDigLst->SetOwner(kTRUE);
515 fCluLst->AddAt(new TClonesArray("AliHMPIDCluster"),ch); fCluLst->SetOwner(kTRUE);
516 fRenMip[ch]=new TPolyMarker; fRenMip[ch]->SetMarkerStyle(kOpenTriangleUp); fRenMip[ch]->SetMarkerColor(kRed);
517 fRenCko[ch]=new TPolyMarker; fRenCko[ch]->SetMarkerStyle(kOpenCircle); fRenCko[ch]->SetMarkerColor(kRed);
518 fRenFee[ch]=new TPolyMarker; fRenFee[ch]->SetMarkerStyle(kOpenDiamond); fRenFee[ch]->SetMarkerColor(kRed);
519 fRenDig[ch]=new TPolyMarker; fRenDig[ch]->SetMarkerStyle(kOpenSquare); fRenDig[ch]->SetMarkerColor(kGreen);
520 fRenClu[ch]=new TPolyMarker; fRenClu[ch]->SetMarkerStyle(kStar); fRenClu[ch]->SetMarkerColor(kBlue);
521 fRenTxC[ch]=new TPolyMarker; fRenTxC[ch]->SetMarkerStyle(kPlus); fRenTxC[ch]->SetMarkerColor(kRed); fRenTxC[ch]->SetMarkerSize(3);
522 fRenRin[ch]=new TPolyMarker; fRenRin[ch]->SetMarkerStyle(kFullDotSmall); fRenRin[ch]->SetMarkerColor(kMagenta);
523 }
524}//MakeStorage()
525//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
526void HmpGui::DrawChamber(Int_t iCh)
527{//used by Draw() to draw chamber structure
528 gPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5);
529 if(iCh>=0){TLatex txt; txt.SetTextSize(0.1); txt.DrawLatex(-5,-5,Form("%i",iCh));}
530
531 for(Int_t iPc=AliHMPIDParam::kMinPc;iPc<=AliHMPIDParam::kMaxPc;iPc++){
532 TBox *pBox=new TBox(AliHMPIDParam::MinPcX(iPc),AliHMPIDParam::MinPcY(iPc),
533 AliHMPIDParam::MaxPcX(iPc),AliHMPIDParam::MaxPcY(iPc));
534 pBox->SetFillStyle(0); pBox->Draw();
535 }//PC loop
536}//DrawChamber()
537//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
538void HmpGui::DrawLegend()
539{//used by Draw() to draw legend
540 Int_t nTxC=0,nMip=0,nCko=0,nFee=0,nDig=0,nClu=0;
541 for(Int_t ch=0;ch<7;ch++){
542 nTxC+=fRenTxC[ch]->GetN();
543 nMip+=fRenMip[ch]->GetN();
544 nCko+=fRenCko[ch]->GetN();
545 nFee+=fRenFee[ch]->GetN();
546 nDig+=fRenDig[ch]->GetN();
547 nClu+=fRenClu[ch]->GetN();
548 }
549 TLegend *pLeg=new TLegend(0.2,0.2,0.8,0.8);
550// pLeg->SetHeader(Form("Event %i Total %i",fEvt,fNevt));
551 pLeg->AddEntry(fRenTxC[0],Form("TRKxPC %i" ,nTxC),"p");
552 pLeg->AddEntry(fRenMip[0],Form("Mip hits %i" ,nMip),"p");
553 pLeg->AddEntry(fRenCko[0],Form("Ckov hits %i" ,nCko),"p");
554 pLeg->AddEntry(fRenFee[0],Form("Feed hits %i" ,nFee),"p");
555 pLeg->AddEntry(fRenDig[0],Form("Digs %i" ,nDig),"p");
556 pLeg->AddEntry(fRenClu[0],Form("Clus %i" ,nClu),"p");
557 pLeg->Draw();
558}//DrawLegend()
559//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
560
561
562void Hnew(){ new HmpGui; }