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