]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/menu.C
Macro to plot pathlengths of back-to-back jets. (A. Dainese)
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
7185d942 1AliRICH * Rich() {return r;}
ed3ceb24 2
3Int_t countContrib[7][3];
4
3b96aee8 5void ControlPlots()
6{
7 Int_t iChamber=1;
8
ed3ceb24 9 TFile *pFile = new TFile("$(HOME)/plots.root","RECREATE");
7185d942 10 Bool_t isDig =!Rich()->GetLoader()->LoadDigits();
11 Bool_t isClus=!Rich()->GetLoader()->LoadRecPoints();
12 TH1F *pHxD,*pHyD,*pCqH1,*pCsH1,pCqMipH1,*pCsMipH1,*pCqCerH1,*pCsCerH1,*pCqFeeH1,*pCsFeeH1;
13 TH2F *pCmH2,*pCmMipH2,*pCmCerH2,*pCmFeeH2;
14 if(isDig){
15 pHxD=new TH1F("HitDigitDiffX","Hit-Digits diff X all chambers;diff [cm]",20,-2,2);
16 pHyD=new TH1F("HitDigitDiffY","Hit-Digits diff Y all chambers;diff [cm]",20,-2,2);
17 }//isDig
18
19 if(isClus){
20 pCqH1=new TH1F("ClusQ", "Cluster Charge all chambers;q [QDC]",Rich()->P()->MaxQdc(),0,Rich()->P()->MaxQdc());
21 pCsH1=new TH1F("ClusSize","Cluster size all chambers;size [number of pads in cluster]",100,0,100);
22 pCmH2=new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,-Rich()->P()->PcSizeX()/2,Rich()->P()->PcSizeX()/2,
23 1000,-Rich()->P()->PcSizeY()/2,Rich()->P()->PcSizeY()/2);
24
25 pCqMipH1=new TH1F("MipClusQ", "MIP Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
26 pCsMipH1=new TH1F("MipClusSize","MIP Cluster size all chambers;size [number of pads in cluster]",100,0,100);
27 pCmMipH2=new TH2F("MipClusMap", "MIP Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
28 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
29
30 pCqCerH1=new TH1F("CerClusQ", "Cerenkov Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
31 pCsCerH1=new TH1F("CerClusSize","Cernekov Cluster size all chambers;size [number of pads in cluster]",100,0,100);
32 pCmCerH2=new TH2F("CerClusMap", "Cerenkov Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
33 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
34
35 pCqFeeH1=new TH1F("FeeClusQ", "Feedback Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc());
36 pCsFeeH1=new TH1F("FeeClusSize","Feedback Cluster size all chambers;size [number of pads in cluster]",100,0,100);
37 pCmFeeH2=new TH2F("FeeClusMap", "Feedback Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2,
38 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2);
39 }//isClus
40
41 for(Int_t iEvtN=0;iEvtN<a->GetEventsPerRun();iEvtN++){//events loop
42 al->GetEvent(iEvtN);
43 for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop
44 if(isClus){
45 Rich()->GetLoader()->TreeR()->GetEntry(0);
46 for(Int_t iClusN=0;iClusN<r->Clusters(iChamN)->GetEntries();iClusN++){//clusters loop
47 AliRICHcluster *pClus=(AliRICHcluster*)r->Clusters(iChamN)->At(iClusN);
48 countContrib[i-1][0] += pClus->Nmips();countContrib[i-1][1] += pClus->Ncerenkovs();countContrib[i-1][2] += pClus->Nfeedbacks();
49 pCqH1->Fill(pClus->Q()); pCsH1->Fill(pClus->Size()); pCmH2->Fill(pClus->X(),pClus->Y()); //common
50 if(pClus->IsPureMip()) {pCqMipH1->Fill(pClus->Q());pCsMipH1->Fill(pClus->Size());pCmMipH2->Fill(pClus->X(),pClus->Y());}//Pure Mips
51 if(pClus->IsPureCerenkov()){pCqCerH1->Fill(pClus->Q());pCsCerH1->Fill(pClus->Size());pCmCerH2->Fill(pClus->X(),pClus->Y());}//Pure Photons
52 if(pClus->IsPureFeedback()){pCqFeeH1->Fill(pClus->Q());pCsFeeH1->Fill(pClus->Size());pCmFeeH2->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks
ed3ceb24 53 }//clusters loop
7185d942 54 }//isClus
55 if(isDig){
56 Rich()->GetLoader()->TreeD()->GetEntry(0);
57 for(Int_t iDigN=0;iDigN<r->Digits(iChamN)->GetEntries();iDigN++){//digits loop
58 AliRICHdigit *pDig=(AliRICHdigit*)r->Digits(iChamN)->At(iDigN);
59 AliRICHhit *pHit=hit(pDig->Tid(0));
60 cout<<"chamber "<<iChamN<<" digit "<<iDigN<<endl;
61 TVector2 hitV2=Rich()->C(iChamN)->Glob2Loc(pHit->OutX3()); TVector2 digV2=Rich()->P()->Pad2Loc(pDig->X(),pDig->Y());
62 pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y());
63 }//digits loop
64 }//isDig
65 }//chambers loop
66 Info("ControlPlots","Event %i processed.",iEvtN);
3b96aee8 67 }//events loop
ed3ceb24 68
7185d942 69 if(isDig) Rich()->GetLoader()->UnloadDigits();
70 if(isClus) Rich()->GetLoader()->UnloadRecPoints();
71
72 pHxD->Draw(); pHyD->SetLineColor(kRed);pHyD->Draw("same");
73
74 pFile->Write(); delete pFile;
75 for(Int_t i=0;i<7;i++) cout<<" chamber "<<i+1<<" n. mips "<<countContrib[i][0]<<" n. ckovs "<<countContrib[i][1]<<" n. fdbks "<<countContrib[i][2]<<endl;
3b96aee8 76}//void ControlPlots()
77//__________________________________________________________________________________________________
c67b2d9f 78void MainTrank()
79{
80 TStopwatch sw;TDatime time;
86594bfc 81 H_SD(); SD_D(); AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();//delete z;
c67b2d9f 82 cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
ed3ceb24 83 cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print();
84 cout<<"Info in <MainTrank>: Time used: ";sw.Print();
c67b2d9f 85}
3b96aee8 86//__________________________________________________________________________________________________
87void sh()
88{
7185d942 89 Rich()->GetLoader()->LoadHits();
3b96aee8 90
91 Int_t iTotalHits=0;
92 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
7185d942 93 Rich()->GetLoader()->TreeH()->GetEntry(iPrimN);
94 Rich()->Hits()->Print();
3b96aee8 95 iTotalHits+=r->Hits()->GetEntries();
96 }
97 Info("sh","totally %i hits",iTotalHits);
7185d942 98 Rich()->GetLoader()->UnloadHits();
99}
100//__________________________________________________________________________________________________
101AliRICHhit* hit(Int_t tid)
102{//print hits for given tid
103 Rich()->GetLoader()->LoadHits();
104 for(Int_t iPrimN=0;iPrimN<Rich()->GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
105 Rich()->GetLoader()->TreeH()->GetEntry(iPrimN);
106 for(Int_t iHitN=0;iHitN<Rich()->Hits()->GetEntries();iHitN++){
107 AliRICHhit *pHit=(AliRICHhit*)Rich()->Hits()->At(iHitN);
108 if(tid==pHit->Track()) {Rich()->GetLoader()->UnloadHits();return pHit;}
109 }//hits
110 }//prims loop
111 Rich()->GetLoader()->UnloadHits();
3b96aee8 112}
113//__________________________________________________________________________________________________
d32d34bf 114void ss()
115{
c1863e3c 116 if(rl->LoadSDigits()) return;
d32d34bf 117 rl->TreeS()->GetEntry(0);
118 r->SDigits()->Print();
3b96aee8 119 Info("ss","totally %i sdigits",r->SDigits()->GetEntries());
d32d34bf 120 rl->UnloadSDigits();
121}
3b96aee8 122//__________________________________________________________________________________________________
c1863e3c 123void sd()
124{
125 if(rl->LoadDigits()) return;
126 rl->TreeD()->GetEntry(0);
3b96aee8 127 Int_t iTotalDigits=0;
128 for(int i=1;i<=7;i++){
129 r->Digits(i)->Print();
130 iTotalDigits+=r->Digits(i)->GetEntries();
131 }
132 Info("sd","totally %i digits",iTotalDigits);
c1863e3c 133 rl->UnloadDigits();
134}
09c52ebc 135//__________________________________________________________________________________________________
c1863e3c 136void sc()
137{
138 if(rl->LoadRecPoints()) return;
c67b2d9f 139 r->SetTreeAddress();
c1863e3c 140 rl->TreeR()->GetEntry(0);
141 for(int i=1;i<=7;i++) r->Clusters(i)->Print();
142 rl->UnloadRecPoints();
143}
09c52ebc 144//__________________________________________________________________________________________________
145void sp(int tid)
146{
7185d942 147 Rich()->GetLoader()->GetRunLoader()->LoadHeader(); Rich()->GetLoader()->GetRunLoader()->LoadKinematics();
148
149 if(tid<0||tid>=Rich()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
150 cout<<"Valid tid number is 0-"<<Rich()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
151 else
152 PrintParticleInfo(tid);
153
154 Rich()->GetLoader()->GetRunLoader()->UnloadKinematics(); Rich()->GetLoader()->GetRunLoader()->UnloadHeader();
09c52ebc 155}
156//__________________________________________________________________________________________________
157void PrintParticleInfo(int tid)
158{
159 TParticle *p=al->Stack()->Particle(tid);
7185d942 160 cout<<p->GetName()<<"("<<tid<<")";
09c52ebc 161 if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
162 else {cout<<endl;}
163}
164//__________________________________________________________________________________________________
7185d942 165Int_t prim(Int_t tid)
166{
167 Rich()->GetLoader()->GetRunLoader()->LoadHeader(); Rich()->GetLoader()->GetRunLoader()->LoadKinematics();
168
169 if(tid<0||tid>=Rich()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
170 cout<<"Valid tid number is 0-"<<Rich()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
171 else
172 while(1){
173 TParticle *p=Rich()->GetLoader()->GetRunLoader()->GetAliRun()->Stack()->Particle(tid);
174 if(p->GetMother(0)==-1) break;
175 tid=p->GetMother(0);
176 }
177
178 Rich()->GetLoader()->GetRunLoader()->UnloadKinematics(); Rich()->GetLoader()->GetRunLoader()->UnloadHeader();
179 return tid;
180}
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//__________________________________________________________________________________________________
543d5224 214
d32d34bf 215void SD_D()
543d5224 216{
d32d34bf 217 Info("SD_D","Start.");
ed3ceb24 218 extern Int_t kBad;
09c52ebc 219 Rich()->Param()->GenSigmaThMap();
543d5224 220 rl->LoadSDigits();
221
222 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
a239137a 223 al->GetEvent(iEventN); cout<<"Event "<<iEventN<<endl;
09c52ebc 224 rl->MakeTree("D"); Rich()->MakeBranch("D"); //create TreeD with RICH branches
225 Rich()->ResetSDigits(); Rich()->ResetDigits(); //reset lists of sdigits and digits
226 rl->TreeS()->GetEntry(0); //get sdigits to memory container
227 Rich()->SDigits()->Sort();
ed3ceb24 228
09c52ebc 229 Int_t combiPid=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
ed3ceb24 230 Int_t iNdigitsPerPad;//how many sdigits for a given pad
231 const int kBad=-101;//??? to be removed in code
09c52ebc 232 for(Int_t i=0;i<Rich()->SDigits()->GetEntries();i++){//sdigits loop (sorted)
233 AliRICHdigit *pSdig=(AliRICHdigit*)Rich()->SDigits()->At(i);
543d5224 234 if(pSdig->Id()==id){//still the same pad
09c52ebc 235 iNdigitsPerPad++; q+=pSdig->Q(); combiPid+=pSdig->CombiPid();
543d5224 236 if(iNdigitsPerPad<=3)
ed3ceb24 237 tid[iNdigitsPerPad-1]=pSdig->Tid(0);
3582c1f9 238 else
239 Warning("SDigits2Digits","More then 3 sdigits for the given pad");
543d5224 240 }else{//new pad, add the pevious one
09c52ebc 241 if(id!=kBad&&Rich()->Param()->IsOverTh(chamber,x,y,q)) {
242 Rich()->AddDigit(chamber,x,y,q,combiPid,tid);
af3d25a6 243 }
ed3ceb24 244 combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id();
245 x=pSdig->X();y=pSdig->Y();
246 q=pSdig->Q();
247 tid[0]=pSdig->Tid(0);
248 iNdigitsPerPad=1;tid[1]=tid[2]=kBad;
543d5224 249 }
250 }//sdigits loop (sorted)
251
09c52ebc 252 if(Rich()->SDigits()->GetEntries() && Rich()->Param()->IsOverTh(chamber,x,y,q))
253 Rich()->AddDigit(chamber,x,y,q,combiPid,tid);//add the last digit
543d5224 254
255 rl->TreeD()->Fill();
256 rl->WriteDigits("OVERWRITE");
257 }//events loop
258 rl->UnloadSDigits(); rl->UnloadDigits();
09c52ebc 259 Rich()->ResetSDigits(); Rich()->ResetDigits();//reset lists of sdigits and digits
d32d34bf 260 Info("SD_D","Stop.");
3b96aee8 261}//SD_D()
08479a10 262//__________________________________________________________________________________________________
3b96aee8 263void Show()
d48cca74 264{
abb44d7c 265 cout<<endl;
c60862bf 266 al->LoadHeader(); al->LoadKinematics();
abb44d7c 267
aed240d4 268 rl->LoadHits();
269 Bool_t isSdigits=!rl->LoadSDigits();
270 Bool_t isClusters=!rl->LoadRecPoints();
271 Bool_t isDigits=!rl->LoadDigits();//loaders
c60862bf 272
273 cout<<endl; cout<<endl;
274 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
275 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 276 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 277
84365c70 278 Int_t iTotalHits=0;
abb44d7c 279 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 280 rl->TreeH()->GetEntry(iPrimN);
281 iTotalHits+=r->Hits()->GetEntries();
abb44d7c 282 TParticle *pPrim=al->Stack()->Particle(iPrimN);
7185d942 283 if(iPrimN<10) Info("Show","Evt %4i prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
09c52ebc 284 iEventN,iPrimN, r->Hits()->GetEntries(), pPrim->GetName(), pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 285 }//prims loop
84365c70 286 Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits",
287 iEventN, iNparticles, iNprims, iTotalHits);
c60862bf 288 if(isSdigits){
289 rl->TreeS()->GetEntry(0);
d32d34bf 290 Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
abb44d7c 291 }
c60862bf 292 if(isDigits){
293 rl->TreeD()->GetEntry(0);
543d5224 294 for(int i=1;i<=7;i++)
aed240d4 295 Info("Show-DIGITS","Evt %i chamber %i contains %5i digits",
296 iEventN, i, r->Digits(i)->GetEntries());
09c52ebc 297 }else
298 Info("Show-DIGITS","There is no digits for this event");
aed240d4 299 if(isClusters){
300 rl->TreeR()->GetEntry(0);
301 for(int i=1;i<=7;i++)
302 Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters",
303 iEventN, i, r->Clusters(i)->GetEntries());
c60862bf 304 }
305 cout<<endl;
abb44d7c 306 }//events loop
aed240d4 307 rl->UnloadHits();
308 if(isSdigits) rl->UnloadSDigits();
309 if(isDigits) rl->UnloadDigits();
310 if(isClusters) rl->UnloadRecPoints();
abb44d7c 311 al->UnloadHeader();
312 al->UnloadKinematics();
313 cout<<endl;
d48cca74 314}//void Show()
aed240d4 315//__________________________________________________________________________________________________
abb44d7c 316
d48cca74 317
d48cca74 318AliRun *a;
853634d3 319AliRunLoader *al;
320AliLoader *rl,*tl,*il;
321
322AliRICH *r;
853634d3 323
d32d34bf 324Bool_t ReadAlice()
d48cca74 325{
d32d34bf 326 Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
abb44d7c 327 AliLoader::SetDebug(0);
328 if(gAlice) delete gAlice;
329 if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
330 gSystem->Exec("rm -rf *.root *.dat");
d32d34bf 331 Error("ReadAlice","galice.root broken, removing all this garbage then init new one");
332 new AliRun("gAlice","Alice experiment system");
333 gAlice->SetDebug(-1);
86594bfc 334 gAlice->Init("Config.C");
d32d34bf 335 r=(AliRICH*)gAlice->GetDetector("RICH");
336 return kFALSE;
abb44d7c 337 }
338 al->LoadgAlice();
339 if(!gAlice) Fatal("ReadAlice","No gAlice in file");
340 a=al->GetAliRun();
341 a->SetDebug(0);
342//RICH
343 if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
344 r->SetDebug(0);
345 if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
346
347 Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
d32d34bf 348 return kTRUE;
abb44d7c 349}
350//__________________________________________________________________________________________________
c33c49f0 351void TestResponse()
abb44d7c 352{
c33c49f0 353 TCanvas *pC=new TCanvas("c","Amplification test",900,800);
354 pC->Divide(1,2);
355 pC->cd(1);
86594bfc 356 TF1 *pF1=new TF1("f1",Gain,-70,70,1); pF1->SetParameters(1,1);pF1->SetParNames("Sector");
357 TF1 *pF2=new TF1("f2",Gain,-70,70,1); pF2->SetParameters(2,1);pF2->SetParNames("Sector");
358 pF1->Draw();pF2->Draw("same");
c33c49f0 359
360 pC->cd(2);
361
362 const Int_t nPoints=8;
363 THStack *pStack=new THStack("stack","photons");
364 TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
365 TH1F *apH[nPoints];
366
367 Double_t starty=AliRICHParam::DeadZone()/2;
368 Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
369
370 for(int i=0;i<nPoints;i++){
86594bfc 371 apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apH[i]->SetLineColor(i);
c33c49f0 372 pStack->Add(apH[i]);
373 pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
abb44d7c 374 }
c33c49f0 375
376
86594bfc 377 TVector2 x2(0,0);
c33c49f0 378// AliRICHParam::ResetWireSag();
379 for(Int_t i=0;i<10000;i++){//events loop
380 for(int j=0;j<nPoints;j++){
86594bfc 381 x2.Set(0,starty-j*deltay);
382 apH[j]->Fill(AliRICHParam::TotQdc(x2,0));
c33c49f0 383 }
abb44d7c 384 }
c33c49f0 385 pStack->Draw("nostack");
386 pLeg->Draw();
387}//TestResponse()
abb44d7c 388//__________________________________________________________________________________________________
d32d34bf 389void TestSD()
abb44d7c 390{
d32d34bf 391 Info("TestSD","Creating test sdigits.");
86594bfc 392 TVector3 hit(426.55,246.28,17.21);
393 TVector2 x2=r->C(4)->Glob2Loc(hit);
394 Int_t iTotQdc=r->Param()->TotQdc(x2,624e-9);
395 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
396 Int_t padx,pady;
397 Int_t sec=r->Param()->Loc2Pad(x2,padx,pady);
398 r->Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
399 Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge",
400 hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc);
401
402 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
403 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
404 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++)
405 cout<<r->Param()->FracQdc(x2,iPadX,iPadY)<<endl;
406 Info("TestSD","Stop.");
543d5224 407}//void TestSdigits()
abb44d7c 408//__________________________________________________________________________________________________
c67b2d9f 409void TestC()
abb44d7c 410{
c67b2d9f 411 Info("TestC","Creating test clusters.");
543d5224 412 rl->MakeTree("R");r->MakeBranch("R");
413
c67b2d9f 414 AliRICHcluster c;
415 c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
416 c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
417 c.CoG();
418
419 r->AddCluster(c);
420
543d5224 421 rl->TreeR()->Fill();
422 rl->WriteRecPoints("OVERWRITE");
423 rl->UnloadRecPoints();
c67b2d9f 424 r->ResetClusters();
543d5224 425
c67b2d9f 426 Info("TestC","Stop.");
427}//TestC()
543d5224 428//__________________________________________________________________________________________________
429void TestSeg()
430{
431 AliRICHParam *p=r->Param();
86594bfc 432 Int_t padx,pady,sec;
d32d34bf 433 Double_t x,y;
86594bfc 434 Double_t eps=0.0000001;
435 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;
436 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;
437 Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
438 Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
439 TVector2 v2;
440
441 AliRICHParam::Print();
442
443 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());
444 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());
445 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());
446 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());
447 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());
448
449 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());
450 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());
451 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());
452 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());
453 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());
454 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());
455
456 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());
457 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());
458 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());
459 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());
460 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());
461 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());
462
463 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());
464 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());
465 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());
466 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());
467 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());
468 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());
469
470 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());
471 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());
472 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());
473 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());
474 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());
475 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());
476
543d5224 477}//void TestSeg()
abb44d7c 478//__________________________________________________________________________________________________
543d5224 479void TestMenu()
abb44d7c 480{
543d5224 481 TControlBar *pMenu = new TControlBar("vertical","RICH test");
c67b2d9f 482 pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods");
c33c49f0 483 pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods");
d32d34bf 484 pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits");
c67b2d9f 485 pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters");
86594bfc 486 pMenu->AddButton("Test digits OLD", "TestDigitsOLD()", "Create test set of OLD digits");
543d5224 487 pMenu->Show();
488}//TestMenu()
489//__________________________________________________________________________________________________
543d5224 490void menu()
491{
492 TControlBar *pMenu = new TControlBar("vertical","RICH main");
493
d32d34bf 494 if(ReadAlice()){//it's from file, reconstruct
3b96aee8 495 pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert");
d32d34bf 496
86594bfc 497 pMenu->AddButton("sdigits->digits" ,"SD_D()" ,"AliRICHDigitizer");
498 pMenu->AddButton("digits->clusters" ,"D_C()" ,"AliRICHClusterFinder");
499 pMenu->AddButton("clusters->recos" ,"C_R()" ,"AliRICHRecon");
543d5224 500
86594bfc 501 pMenu->AddButton("Show", "Show()","Shows the structure of events in files");
502 pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
503 pMenu->AddButton("Control Plots", "ControlPlots()", "Display some control histograms");
d32d34bf 504 pMenu->AddButton("OLD specials->sdigits", "OLD_S_SD()", "Perform first phase converstion");
543d5224 505
506 }else{//it's aliroot, simulate
507 pMenu->AddButton("Run", "a->Run(1)", "Process!");
86594bfc 508 pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
543d5224 509 }
543d5224 510 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
511 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
3b96aee8 512 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
513 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
543d5224 514 pMenu->AddButton("Quit", ".q", "Close session");
515 pMenu->Show();
516 a=gAlice;//for manual manipulation convinience
517}//menu()
518//__________________________________________________________________________________________________
3b96aee8 519void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);}
520void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);}