]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/menu.C
too many changes to list it here, while not very important
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
4fddd5b8 1AliRICH * R() {return r;}
ed3ceb24 2
3b96aee8 3void ControlPlots()
4{
4fddd5b8 5 TH1F *pHxD,*pHyD,*pCqH1,*pCsH1,*pCqMipH1,*pCsMipH1,*pCqCerH1,*pCsCerH1,*pCqFeeH1,*pCsFeeH1,*pNumClusH1;
7185d942 6 TH2F *pCmH2,*pCmMipH2,*pCmCerH2,*pCmFeeH2;
4fddd5b8 7
8 Bool_t isDig =!R()->GetLoader()->LoadDigits();
9 Bool_t isClus=!R()->GetLoader()->LoadRecPoints();
10
11 if(!isDig && !isClus){ Info("ControlPlots","No digits and clusters! Nothing to do.");return;}
12
13 TFile *pFile = new TFile("$(HOME)/ControlPlots.root","RECREATE");
14
7185d942 15 if(isDig){
4fddd5b8 16 cout<<"Digits available\n";
17 pHxD=new TH1F("HitDigitDiffX","Hit-Digits diff X all chambers;diff [cm]",100,-10,10);
18 pHyD=new TH1F("HitDigitDiffY","Hit-Digits diff Y all chambers;diff [cm]",100,-10,10);
7185d942 19 }//isDig
20
4fddd5b8 21 if(isClus){
22 cout<<"Clusters available\n";
23 pNumClusH1=new TH1F("NumClusPerEvent","Number of clusters per event;number",50,0,49);
24 pCqH1=new TH1F("ClusQ", "Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
7185d942 25 pCsH1=new TH1F("ClusSize","Cluster size all chambers;size [number of pads in cluster]",100,0,100);
4fddd5b8 26 pCmH2=new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
27 1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
7185d942 28
4fddd5b8 29 pCqMipH1=new TH1F("MipClusQ", "MIP Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
7185d942 30 pCsMipH1=new TH1F("MipClusSize","MIP Cluster size all chambers;size [number of pads in cluster]",100,0,100);
4fddd5b8 31 pCmMipH2=new TH2F("MipClusMap", "MIP Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
32 1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
7185d942 33
4fddd5b8 34 pCqCerH1=new TH1F("CerClusQ", "Cerenkov Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
7185d942 35 pCsCerH1=new TH1F("CerClusSize","Cernekov Cluster size all chambers;size [number of pads in cluster]",100,0,100);
4fddd5b8 36 pCmCerH2=new TH2F("CerClusMap", "Cerenkov Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
37 1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
7185d942 38
4fddd5b8 39 pCqFeeH1=new TH1F("FeeClusQ", "Feedback Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
7185d942 40 pCsFeeH1=new TH1F("FeeClusSize","Feedback Cluster size all chambers;size [number of pads in cluster]",100,0,100);
4fddd5b8 41 pCmFeeH2=new TH2F("FeeClusMap", "Feedback Cluster map;x [cm];y [cm]",1000,-R()->P()->PcSizeX()/2,R()->P()->PcSizeX()/2,
42 1000,-R()->P()->PcSizeY()/2,R()->P()->PcSizeY()/2);
7185d942 43 }//isClus
44
4fddd5b8 45 for(Int_t iEvtN=0;iEvtN<R()->GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEvtN++){//events loop
46 R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
47 if(isClus) R()->GetLoader()->TreeR()->GetEntry(0);
48 if(isDig) R()->GetLoader()->TreeD()->GetEntry(0);
49
7185d942 50 for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop
51 if(isClus){
4fddd5b8 52 Int_t iNclusCham=R()->Clusters(iChamN)->GetEntries();
53 if(iNclusCham) pNumClusH1->Fill(iNclusCham);//fill total number of clusters for a given event
54 for(Int_t iClusN=0;iClusN<iNclusCham;iClusN++){//clusters loop
55 AliRICHcluster *pClus=(AliRICHcluster*)R()->Clusters(iChamN)->At(iClusN);
7185d942 56 pCqH1->Fill(pClus->Q()); pCsH1->Fill(pClus->Size()); pCmH2->Fill(pClus->X(),pClus->Y()); //common
4fddd5b8 57 if(pClus->IsPureMip()) {pCqMipH1->Fill(pClus->Q());pCsMipH1->Fill(pClus->Size());pCmMipH2->Fill(pClus->X(),pClus->Y());}//Pure Mips
58 if(pClus->IsPureCerenkov()){pCqCerH1->Fill(pClus->Q());pCsCerH1->Fill(pClus->Size());pCmCerH2->Fill(pClus->X(),pClus->Y());}//Pure Photons
59 if(pClus->IsPureFeedback()){pCqFeeH1->Fill(pClus->Q());pCsFeeH1->Fill(pClus->Size());pCmFeeH2->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks
ed3ceb24 60 }//clusters loop
7185d942 61 }//isClus
62 if(isDig){
7185d942 63 for(Int_t iDigN=0;iDigN<r->Digits(iChamN)->GetEntries();iDigN++){//digits loop
64 AliRICHdigit *pDig=(AliRICHdigit*)r->Digits(iChamN)->At(iDigN);
65 AliRICHhit *pHit=hit(pDig->Tid(0));
4fddd5b8 66 TVector2 hitV2=R()->C(iChamN)->Glob2Loc(pHit->OutX3()); TVector2 digV2=R()->P()->Pad2Loc(pDig->X(),pDig->Y());
7185d942 67 pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y());
68 }//digits loop
69 }//isDig
70 }//chambers loop
71 Info("ControlPlots","Event %i processed.",iEvtN);
3b96aee8 72 }//events loop
ed3ceb24 73
4fddd5b8 74 if(isDig) R()->GetLoader()->UnloadDigits();
75 if(isClus) R()->GetLoader()->UnloadRecPoints();
7185d942 76
4fddd5b8 77 pFile->Write(); delete pFile;
3b96aee8 78}//void ControlPlots()
79//__________________________________________________________________________________________________
c67b2d9f 80void MainTrank()
81{
82 TStopwatch sw;TDatime time;
86594bfc 83 H_SD(); SD_D(); AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();//delete z;
c67b2d9f 84 cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
ed3ceb24 85 cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print();
86 cout<<"Info in <MainTrank>: Time used: ";sw.Print();
c67b2d9f 87}
3b96aee8 88//__________________________________________________________________________________________________
89void sh()
4fddd5b8 90{//prints list of hits for a given event
91 R()->GetLoader()->LoadHits();
3b96aee8 92
93 Int_t iTotalHits=0;
94 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
4fddd5b8 95 R()->GetLoader()->TreeH()->GetEntry(iPrimN);
96 R()->Hits()->Print();
97 iTotalHits+=R()->Hits()->GetEntries();
3b96aee8 98 }
99 Info("sh","totally %i hits",iTotalHits);
4fddd5b8 100 R()->GetLoader()->UnloadHits();
7185d942 101}
102//__________________________________________________________________________________________________
103AliRICHhit* hit(Int_t tid)
104{//print hits for given tid
4fddd5b8 105 R()->GetLoader()->LoadHits();
106 for(Int_t iPrimN=0;iPrimN<R()->GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
107 R()->GetLoader()->TreeH()->GetEntry(iPrimN);
108 for(Int_t iHitN=0;iHitN<R()->Hits()->GetEntries();iHitN++){
109 AliRICHhit *pHit=(AliRICHhit*)R()->Hits()->At(iHitN);
110 if(tid==pHit->Track()) {R()->GetLoader()->UnloadHits();return pHit;}
7185d942 111 }//hits
112 }//prims loop
4fddd5b8 113 R()->GetLoader()->UnloadHits();
3b96aee8 114}
115//__________________________________________________________________________________________________
d32d34bf 116void ss()
117{
c1863e3c 118 if(rl->LoadSDigits()) return;
d32d34bf 119 rl->TreeS()->GetEntry(0);
120 r->SDigits()->Print();
3b96aee8 121 Info("ss","totally %i sdigits",r->SDigits()->GetEntries());
d32d34bf 122 rl->UnloadSDigits();
123}
3b96aee8 124//__________________________________________________________________________________________________
c1863e3c 125void sd()
126{
127 if(rl->LoadDigits()) return;
128 rl->TreeD()->GetEntry(0);
3b96aee8 129 Int_t iTotalDigits=0;
130 for(int i=1;i<=7;i++){
131 r->Digits(i)->Print();
132 iTotalDigits+=r->Digits(i)->GetEntries();
133 }
134 Info("sd","totally %i digits",iTotalDigits);
c1863e3c 135 rl->UnloadDigits();
136}
09c52ebc 137//__________________________________________________________________________________________________
4fddd5b8 138void sc(Int_t iEvtN=0)
c1863e3c 139{
4fddd5b8 140 Info("sc","List of clusters for event %i",iEvtN);
141 R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
142 if(R()->GetLoader()->LoadRecPoints()) return;
143// r->SetTreeAddress();
144 R()->GetLoader()->TreeR()->GetEntry(0);
145 Int_t iTotalClusters=0;
146 for(Int_t iChamber=1;iChamber<=7;iChamber++){
147 R()->Clusters(iChamber)->Print();
148 iTotalClusters+=R()->Clusters(iChamber)->GetEntries();
149 }
150 R()->GetLoader()->UnloadRecPoints();
151 Info("sc","totally %i clusters",iTotalClusters);
c1863e3c 152}
09c52ebc 153//__________________________________________________________________________________________________
154void sp(int tid)
155{
4fddd5b8 156 R()->GetLoader()->GetRunLoader()->LoadHeader(); R()->GetLoader()->GetRunLoader()->LoadKinematics();
7185d942 157
4fddd5b8 158 if(tid<0||tid>=R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
159 cout<<"Valid tid number is 0-"<<R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
7185d942 160 else
161 PrintParticleInfo(tid);
162
4fddd5b8 163 R()->GetLoader()->GetRunLoader()->UnloadKinematics(); R()->GetLoader()->GetRunLoader()->UnloadHeader();
09c52ebc 164}
165//__________________________________________________________________________________________________
166void PrintParticleInfo(int tid)
167{
168 TParticle *p=al->Stack()->Particle(tid);
7185d942 169 cout<<p->GetName()<<"("<<tid<<")";
09c52ebc 170 if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
171 else {cout<<endl;}
172}
173//__________________________________________________________________________________________________
7185d942 174Int_t prim(Int_t tid)
175{
4fddd5b8 176 R()->GetLoader()->GetRunLoader()->LoadHeader(); R()->GetLoader()->GetRunLoader()->LoadKinematics();
7185d942 177
4fddd5b8 178 if(tid<0||tid>=R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
179 cout<<"Valid tid number is 0-"<<R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
7185d942 180 else
181 while(1){
4fddd5b8 182 TParticle *p=R()->GetLoader()->GetRunLoader()->GetAliRun()->Stack()->Particle(tid);
7185d942 183 if(p->GetMother(0)==-1) break;
184 tid=p->GetMother(0);
185 }
186
4fddd5b8 187 R()->GetLoader()->GetRunLoader()->UnloadKinematics(); R()->GetLoader()->GetRunLoader()->UnloadHeader();
7185d942 188 return tid;
189}
4fddd5b8 190
191
7185d942 192//__________________________________________________________________________________________________
8fc0dab8 193
194Double_t r2d = TMath::RadToDeg();
195Double_t d2r = TMath::DegToRad();
196
ed3ceb24 197void DisplFast(){ AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();}
fa49f877 198
199
af3d25a6 200void C_R()
c60862bf 201{
5cb4dfc3 202 AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
543d5224 203
204
8fc0dab8 205 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
543d5224 206 al->GetEvent(nev);
207 cout <<endl<< "Processing event:" <<nev<<endl;
5cb4dfc3 208 detect->StartProcessEvent();
543d5224 209 } // event loop
fa49f877 210 delete detect;
543d5224 211}
0f72f306 212//__________________________________________________________________________________________________
213void D_C()
214{
215 TStopwatch sw;TDatime time;
543d5224 216
0f72f306 217 AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();
543d5224 218
0f72f306 219 cout << endl;
220 cout << "Info in Digits->Clusters: Start time: ";time.Print();
221 cout << "Info in Digits->Clusters: Stop time: ";time.Set(); time.Print();
222 cout << "Info in Digits->Clusters: Time used: ";sw.Print();
223}
d32d34bf 224//__________________________________________________________________________________________________
543d5224 225
d32d34bf 226void SD_D()
543d5224 227{
d32d34bf 228 Info("SD_D","Start.");
ed3ceb24 229 extern Int_t kBad;
4fddd5b8 230 R()->P()->GenSigmaThMap();
543d5224 231 rl->LoadSDigits();
232
233 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
a239137a 234 al->GetEvent(iEventN); cout<<"Event "<<iEventN<<endl;
4fddd5b8 235 rl->MakeTree("D"); R()->MakeBranch("D"); //create TreeD with RICH branches
236 R()->ResetSDigits(); R()->ResetDigits(); //reset lists of sdigits and digits
09c52ebc 237 rl->TreeS()->GetEntry(0); //get sdigits to memory container
4fddd5b8 238 R()->SDigits()->Sort();
ed3ceb24 239
09c52ebc 240 Int_t combiPid=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
ed3ceb24 241 Int_t iNdigitsPerPad;//how many sdigits for a given pad
242 const int kBad=-101;//??? to be removed in code
4fddd5b8 243 for(Int_t i=0;i<R()->SDigits()->GetEntries();i++){//sdigits loop (sorted)
244 AliRICHdigit *pSdig=(AliRICHdigit*)R()->SDigits()->At(i);
543d5224 245 if(pSdig->Id()==id){//still the same pad
09c52ebc 246 iNdigitsPerPad++; q+=pSdig->Q(); combiPid+=pSdig->CombiPid();
543d5224 247 if(iNdigitsPerPad<=3)
ed3ceb24 248 tid[iNdigitsPerPad-1]=pSdig->Tid(0);
3582c1f9 249 else
250 Warning("SDigits2Digits","More then 3 sdigits for the given pad");
543d5224 251 }else{//new pad, add the pevious one
4fddd5b8 252 if(id!=kBad&&R()->P()->IsOverTh(chamber,x,y,q)) {
253 R()->AddDigit(chamber,x,y,q,combiPid,tid);
af3d25a6 254 }
ed3ceb24 255 combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id();
256 x=pSdig->X();y=pSdig->Y();
257 q=pSdig->Q();
258 tid[0]=pSdig->Tid(0);
259 iNdigitsPerPad=1;tid[1]=tid[2]=kBad;
543d5224 260 }
261 }//sdigits loop (sorted)
262
4fddd5b8 263 if(R()->SDigits()->GetEntries() && R()->P()->IsOverTh(chamber,x,y,q))
264 R()->AddDigit(chamber,x,y,q,combiPid,tid);//add the last digit
543d5224 265
266 rl->TreeD()->Fill();
267 rl->WriteDigits("OVERWRITE");
268 }//events loop
269 rl->UnloadSDigits(); rl->UnloadDigits();
4fddd5b8 270 R()->ResetSDigits(); R()->ResetDigits();//reset lists of sdigits and digits
d32d34bf 271 Info("SD_D","Stop.");
3b96aee8 272}//SD_D()
08479a10 273//__________________________________________________________________________________________________
3b96aee8 274void Show()
d48cca74 275{
abb44d7c 276 cout<<endl;
c60862bf 277 al->LoadHeader(); al->LoadKinematics();
abb44d7c 278
aed240d4 279 rl->LoadHits();
280 Bool_t isSdigits=!rl->LoadSDigits();
281 Bool_t isClusters=!rl->LoadRecPoints();
282 Bool_t isDigits=!rl->LoadDigits();//loaders
c60862bf 283
284 cout<<endl; cout<<endl;
285 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
286 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 287 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 288
84365c70 289 Int_t iTotalHits=0;
abb44d7c 290 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 291 rl->TreeH()->GetEntry(iPrimN);
292 iTotalHits+=r->Hits()->GetEntries();
abb44d7c 293 TParticle *pPrim=al->Stack()->Particle(iPrimN);
7185d942 294 if(iPrimN<10) Info("Show","Evt %4i prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
09c52ebc 295 iEventN,iPrimN, r->Hits()->GetEntries(), pPrim->GetName(), pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 296 }//prims loop
4fddd5b8 297 Info("Show-HIT","Evt %i total: %i particles %i primaries %i hits",
84365c70 298 iEventN, iNparticles, iNprims, iTotalHits);
c60862bf 299 if(isSdigits){
300 rl->TreeS()->GetEntry(0);
4fddd5b8 301 Info("Show-SDI","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
abb44d7c 302 }
c60862bf 303 if(isDigits){
304 rl->TreeD()->GetEntry(0);
543d5224 305 for(int i=1;i<=7;i++)
4fddd5b8 306 Info("Show-DIG","Evt %i chamber %i contains %5i digits",
aed240d4 307 iEventN, i, r->Digits(i)->GetEntries());
09c52ebc 308 }else
4fddd5b8 309 Info("Show-DIG","There is no digits for this event");
aed240d4 310 if(isClusters){
311 rl->TreeR()->GetEntry(0);
312 for(int i=1;i<=7;i++)
4fddd5b8 313 Info("Show-CLU","Evt %i chamber %i contains %5i clusters",
aed240d4 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);
86594bfc 345 gAlice->Init("Config.C");
d32d34bf 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//__________________________________________________________________________________________________
c33c49f0 362void TestResponse()
abb44d7c 363{
c33c49f0 364 TCanvas *pC=new TCanvas("c","Amplification test",900,800);
365 pC->Divide(1,2);
366 pC->cd(1);
86594bfc 367 TF1 *pF1=new TF1("f1",Gain,-70,70,1); pF1->SetParameters(1,1);pF1->SetParNames("Sector");
368 TF1 *pF2=new TF1("f2",Gain,-70,70,1); pF2->SetParameters(2,1);pF2->SetParNames("Sector");
369 pF1->Draw();pF2->Draw("same");
c33c49f0 370
371 pC->cd(2);
372
373 const Int_t nPoints=8;
374 THStack *pStack=new THStack("stack","photons");
375 TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
376 TH1F *apH[nPoints];
377
378 Double_t starty=AliRICHParam::DeadZone()/2;
379 Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
380
381 for(int i=0;i<nPoints;i++){
86594bfc 382 apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apH[i]->SetLineColor(i);
c33c49f0 383 pStack->Add(apH[i]);
384 pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
abb44d7c 385 }
c33c49f0 386
387
86594bfc 388 TVector2 x2(0,0);
c33c49f0 389// AliRICHParam::ResetWireSag();
390 for(Int_t i=0;i<10000;i++){//events loop
391 for(int j=0;j<nPoints;j++){
86594bfc 392 x2.Set(0,starty-j*deltay);
393 apH[j]->Fill(AliRICHParam::TotQdc(x2,0));
c33c49f0 394 }
abb44d7c 395 }
c33c49f0 396 pStack->Draw("nostack");
397 pLeg->Draw();
398}//TestResponse()
abb44d7c 399//__________________________________________________________________________________________________
d32d34bf 400void TestSD()
abb44d7c 401{
d32d34bf 402 Info("TestSD","Creating test sdigits.");
86594bfc 403 TVector3 hit(426.55,246.28,17.21);
404 TVector2 x2=r->C(4)->Glob2Loc(hit);
4fddd5b8 405 Int_t iTotQdc=r->P()->TotQdc(x2,624e-9);
86594bfc 406 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
407 Int_t padx,pady;
4fddd5b8 408 Int_t sec=r->P()->Loc2Pad(x2,padx,pady);
409 r->P()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
86594bfc 410 Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge",
411 hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc);
412
413 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
414 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
415 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++)
4fddd5b8 416 cout<<r->P()->FracQdc(x2,iPadX,iPadY)<<endl;
86594bfc 417 Info("TestSD","Stop.");
543d5224 418}//void TestSdigits()
abb44d7c 419//__________________________________________________________________________________________________
c67b2d9f 420void TestC()
abb44d7c 421{
c67b2d9f 422 Info("TestC","Creating test clusters.");
543d5224 423 rl->MakeTree("R");r->MakeBranch("R");
424
c67b2d9f 425 AliRICHcluster c;
426 c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
427 c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
428 c.CoG();
429
430 r->AddCluster(c);
431
543d5224 432 rl->TreeR()->Fill();
433 rl->WriteRecPoints("OVERWRITE");
434 rl->UnloadRecPoints();
c67b2d9f 435 r->ResetClusters();
543d5224 436
c67b2d9f 437 Info("TestC","Stop.");
438}//TestC()
543d5224 439//__________________________________________________________________________________________________
440void TestSeg()
441{
4fddd5b8 442 AliRICHParam *p=R()->P();
86594bfc 443 Int_t padx,pady,sec;
d32d34bf 444 Double_t x,y;
86594bfc 445 Double_t eps=0.0000001;
446 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;
447 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;
448 Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
449 Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
450 TVector2 v2;
451
452 AliRICHParam::Print();
453
454 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());
455 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());
456 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());
457 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());
458 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());
459
460 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());
461 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());
462 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());
463 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());
464 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());
465 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());
466
467 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());
468 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());
469 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());
470 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());
471 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());
472 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());
473
474 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());
475 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());
476 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());
477 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());
478 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());
479 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());
480
481 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());
482 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());
483 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());
484 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());
485 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());
486 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());
487
4fddd5b8 488 new TCanvas("name","title");
489 gPad->Range(-80,-80,80,80);
490 AliRICHDisplFast::DrawSectors();
491 AliRICHParam *p=new AliRICHParam;
492
493 Double_t eps=0.0001;
494 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;
495 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;
496 Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps;
497 Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps;
498
499 TLatex t; t.SetTextSize(0.02);
500
501 TVector2 v2;
502 v2=AliRICHParam::Pad2Loc( 1,140); t.DrawLatex(v2.X(),v2.Y(),"Sector 1");
503 v2=AliRICHParam::Pad2Loc(49,140); t.DrawLatex(v2.X(),v2.Y(),"Sector 2");
504 v2=AliRICHParam::Pad2Loc(97,140); t.DrawLatex(v2.X(),v2.Y(),"Sector 3");
505 v2=AliRICHParam::Pad2Loc( 1, 60); t.DrawLatex(v2.X(),v2.Y(),"Sector 4");
506 v2=AliRICHParam::Pad2Loc(49, 60); t.DrawLatex(v2.X(),v2.Y(),"Sector 5");
507 v2=AliRICHParam::Pad2Loc(97, 60); t.DrawLatex(v2.X(),v2.Y(),"Sector 6");
508
509 t.SetTextColor(kRed);
510 t.DrawLatex(-63.08,-70,"-63.08"); t.DrawLatex(-28.00,-70,"-22.76"); t.DrawLatex(-20.16,-70,"-20.16"); //x position
511 t.DrawLatex( 58.00,-70," 63.08"); t.DrawLatex( 22.76,-70," 22.76"); t.DrawLatex( 15.00,-70," 20.16");
512 t.DrawLatex(-70,-64,"-65.30"); t.DrawLatex(-70,-5,"-1.30"); //y position
513 t.DrawLatex(-70, 63," 65.30"); t.DrawLatex(-70, 2," 1.30");
514
515 t.SetTextColor(kBlue);
516 t.DrawLatex(-63.08,-75,"1"); t.DrawLatex(-25.00,-75,"48"); t.DrawLatex(-20.00,-75,"49"); //x pads
517 t.DrawLatex( 18.00,-75,"96"); t.DrawLatex( 23.00,-75,"97"); t.DrawLatex( 60.00,-75,"144");
518 t.DrawLatex(-75,-64,"1"); t.DrawLatex(-75,-5,"80"); //y pads
519 t.DrawLatex(-75, 63,"160"); t.DrawLatex(-75, 2,"81");
543d5224 520}//void TestSeg()
abb44d7c 521//__________________________________________________________________________________________________
543d5224 522void TestMenu()
abb44d7c 523{
543d5224 524 TControlBar *pMenu = new TControlBar("vertical","RICH test");
c67b2d9f 525 pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods");
c33c49f0 526 pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods");
d32d34bf 527 pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits");
c67b2d9f 528 pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters");
86594bfc 529 pMenu->AddButton("Test digits OLD", "TestDigitsOLD()", "Create test set of OLD digits");
543d5224 530 pMenu->Show();
531}//TestMenu()
532//__________________________________________________________________________________________________
543d5224 533void menu()
534{
535 TControlBar *pMenu = new TControlBar("vertical","RICH main");
536
d32d34bf 537 if(ReadAlice()){//it's from file, reconstruct
3b96aee8 538 pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert");
d32d34bf 539
86594bfc 540 pMenu->AddButton("sdigits->digits" ,"SD_D()" ,"AliRICHDigitizer");
4fddd5b8 541 pMenu->AddButton("digits->resolved clusters" ,"cf=new AliRICHClusterFinder(r);cf->Exec();delete cf;","AliRICHClusterFinder");
542 pMenu->AddButton("digits->raw clusters" , "AliRICHParam::SetDeclustering(kFALSE);cf=new AliRICHClusterFinder(r);cf->Exec();delete cf;","AliRICHClusterFinder");
86594bfc 543 pMenu->AddButton("clusters->recos" ,"C_R()" ,"AliRICHRecon");
543d5224 544
86594bfc 545 pMenu->AddButton("Show", "Show()","Shows the structure of events in files");
546 pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
547 pMenu->AddButton("Control Plots", "ControlPlots()", "Display some control histograms");
543d5224 548
549 }else{//it's aliroot, simulate
550 pMenu->AddButton("Run", "a->Run(1)", "Process!");
86594bfc 551 pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
4fddd5b8 552 pMenu->AddButton("Read RAW","ReadRaw()","Read a list of digits from test beam file");
543d5224 553 }
543d5224 554 pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
555 pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
3b96aee8 556 pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
557 pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
543d5224 558 pMenu->AddButton("Quit", ".q", "Close session");
559 pMenu->Show();
560 a=gAlice;//for manual manipulation convinience
561}//menu()
562//__________________________________________________________________________________________________
3b96aee8 563void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);}
564void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);}
4fddd5b8 565
566void ReadRaw()
567{
568 char *sRawFileName="beam/run1822_4sigma.dat";
569 FILE *pRawFile=fopen(sRawFileName,"r");
570 if(!pRawFile){Error("ReadRaw","Something wrong with raw data file %s",sRawFileName); return;}
571
572 Int_t iNpads=0,q=0,x=0,y=0;
573
574 while(fscanf(pRawFile,"%i",&iNpads)){
575 Info("ReadRaw","%i pads fired",iNpads);
576 for(Int_t i=0;i<iNpads;i++)
577 fscanf(pRawFile,"%i %i %i",&q,&x,&y);
578 }
579 fclose(pRawFile);
580}