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