]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/menu.C
Bug Correction
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
0fa80b80 1AliRICH * R() {return r;}
2void ph(Int_t event=0) {R()->PrintHits(event);} //utility print hits for 'event' event
3void ps(Int_t event=0) {R()->PrintSDigits(event);} //utility print sdigits
4void pd(Int_t event=0) {R()->PrintDigits(event);} //utility print digits
5void pc(Int_t event=0) {R()->PrintClusters(event);}//utility print clusters
ed3ceb24 6
3b96aee8 7//__________________________________________________________________________________________________
0fa80b80 8void pp(int tid)
09c52ebc 9{
4fddd5b8 10 R()->GetLoader()->GetRunLoader()->LoadHeader(); R()->GetLoader()->GetRunLoader()->LoadKinematics();
7185d942 11
4fddd5b8 12 if(tid<0||tid>=R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
13 cout<<"Valid tid number is 0-"<<R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
7185d942 14 else
15 PrintParticleInfo(tid);
16
4fddd5b8 17 R()->GetLoader()->GetRunLoader()->UnloadKinematics(); R()->GetLoader()->GetRunLoader()->UnloadHeader();
09c52ebc 18}
19//__________________________________________________________________________________________________
20void PrintParticleInfo(int tid)
21{
22 TParticle *p=al->Stack()->Particle(tid);
7185d942 23 cout<<p->GetName()<<"("<<tid<<")";
09c52ebc 24 if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
25 else {cout<<endl;}
26}
27//__________________________________________________________________________________________________
7185d942 28Int_t prim(Int_t tid)
29{
4fddd5b8 30 R()->GetLoader()->GetRunLoader()->LoadHeader(); R()->GetLoader()->GetRunLoader()->LoadKinematics();
7185d942 31
4fddd5b8 32 if(tid<0||tid>=R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
33 cout<<"Valid tid number is 0-"<<R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
7185d942 34 else
35 while(1){
4fddd5b8 36 TParticle *p=R()->GetLoader()->GetRunLoader()->GetAliRun()->Stack()->Particle(tid);
7185d942 37 if(p->GetMother(0)==-1) break;
38 tid=p->GetMother(0);
39 }
40
4fddd5b8 41 R()->GetLoader()->GetRunLoader()->UnloadKinematics(); R()->GetLoader()->GetRunLoader()->UnloadHeader();
7185d942 42 return tid;
43}
4fddd5b8 44
45
7185d942 46//__________________________________________________________________________________________________
8fc0dab8 47
48Double_t r2d = TMath::RadToDeg();
49Double_t d2r = TMath::DegToRad();
50
ed3ceb24 51void DisplFast(){ AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();}
fa49f877 52
53
af3d25a6 54void C_R()
c60862bf 55{
5cb4dfc3 56 AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
543d5224 57
58
8fc0dab8 59 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
543d5224 60 al->GetEvent(nev);
61 cout <<endl<< "Processing event:" <<nev<<endl;
5cb4dfc3 62 detect->StartProcessEvent();
543d5224 63 } // event loop
fa49f877 64 delete detect;
543d5224 65}
0f72f306 66//__________________________________________________________________________________________________
67void D_C()
68{
69 TStopwatch sw;TDatime time;
543d5224 70
0f72f306 71 AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();
543d5224 72
0f72f306 73 cout << endl;
74 cout << "Info in Digits->Clusters: Start time: ";time.Print();
75 cout << "Info in Digits->Clusters: Stop time: ";time.Set(); time.Print();
76 cout << "Info in Digits->Clusters: Time used: ";sw.Print();
77}
d32d34bf 78//__________________________________________________________________________________________________
543d5224 79
3b96aee8 80void Show()
d48cca74 81{
abb44d7c 82 cout<<endl;
c60862bf 83 al->LoadHeader(); al->LoadKinematics();
abb44d7c 84
aed240d4 85 rl->LoadHits();
86 Bool_t isSdigits=!rl->LoadSDigits();
87 Bool_t isClusters=!rl->LoadRecPoints();
88 Bool_t isDigits=!rl->LoadDigits();//loaders
c60862bf 89
90 cout<<endl; cout<<endl;
91 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
92 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 93 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 94
84365c70 95 Int_t iTotalHits=0;
abb44d7c 96 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 97 rl->TreeH()->GetEntry(iPrimN);
98 iTotalHits+=r->Hits()->GetEntries();
abb44d7c 99 TParticle *pPrim=al->Stack()->Particle(iPrimN);
7185d942 100 if(iPrimN<10) Info("Show","Evt %4i prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
09c52ebc 101 iEventN,iPrimN, r->Hits()->GetEntries(), pPrim->GetName(), pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 102 }//prims loop
4fddd5b8 103 Info("Show-HIT","Evt %i total: %i particles %i primaries %i hits",
84365c70 104 iEventN, iNparticles, iNprims, iTotalHits);
c60862bf 105 if(isSdigits){
106 rl->TreeS()->GetEntry(0);
4fddd5b8 107 Info("Show-SDI","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
abb44d7c 108 }
c60862bf 109 if(isDigits){
110 rl->TreeD()->GetEntry(0);
543d5224 111 for(int i=1;i<=7;i++)
4fddd5b8 112 Info("Show-DIG","Evt %i chamber %i contains %5i digits",
aed240d4 113 iEventN, i, r->Digits(i)->GetEntries());
09c52ebc 114 }else
4fddd5b8 115 Info("Show-DIG","There is no digits for this event");
aed240d4 116 if(isClusters){
117 rl->TreeR()->GetEntry(0);
118 for(int i=1;i<=7;i++)
4fddd5b8 119 Info("Show-CLU","Evt %i chamber %i contains %5i clusters",
aed240d4 120 iEventN, i, r->Clusters(i)->GetEntries());
c60862bf 121 }
122 cout<<endl;
abb44d7c 123 }//events loop
0fa80b80 124
aed240d4 125 rl->UnloadHits();
126 if(isSdigits) rl->UnloadSDigits();
127 if(isDigits) rl->UnloadDigits();
128 if(isClusters) rl->UnloadRecPoints();
abb44d7c 129 al->UnloadHeader();
130 al->UnloadKinematics();
0fa80b80 131
132 TVector counters=r->Counters();
133
134 counters(9)=counters(0); for(Int_t i=1;i<=8;i++) counters(9)-=counters(i);
135 counters.Print();
abb44d7c 136 cout<<endl;
d48cca74 137}//void Show()
aed240d4 138//__________________________________________________________________________________________________
abb44d7c 139
d48cca74 140
d48cca74 141AliRun *a;
853634d3 142AliRunLoader *al;
143AliLoader *rl,*tl,*il;
144
145AliRICH *r;
853634d3 146
d32d34bf 147Bool_t ReadAlice()
d48cca74 148{
d32d34bf 149 Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
abb44d7c 150 AliLoader::SetDebug(0);
151 if(gAlice) delete gAlice;
152 if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
153 gSystem->Exec("rm -rf *.root *.dat");
0fa80b80 154 Error("menu.C::ReadAlice","galice.root broken, removing all this garbage then init new one");
d32d34bf 155 new AliRun("gAlice","Alice experiment system");
156 gAlice->SetDebug(-1);
86594bfc 157 gAlice->Init("Config.C");
d32d34bf 158 r=(AliRICH*)gAlice->GetDetector("RICH");
159 return kFALSE;
abb44d7c 160 }
161 al->LoadgAlice();
0fa80b80 162 if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
abb44d7c 163 a=al->GetAliRun();
164 a->SetDebug(0);
165//RICH
166 if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
167 r->SetDebug(0);
168 if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
169
170 Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
d32d34bf 171 return kTRUE;
abb44d7c 172}
173//__________________________________________________________________________________________________
c33c49f0 174void TestResponse()
abb44d7c 175{
c33c49f0 176 TCanvas *pC=new TCanvas("c","Amplification test",900,800);
177 pC->Divide(1,2);
c33c49f0 178
c33c49f0 179
180 const Int_t nPoints=8;
0fa80b80 181 THStack *pStackPhot=new THStack("StackPhot","photons");
182 THStack *pStackMip =new THStack("StackMip","mips");
c33c49f0 183 TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
0fa80b80 184 TH1F *apHphot[nPoints];
185 TH1F *apHmip[nPoints];
c33c49f0 186
0fa80b80 187 Double_t starty=0;
c33c49f0 188 Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
189
190 for(int i=0;i<nPoints;i++){
0fa80b80 191 apHphot[i]=new TH1F(Form("hphot%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apHphot[i]->SetLineColor(i);pStackPhot->Add(apHphot[i]);
192 apHmip[i] =new TH1F(Form("hmip%i",i),"Qdc for Mip;QDC;Counts",4000,0,4000); apHmip[i]->SetLineColor(i);pStackMip->Add(apHmip[i]);
193
194 pLeg->AddEntry(apHphot[i],Form("@(10,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
abb44d7c 195 }
c33c49f0 196
197
86594bfc 198 TVector2 x2(0,0);
c33c49f0 199// AliRICHParam::ResetWireSag();
200 for(Int_t i=0;i<10000;i++){//events loop
201 for(int j=0;j<nPoints;j++){
0fa80b80 202 x2.Set(10,starty+j*deltay);
203 apHphot[j]->Fill(AliRICHParam::TotQdc(x2,0));
204 apHmip[j]->Fill(AliRICHParam::TotQdc(x2,gRandom->Landau(600,150)*1e-9));
c33c49f0 205 }
abb44d7c 206 }
0fa80b80 207
208 pC->cd(1); pStackMip->Draw("nostack");
209 pC->cd(2); pStackPhot->Draw("nostack"); pLeg->Draw();
c33c49f0 210}//TestResponse()
abb44d7c 211//__________________________________________________________________________________________________
d32d34bf 212void TestSD()
abb44d7c 213{
d32d34bf 214 Info("TestSD","Creating test sdigits.");
86594bfc 215 TVector3 hit(426.55,246.28,17.21);
216 TVector2 x2=r->C(4)->Glob2Loc(hit);
4fddd5b8 217 Int_t iTotQdc=r->P()->TotQdc(x2,624e-9);
86594bfc 218 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
219 Int_t padx,pady;
4fddd5b8 220 Int_t sec=r->P()->Loc2Pad(x2,padx,pady);
221 r->P()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
86594bfc 222 Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge",
223 hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc);
224
225 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
226 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
227 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++)
4fddd5b8 228 cout<<r->P()->FracQdc(x2,iPadX,iPadY)<<endl;
86594bfc 229 Info("TestSD","Stop.");
543d5224 230}//void TestSdigits()
abb44d7c 231//__________________________________________________________________________________________________
c67b2d9f 232void TestC()
abb44d7c 233{
c67b2d9f 234 Info("TestC","Creating test clusters.");
0fa80b80 235 R()->GetLoader()->MakeTree("R");R()->MakeBranch("R");
543d5224 236
c67b2d9f 237 AliRICHcluster c;
238 c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
239 c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
240 c.CoG();
241
0fa80b80 242 R()->AddCluster(c);
c67b2d9f 243
0fa80b80 244 R()->GetLoader()->TreeR()->Fill(); R()->GetLoader()->WriteRecPoints("OVERWRITE");
245 R()->GetLoader()->UnloadRecPoints();
246 R()->ResetClusters();
543d5224 247
c67b2d9f 248 Info("TestC","Stop.");
249}//TestC()
543d5224 250//__________________________________________________________________________________________________
251void TestSeg()
252{
0fa80b80 253 AliRICHParam p;
86594bfc 254
0fa80b80 255 new TCanvas("name","PC segmentation");
256 gPad->Range(-20,-20,200,150);
4fddd5b8 257 AliRICHDisplFast::DrawSectors();
4fddd5b8 258
259 TLatex t; t.SetTextSize(0.02);
0fa80b80 260 t.DrawLatex(p.PcSizeX()+10,120,Form("Pc %6.2fx%6.2fcm %3ix%3ipads",p.PcSizeX() ,p.PcSizeY(), p.NpadsX() ,p.NpadsY()));
261 t.DrawLatex(p.PcSizeX()+10,115,Form("Sec %6.2fx%5.2fcm %3ix%2ipads",p.SectorSizeX(),p.SectorSizeY(),p.NpadsXsec(),p.NpadsYsec()));
262 t.DrawLatex(p.PcSizeX()+10,110,Form("Pad %6.2fx%4.2fcm DeadZone %6.2fcm",p.PadSizeX() ,p.PadSizeY(),p.DeadZone()));
4fddd5b8 263
264 TVector2 v2;
0fa80b80 265 t.SetTextAlign(12);
266 v2=AliRICHParam::Pad2Loc( 1,24); t.DrawText(v2.X(),v2.Y(),"sec 1");
267 v2=AliRICHParam::Pad2Loc(81,24); t.DrawText(v2.X(),v2.Y(),"sec 2");
268 v2=AliRICHParam::Pad2Loc( 1,70); t.DrawText(v2.X(),v2.Y(),"sec 3");
269 v2=AliRICHParam::Pad2Loc(81,70); t.DrawText(v2.X(),v2.Y(),"sec 4");
270 v2=AliRICHParam::Pad2Loc( 1,120); t.DrawText(v2.X(),v2.Y(),"sec 5");
271 v2=AliRICHParam::Pad2Loc(81,120); t.DrawText(v2.X(),v2.Y(),"sec 6");
272
273// TGaxis *pAx=new TGaxis(0,0,140, 0,0,140,510,"-="); pAx->SetTitle("x, cm"); pAx->SetTextSize(0.05); pAx->Draw();
274// TGaxis *pAy=new TGaxis(0,0, 0,140,0,140,510,"-="); pAy->SetTitle("y, cm"); pAy->SetTextSize(0.05); pAy->Draw();
275
4fddd5b8 276
277 t.SetTextColor(kBlue);
0fa80b80 278
279 Int_t padx,pady,sec;
280 Double_t margin=5;
281 Double_t x0=0; Double_t x1=p.SectorSizeX(); Double_t x2=p.SectorSizeX()+p.DeadZone(); Double_t x3=p.PcSizeX();
282 Double_t y0=0; Double_t y1=p.SectorSizeY(); Double_t y2=p.SectorSizeY()+p.DeadZone();
283 Double_t y3=2*p.SectorSizeY()+p.DeadZone(); Double_t y4=p.PcSizeY()-p.SectorSizeY();
284 Double_t y5=p.PcSizeY();
285
286//pads along x
287 t.SetTextAlign(11); t.DrawText(x0,y5+margin,"1");
288 t.SetTextAlign(31); t.DrawText(x1,y5+margin,"80");
289 t.SetTextAlign(11); t.DrawText(x2,y5+margin,"81");
290 t.SetTextAlign(31); t.DrawText(x3,y5+margin,"160");
291//pads along y
292 t.SetTextAlign(11); t.DrawText(x3+margin,y0,"1");
293 t.SetTextAlign(13); t.DrawText(x3+margin,y1,"48");
294 t.SetTextAlign(11); t.DrawText(x3+margin,y2,"49");
295 t.SetTextAlign(13); t.DrawText(x3+margin,y3,"96");
296 t.SetTextAlign(11); t.DrawText(x3+margin,y4,"97");
297 t.SetTextAlign(13); t.DrawText(x3+margin,y5,"144");
298
299 t.SetTextColor(kRed);
300
301//positions along x
302 t.SetTextAlign(13);t.DrawText(x0,y0-margin,Form("%5.2f",x0));
303 t.SetTextAlign(33);t.DrawText(x1,y0-margin,Form("%5.2f",x1));
304 t.SetTextAlign(13);t.DrawText(x2,y0-margin,Form("%5.2f",x2));
305 t.SetTextAlign(33);t.DrawText(x3,y0-margin,Form("%5.2f",x3));
306//positions along y
307 t.SetTextAlign(31);t.DrawText(x0-margin,y0,Form("%5.2f",y0));
308 t.SetTextAlign(33);t.DrawText(x0-margin,y1,Form("%5.2f",y1));
309 t.SetTextAlign(31);t.DrawText(x0-margin,y2,Form("%5.2f",y2));
310 t.SetTextAlign(33);t.DrawText(x0-margin,y3,Form("%5.2f",y3));
311 t.SetTextAlign(31);t.DrawText(x0-margin,y4,Form("%5.2f",y4));
312 t.SetTextAlign(33);t.DrawText(x0-margin,y5,Form("%5.2f",y5));
313//coners
314 t.SetTextSize(0.02);
315 TVector pad(2);
316 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
317 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
318 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
319 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
320
321 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
322 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
323 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
324 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
325
326 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
327 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
328 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
329 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
330
331 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
332 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
333 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
334 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
335
336 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
337 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
338 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
339 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
340
341 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
342 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
343 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
344 v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
345//new canvas
346 new TCanvas("trasform","Test LRS-MRS transform");
347
348 TView *pView=new TView(1);
349 pView->SetRange(-600,-600,-600,600,600,600);
350//axis
351 Double_t X[6]={0,0,0,300,0,0}; Double_t Y[6]={0,0,0,0,300,0}; Double_t Z[6]={0,0,0,0,0,300};
352 TPolyLine3D *pXaxis=new TPolyLine3D(2,X);pXaxis->SetLineColor(kRed); pXaxis->Draw();
353 TPolyLine3D *pYaxis=new TPolyLine3D(2,Y);pYaxis->SetLineColor(kGreen); pYaxis->Draw();
354 TPolyLine3D *pZaxis=new TPolyLine3D(2,Z);pZaxis->SetLineColor(kBlue); pZaxis->Draw();
355//chambers
356 Int_t iNpointsX=50,iNpointsY=50;
357 for(Int_t iChamberN=1;iChamberN<=7;iChamberN++){//chamber loop
358 TPolyMarker3D *pChamber=new TPolyMarker3D(iNpointsX*iNpointsY);
359 Int_t i=0;
360 for(Double_t x=0;x<p.PcSizeX();x+=p.PcSizeX()/iNpointsX)
361 for(Double_t y=0;y<p.PcSizeY();y+=p.PcSizeY()/iNpointsY){//step loop
362 TVector3 v3=p.C(iChamberN)->Loc2Glob(TVector2(x,y));
363 pChamber->SetPoint(i++,v3.X(),v3.Y(),v3.Z());
364 pChamber->SetMarkerSize(1);
365 pChamber->SetMarkerColor(iChamberN);
366 }//step loop
367 pChamber->Draw();
368 }//chamber loop
369 gPad->GetView()->RotateView(270,30);
543d5224 370}//void TestSeg()
abb44d7c 371//__________________________________________________________________________________________________
543d5224 372void TestMenu()
abb44d7c 373{
543d5224 374 TControlBar *pMenu = new TControlBar("vertical","RICH test");
c67b2d9f 375 pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods");
c33c49f0 376 pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods");
d32d34bf 377 pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits");
c67b2d9f 378 pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters");
543d5224 379 pMenu->Show();
380}//TestMenu()
381//__________________________________________________________________________________________________
543d5224 382void menu()
383{
384 TControlBar *pMenu = new TControlBar("vertical","RICH main");
385
d32d34bf 386 if(ReadAlice()){//it's from file, reconstruct
0fa80b80 387 pMenu->AddButton("Show", "Show()", "Shows the structure of events in files");
388 pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
389 pMenu->AddButton("Control Plots", "R()->ControlPlots()","Create some control histograms");
543d5224 390
391 }else{//it's aliroot, simulate
392 pMenu->AddButton("Run", "a->Run(1)", "Process!");
86594bfc 393 pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
4fddd5b8 394 pMenu->AddButton("Read RAW","ReadRaw()","Read a list of digits from test beam file");
543d5224 395 }
543d5224 396 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
397 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
3b96aee8 398 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
399 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
543d5224 400 pMenu->AddButton("Quit", ".q", "Close session");
401 pMenu->Show();
402 a=gAlice;//for manual manipulation convinience
403}//menu()
404//__________________________________________________________________________________________________
3b96aee8 405void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);}
406void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);}
4fddd5b8 407
408void ReadRaw()
409{
0fa80b80 410// First interation for TB raw data reader
4fddd5b8 411 char *sRawFileName="beam/run1822_4sigma.dat";
412 FILE *pRawFile=fopen(sRawFileName,"r");
413 if(!pRawFile){Error("ReadRaw","Something wrong with raw data file %s",sRawFileName); return;}
414
415 Int_t iNpads=0,q=0,x=0,y=0;
416
417 while(fscanf(pRawFile,"%i",&iNpads)){
418 Info("ReadRaw","%i pads fired",iNpads);
419 for(Int_t i=0;i<iNpads;i++)
420 fscanf(pRawFile,"%i %i %i",&q,&x,&y);
421 }
422 fclose(pRawFile);
423}