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