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