]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/menu.C
remove ConfigRich, as fully substitueted by
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
86594bfc 1//__________________________________________________________________________________________________
2void H_SD()
3{
4 Info("H_SD","Start.");
5
6 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
7 al->GetEvent(iEventN);
8
9 if(!rl->TreeH()) rl->LoadHits(); al->LoadHeader(); al->LoadKinematics();//from
10 if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
11
12 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
13 rl->TreeH()->GetEntry(iPrimN);
14 for(Int_t iHitN=0;iHitN<r->Hits()->GetEntries();iHitN++){//hits loop ???
15 AliRICHhit *pHit=r->Hits()->At(iHitN);
16
17 TVector2 x2 = r->Param()->ShiftToWirePos(r->C(pHit->C())->Glob2Loc(pHit->OutX3()));
18
19 Int_t iTotQdc=r->Param()->TotQdc(x2,pHit->Eloss());
20
21 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
22 r->Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
23 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
24 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
25 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
26 Double_t padQdc=iTotQdc*r->Param()->FracQdc(x2,iPadX,iPadY);
27 cout<<padQdc<<endl;
28 if(padQdc>0.1) r->AddSDigit(pHit->C(),iPadX,iPadY,padQdc,al->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack());
29 }
30 }//hits loop
31 }//prims loop
32 rl->TreeS()->Fill();
33 rl->WriteSDigits("OVERWRITE");
34 }//events loop
35
36 rl->UnloadHits(); al->UnloadHeader(); al->UnloadKinematics();
37 rl->UnloadSDigits();
38 Info("H_SD","Stop.");
39}//H_SD()
40//__________________________________________________________________________________________________
ed3ceb24 41
42Int_t countContrib[7][3];
43
3b96aee8 44void ControlPlots()
45{
46 Int_t iChamber=1;
47
ed3ceb24 48 TFile *pFile = new TFile("$(HOME)/plots.root","RECREATE");
49 TH1F *pCqH1=new TH1F("ClusQ", "Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
50 TH1F *pCsH1=new TH1F("ClusSize","Cluster size all chambers;size [number of pads in cluster]",100,0,100);
51 TH2F *pCmH2=new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
52 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
3b96aee8 53
ed3ceb24 54 TH1F *pCqMipH1=new TH1F("MipClusQ", "MIP Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
55 TH1F *pCsMipH1=new TH1F("MipClusSize","MIP Cluster size all chambers;size [number of pads in cluster]",100,0,100);
56 TH2F *pCmMipH2=new TH2F("MipClusMap", "MIP Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
57 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
3b96aee8 58
ed3ceb24 59 TH1F *pCqCerH1=new TH1F("CerClusQ", "Cerenkov Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
60 TH1F *pCsCerH1=new TH1F("CerClusSize","Cernekov Cluster size all chambers;size [number of pads in cluster]",100,0,100);
61 TH2F *pCmCerH2=new TH2F("CerClusMap", "Cerenkov Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
62 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
63 TH1F *pCqFeeH1=new TH1F("FeeClusQ", "Feedback Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
64 TH1F *pCsFeeH1=new TH1F("FeeClusSize","Feedback Cluster size all chambers;size [number of pads in cluster]",100,0,100);
65 TH2F *pCmFeeH2=new TH2F("FeeClusMap", "Feedback Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
66 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
67 Bool_t isClusters=!rl->LoadRecPoints();
68 r->SetTreeAddress();
3b96aee8 69 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
70 al->GetEvent(iEventN);
3b96aee8 71 if(isClusters){
72 rl->TreeR()->GetEntry(0);
73 Int_t iTotalClusters=0;
ed3ceb24 74 for(int i=1;i<=7;i++){//chambers loop
75 iTotalClusters+=r->Clusters(i)->GetEntries();
76 for(Int_t iClusterN=0;iClusterN<r->Clusters(i)->GetEntries();iClusterN++){//clusters loop
77 AliRICHcluster *pClus=(AliRICHcluster*)r->Clusters(i)->At(iClusterN);
78
79 countContrib[i-1][0] += pClus->Nmips();
80 countContrib[i-1][1] += pClus->Ncerenkovs();
81 countContrib[i-1][2] += pClus->Nfeedbacks();
82
83 pCqH1->Fill(pClus->Q());
84 pCsH1->Fill(pClus->Size());
85 pCmH2->Fill(pClus->X(),pClus->Y());
86
87 if(pClus->IsPureMip()){ //Pure Mips
88 pCqMipH1->Fill(pClus->Q());
89 pCsMipH1->Fill(pClus->Size());
90 pCmMipH2->Fill(pClus->X(),pClus->Y());
91 }
92 if(pClus->IsPureCerenkov()){ //Pure Photons
93 pCqCerH1->Fill(pClus->Q());
94 pCsCerH1->Fill(pClus->Size());
95 pCmCerH2->Fill(pClus->X(),pClus->Y());
96 }
97 if(pClus->IsPureFeedback()){ //Pure Feedbacks
98 pCqFeeH1->Fill(pClus->Q());
99 pCsFeeH1->Fill(pClus->Size());
100 pCmFeeH2->Fill(pClus->X(),pClus->Y());
101 }
102 }//clusters loop
103 }//chambers loop
3b96aee8 104 }//isClusters
ed3ceb24 105 Info("ControlPlots","Event %i processed.",iEventN);
3b96aee8 106 }//events loop
ed3ceb24 107 if(isClusters) rl->UnloadRecPoints();
108
109 pFile->Write();
110 delete pFile;
111 for(Int_t i=0;i<7;i++)
112 cout <<" chamber " << i+1 << " n. mips " << countContrib[i][0] << " n. ckovs " << countContrib[i][1] << " n. fdbks " << countContrib[i][2] << endl;
3b96aee8 113}//void ControlPlots()
114//__________________________________________________________________________________________________
c67b2d9f 115void MainTrank()
116{
117 TStopwatch sw;TDatime time;
86594bfc 118 H_SD(); SD_D(); AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();//delete z;
c67b2d9f 119 cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
ed3ceb24 120 cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print();
121 cout<<"Info in <MainTrank>: Time used: ";sw.Print();
c67b2d9f 122}
3b96aee8 123//__________________________________________________________________________________________________
124void sh()
125{
126 if(rl->LoadHits()) return;
127
128 Int_t iTotalHits=0;
129 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
130 rl->TreeH()->GetEntry(iPrimN);
131 r->Hits()->Print();
132 iTotalHits+=r->Hits()->GetEntries();
133 }
134 Info("sh","totally %i hits",iTotalHits);
135 rl->UnloadHits();
136}
137//__________________________________________________________________________________________________
138void ssp()
139{
140 if(rl->LoadHits()) return;
141
142 Int_t iTotalSpecials=0;
143 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
144 rl->TreeH()->GetEntry(iPrimN);
145 r->Specials()->Print();
146 iTotalSpecials+=r->Specials()->GetEntries();
147 }
148 Info("ssp","totally %i specials",iTotalSpecials);
149 rl->UnloadHits();
150}
151//__________________________________________________________________________________________________
d32d34bf 152void ss()
153{
c1863e3c 154 if(rl->LoadSDigits()) return;
d32d34bf 155 rl->TreeS()->GetEntry(0);
156 r->SDigits()->Print();
3b96aee8 157 Info("ss","totally %i sdigits",r->SDigits()->GetEntries());
d32d34bf 158 rl->UnloadSDigits();
159}
3b96aee8 160//__________________________________________________________________________________________________
c1863e3c 161void sd()
162{
163 if(rl->LoadDigits()) return;
164 rl->TreeD()->GetEntry(0);
3b96aee8 165 Int_t iTotalDigits=0;
166 for(int i=1;i<=7;i++){
167 r->Digits(i)->Print();
168 iTotalDigits+=r->Digits(i)->GetEntries();
169 }
170 Info("sd","totally %i digits",iTotalDigits);
c1863e3c 171 rl->UnloadDigits();
172}
173
174void sc()
175{
176 if(rl->LoadRecPoints()) return;
c67b2d9f 177 r->SetTreeAddress();
c1863e3c 178 rl->TreeR()->GetEntry(0);
179 for(int i=1;i<=7;i++) r->Clusters(i)->Print();
180 rl->UnloadRecPoints();
181}
8fc0dab8 182
183Double_t r2d = TMath::RadToDeg();
184Double_t d2r = TMath::DegToRad();
185
ed3ceb24 186void DisplFast(){ AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();}
fa49f877 187
188
af3d25a6 189void C_R()
c60862bf 190{
5cb4dfc3 191 AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
543d5224 192
193
8fc0dab8 194 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
543d5224 195 al->GetEvent(nev);
196 cout <<endl<< "Processing event:" <<nev<<endl;
5cb4dfc3 197 detect->StartProcessEvent();
543d5224 198 } // event loop
fa49f877 199 delete detect;
543d5224 200}
0f72f306 201//__________________________________________________________________________________________________
202void D_C()
203{
204 TStopwatch sw;TDatime time;
543d5224 205
0f72f306 206 AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();
543d5224 207
0f72f306 208 cout << endl;
209 cout << "Info in Digits->Clusters: Start time: ";time.Print();
210 cout << "Info in Digits->Clusters: Stop time: ";time.Set(); time.Print();
211 cout << "Info in Digits->Clusters: Time used: ";sw.Print();
212}
d32d34bf 213//__________________________________________________________________________________________________
214void OLD_S_SD()
c60862bf 215{
ed3ceb24 216 Info("OLD_S_SD","Start.");
217 rl->LoadHits();
c60862bf 218 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
ed3ceb24 219 al->GetEvent(iEventN); Info("OLD_S_SD","Processing event %i",iEventN);
c60862bf 220
543d5224 221 rl->MakeTree("S"); r->MakeBranch("S");
d32d34bf 222 r->ResetSDigits(); r->ResetSpecialsOld();
543d5224 223
c60862bf 224 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
225 rl->TreeH()->GetEntry(iPrimN);
af3d25a6 226 for(Int_t i=0;i<r->Specials()->GetEntries();i++){//specials loop
a239137a 227 Int_t padx=1+ ((AliRICHSDigit*)r->Specials()->At(i))->PadX()+r->Param()->NpadsX()/2;
228 Int_t pady=1+ ((AliRICHSDigit*)r->Specials()->At(i))->PadY()+r->Param()->NpadsY()/2;
d32d34bf 229 Double_t q= ((AliRICHSDigit*)r->Specials()->At(i))->QPad();
ed3ceb24 230
543d5224 231 Int_t hitN= ((AliRICHSDigit*)r->Specials()->At(i))->HitNumber()-1;//!!! important -1
232 Int_t chamber=((AliRICHhit*)r->Hits()->At(hitN))->C();
ed3ceb24 233 Int_t tid=((AliRICHhit*)r->Hits()->At(hitN))->GetTrack();
234 Int_t pid=((AliRICHhit*)r->Hits()->At(hitN))->Pid();
3b96aee8 235 if(padx<1 || padx>r->Param()->NpadsX() ||pady<1 || pady>r->Param()->NpadsY())
a239137a 236 Warning("OLD_S_SD","pad is out of valid range padx= %i pady=%i event %i",padx,pady,iEventN);
3b96aee8 237 else
ed3ceb24 238 r->AddSDigit(chamber,padx,pady,q,pid,tid);
c60862bf 239 }//specials loop
240 }//prims loop
241 rl->TreeS()->Fill();
242 rl->WriteSDigits("OVERWRITE");
c60862bf 243 }//events loop
244 rl->UnloadHits(); rl->UnloadSDigits();
d32d34bf 245 Info("OLD_S_SD","Stop.");
3b96aee8 246}//OLD_S_SD()
543d5224 247//__________________________________________________________________________________________________
d32d34bf 248void SD_D()
543d5224 249{
d32d34bf 250 Info("SD_D","Start.");
ed3ceb24 251 extern Int_t kBad;
a239137a 252 r->Param()->GenSigmaThMap();
543d5224 253 rl->LoadSDigits();
254
255 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
a239137a 256 al->GetEvent(iEventN); cout<<"Event "<<iEventN<<endl;
543d5224 257 rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
d32d34bf 258 r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
543d5224 259 rl->TreeS()->GetEntry(0);
d32d34bf 260 r->SDigits()->Sort();
ed3ceb24 261
262 Int_t combiPid,chamber,x,y,tid[3],id; Double_t q;
263 Int_t iNdigitsPerPad;//how many sdigits for a given pad
264 const int kBad=-101;//??? to be removed in code
d32d34bf 265 for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted)
266 AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i);
543d5224 267 if(pSdig->Id()==id){//still the same pad
268 iNdigitsPerPad++;
d32d34bf 269 q+=pSdig->Q();
ed3ceb24 270 combiPid+=pSdig->CombiPid();
543d5224 271 if(iNdigitsPerPad<=3)
ed3ceb24 272 tid[iNdigitsPerPad-1]=pSdig->Tid(0);
3b96aee8 273// else
274// Info("","More then 3 sdigits for the given pad");
543d5224 275 }else{//new pad, add the pevious one
af3d25a6 276 if(id!=kBad&&r->Param()->IsOverTh(chamber,x,y,q)) {
ed3ceb24 277 r->AddDigit(chamber,x,y,q,combiPid,tid);
af3d25a6 278 }
ed3ceb24 279 combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id();
280 x=pSdig->X();y=pSdig->Y();
281 q=pSdig->Q();
282 tid[0]=pSdig->Tid(0);
283 iNdigitsPerPad=1;tid[1]=tid[2]=kBad;
543d5224 284 }
285 }//sdigits loop (sorted)
286
a239137a 287 if(r->SDigits()->GetEntries()&&r->Param()->IsOverTh(chamber,x,y,q))
ed3ceb24 288 r->AddDigit(chamber,x,y,q,combiPid,tid);//add the last digit
543d5224 289
290 rl->TreeD()->Fill();
291 rl->WriteDigits("OVERWRITE");
292 }//events loop
293 rl->UnloadSDigits(); rl->UnloadDigits();
d32d34bf 294 r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
295 Info("SD_D","Stop.");
3b96aee8 296}//SD_D()
08479a10 297//__________________________________________________________________________________________________
3b96aee8 298void Show()
d48cca74 299{
abb44d7c 300 cout<<endl;
c60862bf 301 al->LoadHeader(); al->LoadKinematics();
abb44d7c 302
aed240d4 303 rl->LoadHits();
304 Bool_t isSdigits=!rl->LoadSDigits();
305 Bool_t isClusters=!rl->LoadRecPoints();
306 Bool_t isDigits=!rl->LoadDigits();//loaders
c60862bf 307
308 cout<<endl; cout<<endl;
309 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
310 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 311 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 312
313 Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
abb44d7c 314 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 315 rl->TreeH()->GetEntry(iPrimN);
316 iTotalHits+=r->Hits()->GetEntries();
317 iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
318 iTotalSpecials+=r->Specials()->GetEntries();
abb44d7c 319 TParticle *pPrim=al->Stack()->Particle(iPrimN);
543d5224 320 Info("Show","Evt %4i prim %4i has %4i hits %5i cerenkovs and %5i specials from %s (,%7.2f,%7.2f)",
c60862bf 321 iEventN,
322 iPrimN,
323 r->Hits()->GetEntries(),
324 r->Cerenkovs()->GetEntries(),
325 r->Specials()->GetEntries(),
326 pPrim->GetName(),
327 pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 328 }//prims loop
543d5224 329 Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits %i cerenkovs %i specials",
c60862bf 330 iEventN, iNparticles, iNprims, iTotalHits,iTotalCerenkovs,iTotalSpecials);
331 if(isSdigits){
332 rl->TreeS()->GetEntry(0);
d32d34bf 333 Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
abb44d7c 334 }
c60862bf 335 if(isDigits){
336 rl->TreeD()->GetEntry(0);
543d5224 337 for(int i=1;i<=7;i++)
aed240d4 338 Info("Show-DIGITS","Evt %i chamber %i contains %5i digits",
339 iEventN, i, r->Digits(i)->GetEntries());
340 }
341 if(isClusters){
342 rl->TreeR()->GetEntry(0);
343 for(int i=1;i<=7;i++)
344 Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters",
345 iEventN, i, r->Clusters(i)->GetEntries());
c60862bf 346 }
347 cout<<endl;
abb44d7c 348 }//events loop
aed240d4 349 rl->UnloadHits();
350 if(isSdigits) rl->UnloadSDigits();
351 if(isDigits) rl->UnloadDigits();
352 if(isClusters) rl->UnloadRecPoints();
abb44d7c 353 al->UnloadHeader();
354 al->UnloadKinematics();
355 cout<<endl;
d48cca74 356}//void Show()
aed240d4 357//__________________________________________________________________________________________________
abb44d7c 358
d48cca74 359
d48cca74 360AliRun *a;
853634d3 361AliRunLoader *al;
362AliLoader *rl,*tl,*il;
363
364AliRICH *r;
853634d3 365
d32d34bf 366Bool_t ReadAlice()
d48cca74 367{
d32d34bf 368 Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
abb44d7c 369 AliLoader::SetDebug(0);
370 if(gAlice) delete gAlice;
371 if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
372 gSystem->Exec("rm -rf *.root *.dat");
d32d34bf 373 Error("ReadAlice","galice.root broken, removing all this garbage then init new one");
374 new AliRun("gAlice","Alice experiment system");
375 gAlice->SetDebug(-1);
86594bfc 376 gAlice->Init("Config.C");
d32d34bf 377 r=(AliRICH*)gAlice->GetDetector("RICH");
378 return kFALSE;
abb44d7c 379 }
380 al->LoadgAlice();
381 if(!gAlice) Fatal("ReadAlice","No gAlice in file");
382 a=al->GetAliRun();
383 a->SetDebug(0);
384//RICH
385 if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
386 r->SetDebug(0);
387 if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
388
389 Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
d32d34bf 390 return kTRUE;
abb44d7c 391}
392//__________________________________________________________________________________________________
d48cca74 393void PrintGeo(Float_t rotDeg=0)
394{
395 AliRICHParam *p=new AliRICHParam;
396 Double_t r=p->Offset();
397 Double_t kP=p->AngleXY();
398 Double_t kT=p->AngleYZ();
399 Double_t kRot;
400
401 if(rotDeg==0)
402 kRot=p->AngleRot();
403 else
404 kRot=rotDeg*deg;
405
406 cout<<endl;
3ea9cb08 407 Double_t phi=90*deg+kRot+kP,theta=90*deg+kT;
d48cca74 408 Info(" menu for 1","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 409 r, theta*r2d, phi*r2d,
d48cca74 410 r*sin(theta)*cos(phi),
411 r*sin(theta)*sin(phi),
412 r*cos(theta));
413
3ea9cb08 414 phi=90*deg+kRot+kP,theta=90*deg;
d48cca74 415 Info(" menu for 2","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));
d48cca74 420
3ea9cb08 421 phi=90*deg+kRot,theta=90*deg-kT;
d48cca74 422 Info(" menu for 3","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 423 r, theta*r2d, phi*r2d,
d48cca74 424 r*sin(theta)*cos(phi),
425 r*sin(theta)*sin(phi),
426 r*cos(theta));
3ea9cb08 427
428
429 phi=90*deg+kRot,theta=90*deg;
d48cca74 430 Info(" menu for 4","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 431 r, theta*r2d, phi*r2d,
d48cca74 432 r*sin(theta)*cos(phi),
433 r*sin(theta)*sin(phi),
434 r*cos(theta));
3ea9cb08 435
d48cca74 436
437 phi=90*deg+kRot,theta=90*deg+kT;
438 Info(" menu for 5","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 439 r, theta*r2d, phi*r2d,
d48cca74 440 r*sin(theta)*cos(phi),
441 r*sin(theta)*sin(phi),
442 r*cos(theta));
443
3ea9cb08 444
445 phi=90*deg+kRot-kP,theta=90*deg;
d48cca74 446 Info(" menu for 6","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
853634d3 447 r, theta*r2d, phi*r2d,
d48cca74 448 r*sin(theta)*cos(phi),
449 r*sin(theta)*sin(phi),
450 r*cos(theta));
3ea9cb08 451
452 phi=90*deg+kRot-kP,theta=90*deg+kT;
453 Info(" menu for 7","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
454 r, theta*r2d, phi*r2d,
455 r*sin(theta)*cos(phi),
456 r*sin(theta)*sin(phi),
457 r*cos(theta));
d48cca74 458
459 delete p;
c33c49f0 460}//PrintGeo()
543d5224 461//__________________________________________________________________________________________________
86594bfc 462
463Double_t Gain(Double_t *x,Double_t *par)
464{
465 return AliRICHParam::GainSag(x[0],par[0]);
466}
467
c33c49f0 468void TestResponse()
abb44d7c 469{
c33c49f0 470 TCanvas *pC=new TCanvas("c","Amplification test",900,800);
471 pC->Divide(1,2);
472 pC->cd(1);
86594bfc 473 TF1 *pF1=new TF1("f1",Gain,-70,70,1); pF1->SetParameters(1,1);pF1->SetParNames("Sector");
474 TF1 *pF2=new TF1("f2",Gain,-70,70,1); pF2->SetParameters(2,1);pF2->SetParNames("Sector");
475 pF1->Draw();pF2->Draw("same");
c33c49f0 476
477 pC->cd(2);
478
479 const Int_t nPoints=8;
480 THStack *pStack=new THStack("stack","photons");
481 TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
482 TH1F *apH[nPoints];
483
484 Double_t starty=AliRICHParam::DeadZone()/2;
485 Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
486
487 for(int i=0;i<nPoints;i++){
86594bfc 488 apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apH[i]->SetLineColor(i);
c33c49f0 489 pStack->Add(apH[i]);
490 pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
abb44d7c 491 }
c33c49f0 492
493
86594bfc 494 TVector2 x2(0,0);
c33c49f0 495// AliRICHParam::ResetWireSag();
496 for(Int_t i=0;i<10000;i++){//events loop
497 for(int j=0;j<nPoints;j++){
86594bfc 498 x2.Set(0,starty-j*deltay);
499 apH[j]->Fill(AliRICHParam::TotQdc(x2,0));
c33c49f0 500 }
abb44d7c 501 }
c33c49f0 502 pStack->Draw("nostack");
503 pLeg->Draw();
504}//TestResponse()
abb44d7c 505//__________________________________________________________________________________________________
d32d34bf 506void TestSD()
abb44d7c 507{
d32d34bf 508 Info("TestSD","Creating test sdigits.");
86594bfc 509 TVector3 hit(426.55,246.28,17.21);
510 TVector2 x2=r->C(4)->Glob2Loc(hit);
511 Int_t iTotQdc=r->Param()->TotQdc(x2,624e-9);
512 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
513 Int_t padx,pady;
514 Int_t sec=r->Param()->Loc2Pad(x2,padx,pady);
515 r->Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
516 Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge",
517 hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc);
518
519 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
520 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
521 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++)
522 cout<<r->Param()->FracQdc(x2,iPadX,iPadY)<<endl;
523 Info("TestSD","Stop.");
543d5224 524}//void TestSdigits()
abb44d7c 525//__________________________________________________________________________________________________
c67b2d9f 526void TestC()
abb44d7c 527{
c67b2d9f 528 Info("TestC","Creating test clusters.");
543d5224 529 rl->MakeTree("R");r->MakeBranch("R");
530
c67b2d9f 531 AliRICHcluster c;
532 c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
533 c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
534 c.CoG();
535
536 r->AddCluster(c);
537
543d5224 538 rl->TreeR()->Fill();
539 rl->WriteRecPoints("OVERWRITE");
540 rl->UnloadRecPoints();
c67b2d9f 541 r->ResetClusters();
543d5224 542
c67b2d9f 543 Info("TestC","Stop.");
544}//TestC()
543d5224 545//__________________________________________________________________________________________________
546void TestSeg()
547{
548 AliRICHParam *p=r->Param();
86594bfc 549 Int_t padx,pady,sec;
d32d34bf 550 Double_t x,y;
86594bfc 551 Double_t eps=0.0000001;
552 Double_t x1=-0.5*p->PcSizeX()+eps; Double_t x2=-0.5*p->SectorSizeX()-p->DeadZone()-eps; Double_t x3=-0.5*p->SectorSizeX()+eps;
553 Double_t x6= 0.5*p->PcSizeX()-eps; Double_t x5= 0.5*p->SectorSizeX()+p->DeadZone()+eps; Double_t x4= 0.5*p->SectorSizeX()-eps;
554 Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
555 Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
556 TVector2 v2;
557
558 AliRICHParam::Print();
559
560 sec=p->Loc2Pad(TVector2(x= 0,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
561 sec=p->Loc2Pad(TVector2(x= 0,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
562 sec=p->Loc2Pad(TVector2(x= 0,y= 0),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" dead ","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
563 sec=p->Loc2Pad(TVector2(x= 0,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
564 sec=p->Loc2Pad(TVector2(x= 0,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
565
566 sec=p->Loc2Pad(TVector2(x=x1,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
567 sec=p->Loc2Pad(TVector2(x=x2,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
568 sec=p->Loc2Pad(TVector2(x=x3,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
569 sec=p->Loc2Pad(TVector2(x=x4,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
570 sec=p->Loc2Pad(TVector2(x=x5,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
571 sec=p->Loc2Pad(TVector2(x=x6,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
572
573 sec=p->Loc2Pad(TVector2(x=x1,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
574 sec=p->Loc2Pad(TVector2(x=x2,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
575 sec=p->Loc2Pad(TVector2(x=x3,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
576 sec=p->Loc2Pad(TVector2(x=x4,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
577 sec=p->Loc2Pad(TVector2(x=x5,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
578 sec=p->Loc2Pad(TVector2(x=x6,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
579
580 sec=p->Loc2Pad(TVector2(x=x1,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
581 sec=p->Loc2Pad(TVector2(x=x2,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
582 sec=p->Loc2Pad(TVector2(x=x3,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
583 sec=p->Loc2Pad(TVector2(x=x4,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
584 sec=p->Loc2Pad(TVector2(x=x5,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
585 sec=p->Loc2Pad(TVector2(x=x6,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
586
587 sec=p->Loc2Pad(TVector2(x=x1,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
588 sec=p->Loc2Pad(TVector2(x=x2,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
589 sec=p->Loc2Pad(TVector2(x=x3,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
590 sec=p->Loc2Pad(TVector2(x=x4,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
591 sec=p->Loc2Pad(TVector2(x=x5,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y());
592 sec=p->Loc2Pad(TVector2(x=x6,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y());
593
543d5224 594}//void TestSeg()
abb44d7c 595//__________________________________________________________________________________________________
543d5224 596void TestMenu()
abb44d7c 597{
543d5224 598 TControlBar *pMenu = new TControlBar("vertical","RICH test");
c67b2d9f 599 pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods");
c33c49f0 600 pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods");
d32d34bf 601 pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits");
c67b2d9f 602 pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters");
86594bfc 603 pMenu->AddButton("Test digits OLD", "TestDigitsOLD()", "Create test set of OLD digits");
543d5224 604 pMenu->Show();
605}//TestMenu()
606//__________________________________________________________________________________________________
543d5224 607void menu()
608{
609 TControlBar *pMenu = new TControlBar("vertical","RICH main");
610
d32d34bf 611 if(ReadAlice()){//it's from file, reconstruct
3b96aee8 612 pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert");
d32d34bf 613
86594bfc 614 pMenu->AddButton("hits->sdigits" ,"H_SD()" ,"AliRICH::Hits2SDigits");
615 pMenu->AddButton("sdigits->digits" ,"SD_D()" ,"AliRICHDigitizer");
616 pMenu->AddButton("digits->clusters" ,"D_C()" ,"AliRICHClusterFinder");
617 pMenu->AddButton("clusters->recos" ,"C_R()" ,"AliRICHRecon");
543d5224 618
86594bfc 619 pMenu->AddButton("Show", "Show()","Shows the structure of events in files");
620 pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
621 pMenu->AddButton("Control Plots", "ControlPlots()", "Display some control histograms");
d32d34bf 622 pMenu->AddButton("OLD specials->sdigits", "OLD_S_SD()", "Perform first phase converstion");
543d5224 623
624 }else{//it's aliroot, simulate
625 pMenu->AddButton("Run", "a->Run(1)", "Process!");
86594bfc 626 pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
543d5224 627 }
543d5224 628 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
629 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
3b96aee8 630 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
631 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
543d5224 632 pMenu->AddButton("Quit", ".q", "Close session");
633 pMenu->Show();
634 a=gAlice;//for manual manipulation convinience
635}//menu()
636//__________________________________________________________________________________________________
3b96aee8 637void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);}
638void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);}