remove AliSTARTv2
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
8fc0dab8 1
2Double_t r2d = TMath::RadToDeg();
3Double_t d2r = TMath::DegToRad();
4
fa49f877 5void DisplFast()
6{
7 AliRICHDisplFast *d = new AliRICHDisplFast();
8
9 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
10 al->GetEvent(nev);
11 cout <<endl<< "Processing event:" <<nev<<endl;
12 d->Display();
13 } // event loop
14}
15
16
543d5224 17void Digits2Recos()
c60862bf 18{
5cb4dfc3 19 AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
543d5224 20
21
8fc0dab8 22 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
543d5224 23 al->GetEvent(nev);
24 cout <<endl<< "Processing event:" <<nev<<endl;
5cb4dfc3 25 detect->StartProcessEvent();
543d5224 26 } // event loop
fa49f877 27 delete detect;
543d5224 28}
29
30
31
32void Hits2Digits()
33{
34 TStopwatch sw;TDatime time;
35 r->Hits2SDigits();r->SDigits2Digits();
36 cout<<"\nInfo in <hits->digits>: Start time: ";time.Print();
37 cout<<"Info in <hits->digits>: Stop time: ";time.Set(); time.Print();
38 cout<<"Info in <hits->digits>: Time used: ";sw.Print();
39}
40
41void DigitsOLD2RawClustersOLD()
42{
43 AliRICHClusterFinder *z=new AliRICHClusterFinder(r);
44 z->Exec();
45}
46
47void Specials2DigitsOLD()
48{
49 Info("OLDspec2d","Start.");
c60862bf 50
543d5224 51// delete gAlice;
c60862bf 52
53 AliRunDigitizer *pManager = new AliRunDigitizer(1,1);
543d5224 54 pManager->SetDebug(10);
c60862bf 55 pManager->SetInputStream(0,"galice.root");
56 new AliRICHDigitizer(pManager);
57 pManager->Exec("deb");
543d5224 58 delete pManager;
59 Info("OLDspec2d","Stop.");
c60862bf 60}
61
543d5224 62void Specials2Sdigits()
c60862bf 63{
543d5224 64 Info("Specials2Sdigits","Start.");
c60862bf 65
543d5224 66 rl->LoadHits();
c60862bf 67
68 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
69 al->GetEvent(iEventN);
c60862bf 70
543d5224 71 rl->MakeTree("S"); r->MakeBranch("S");
72 r->ResetSdigits(); r->ResetSpecialsOld();
73
c60862bf 74 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
75 rl->TreeH()->GetEntry(iPrimN);
76 for(Int_t i=0;i<r->Specials()->GetEntries();i++){//specials loop
77 Int_t padx= ((AliRICHSDigit*)r->Specials()->At(i))->PadX();
78 Int_t pady= ((AliRICHSDigit*)r->Specials()->At(i))->PadY();
79 Int_t qdc= ((AliRICHSDigit*)r->Specials()->At(i))->QPad();
543d5224 80 Int_t hitN= ((AliRICHSDigit*)r->Specials()->At(i))->HitNumber()-1;//!!! important -1
81 Int_t chamber=((AliRICHhit*)r->Hits()->At(hitN))->C();
82 Int_t track=((AliRICHhit*)r->Hits()->At(hitN))->GetTrack();
83 r->AddSdigit(chamber,padx+r->Param()->NpadsX()/2,pady+r->Param()->NpadsY()/2,qdc,track);
c60862bf 84 }//specials loop
85 }//prims loop
86 rl->TreeS()->Fill();
87 rl->WriteSDigits("OVERWRITE");
c60862bf 88 }//events loop
89 rl->UnloadHits(); rl->UnloadSDigits();
543d5224 90 Info("Specials2Sdigits","Stop.");
91}//Specials2Sdigits()
92//__________________________________________________________________________________________________
93void Hits2Sdigits()
c60862bf 94{
543d5224 95 Info("Hits2Sdigits","Start.");
c60862bf 96
97 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
98 al->GetEvent(iEventN);
99
100 if(!rl->TreeH()) rl->LoadHits();//from
101 if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
543d5224 102
103 NOT YET DONE!
c60862bf 104 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
105 rl->TreeH()->GetEntry(iPrimN);
106 for(Int_t iHitN=0;iHitN<r->Hits()->GetEntries();iHitN++){//hits loop
107 AliRICHhit *pHit=r->Hits()->At(iHitN);
108 r->Param()->G2Px
109 r->AddSdigit(pHit->C(),padx+r->Param()->NpadsX()/2,pady+r->Param()->NpadsY()/2,qdc,track);
110 }
111 }
112 rl->TreeS()->Fill();
113 rl->WriteSDigits("OVERWRITE");
114 }//events loop
115
116 rl->UnloadHits();
117 rl->UnloadSDigits();
543d5224 118 Info("Hits2Sdigits","Stop.");
119}//Hits2Sdigits()
120//__________________________________________________________________________________________________
121void Sdigits2Digits()
122{
123 Info("Sdigits2Digits","Start.");
124
125 rl->LoadSDigits();
126
127 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
128 al->GetEvent(iEventN);
129
130 rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
131 r->ResetSdigits();r->ResetDigits();//reset lists of sdigits and digits
132 rl->TreeS()->GetEntry(0);
133 r->Sdigits()->Sort();
134
135 Int_t kBad=-101;
136 Int_t chamber,x,y,qdc,tr[3],id;
137 chamber=x=y=qdc=tr[0]=tr[1]=tr[2]=id=kBad;
138 Int_t iNdigitsPerPad=kBad;//how many sdigits for a given pad
139
140 for(Int_t i=0;i<r->Sdigits()->GetEntries();i++){//sdigits loop (sorted)
141 AliRICHdigit *pSdig=(AliRICHdigit*)r->Sdigits()->At(i);
142 if(pSdig->Id()==id){//still the same pad
143 iNdigitsPerPad++;
144 qdc+=pSdig->Qdc();
145 if(iNdigitsPerPad<=3)
146 tr[iNdigitsPerPad-1]=pSdig->T(0);
147 else
148 Info("","More then 3 sdigits for the given pad");
149 }else{//new pad, add the pevious one
150 if(id!=kBad) r->AddDigit(chamber,x,y,qdc,tr[0],tr[1],tr[2]);//ch-xpad-ypad-qdc-tr1-2-3
151 chamber=pSdig->C();x=pSdig->X();y=pSdig->Y();qdc=pSdig->Qdc();tr[0]=pSdig->T(0);id=pSdig->Id();
152 iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
153 }
154 }//sdigits loop (sorted)
155
156 r->AddDigit(chamber,x,y,qdc,tr[0],tr[1],tr[2]);//add the last digit
157
158 rl->TreeD()->Fill();
159 rl->WriteDigits("OVERWRITE");
160 }//events loop
161 rl->UnloadSDigits(); rl->UnloadDigits();
162 r->ResetSdigits();r->ResetDigits();//reset lists of sdigits and digits
163 Info("Sdigits2Digits","Stop.");
c60862bf 164}
165
543d5224 166
167
168void Sdigits2DigitsOLD()
abb44d7c 169{
543d5224 170 Info("Sdigits2DigitsOLD","Start.");
171
abb44d7c 172 rl->LoadSDigits();
abb44d7c 173
543d5224 174 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
175 al->GetEvent(iEventN);
176
177 rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
178 r->ResetSdigits();r->ResetDigitsOld();//reset lists of sdigits and digits
179 rl->TreeS()->GetEntry(0);
180 r->Sdigits()->Sort();
abb44d7c 181
543d5224 182 Int_t kBad=-101;
183
184 Int_t tr[3],q[3],dig[5]; for(Int_t i=0;i<3;i++) tr[i]=q[i]=kBad; for(Int_t i=0;i<5;i++) dig[i]=kBad;
185 Int_t chamber=kBad,id=kBad,iNdigitsPerPad=kBad;//how many sdigits for a given pad
abb44d7c 186
543d5224 187 for(Int_t i=0;i<r->Sdigits()->GetEntries();i++){//sdigits loop (sorted)
188 AliRICHdigit *pSdig=(AliRICHdigit*)r->Sdigits()->At(i);
189 if(pSdig->Id()==id){//still the same pad
190 iNdigitsPerPad++;
191 dig[2]+=pSdig->Qdc();//sum up qdc
192 if(iNdigitsPerPad<=3)
193 tr[iNdigitsPerPad-1]=pSdig->T(0);
194 else
195 Info("","More then 3 sdigits for the given pad");
196 }else{//new pad, add the pevious one
197 if(id!=kBad) r->AddDigitOld(chamber,tr,q,dig);
198 chamber=pSdig->C();dig[0]=pSdig->X();dig[1]=pSdig->Y();dig[2]=pSdig->Qdc();tr[0]=pSdig->T(0);id=pSdig->Id();
199 iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
200 }
201 }//sdigits loop (sorted)
202 r->AddDigitOld(chamber,tr,q,dig);//add the last digit
abb44d7c 203
543d5224 204 rl->TreeD()->Fill();
205 rl->WriteDigits("OVERWRITE");
206 }//events loop
207 rl->UnloadSDigits(); rl->UnloadDigits();
208 r->ResetSdigits();r->ResetDigitsOld();//reset lists of sdigits and digits
209 Info("Sdigits2DigitsOLD","Stop.");
abb44d7c 210}
211
543d5224 212
abb44d7c 213void Show3()
d48cca74 214{
abb44d7c 215 cout<<endl;
c60862bf 216 al->LoadHeader(); al->LoadKinematics();
abb44d7c 217
c60862bf 218 rl->LoadHits(); Bool_t isSdigits=!rl->LoadSDigits(); Bool_t isDigits=!rl->LoadDigits();//loaders
219
220 cout<<endl; cout<<endl;
221 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
222 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 223 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 224
225 Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
abb44d7c 226 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 227 rl->TreeH()->GetEntry(iPrimN);
228 iTotalHits+=r->Hits()->GetEntries();
229 iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
230 iTotalSpecials+=r->Specials()->GetEntries();
abb44d7c 231 TParticle *pPrim=al->Stack()->Particle(iPrimN);
543d5224 232 Info("Show","Evt %4i prim %4i has %4i hits %5i cerenkovs and %5i specials from %s (,%7.2f,%7.2f)",
c60862bf 233 iEventN,
234 iPrimN,
235 r->Hits()->GetEntries(),
236 r->Cerenkovs()->GetEntries(),
237 r->Specials()->GetEntries(),
238 pPrim->GetName(),
239 pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 240 }//prims loop
543d5224 241 Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits %i cerenkovs %i specials",
c60862bf 242 iEventN, iNparticles, iNprims, iTotalHits,iTotalCerenkovs,iTotalSpecials);
243 if(isSdigits){
244 rl->TreeS()->GetEntry(0);
543d5224 245 Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->Sdigits()->GetEntries());
abb44d7c 246 }
c60862bf 247 if(isDigits){
248 rl->TreeD()->GetEntry(0);
543d5224 249 for(int i=1;i<=7;i++)
250 Info("Show-DIGITS","Evt %i chamber %i contains %5i NEW digits and %5i OLD",
251 iEventN, i, r->Digits(i)->GetEntries(),r->DigitsOld(i)->GetEntries());
c60862bf 252 }
253 cout<<endl;
abb44d7c 254 }//events loop
c60862bf 255 rl->UnloadHits(); if(isSdigits) rl->UnloadSDigits(); if(isDigits) rl->UnloadDigits();
abb44d7c 256 al->UnloadHeader();
257 al->UnloadKinematics();
258 cout<<endl;
d48cca74 259}//void Show()
260
d48cca74 261
853634d3 262
abb44d7c 263void DebugOFF()
264{
265 Info("DebugOFF","");
266 a->SetDebug(0);
267 r->SetDebug(0);
268 AliLoader::SetDebug(0);
269}//void DebugOFF()
270
271void DebugON()
272{
273 Info("DebugON","");
274 a->SetDebug(1);
275 r->SetDebug(1);
276 AliLoader::SetDebug(1);
277}//void DebugON()
278
d48cca74 279
d48cca74 280AliRun *a;
853634d3 281AliRunLoader *al;
282AliLoader *rl,*tl,*il;
283
284AliRICH *r;
853634d3 285
abb44d7c 286Bool_t CheckAlice()
d48cca74 287{
288 if(gAlice){//it's aliroot
abb44d7c 289 if(gSystem->Exec("ls galice.root")){
290 Info("CheckAlice","It's AliRoot, and no galice.root: SIMULATION");
c60862bf 291 gAlice->SetDebug(-1);
e228ec30 292 gAlice->Init("ConfigRich.C");
abb44d7c 293 r=(AliRICH*)gAlice->GetDetector("RICH");
294 return kFALSE;
295 }else{//galice.root is present we want to read alice from file
296 ReadAlice();
297 return kTRUE;
298 }
d48cca74 299 }else{//it's root with ALICE libs loaded
abb44d7c 300 ReadAlice();
d48cca74 301 return kTRUE;
302 }
abb44d7c 303}//void CheckAlice()
d48cca74 304
abb44d7c 305void ReadAlice()
306{
307 Info("ReadAlice","Reading ALICE from SIMULATED FILE.");
308 AliLoader::SetDebug(0);
309 if(gAlice) delete gAlice;
310 if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
311 gSystem->Exec("rm -rf *.root *.dat");
312 Fatal("ReadAlice","galice.root broken, removing all this garbage");
313 }
314 al->LoadgAlice();
315 if(!gAlice) Fatal("ReadAlice","No gAlice in file");
316 a=al->GetAliRun();
317 a->SetDebug(0);
318//RICH
319 if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
320 r->SetDebug(0);
321 if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
322
323 Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
324}
325//__________________________________________________________________________________________________
853634d3 326void RingViewer()
327{
328 gStyle->SetPalette(1);
3ea9cb08 329 TCanvas *view=new TCanvas("Display","ALICE RICH Display",0,0,600,600);
853634d3 330
3ea9cb08 331 TH2F *pH2=new TH2F("pH2F","RICH DISPLAY",r->Param()->Nx(),0,r->Param()->Nx(),r->Param()->Ny(),0,r->Param()->Ny());
853634d3 332 pH2->SetStats(0);
333 pH2->SetMaximum(100);
d48cca74 334
853634d3 335 Int_t Nevents = gAlice->GetEventsPerRun();
336}
853634d3 337//______________________________________________________________________________
abb44d7c 338//__________________________________________________________________________________________________
d48cca74 339void GeoTest()
340{
341
3ea9cb08 342 TBRIK *pAliceBRIK=new TBRIK("aliceBRIK","ALICE mother volume","void",500,500,500);
343 TBRIK *pArmBRIK=new TBRIK("armBRIK","RICH arm1","void",pRICH->GetSizeX(),pRICH->GetSizeY(),pRICH->GetSizeZ());
d48cca74 344
345 TNode *pAliceNode=new TNode("aliceNode","Mother volume","aliceBRIK");
346 pAliceNode->cd();
347
348// ARM 1 LEFT
349 TRotation rot1;
350 TVector3 v1(0,pRICH->GetOffset(),0);
351
352
353 rot1.RotateX(pRICH->GetYZAngle()*kDegrad); v1.RotateX(pRICH->GetYZAngle()*kDegrad);
354 rot1.RotateZ(pRICH->GetXYAngle()*kDegrad); v1.RotateZ(pRICH->GetXYAngle()*kDegrad);
355 rot1.RotateZ(pRICH->GetRotAngle()*kDegrad); v1.RotateZ(pRICH->GetRotAngle()*kDegrad);
356
357 TRotMatrix *pArm1RotMatrix=new TRotMatrix("rotArm1","rotArm1",rot1.ThetaX()*kRaddeg, rot1.PhiX()*kRaddeg,
358 rot1.ThetaY()*kRaddeg, rot1.PhiY()*kRaddeg,
359 rot1.ThetaZ()*kRaddeg, rot1.PhiZ()*kRaddeg);
360
361 TNode *pArm1Node=new TNode("arm1Node","Left arm","armBRIK",v1.X(),v1.Y(),v1.Z(),"rotArm1");
362 arm1Node->SetLineColor(kRed);
363
364// ARM 2 LEFT
365 TRotation rot2;
366 TVector3 v2(0,pRICH->GetOffset(),0);
367
368
3ea9cb08 369 rot2.RotateX( pRICH->YZAngle()*kDegrad); v2.RotateX(pRICH->GetYZAngle()*kDegrad);
370 rot2.RotateZ(-pRICH->XYAngle()*kDegrad); v2.RotateZ(-pRICH->GetXYAngle()*kDegrad);
371 rot2.RotateZ( pRICH->RotAngle()*kDegrad); v2.RotateZ(pRICH->GetRotAngle()*kDegrad);
d48cca74 372
373 TRotMatrix *pArm2RotMatrix=new TRotMatrix("rotArm2","rotArm2",rot2.ThetaX()*kRaddeg, rot2.PhiX()*kRaddeg,
374 rot2.ThetaY()*kRaddeg, rot2.PhiY()*kRaddeg,
375 rot2.ThetaZ()*kRaddeg, rot2.PhiZ()*kRaddeg);
376
377 TNode *pArm2Node=new TNode("arm2Node","Left arm","armBRIK",v2.X(),v2.Y(),v2.Z(),"rotArm2");
378 arm2Node->SetLineColor(kBlue);
379
380 aliceNode->Draw();
381}//void GeoTest()
abb44d7c 382//__________________________________________________________________________________________________
d48cca74 383void PrintGeo(Float_t rotDeg=0)
384{
385 AliRICHParam *p=new AliRICHParam;
386 Double_t r=p->Offset();
387 Double_t kP=p->AngleXY();
388 Double_t kT=p->AngleYZ();
389 Double_t kRot;
390
391 if(rotDeg==0)
392 kRot=p->AngleRot();
393 else
394 kRot=rotDeg*deg;
395
396 cout<<endl;
3ea9cb08 397 Double_t phi=90*deg+kRot+kP,theta=90*deg+kT;
d48cca74 398 Info(" menu for 1","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 399 r, theta*r2d, phi*r2d,
d48cca74 400 r*sin(theta)*cos(phi),
401 r*sin(theta)*sin(phi),
402 r*cos(theta));
403
3ea9cb08 404 phi=90*deg+kRot+kP,theta=90*deg;
d48cca74 405 Info(" menu for 2","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 406 r, theta*r2d, phi*r2d,
d48cca74 407 r*sin(theta)*cos(phi),
408 r*sin(theta)*sin(phi),
409 r*cos(theta));
d48cca74 410
3ea9cb08 411 phi=90*deg+kRot,theta=90*deg-kT;
d48cca74 412 Info(" menu for 3","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 413 r, theta*r2d, phi*r2d,
d48cca74 414 r*sin(theta)*cos(phi),
415 r*sin(theta)*sin(phi),
416 r*cos(theta));
3ea9cb08 417
418
419 phi=90*deg+kRot,theta=90*deg;
d48cca74 420 Info(" menu for 4","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 421 r, theta*r2d, phi*r2d,
d48cca74 422 r*sin(theta)*cos(phi),
423 r*sin(theta)*sin(phi),
424 r*cos(theta));
3ea9cb08 425
d48cca74 426
427 phi=90*deg+kRot,theta=90*deg+kT;
428 Info(" menu for 5","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 429 r, theta*r2d, phi*r2d,
d48cca74 430 r*sin(theta)*cos(phi),
431 r*sin(theta)*sin(phi),
432 r*cos(theta));
433
3ea9cb08 434
435 phi=90*deg+kRot-kP,theta=90*deg;
d48cca74 436 Info(" menu for 6","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 437 r, theta*r2d, phi*r2d,
d48cca74 438 r*sin(theta)*cos(phi),
439 r*sin(theta)*sin(phi),
440 r*cos(theta));
3ea9cb08 441
442 phi=90*deg+kRot-kP,theta=90*deg+kT;
443 Info(" menu for 7","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
444 r, theta*r2d, phi*r2d,
445 r*sin(theta)*cos(phi),
446 r*sin(theta)*sin(phi),
447 r*cos(theta));
d48cca74 448
449 delete p;
450}//void PrintGeo()
abb44d7c 451
452
453
543d5224 454//__________________________________________________________________________________________________
abb44d7c 455void TestGain()
456{
457 AliRICHParam *pParam=new AliRICHParam;
458 AliRICHResponseV0 *pRes=new AliRICHResponseV0;
459
460 TLegend *pLegend=new TLegend(0.6,0.3,0.85,0.5);
461 TH1F *pH0=new TH1F("pH1","Gain",100,0,600);
462 TH1F *pH10=new TH1F("pH10","Gain",100,0,600);
463 TH1F *pH20=new TH1F("pH20","Gain",100,0,600);
464 TH1F *pH30=new TH1F("pH30","Gain",100,0,600);
465 TH1F *pHold=new TH1F("pHold","Mip Charge",100,0,2000);
466 for(int i=0;i<1000;i++){
467 pH0 ->Fill(pParam->Gain(0));
468 pH10->Fill(pParam->Gain(10));
469 pH20->Fill(pParam->Gain(20));
470 pH30->Fill(pParam->Gain(30));
471 pHold->Fill(pRes->IntPH(30));
472 }
473 pH0->Draw();
474 pH10->Draw("same");
475 pH20->Draw("same");
476 pH30->Draw("same");
477 pHold->Draw("same");
478 pLegend->AddEntry(pH0,"y=0");
479 pLegend->AddEntry(pH10,"y=10");pH10->SetLineColor(kRed);
480 pLegend->AddEntry(pH20,"y=20");pH20->SetLineColor(kBlue);
481 pLegend->AddEntry(pH30,"y=30");pH30->SetLineColor(kGreen);
482 pLegend->AddEntry(pHold,"res");pHold->SetLineColor(kMagenta);
483 pLegend->Draw();
484}//void TestGain()
485//__________________________________________________________________________________________________
486void TestMipCharge()
487{
488 AliRICHParam *pParam=new AliRICHParam;
489 AliRICHResponseV0 *pRes=new AliRICHResponseV0;
490
491 TLegend *pLegend=new TLegend(0.6,0.3,0.85,0.5);
492 TH1F *pH0= new TH1F("pH1", "Mip Charge",100,0,500);
493 TH1F *pH10=new TH1F("pH10","Mip Charge",100,0,500);
494 TH1F *pH20=new TH1F("pH20","Mip Charge",100,0,500);
495 TH1F *pH30=new TH1F("pH30","Mip Charge",100,0,500);
496 TH1F *pHold=new TH1F("pHold","Mip Charge",100,0,500);
497 for(int i=0;i<1000;i++){
498 pH0 ->Fill(pParam->TotalCharge(kPiPlus,0.5e-9,0));
499 pH10->Fill(pParam->TotalCharge(kPiPlus,0.5e-9,10));
500 pH20->Fill(pParam->TotalCharge(kPiPlus,0.5e-9,20));
501 pH30->Fill(pParam->TotalCharge(kPiPlus,0.5e-9,30));
502 pHold->Fill(pRes->IntPH(0.5e-9,-30));
503 }
504 pH0->Draw();
505 pH10->Draw("same");
506 pH20->Draw("same");
507 pH30->Draw("same");
508 pHold->Draw("same");
509 pLegend->AddEntry(pH0,"y=0");
510 pLegend->AddEntry(pH10,"y=10");pH10->SetLineColor(kRed);
511 pLegend->AddEntry(pH20,"y=20");pH20->SetLineColor(kBlue);
512 pLegend->AddEntry(pH30,"y=30");pH30->SetLineColor(kGreen);
513 pLegend->AddEntry(pHold,"res");pHold->SetLineColor(kMagenta);
514 pLegend->Draw();
515}//void TestGain()
516//__________________________________________________________________________________________________
543d5224 517void TestDigitsOLD()
abb44d7c 518{
543d5224 519 Info("TestDigitsOLD","Creating test digits.");
abb44d7c 520 rl->MakeTree("D");r->MakeBranch("D");
7f48292d 521
522
c60862bf 523 Int_t t[10];
524 Int_t c[10];
525 Int_t d[5];
526 t[0]=100;t[1]=200;t[2]=300;
527 c[0]=10;c[1]=20;c[2]=30;
7f48292d 528
529
543d5224 530 d[0]=1;d[1]=1;d[2]=10;d[3]=3;d[4]=4;r->AddDigitOld(1,t,c,d);
7f48292d 531
532 d[0]=2;d[1]=2;d[2]=10;d[3]=3;d[4]=4;r->AddDigitOld(2,t,c,d);
543d5224 533 d[0]=2;d[1]=3;d[2]=10;d[3]=3;d[4]=4;r->AddDigitOld(2,t,c,d);
7f48292d 534
535 d[0]=2;d[1]=2;d[2]=100;d[3]=3;d[4]=4;r->AddDigitOld(3,t,c,d);
6ce834b4 536 d[0]=2;d[1]=3;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(3,t,c,d);
537 d[0]=2;d[1]=4;d[2]=200;d[3]=3;d[4]=4;r->AddDigitOld(3,t,c,d);
7f48292d 538
539 d[0]=2;d[1]=2;d[2]=100;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
540 d[0]=2;d[1]=3;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
541 d[0]=2;d[1]=4;d[2]=200;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
542 d[0]=2;d[1]=5;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
543 d[0]=2;d[1]=6;d[2]=300;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
544 d[0]=2;d[1]=7;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
545
abb44d7c 546 rl->TreeD()->Fill();
547 rl->WriteDigits("OVERWRITE");
548 rl->UnloadDigits();
543d5224 549 r->ResetDigitsOld();
550 Info("TestDigitsOLD","Stop.");
abb44d7c 551}//void TestDigits()
552//__________________________________________________________________________________________________
553void TestSdigits()
554{
543d5224 555 Info("TestSdigits","Creating test sdigits.");
abb44d7c 556 rl->MakeTree("S");r->MakeBranch("S");
557//totally 19 must be trasformd to 6 digits
558 r->AddSdigit(1,40,40,10,40); r->AddSdigit(1,40,40,10,41); r->AddSdigit(1,40,40,10,42); r->AddSdigit(1,40,40,10,43);
559 r->AddSdigit(1,45,45,10,45); r->AddSdigit(1,45,45,10,45); r->AddSdigit(1,45,45,10,45); r->AddSdigit(1,45,45,10,45);
7f48292d 560
abb44d7c 561 r->AddSdigit(1,20,20,10,20); r->AddSdigit(1,20,20,10,21);
562 r->AddSdigit(1,25,25,10,25); r->AddSdigit(1,25,25,10,25);
563
564 r->AddSdigit(1,30,30,10,30); r->AddSdigit(1,30,30,10,31); r->AddSdigit(1,30,30,10,32);
565 r->AddSdigit(1,35,35,10,35); r->AddSdigit(1,35,35,10,35); r->AddSdigit(1,35,35,10,35);
566
567
568 r->AddSdigit(1,10,10,10,10);
569
abb44d7c 570
571 rl->TreeS()->Fill();
572 rl->WriteSDigits("OVERWRITE");
573 rl->UnloadSDigits();
574 cout<<endl;r->Sdigits()->Print();
575 r->ResetSDigits();
543d5224 576 Info("TestSdigits","Stop.");
577}//void TestSdigits()
abb44d7c 578//__________________________________________________________________________________________________
543d5224 579void TestClustersOLD()
abb44d7c 580{
543d5224 581 Info("TestClusters","Creating test clusters.");
582 rl->MakeTree("R");r->MakeBranch("R");
583
584 AliRICHRawCluster c;
585 r->AddClusterOld(1,c);
586 rl->TreeR()->Fill();
587 rl->WriteRecPoints("OVERWRITE");
588 rl->UnloadRecPoints();
589 r->ResetRawClusters();
590
591 Info("TestClusters","Stop.");
592}//void TestClustersOLD()
593//__________________________________________________________________________________________________
594void TestSeg()
595{
596 AliRICHParam *p=r->Param();
abb44d7c 597 Int_t padx,pady;
543d5224 598 Float_t x,y;
599 Float_t dz=p->DeadZone();
600 Float_t sx=p->SectorSizeX(); Float_t sy=p->SectorSizeY(); Float_t px=p->PcSizeX(); Float_t py=p->PcSizeY();
601 cout<<endl;
602 Info(" 1- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad(-px/2 , -py/2 ,padx,pady),padx,pady);
603 Info(" 48- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2-dz , -py/2 ,padx,pady),padx,pady);
604 Info(" 49- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2 , -py/2 ,padx,pady),padx,pady);
605 Info(" 96- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2 , -py/2 ,padx,pady),padx,pady);
606 Info(" 97- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2+dz , -py/2 ,padx,pady),padx,pady);
607 Info("144- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad( px/2 , -py/2 ,padx,pady),padx,pady);
abb44d7c 608 cout<<endl;
543d5224 609 Info(" 1- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad(-px/2 , -dz/2 ,padx,pady),padx,pady);
610 Info(" 48- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2-dz , -dz/2 ,padx,pady),padx,pady);
611 Info(" 49- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2 , -dz/2 ,padx,pady),padx,pady);
612 Info(" 96- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2 , -dz/2 ,padx,pady),padx,pady);
613 Info(" 97- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2+dz , -dz/2 ,padx,pady),padx,pady);
614 Info("144- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad( px/2 , -dz/2 ,padx,pady),padx,pady);
abb44d7c 615 cout<<endl;
543d5224 616 Info(" 1- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad(-px/2 , dz/2 ,padx,pady),padx,pady);
617 Info(" 48- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2-dz , dz/2 ,padx,pady),padx,pady);
618 Info(" 49- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2 , dz/2 ,padx,pady),padx,pady);
619 Info(" 96- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2 , dz/2 ,padx,pady),padx,pady);
620 Info(" 97- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2+dz , dz/2 ,padx,pady),padx,pady);
621 Info("144- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad( px/2 , dz/2 ,padx,pady),padx,pady);
abb44d7c 622 cout<<endl;
543d5224 623 Info(" 1-160","sec=%i padx=%3i pady=%3i",p->Local2Pad(-px/2 , py/2 ,padx,pady),padx,pady);
624 Info(" 48-160","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2-dz , py/2 ,padx,pady),padx,pady);
625 Info(" 49-160","sec=%i padx=%3i pady=%3i",p->Local2Pad(-sx/2 , py/2 ,padx,pady),padx,pady);
626 Info(" 96-160","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2 , py/2 ,padx,pady),padx,pady);
627 Info(" 97-160","sec=%i padx=%3i pady=%3i",p->Local2Pad( sx/2+dz , py/2 ,padx,pady),padx,pady);
628 Info("144-160","sec=%i padx=%3i pady=%3i",p->Local2Pad( px/2 , py/2 ,padx,pady),padx,pady);
abb44d7c 629 cout<<endl;
543d5224 630 Info(" 73-160","sec=%i padx=%3i pady=%3i",p->Local2Pad( 0 , py/2 ,padx,pady),padx,pady);
631 Info(" 73- 81","sec=%i padx=%3i pady=%3i",p->Local2Pad( 0 , dz/2 ,padx,pady),padx,pady);
632 Info("0-0dead","sec=%i padx=%3i pady=%3i",p->Local2Pad( 0 , 0 ,padx,pady),padx,pady);
633 Info(" 73- 80","sec=%i padx=%3i pady=%3i",p->Local2Pad( 0 , -dz/2 ,padx,pady),padx,pady);
634 Info(" 73- 1","sec=%i padx=%3i pady=%3i",p->Local2Pad( 0 , -py/2 ,padx,pady),padx,pady);
abb44d7c 635 cout<<endl;
543d5224 636 p->Pad2Local(padx= 1,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
637 p->Pad2Local(padx= 48,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
638 p->Pad2Local(padx= 49,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
639 p->Pad2Local(padx= 96,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
640 p->Pad2Local(padx= 97,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
641 p->Pad2Local(padx=144,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
642 cout<<endl;
643 p->Pad2Local(padx= 1,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
644 p->Pad2Local(padx= 48,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
645 p->Pad2Local(padx= 49,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
646 p->Pad2Local(padx= 96,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
647 p->Pad2Local(padx= 97,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
648 p->Pad2Local(padx=144,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
649 cout<<endl;
650 p->Pad2Local(padx= 1,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
651 p->Pad2Local(padx= 48,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
652 p->Pad2Local(padx= 49,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
653 p->Pad2Local(padx= 96,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
654 p->Pad2Local(padx= 97,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
655 p->Pad2Local(padx=144,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
656 cout<<endl;
657 p->Pad2Local(padx= 1,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
658 p->Pad2Local(padx= 48,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
659 p->Pad2Local(padx= 49,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
660 p->Pad2Local(padx= 96,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
661 p->Pad2Local(padx= 97,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
662 p->Pad2Local(padx=144,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
663}//void TestSeg()
abb44d7c 664//__________________________________________________________________________________________________
543d5224 665void TestMenu()
abb44d7c 666{
543d5224 667 TControlBar *pMenu = new TControlBar("vertical","RICH test");
668 pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam::L2P() method");
669 pMenu->AddButton("Test transform", "TestTransform()", "Test ALiRICHChamber::L2G() and G2L methods");
670 pMenu->AddButton("Test gain", "TestGain()", "Test AliRICHParam::Gain() method");
671 pMenu->AddButton("Test MIP charge", "TestMipCharge()", "Test AliRICHParam::TotalCharge() method");
672 pMenu->AddButton("Test Sdigits", "TestSdigits()", "Create test set of sdigits");
673 pMenu->AddButton("Test Digits OLD", "TestDigitsOLD()", "Create test set of OLD digits");
674 pMenu->AddButton("Test Clusters OLD", "TestClustersOLD()", "Create test set of OLD clusters");
675 pMenu->Show();
676}//TestMenu()
677//__________________________________________________________________________________________________
678void GeoMenu()
679{
680 TControlBar *pMenu = new TControlBar("vertical","RICH draw");
681 pMenu->AddButton("RICH Isometry", "gMC->Gdraw(\"ALIC\", 60,40,0, 10,10, 0.008,0.008)","Draws ALIC volume in isometry");
682 pMenu->AddButton("RICH Front XY", "gMC->Gdraw(\"ALIC\", 0,0,0, 10,10, 0.01,0.01)","Draws ALIC volume in XY view");
683 pMenu->AddButton("RICH Side YZ", "gMC->Gdraw(\"ALIC\",90,180, 0, 10,10, 0.01,0.01)","Draws ALIC volume in YZ view");
684 pMenu->AddButton("RICH Top XZ", "gMC->Gdraw(\"ALIC\",90, 90, 0, 10,10, 0.01,0.01)","Draws ALIC volume in XZ view");
685 pMenu->AddButton("Module Isometry","gMC->Gdraw(\"SRIC\", 30,60,0, 10,10, 0.1,0.1)","Draws SRIC volume in isometry");
686 pMenu->AddButton("Module Front XY","gMC->Gdraw(\"SRIC\", 0,0,0, 10,10, 0.1,0.1)","Draws SRIC volume in XY view");
687 pMenu->AddButton("Module Top XZ", "gMC->Gdraw(\"SRIC\",90, 90, 0, 10,10, 0.1,0.1)","Draws SRIC volume in XZ view");
688 pMenu->AddButton("ALICE Tree", "((TGeant3*)gMC)->Gdtree(\"ALIC\")","Draws ALICE tree");
689 pMenu->AddButton("RICH Tree", "((TGeant3*)gMC)->Gdtree(\"RICH\")","Draws RICH tree");
690 pMenu->AddButton("Geo test", "GeoTest()", "Draw RICH geo as a macro");
691 pMenu->AddButton("Print ref", "PrintGeo()", "Print RICH chambers default position");
692 pMenu->AddButton("AliRICH::Print", "r->Print();", "Print RICH chambers default position");
693 pMenu->AddButton("Test transform","TestTransform()","Test L2G and G2L methods");
694 pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
695 pMenu->Show();
696}//GeoMenu()
697//__________________________________________________________________________________________________
698void menu()
699{
700 TControlBar *pMenu = new TControlBar("vertical","RICH main");
701
702 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
703 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
704 if(CheckAlice()){//it's from file, reconstruct
705 pMenu->AddButton("Hits->Sdigits->Digits","Hits2Digits()","Convert");
706 pMenu->AddButton("Digits->Recos", "Digits2Recos()","Convert");
707 pMenu->AddButton("Show","Show3()","Shows the structure of events in files");
708 pMenu->AddButton("Hits->Sdigits", "Hits2Sdigits()", "Perform first phase converstion");
709 pMenu->AddButton("Specials->Sdigits","Specials2Sdigits()", "Perform first phase converstion");
710 pMenu->AddButton("Sdigits->Digits", "Sdigits2Digits()", "Perform first phase converstion");
711 pMenu->AddButton("Digits->Clusters", "Digits2Clusters()", "Perform first phase converstion");
712
713 pMenu->AddButton("Sdigits->DigitsOLD", "Sdigits2DigitsOLD()","Perform second phase converstion");
714 pMenu->AddButton("DigitsOLD->RawClustersOLD", "DigitsOLD2RawClustersOLD()", "Perform second phase converstion");
715
716 }else{//it's aliroot, simulate
717 pMenu->AddButton("Run", "a->Run(1)", "Process!");
718 }
719 pMenu->AddButton("Geo submenu", "GeoMenu()", "Shows geomentry submenu");
720 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
721 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
fa49f877 722 pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
543d5224 723 pMenu->AddButton("Quit", ".q", "Close session");
724 pMenu->Show();
725 a=gAlice;//for manual manipulation convinience
726}//menu()
727//__________________________________________________________________________________________________