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