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