Pass name correctly to base class.
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
3b96aee8 1void ControlPlots()
2{
3 Int_t iChamber=1;
4
5 TH1F *pCqH1=new TH1F("clusq","Clusters Charge;q [QDC]",300,0,4000);
6 al->LoadHeader(); al->LoadKinematics();
7
8 Bool_t isHits=!rl->LoadHits();
9 Bool_t isSDigits=!rl->LoadSDigits();
10 Bool_t isClusters=!rl->LoadRecPoints();
11 Bool_t isDigits=!rl->LoadDigits();
12
13 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
14 al->GetEvent(iEventN);
15 if(isHits){
16 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
17 rl->TreeH()->GetEntry(iPrimN);
18 Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
19 iTotalHits+=r->Hits()->GetEntries();
20 iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
21 iTotalSpecials+=r->Specials()->GetEntries();
22 }//prims loop
23 }//isHits
24 if(isSDigits){
25 rl->TreeS()->GetEntry(0);
26 }//isSdigits
27 if(isDigits){
28 rl->TreeD()->GetEntry(0);
29 for(int i=1;i<=7;i++);
30 }//isDigits
31 if(isClusters){
32 rl->TreeR()->GetEntry(0);
33 Int_t iTotalClusters=0;
34 for(int i=1;i<=7;i++) iTotalClusters+=r->Clusters(i)->GetEntries();
35 for(Int_t iClusterN=0;iClusterN<r->Clusters(iChamber)->GetEntries();iClusterN++){
36 pCqH1->Fill(((AliRICHcluster*)r->Clusters(iChamber)->At(i))->Q());
37 }//clusters loop
38 }//isClusters
39 }//events loop
40 if(isHits) rl->UnloadHits();
41 if(isSDigits) rl->UnloadSDigits();
42 if(isDigits) rl->UnloadDigits();
43 if(isClusters) rl->UnloadRecPoints();
44 al->UnloadHeader(); al->UnloadKinematics();
45 pCqH1->Draw();
46}//void ControlPlots()
47//__________________________________________________________________________________________________
c67b2d9f 48void MainTrank()
49{
50 TStopwatch sw;TDatime time;
3b96aee8 51 OLD_S_SD(); SD_D(); D_C();
c67b2d9f 52 cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
53 cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print();
54 cout<<"Info in <MainTrank>: Time used: ";sw.Print();
55}
3b96aee8 56//__________________________________________________________________________________________________
57void sh()
58{
59 if(rl->LoadHits()) return;
60
61 Int_t iTotalHits=0;
62 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
63 rl->TreeH()->GetEntry(iPrimN);
64 r->Hits()->Print();
65 iTotalHits+=r->Hits()->GetEntries();
66 }
67 Info("sh","totally %i hits",iTotalHits);
68 rl->UnloadHits();
69}
70//__________________________________________________________________________________________________
71void ssp()
72{
73 if(rl->LoadHits()) return;
74
75 Int_t iTotalSpecials=0;
76 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
77 rl->TreeH()->GetEntry(iPrimN);
78 r->Specials()->Print();
79 iTotalSpecials+=r->Specials()->GetEntries();
80 }
81 Info("ssp","totally %i specials",iTotalSpecials);
82 rl->UnloadHits();
83}
84//__________________________________________________________________________________________________
d32d34bf 85void ss()
86{
c1863e3c 87 if(rl->LoadSDigits()) return;
d32d34bf 88 rl->TreeS()->GetEntry(0);
89 r->SDigits()->Print();
3b96aee8 90 Info("ss","totally %i sdigits",r->SDigits()->GetEntries());
d32d34bf 91 rl->UnloadSDigits();
92}
3b96aee8 93//__________________________________________________________________________________________________
c1863e3c 94void sd()
95{
96 if(rl->LoadDigits()) return;
97 rl->TreeD()->GetEntry(0);
3b96aee8 98 Int_t iTotalDigits=0;
99 for(int i=1;i<=7;i++){
100 r->Digits(i)->Print();
101 iTotalDigits+=r->Digits(i)->GetEntries();
102 }
103 Info("sd","totally %i digits",iTotalDigits);
c1863e3c 104 rl->UnloadDigits();
105}
106
107void sc()
108{
109 if(rl->LoadRecPoints()) return;
c67b2d9f 110 r->SetTreeAddress();
c1863e3c 111 rl->TreeR()->GetEntry(0);
112 for(int i=1;i<=7;i++) r->Clusters(i)->Print();
113 rl->UnloadRecPoints();
114}
8fc0dab8 115
116Double_t r2d = TMath::RadToDeg();
117Double_t d2r = TMath::DegToRad();
118
fa49f877 119void DisplFast()
120{
121 AliRICHDisplFast *d = new AliRICHDisplFast();
aed240d4 122 d->Exec();
fa49f877 123}
124
125
543d5224 126void Digits2Recos()
c60862bf 127{
5cb4dfc3 128 AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
543d5224 129
130
8fc0dab8 131 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
543d5224 132 al->GetEvent(nev);
133 cout <<endl<< "Processing event:" <<nev<<endl;
5cb4dfc3 134 detect->StartProcessEvent();
543d5224 135 } // event loop
fa49f877 136 delete detect;
543d5224 137}
138
139
140
543d5224 141
d32d34bf 142void D_C()
543d5224 143{
144 AliRICHClusterFinder *z=new AliRICHClusterFinder(r);
145 z->Exec();
146}
d32d34bf 147//__________________________________________________________________________________________________
148void OLD_S_SD()
c60862bf 149{
d32d34bf 150 Info("OLD_S_SD","Start.");
c60862bf 151
543d5224 152 rl->LoadHits();
c60862bf 153
154 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
155 al->GetEvent(iEventN);
c60862bf 156
543d5224 157 rl->MakeTree("S"); r->MakeBranch("S");
d32d34bf 158 r->ResetSDigits(); r->ResetSpecialsOld();
543d5224 159
c60862bf 160 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
161 rl->TreeH()->GetEntry(iPrimN);
162 for(Int_t i=0;i<r->Specials()->GetEntries();i++){//specials loop
3b96aee8 163 Int_t padx= ((AliRICHSDigit*)r->Specials()->At(i))->PadX()+r->Param()->NpadsX()/2;
164 Int_t pady= ((AliRICHSDigit*)r->Specials()->At(i))->PadY()+r->Param()->NpadsY()/2;
d32d34bf 165 Double_t q= ((AliRICHSDigit*)r->Specials()->At(i))->QPad();
543d5224 166 Int_t hitN= ((AliRICHSDigit*)r->Specials()->At(i))->HitNumber()-1;//!!! important -1
167 Int_t chamber=((AliRICHhit*)r->Hits()->At(hitN))->C();
168 Int_t track=((AliRICHhit*)r->Hits()->At(hitN))->GetTrack();
3b96aee8 169 if(padx<1 || padx>r->Param()->NpadsX() ||pady<1 || pady>r->Param()->NpadsY())
170 Error("OLD_S_SD","pad is out of valid range padx= %i pady=%i event %i",padx,pady,iEventN);
171 else
172 r->AddSDigit(chamber,padx,pady,q,track);
c60862bf 173 }//specials loop
174 }//prims loop
175 rl->TreeS()->Fill();
176 rl->WriteSDigits("OVERWRITE");
c60862bf 177 }//events loop
178 rl->UnloadHits(); rl->UnloadSDigits();
d32d34bf 179 Info("OLD_S_SD","Stop.");
3b96aee8 180}//OLD_S_SD()
543d5224 181//__________________________________________________________________________________________________
c712cb2f 182void H_SD()
c60862bf 183{
c712cb2f 184 Info("H_SD","Start.");
c60862bf 185
186 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
187 al->GetEvent(iEventN);
188
189 if(!rl->TreeH()) rl->LoadHits();//from
190 if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
543d5224 191
c60862bf 192 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
193 rl->TreeH()->GetEntry(iPrimN);
d32d34bf 194 for(Int_t iHitN=0;iHitN<3;iHitN++){//hits loop ???
c712cb2f 195 AliRICHhit *pHit=r->Hits()->At(iHitN);
196 TVector3 globX3(pHit->X(),pHit->Y(),pHit->Z());
197 TVector3 locX3=r->C(pHit->C())->Glob2Loc(globX3);
198
199 Int_t sector;
200 Int_t iTotQdc=r->Param()->Loc2TotQdc(locX3,pHit->Eloss(),pHit->Pid(),sector);
201
202 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
203 r->Param()->Loc2Area(locX3,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
204 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
205 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
206 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
d32d34bf 207 Double_t padQdc=iTotQdc*r->Param()->Loc2PadFrac(locX3,iPadX,iPadY);
208 if(padQdc>0.1)r->AddSDigit(pHit->C(),iPadX,iPadY,padQdc,pHit->GetTrack());
209 }
c712cb2f 210 }//hits loop
211 }//prims loop
c60862bf 212 rl->TreeS()->Fill();
213 rl->WriteSDigits("OVERWRITE");
214 }//events loop
215
216 rl->UnloadHits();
217 rl->UnloadSDigits();
d32d34bf 218 Info("H_SD","Stop.");
3b96aee8 219}//H_SD()
543d5224 220//__________________________________________________________________________________________________
d32d34bf 221void SD_D()
543d5224 222{
d32d34bf 223 Info("SD_D","Start.");
543d5224 224
225 rl->LoadSDigits();
226
227 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
228 al->GetEvent(iEventN);
3b96aee8 229 cout<<"Event "<<iEventN<<endl;
543d5224 230 rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
d32d34bf 231 r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
543d5224 232 rl->TreeS()->GetEntry(0);
d32d34bf 233 r->SDigits()->Sort();
543d5224 234
235 Int_t kBad=-101;
d32d34bf 236 Int_t chamber,x,y,tr[3],id;
237 Double_t q=kBad;
238 chamber=x=y=tr[0]=tr[1]=tr[2]=id=kBad;
543d5224 239 Int_t iNdigitsPerPad=kBad;//how many sdigits for a given pad
240
d32d34bf 241 for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted)
242 AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i);
543d5224 243 if(pSdig->Id()==id){//still the same pad
244 iNdigitsPerPad++;
d32d34bf 245 q+=pSdig->Q();
543d5224 246 if(iNdigitsPerPad<=3)
247 tr[iNdigitsPerPad-1]=pSdig->T(0);
3b96aee8 248// else
249// Info("","More then 3 sdigits for the given pad");
543d5224 250 }else{//new pad, add the pevious one
3b96aee8 251 if(id!=kBad) r->AddDigit(chamber,x,y,q,tr[0],tr[1],tr[2]);//ch-xpad-ypad-qdc-tr1-2-3
d32d34bf 252 chamber=pSdig->C();x=pSdig->X();y=pSdig->Y();q=pSdig->Q();tr[0]=pSdig->T(0);id=pSdig->Id();
543d5224 253 iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
254 }
255 }//sdigits loop (sorted)
256
3b96aee8 257 if(r->SDigits()->GetEntries())r->AddDigit(chamber,x,y,q,tr[0],tr[1],tr[2]);//add the last digit
543d5224 258
259 rl->TreeD()->Fill();
260 rl->WriteDigits("OVERWRITE");
261 }//events loop
262 rl->UnloadSDigits(); rl->UnloadDigits();
d32d34bf 263 r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
264 Info("SD_D","Stop.");
3b96aee8 265}//SD_D()
08479a10 266//__________________________________________________________________________________________________
3b96aee8 267void Show()
d48cca74 268{
abb44d7c 269 cout<<endl;
c60862bf 270 al->LoadHeader(); al->LoadKinematics();
abb44d7c 271
aed240d4 272 rl->LoadHits();
273 Bool_t isSdigits=!rl->LoadSDigits();
274 Bool_t isClusters=!rl->LoadRecPoints();
275 Bool_t isDigits=!rl->LoadDigits();//loaders
c60862bf 276
277 cout<<endl; cout<<endl;
278 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
279 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 280 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 281
282 Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
abb44d7c 283 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 284 rl->TreeH()->GetEntry(iPrimN);
285 iTotalHits+=r->Hits()->GetEntries();
286 iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
287 iTotalSpecials+=r->Specials()->GetEntries();
abb44d7c 288 TParticle *pPrim=al->Stack()->Particle(iPrimN);
543d5224 289 Info("Show","Evt %4i prim %4i has %4i hits %5i cerenkovs and %5i specials from %s (,%7.2f,%7.2f)",
c60862bf 290 iEventN,
291 iPrimN,
292 r->Hits()->GetEntries(),
293 r->Cerenkovs()->GetEntries(),
294 r->Specials()->GetEntries(),
295 pPrim->GetName(),
296 pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 297 }//prims loop
543d5224 298 Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits %i cerenkovs %i specials",
c60862bf 299 iEventN, iNparticles, iNprims, iTotalHits,iTotalCerenkovs,iTotalSpecials);
300 if(isSdigits){
301 rl->TreeS()->GetEntry(0);
d32d34bf 302 Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
abb44d7c 303 }
c60862bf 304 if(isDigits){
305 rl->TreeD()->GetEntry(0);
543d5224 306 for(int i=1;i<=7;i++)
aed240d4 307 Info("Show-DIGITS","Evt %i chamber %i contains %5i digits",
308 iEventN, i, r->Digits(i)->GetEntries());
309 }
310 if(isClusters){
311 rl->TreeR()->GetEntry(0);
312 for(int i=1;i<=7;i++)
313 Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters",
314 iEventN, i, r->Clusters(i)->GetEntries());
c60862bf 315 }
316 cout<<endl;
abb44d7c 317 }//events loop
aed240d4 318 rl->UnloadHits();
319 if(isSdigits) rl->UnloadSDigits();
320 if(isDigits) rl->UnloadDigits();
321 if(isClusters) rl->UnloadRecPoints();
abb44d7c 322 al->UnloadHeader();
323 al->UnloadKinematics();
324 cout<<endl;
d48cca74 325}//void Show()
aed240d4 326//__________________________________________________________________________________________________
abb44d7c 327
d48cca74 328
d48cca74 329AliRun *a;
853634d3 330AliRunLoader *al;
331AliLoader *rl,*tl,*il;
332
333AliRICH *r;
853634d3 334
d32d34bf 335Bool_t ReadAlice()
d48cca74 336{
d32d34bf 337 Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
abb44d7c 338 AliLoader::SetDebug(0);
339 if(gAlice) delete gAlice;
340 if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
341 gSystem->Exec("rm -rf *.root *.dat");
d32d34bf 342 Error("ReadAlice","galice.root broken, removing all this garbage then init new one");
343 new AliRun("gAlice","Alice experiment system");
344 gAlice->SetDebug(-1);
345 gAlice->Init("ConfigRich.C");
346 r=(AliRICH*)gAlice->GetDetector("RICH");
347 return kFALSE;
abb44d7c 348 }
349 al->LoadgAlice();
350 if(!gAlice) Fatal("ReadAlice","No gAlice in file");
351 a=al->GetAliRun();
352 a->SetDebug(0);
353//RICH
354 if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
355 r->SetDebug(0);
356 if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
357
358 Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
d32d34bf 359 return kTRUE;
abb44d7c 360}
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;
c33c49f0 429}//PrintGeo()
543d5224 430//__________________________________________________________________________________________________
c33c49f0 431void TestResponse()
abb44d7c 432{
c33c49f0 433 TCanvas *pC=new TCanvas("c","Amplification test",900,800);
434 pC->Divide(1,2);
435 pC->cd(1);
436 TF1 *pF1=new TF1("f1","9e-6*pow(x,4)+2e-7*pow(x,3)-0.0316*pow(x,2)-3e-4*x+25.367",-70,70);
437 pF1->Draw();
438
439 pC->cd(2);
440
441 const Int_t nPoints=8;
442 THStack *pStack=new THStack("stack","photons");
443 TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
444 TH1F *apH[nPoints];
445
446 Double_t starty=AliRICHParam::DeadZone()/2;
447 Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
448
449 for(int i=0;i<nPoints;i++){
450 apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",1000,0,1000); apH[i]->SetLineColor(i);
451 pStack->Add(apH[i]);
452 pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
abb44d7c 453 }
c33c49f0 454
455
456 TVector3 x3(0,0,0);
457 Int_t sector=10;
458// AliRICHParam::ResetWireSag();
459 for(Int_t i=0;i<10000;i++){//events loop
460 for(int j=0;j<nPoints;j++){
461 x3.SetY(starty-j*deltay);
462 apH[j]->Fill(AliRICHParam::Loc2TotQdc(x3,400e-9,500000,sector));
463 }
abb44d7c 464 }
c33c49f0 465 pStack->Draw("nostack");
466 pLeg->Draw();
467}//TestResponse()
abb44d7c 468//__________________________________________________________________________________________________
d32d34bf 469void TestSD()
abb44d7c 470{
d32d34bf 471 Info("TestSD","Creating test sdigits.");
abb44d7c 472 rl->MakeTree("S");r->MakeBranch("S");
abb44d7c 473
d32d34bf 474 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
475 al->GetEvent(iEventN);
abb44d7c 476
d32d34bf 477 if(!rl->TreeH()) rl->LoadHits();//from
478 if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
479
480 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
481 rl->TreeH()->GetEntry(iPrimN);
482 for(Int_t iHitN=0;iHitN<3;iHitN++){//hits loop ???
483 AliRICHhit *pHit=r->Hits()->At(iHitN);
484 TVector3 globX3(pHit->X(),pHit->Y(),pHit->Z());
485 TVector3 locX3=r->C(pHit->C())->Glob2Loc(globX3);
486
487 Int_t sector;
488 Int_t iTotQdc=r->Param()->Loc2TotQdc(locX3,pHit->Eloss(),pHit->Pid(),sector);
489
490 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
491 r->Param()->Loc2Area(locX3,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
492 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
493 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
494 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
495 Float_t iPadQdc=iTotQdc*r->Param()->Loc2PadFrac(locX3,iPadX,iPadY);
496 Int_t padx,pady; r->Param()->Loc2Pad(locX3.X(),locX3.Y(),padx,pady);
497 cout<<"hit="<<iHitN<<" ("<<locX3.X()<<','<<locX3.Y()<<")("<<padx<<','<<pady<<") cur pad("<<iPadX<<","<<iPadY<<") qtot="<<iTotQdc<<" qfrac="<<r->Param()->Loc2PadFrac(locX3,iPadX,iPadY)<<endl;
498 }
c67b2d9f 499// r->AddSDigit(pHit->C(),padx,pady,r->Param()->Local2PadQdc(localX3,padx,pady),pHit->GetTrack());
d32d34bf 500 }//hits loop
501 }//prims loop
502 rl->TreeS()->Fill();
503 rl->WriteSDigits("OVERWRITE");
504 }//events loop
abb44d7c 505
d32d34bf 506 rl->UnloadHits();
507 rl->UnloadSDigits();
508
abb44d7c 509 rl->TreeS()->Fill();
510 rl->WriteSDigits("OVERWRITE");
511 rl->UnloadSDigits();
512 cout<<endl;r->Sdigits()->Print();
513 r->ResetSDigits();
543d5224 514 Info("TestSdigits","Stop.");
515}//void TestSdigits()
abb44d7c 516//__________________________________________________________________________________________________
c67b2d9f 517void TestC()
abb44d7c 518{
c67b2d9f 519 Info("TestC","Creating test clusters.");
543d5224 520 rl->MakeTree("R");r->MakeBranch("R");
521
c67b2d9f 522 AliRICHcluster c;
523 c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
524 c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
525 c.CoG();
526
527 r->AddCluster(c);
528
543d5224 529 rl->TreeR()->Fill();
530 rl->WriteRecPoints("OVERWRITE");
531 rl->UnloadRecPoints();
c67b2d9f 532 r->ResetClusters();
543d5224 533
c67b2d9f 534 Info("TestC","Stop.");
535}//TestC()
543d5224 536//__________________________________________________________________________________________________
537void TestSeg()
538{
539 AliRICHParam *p=r->Param();
abb44d7c 540 Int_t padx,pady;
d32d34bf 541 Double_t x,y;
542 Double_t dz=p->DeadZone();
543 Double_t sx=p->SectorSizeX(); Double_t sy=p->SectorSizeY(); Double_t px=p->PcSizeX(); Double_t py=p->PcSizeY();
543d5224 544 cout<<endl;
d32d34bf 545 Info(" 1- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , -py/2 ,padx,pady),padx,pady);
546 Info(" 48- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , -py/2 ,padx,pady),padx,pady);
547 Info(" 49- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , -py/2 ,padx,pady),padx,pady);
548 Info(" 96- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , -py/2 ,padx,pady),padx,pady);
549 Info(" 97- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , -py/2 ,padx,pady),padx,pady);
550 Info("144- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , -py/2 ,padx,pady),padx,pady);
abb44d7c 551 cout<<endl;
d32d34bf 552 Info(" 1- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , -dz/2 ,padx,pady),padx,pady);
553 Info(" 48- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , -dz/2 ,padx,pady),padx,pady);
554 Info(" 49- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , -dz/2 ,padx,pady),padx,pady);
555 Info(" 96- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , -dz/2 ,padx,pady),padx,pady);
556 Info(" 97- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , -dz/2 ,padx,pady),padx,pady);
557 Info("144- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , -dz/2 ,padx,pady),padx,pady);
abb44d7c 558 cout<<endl;
d32d34bf 559 Info(" 1- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , dz/2 ,padx,pady),padx,pady);
560 Info(" 48- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , dz/2 ,padx,pady),padx,pady);
561 Info(" 49- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , dz/2 ,padx,pady),padx,pady);
562 Info(" 96- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , dz/2 ,padx,pady),padx,pady);
563 Info(" 97- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , dz/2 ,padx,pady),padx,pady);
564 Info("144- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , dz/2 ,padx,pady),padx,pady);
abb44d7c 565 cout<<endl;
d32d34bf 566 Info(" 1-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , py/2 ,padx,pady),padx,pady);
567 Info(" 48-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , py/2 ,padx,pady),padx,pady);
568 Info(" 49-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , py/2 ,padx,pady),padx,pady);
569 Info(" 96-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , py/2 ,padx,pady),padx,pady);
570 Info(" 97-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , py/2 ,padx,pady),padx,pady);
571 Info("144-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , py/2 ,padx,pady),padx,pady);
abb44d7c 572 cout<<endl;
d32d34bf 573 Info(" 73-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , py/2 ,padx,pady),padx,pady);
574 Info(" 73- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , dz/2 ,padx,pady),padx,pady);
575 Info("0-0dead","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , 0 ,padx,pady),padx,pady);
576 Info(" 73- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , -dz/2 ,padx,pady),padx,pady);
577 Info(" 73- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , -py/2 ,padx,pady),padx,pady);
abb44d7c 578 cout<<endl;
d32d34bf 579 p->Pad2Loc(padx= 1,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
580 p->Pad2Loc(padx= 48,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
581 p->Pad2Loc(padx= 49,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
582 p->Pad2Loc(padx= 96,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
583 p->Pad2Loc(padx= 97,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
584 p->Pad2Loc(padx=144,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
543d5224 585 cout<<endl;
d32d34bf 586 p->Pad2Loc(padx= 1,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
587 p->Pad2Loc(padx= 48,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
588 p->Pad2Loc(padx= 49,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
589 p->Pad2Loc(padx= 96,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
590 p->Pad2Loc(padx= 97,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
591 p->Pad2Loc(padx=144,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
543d5224 592 cout<<endl;
d32d34bf 593 p->Pad2Loc(padx= 1,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
594 p->Pad2Loc(padx= 48,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
595 p->Pad2Loc(padx= 49,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
596 p->Pad2Loc(padx= 96,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
597 p->Pad2Loc(padx= 97,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
598 p->Pad2Loc(padx=144,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
543d5224 599 cout<<endl;
d32d34bf 600 p->Pad2Loc(padx= 1,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
601 p->Pad2Loc(padx= 48,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
602 p->Pad2Loc(padx= 49,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
603 p->Pad2Loc(padx= 96,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
604 p->Pad2Loc(padx= 97,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
605 p->Pad2Loc(padx=144,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
543d5224 606}//void TestSeg()
abb44d7c 607//__________________________________________________________________________________________________
543d5224 608void TestMenu()
abb44d7c 609{
543d5224 610 TControlBar *pMenu = new TControlBar("vertical","RICH test");
c67b2d9f 611 pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods");
612 pMenu->AddButton("Test transform", "TestTransform()", "Test ALiRICHChamber methods");
c33c49f0 613 pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods");
d32d34bf 614 pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits");
c67b2d9f 615 pMenu->AddButton("Test digits OLD", "TestDigitsOLD()", "Create test set of OLD digits");
616 pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters");
543d5224 617 pMenu->Show();
618}//TestMenu()
619//__________________________________________________________________________________________________
620void GeoMenu()
621{
622 TControlBar *pMenu = new TControlBar("vertical","RICH draw");
623 pMenu->AddButton("RICH Isometry", "gMC->Gdraw(\"ALIC\", 60,40,0, 10,10, 0.008,0.008)","Draws ALIC volume in isometry");
624 pMenu->AddButton("RICH Front XY", "gMC->Gdraw(\"ALIC\", 0,0,0, 10,10, 0.01,0.01)","Draws ALIC volume in XY view");
625 pMenu->AddButton("RICH Side YZ", "gMC->Gdraw(\"ALIC\",90,180, 0, 10,10, 0.01,0.01)","Draws ALIC volume in YZ view");
626 pMenu->AddButton("RICH Top XZ", "gMC->Gdraw(\"ALIC\",90, 90, 0, 10,10, 0.01,0.01)","Draws ALIC volume in XZ view");
627 pMenu->AddButton("Module Isometry","gMC->Gdraw(\"SRIC\", 30,60,0, 10,10, 0.1,0.1)","Draws SRIC volume in isometry");
628 pMenu->AddButton("Module Front XY","gMC->Gdraw(\"SRIC\", 0,0,0, 10,10, 0.1,0.1)","Draws SRIC volume in XY view");
629 pMenu->AddButton("Module Top XZ", "gMC->Gdraw(\"SRIC\",90, 90, 0, 10,10, 0.1,0.1)","Draws SRIC volume in XZ view");
630 pMenu->AddButton("ALICE Tree", "((TGeant3*)gMC)->Gdtree(\"ALIC\")","Draws ALICE tree");
631 pMenu->AddButton("RICH Tree", "((TGeant3*)gMC)->Gdtree(\"RICH\")","Draws RICH tree");
632 pMenu->AddButton("Geo test", "GeoTest()", "Draw RICH geo as a macro");
633 pMenu->AddButton("Print ref", "PrintGeo()", "Print RICH chambers default position");
634 pMenu->AddButton("AliRICH::Print", "r->Print();", "Print RICH chambers default position");
635 pMenu->AddButton("Test transform","TestTransform()","Test L2G and G2L methods");
543d5224 636 pMenu->Show();
637}//GeoMenu()
638//__________________________________________________________________________________________________
639void menu()
640{
641 TControlBar *pMenu = new TControlBar("vertical","RICH main");
642
d32d34bf 643 if(ReadAlice()){//it's from file, reconstruct
3b96aee8 644 pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert");
d32d34bf 645
c712cb2f 646 pMenu->AddButton("hits->sdigits", "H_SD()", "Perform first phase converstion");
c712cb2f 647 pMenu->AddButton("sdigits->digits", "SD_D()", "Perform first phase converstion");
648 pMenu->AddButton("digits->clusters", "D_C()", "Perform first phase converstion");
543d5224 649
3b96aee8 650 pMenu->AddButton("Show","Show()","Shows the structure of events in files");
d32d34bf 651 pMenu->AddButton("OLD specials->sdigits", "OLD_S_SD()", "Perform first phase converstion");
543d5224 652
653 }else{//it's aliroot, simulate
654 pMenu->AddButton("Run", "a->Run(1)", "Process!");
655 }
656 pMenu->AddButton("Geo submenu", "GeoMenu()", "Shows geomentry submenu");
d32d34bf 657 pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
543d5224 658 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
659 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
fa49f877 660 pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
3b96aee8 661 pMenu->AddButton("Control Plots", "ControlPlots()", "Display some control histograms");
662 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
663 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
543d5224 664 pMenu->AddButton("Quit", ".q", "Close session");
665 pMenu->Show();
666 a=gAlice;//for manual manipulation convinience
667}//menu()
668//__________________________________________________________________________________________________
3b96aee8 669void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);}
670void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);}