-void MainTrank()
-{
- TStopwatch sw;TDatime time;
- OLD_S_SD(); SD_D(); //D_C();
- cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
- cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print();
- cout<<"Info in <MainTrank>: Time used: ";sw.Print();
-}
+AliRICH * R() {return r;}
+void ph(Int_t event=0) {R()->PrintHits(event);} //utility print hits for 'event' event
+void ps(Int_t event=0) {R()->PrintSDigits(event);} //utility print sdigits
+void pd(Int_t event=0) {R()->PrintDigits(event);} //utility print digits
+void pc(Int_t event=0) {R()->PrintClusters(event);}//utility print clusters
+void pt(Int_t event=0) {R()->PrintTracks(event);} //utility print tracks
-void ss()
+//__________________________________________________________________________________________________
+void pp(int tid)
{
- if(rl->LoadSDigits()) return;
- rl->TreeS()->GetEntry(0);
- r->SDigits()->Print();
- Info("ss","totally %i",r->SDigits()->GetEntries());
- rl->UnloadSDigits();
+ R()->GetLoader()->GetRunLoader()->LoadHeader(); R()->GetLoader()->GetRunLoader()->LoadKinematics();
+
+ if(tid<0||tid>=R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
+ cout<<"Valid tid number is 0-"<<R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
+ else
+ PrintParticleInfo(tid);
+
+ R()->GetLoader()->GetRunLoader()->UnloadKinematics(); R()->GetLoader()->GetRunLoader()->UnloadHeader();
}
-
-void sd()
+//__________________________________________________________________________________________________
+void PrintParticleInfo(int tid)
{
- if(rl->LoadDigits()) return;
- rl->TreeD()->GetEntry(0);
- for(int i=1;i<=7;i++) r->Digits(i)->Print();
- rl->UnloadDigits();
-}
-
-void sc()
+// Prints particle info for a given TID
+ TParticle *p=al->Stack()->Particle(tid);
+ cout<<p->GetName()<<"("<<tid<<")";
+ if(p->GetMother(0)!=-1){cout<<" from "; PrintParticleInfo(p->GetMother(0));}
+ else {cout<<endl;}
+}
+//__________________________________________________________________________________________________
+Int_t prim(Int_t tid)
{
- if(rl->LoadRecPoints()) return;
- r->SetTreeAddress();
- rl->TreeR()->GetEntry(0);
- for(int i=1;i<=7;i++) r->Clusters(i)->Print();
- rl->UnloadRecPoints();
+// Provides mother TID for the given TID
+ R()->GetLoader()->GetRunLoader()->LoadHeader(); R()->GetLoader()->GetRunLoader()->LoadKinematics();
+
+ if(tid<0||tid>=R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack())
+ cout<<"Valid tid number is 0-"<<R()->GetLoader()->GetRunLoader()->Stack()->GetNtrack()-1<<" for this event.\n";
+ else
+ while(1){
+ TParticle *p=R()->GetLoader()->GetRunLoader()->GetAliRun()->Stack()->Particle(tid);
+ if(p->GetMother(0)==-1) break;
+ tid=p->GetMother(0);
+ }
+
+ R()->GetLoader()->GetRunLoader()->UnloadKinematics(); R()->GetLoader()->GetRunLoader()->UnloadHeader();
+ return tid;
}
+
+//__________________________________________________________________________________________________
+
Double_t r2d = TMath::RadToDeg();
Double_t d2r = TMath::DegToRad();
-void DisplFast()
-{
- AliRICHDisplFast *d = new AliRICHDisplFast();
- d->Exec();
-}
+void DisplFast(){ AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();}
-void Digits2Recos()
+void C_R()
{
AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
} // event loop
delete detect;
}
-
-
-
-
-void D_C()
-{
- AliRICHClusterFinder *z=new AliRICHClusterFinder(r);
- z->Exec();
-}
//__________________________________________________________________________________________________
-void OLD_S_SD()
-{
- Info("OLD_S_SD","Start.");
-
- rl->LoadHits();
-
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- al->GetEvent(iEventN);
-
- rl->MakeTree("S"); r->MakeBranch("S");
- r->ResetSDigits(); r->ResetSpecialsOld();
-
- for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
- rl->TreeH()->GetEntry(iPrimN);
- for(Int_t i=0;i<r->Specials()->GetEntries();i++){//specials loop
- Int_t padx= ((AliRICHSDigit*)r->Specials()->At(i))->PadX();
- Int_t pady= ((AliRICHSDigit*)r->Specials()->At(i))->PadY();
- Double_t q= ((AliRICHSDigit*)r->Specials()->At(i))->QPad();
- Int_t hitN= ((AliRICHSDigit*)r->Specials()->At(i))->HitNumber()-1;//!!! important -1
- Int_t chamber=((AliRICHhit*)r->Hits()->At(hitN))->C();
- Int_t track=((AliRICHhit*)r->Hits()->At(hitN))->GetTrack();
- r->AddSDigit(chamber,padx+r->Param()->NpadsX()/2,pady+r->Param()->NpadsY()/2,q,track);
- }//specials loop
- }//prims loop
- rl->TreeS()->Fill();
- rl->WriteSDigits("OVERWRITE");
- }//events loop
- rl->UnloadHits(); rl->UnloadSDigits();
- Info("OLD_S_SD","Stop.");
-}//Specials2Sdigits()
-//__________________________________________________________________________________________________
-void H_SD()
-{
- Info("H_SD","Start.");
-
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- al->GetEvent(iEventN);
-
- if(!rl->TreeH()) rl->LoadHits();//from
- if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
-
- for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
- rl->TreeH()->GetEntry(iPrimN);
- for(Int_t iHitN=0;iHitN<3;iHitN++){//hits loop ???
- AliRICHhit *pHit=r->Hits()->At(iHitN);
- TVector3 globX3(pHit->X(),pHit->Y(),pHit->Z());
- TVector3 locX3=r->C(pHit->C())->Glob2Loc(globX3);
-
- Int_t sector;
- Int_t iTotQdc=r->Param()->Loc2TotQdc(locX3,pHit->Eloss(),pHit->Pid(),sector);
-
- Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
- r->Param()->Loc2Area(locX3,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
- cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
- for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
- for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
- Double_t padQdc=iTotQdc*r->Param()->Loc2PadFrac(locX3,iPadX,iPadY);
- if(padQdc>0.1)r->AddSDigit(pHit->C(),iPadX,iPadY,padQdc,pHit->GetTrack());
- }
- }//hits loop
- }//prims loop
- rl->TreeS()->Fill();
- rl->WriteSDigits("OVERWRITE");
- }//events loop
-
- rl->UnloadHits();
- rl->UnloadSDigits();
- Info("H_SD","Stop.");
-}//Hits2Sdigits()
-//__________________________________________________________________________________________________
-void SD_D()
+void D_C()
{
- Info("SD_D","Start.");
-
- rl->LoadSDigits();
-
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- al->GetEvent(iEventN);
-
- rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
- r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
- rl->TreeS()->GetEntry(0);
- r->SDigits()->Sort();
-
- Int_t kBad=-101;
- Int_t chamber,x,y,tr[3],id;
- Double_t q=kBad;
- chamber=x=y=tr[0]=tr[1]=tr[2]=id=kBad;
- Int_t iNdigitsPerPad=kBad;//how many sdigits for a given pad
-
- for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted)
- AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i);
- if(pSdig->Id()==id){//still the same pad
- iNdigitsPerPad++;
- q+=pSdig->Q();
- if(iNdigitsPerPad<=3)
- tr[iNdigitsPerPad-1]=pSdig->T(0);
- else
- Info("","More then 3 sdigits for the given pad");
- }else{//new pad, add the pevious one
- if(id!=kBad&&r->Param()->IsOverTh(chamber,x,y,q)) {
-
- r->AddDigit(chamber,x,y,q,tr[0],tr[1],tr[2]);//ch-xpad-ypad-qdc-tr1-2-3
- }
- chamber=pSdig->C();x=pSdig->X();y=pSdig->Y();q=pSdig->Q();tr[0]=pSdig->T(0);id=pSdig->Id();
- iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
- }
- }//sdigits loop (sorted)
-
- if(r->SDigits()->GetEntries()&&r->Param()->IsOverTh(chamber,x,y,q))
- r->AddDigit(chamber,x,y,q,tr[0],tr[1],tr[2]);//add the last digit
-
- rl->TreeD()->Fill();
- rl->WriteDigits("OVERWRITE");
- }//events loop
- rl->UnloadSDigits(); rl->UnloadDigits();
- r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
- Info("SD_D","Stop.");
-}
-
-
+ TStopwatch sw;TDatime time;
-void OLD_SD_D()
-{
- Info("SD_DOLD","Start.");
+ AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();
- rl->LoadSDigits();
-
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- al->GetEvent(iEventN);
-
- rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
- r->ResetSDigits();r->ResetDigitsOld();//reset lists of sdigits and digits
- rl->TreeS()->GetEntry(0);
- r->SDigits()->Sort();
-
- Int_t kBad=-101;
-
- 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;
- Int_t chamber=kBad,id=kBad,iNdigitsPerPad=kBad;//how many sdigits for a given pad
-
- for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted)
- AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i);
- if(pSdig->Id()==id){//still the same pad
- iNdigitsPerPad++;
- dig[2]+=pSdig->Q();//sum up qdc
- if(iNdigitsPerPad<=3)
- tr[iNdigitsPerPad-1]=pSdig->T(0);
- else
- Info("","More then 3 sdigits for the given pad");
- }else{//new pad, add the pevious one
- if(id!=kBad) r->AddDigitOld(chamber,tr,q,dig);
- chamber=pSdig->C();dig[0]=pSdig->X();dig[1]=pSdig->Y();dig[2]=pSdig->Qdc();tr[0]=pSdig->T(0);id=pSdig->Id();
- iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
- }
- }//sdigits loop (sorted)
- r->AddDigitOld(chamber,tr,q,dig);//add the last digit
-
- rl->TreeD()->Fill();
- rl->WriteDigits("OVERWRITE");
- }//events loop
- rl->UnloadSDigits(); rl->UnloadDigits();
- r->ResetSDigits();r->ResetDigitsOld();//reset lists of sdigits and digits
- Info("SD_DOLD","Stop.");
+ cout << endl;
+ cout << "Info in Digits->Clusters: Start time: ";time.Print();
+ cout << "Info in Digits->Clusters: Stop time: ";time.Set(); time.Print();
+ cout << "Info in Digits->Clusters: Time used: ";sw.Print();
}
//__________________________________________________________________________________________________
-void Show3()
+
+void Show()
{
cout<<endl;
- al->LoadHeader(); al->LoadKinematics();
-
- rl->LoadHits();
- Bool_t isSdigits=!rl->LoadSDigits();
- Bool_t isClusters=!rl->LoadRecPoints();
- Bool_t isDigits=!rl->LoadDigits();//loaders
-
+//load all trees
+ al->LoadHeader();
+ al->LoadKinematics();
+ rl->LoadHits();
+ Bool_t isSdigits=!rl->LoadSDigits();
+ Bool_t isClusters=!rl->LoadRecPoints();
+ Bool_t isDigits=!rl->LoadDigits();//loaders
cout<<endl; cout<<endl;
for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
Int_t iNparticles=a->GetEvent(iEventN);
- Int_t iNprims=rl->TreeH()->GetEntries();
+ Int_t iNprims=al->Stack()->GetNprimary();
- Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
+ Int_t iTotalHits=0;
for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
rl->TreeH()->GetEntry(iPrimN);
iTotalHits+=r->Hits()->GetEntries();
- iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
- iTotalSpecials+=r->Specials()->GetEntries();
TParticle *pPrim=al->Stack()->Particle(iPrimN);
- Info("Show","Evt %4i prim %4i has %4i hits %5i cerenkovs and %5i specials from %s (,%7.2f,%7.2f)",
- iEventN,
- iPrimN,
- r->Hits()->GetEntries(),
- r->Cerenkovs()->GetEntries(),
- r->Specials()->GetEntries(),
- pPrim->GetName(),
- pPrim->Theta()*r2d,pPrim->Phi()*r2d);
+ if(iPrimN<10) Info("Show","Evt %4i prim %4i has %4i hits from %s (,%7.2f,%7.2f)",
+ iEventN,iPrimN, r->Hits()->GetEntries(), pPrim->GetName(), pPrim->Theta()*r2d,pPrim->Phi()*r2d);
}//prims loop
- Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits %i cerenkovs %i specials",
- iEventN, iNparticles, iNprims, iTotalHits,iTotalCerenkovs,iTotalSpecials);
+ Info("Show-HIT","Evt %i total: %i particles %i primaries %i hits",
+ iEventN, iNparticles, iNprims, iTotalHits);
if(isSdigits){
rl->TreeS()->GetEntry(0);
- Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
+ Info("Show-SDI","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
}
if(isDigits){
rl->TreeD()->GetEntry(0);
for(int i=1;i<=7;i++)
- Info("Show-DIGITS","Evt %i chamber %i contains %5i digits",
+ Info("Show-DIG","Evt %i chamber %i contains %5i digits",
iEventN, i, r->Digits(i)->GetEntries());
- }
+ }else
+ Info("Show-DIG","There is no digits for this event");
if(isClusters){
rl->TreeR()->GetEntry(0);
for(int i=1;i<=7;i++)
- Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters",
+ Info("Show-CLU","Evt %i chamber %i contains %5i clusters",
iEventN, i, r->Clusters(i)->GetEntries());
}
cout<<endl;
}//events loop
+//unload all trees
rl->UnloadHits();
if(isSdigits) rl->UnloadSDigits();
if(isDigits) rl->UnloadDigits();
if(isClusters) rl->UnloadRecPoints();
- al->UnloadHeader();
- al->UnloadKinematics();
- cout<<endl;
-}//void Show()
-//__________________________________________________________________________________________________
-void ControlPlots()
-{
- Int_t iChamber = 1;
- TH1F *pqclusterH1 = new TH1F("qclus","charge of clusters;Q (ADC);events",2000,0.,2000);
-
- al->LoadHeader(); al->LoadKinematics();
+ al->UnloadHeader();
+ al->UnloadKinematics();
- rl->LoadHits();
- Bool_t isSdigits=!rl->LoadSDigits();
- Bool_t isClusters=!rl->LoadRecPoints();
- Bool_t isDigits=!rl->LoadDigits();//loaders
+ TVector counters=r->Counters();
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- Int_t iNparticles=a->GetEvent(iEventN);
- Int_t iNprims=rl->TreeH()->GetEntries();
-
- Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
- for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
- rl->TreeH()->GetEntry(iPrimN);
- iTotalHits+=r->Hits()->GetEntries();
- iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
- iTotalSpecials+=r->Specials()->GetEntries();
- TParticle *pPrim=al->Stack()->Particle(iPrimN);
- }//prims loop
- if(isSdigits){
- rl->TreeS()->GetEntry(0);
- }
- if(isDigits){
- rl->TreeD()->GetEntry(0);
- for(int i=1;i<=7;i++);
- }
- if(isClusters){
- rl->TreeR()->GetEntry(0);
- for(Int_t iclus=0;iclus<r->Clusters(iChamber)->GetEntries();iclus++) {
- pqclusterH1->Fill(((AliRICHcluster*)r->Clusters(iChamber)->At(iclus))->Q());
- }
- }
- cout<<endl;
- }//events loop
- pqclusterH1->Draw();
- rl->UnloadHits();
- if(isSdigits) rl->UnloadSDigits();
- if(isDigits) rl->UnloadDigits();
- if(isClusters) rl->UnloadRecPoints();
- al->UnloadHeader();
- al->UnloadKinematics();
-}//void Controlòlots()
+ counters(9)=counters(0); for(Int_t i=1;i<=8;i++) counters(9)-=counters(i);
+ counters.Print();
+ cout<<endl;
+}//void Show()
//__________________________________________________________________________________________________
-void DebugOFF()
-{
- Info("DebugOFF","");
- a->SetDebug(0);
- r->SetDebug(0);
- AliLoader::SetDebug(0);
-}//void DebugOFF()
-
-void DebugON()
-{
- Info("DebugON","");
- a->SetDebug(1);
- r->SetDebug(1);
- AliLoader::SetDebug(1);
-}//void DebugON()
AliRun *a;
Bool_t ReadAlice()
{
Info("ReadAlice","Tring to read ALICE from SIMULATED FILE.");
- AliLoader::SetDebug(0);
if(gAlice) delete gAlice;
if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){
gSystem->Exec("rm -rf *.root *.dat");
- Error("ReadAlice","galice.root broken, removing all this garbage then init new one");
+ Error("menu.C::ReadAlice","galice.root broken, removing all this garbage then init new one");
new AliRun("gAlice","Alice experiment system");
- gAlice->SetDebug(-1);
- gAlice->Init("ConfigRich.C");
+ gAlice->Init("Config.C");
r=(AliRICH*)gAlice->GetDetector("RICH");
return kFALSE;
}
al->LoadgAlice();
- if(!gAlice) Fatal("ReadAlice","No gAlice in file");
+ if(!gAlice) Fatal("menu.C::ReadAlice","No gAlice in file");
a=al->GetAliRun();
a->SetDebug(0);
//RICH
if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file");
- r->SetDebug(0);
if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file");
Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun());
return kTRUE;
}
//__________________________________________________________________________________________________
-void GeoTest()
-{
-
- TBRIK *pAliceBRIK=new TBRIK("aliceBRIK","ALICE mother volume","void",500,500,500);
- TBRIK *pArmBRIK=new TBRIK("armBRIK","RICH arm1","void",pRICH->GetSizeX(),pRICH->GetSizeY(),pRICH->GetSizeZ());
-
- TNode *pAliceNode=new TNode("aliceNode","Mother volume","aliceBRIK");
- pAliceNode->cd();
-
-// ARM 1 LEFT
- TRotation rot1;
- TVector3 v1(0,pRICH->GetOffset(),0);
-
-
- rot1.RotateX(pRICH->GetYZAngle()*kDegrad); v1.RotateX(pRICH->GetYZAngle()*kDegrad);
- rot1.RotateZ(pRICH->GetXYAngle()*kDegrad); v1.RotateZ(pRICH->GetXYAngle()*kDegrad);
- rot1.RotateZ(pRICH->GetRotAngle()*kDegrad); v1.RotateZ(pRICH->GetRotAngle()*kDegrad);
-
- TRotMatrix *pArm1RotMatrix=new TRotMatrix("rotArm1","rotArm1",rot1.ThetaX()*kRaddeg, rot1.PhiX()*kRaddeg,
- rot1.ThetaY()*kRaddeg, rot1.PhiY()*kRaddeg,
- rot1.ThetaZ()*kRaddeg, rot1.PhiZ()*kRaddeg);
-
- TNode *pArm1Node=new TNode("arm1Node","Left arm","armBRIK",v1.X(),v1.Y(),v1.Z(),"rotArm1");
- arm1Node->SetLineColor(kRed);
-
-// ARM 2 LEFT
- TRotation rot2;
- TVector3 v2(0,pRICH->GetOffset(),0);
-
-
- rot2.RotateX( pRICH->YZAngle()*kDegrad); v2.RotateX(pRICH->GetYZAngle()*kDegrad);
- rot2.RotateZ(-pRICH->XYAngle()*kDegrad); v2.RotateZ(-pRICH->GetXYAngle()*kDegrad);
- rot2.RotateZ( pRICH->RotAngle()*kDegrad); v2.RotateZ(pRICH->GetRotAngle()*kDegrad);
-
- TRotMatrix *pArm2RotMatrix=new TRotMatrix("rotArm2","rotArm2",rot2.ThetaX()*kRaddeg, rot2.PhiX()*kRaddeg,
- rot2.ThetaY()*kRaddeg, rot2.PhiY()*kRaddeg,
- rot2.ThetaZ()*kRaddeg, rot2.PhiZ()*kRaddeg);
-
- TNode *pArm2Node=new TNode("arm2Node","Left arm","armBRIK",v2.X(),v2.Y(),v2.Z(),"rotArm2");
- arm2Node->SetLineColor(kBlue);
-
- aliceNode->Draw();
-}//void GeoTest()
-//__________________________________________________________________________________________________
-void PrintGeo(Float_t rotDeg=0)
-{
- AliRICHParam *p=new AliRICHParam;
- Double_t r=p->Offset();
- Double_t kP=p->AngleXY();
- Double_t kT=p->AngleYZ();
- Double_t kRot;
-
- if(rotDeg==0)
- kRot=p->AngleRot();
- else
- kRot=rotDeg*deg;
-
- cout<<endl;
- Double_t phi=90*deg+kRot+kP,theta=90*deg+kT;
- Info(" menu for 1","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
- phi=90*deg+kRot+kP,theta=90*deg;
- Info(" menu for 2","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
- phi=90*deg+kRot,theta=90*deg-kT;
- Info(" menu for 3","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
-
- phi=90*deg+kRot,theta=90*deg;
- Info(" menu for 4","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
-
- phi=90*deg+kRot,theta=90*deg+kT;
- Info(" menu for 5","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
-
- phi=90*deg+kRot-kP,theta=90*deg;
- Info(" menu for 6","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
- phi=90*deg+kRot-kP,theta=90*deg+kT;
- Info(" menu for 7","r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
- r, theta*r2d, phi*r2d,
- r*sin(theta)*cos(phi),
- r*sin(theta)*sin(phi),
- r*cos(theta));
-
- delete p;
-}//PrintGeo()
-//__________________________________________________________________________________________________
void TestResponse()
{
TCanvas *pC=new TCanvas("c","Amplification test",900,800);
pC->Divide(1,2);
- pC->cd(1);
- 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);
- pF1->Draw();
- pC->cd(2);
const Int_t nPoints=8;
- THStack *pStack=new THStack("stack","photons");
+ THStack *pStackPhot=new THStack("StackPhot","photons");
+ THStack *pStackMip =new THStack("StackMip","mips");
TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
- TH1F *apH[nPoints];
+ TH1F *apHphot[nPoints];
+ TH1F *apHmip[nPoints];
- Double_t starty=AliRICHParam::DeadZone()/2;
+ Double_t starty=0;
Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
for(int i=0;i<nPoints;i++){
- apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",1000,0,1000); apH[i]->SetLineColor(i);
- pStack->Add(apH[i]);
- pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
+ apHphot[i]=new TH1F(Form("hphot%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apHphot[i]->SetLineColor(i);pStackPhot->Add(apHphot[i]);
+ apHmip[i] =new TH1F(Form("hmip%i",i),"Qdc for Mip;QDC;Counts",4000,0,4000); apHmip[i]->SetLineColor(i);pStackMip->Add(apHmip[i]);
+
+ pLeg->AddEntry(apHphot[i],Form("@(10,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2));
}
- TVector3 x3(0,0,0);
- Int_t sector=10;
+ TVector2 x2(0,0);
// AliRICHParam::ResetWireSag();
for(Int_t i=0;i<10000;i++){//events loop
for(int j=0;j<nPoints;j++){
- x3.SetY(starty-j*deltay);
- apH[j]->Fill(AliRICHParam::Loc2TotQdc(x3,400e-9,500000,sector));
+ x2.Set(10,starty+j*deltay);
+ apHphot[j]->Fill(AliRICHParam::TotQdc(x2,0));
+ apHmip[j]->Fill(AliRICHParam::TotQdc(x2,gRandom->Landau(600,150)*1e-9));
}
}
- pStack->Draw("nostack");
- pLeg->Draw();
+
+ pC->cd(1); pStackMip->Draw("nostack");
+ pC->cd(2); pStackPhot->Draw("nostack"); pLeg->Draw();
}//TestResponse()
//__________________________________________________________________________________________________
-void TestDigitsOLD()
-{
- Info("TestDigitsOLD","Creating test digits.");
- rl->MakeTree("D");r->MakeBranch("D");
-
-
- Int_t t[10];
- Int_t c[10];
- Int_t d[5];
- t[0]=100;t[1]=200;t[2]=300;
- c[0]=10;c[1]=20;c[2]=30;
-
-
- d[0]=1;d[1]=1;d[2]=10;d[3]=3;d[4]=4;r->AddDigitOld(1,t,c,d);
-
- d[0]=2;d[1]=2;d[2]=10;d[3]=3;d[4]=4;r->AddDigitOld(2,t,c,d);
- d[0]=2;d[1]=3;d[2]=10;d[3]=3;d[4]=4;r->AddDigitOld(2,t,c,d);
-
- d[0]=2;d[1]=2;d[2]=100;d[3]=3;d[4]=4;r->AddDigitOld(3,t,c,d);
- d[0]=2;d[1]=3;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(3,t,c,d);
- d[0]=2;d[1]=4;d[2]=200;d[3]=3;d[4]=4;r->AddDigitOld(3,t,c,d);
-
- d[0]=2;d[1]=2;d[2]=100;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
- d[0]=2;d[1]=3;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
- d[0]=2;d[1]=4;d[2]=200;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
- d[0]=2;d[1]=5;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
- d[0]=2;d[1]=6;d[2]=300;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
- d[0]=2;d[1]=7;d[2]= 50;d[3]=3;d[4]=4;r->AddDigitOld(6,t,c,d);
-
- rl->TreeD()->Fill();
- rl->WriteDigits("OVERWRITE");
- rl->UnloadDigits();
- r->ResetDigitsOld();
- Info("TestDigitsOLD","Stop.");
-}//void TestDigits()
-//__________________________________________________________________________________________________
void TestSD()
{
Info("TestSD","Creating test sdigits.");
- rl->MakeTree("S");r->MakeBranch("S");
-
- for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
- al->GetEvent(iEventN);
-
- if(!rl->TreeH()) rl->LoadHits();//from
- if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
-
- for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
- rl->TreeH()->GetEntry(iPrimN);
- for(Int_t iHitN=0;iHitN<3;iHitN++){//hits loop ???
- AliRICHhit *pHit=r->Hits()->At(iHitN);
- TVector3 globX3(pHit->X(),pHit->Y(),pHit->Z());
- TVector3 locX3=r->C(pHit->C())->Glob2Loc(globX3);
-
- Int_t sector;
- Int_t iTotQdc=r->Param()->Loc2TotQdc(locX3,pHit->Eloss(),pHit->Pid(),sector);
-
- Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
- r->Param()->Loc2Area(locX3,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
- cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
- for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
- for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
- Float_t iPadQdc=iTotQdc*r->Param()->Loc2PadFrac(locX3,iPadX,iPadY);
- Int_t padx,pady; r->Param()->Loc2Pad(locX3.X(),locX3.Y(),padx,pady);
- cout<<"hit="<<iHitN<<" ("<<locX3.X()<<','<<locX3.Y()<<")("<<padx<<','<<pady<<") cur pad("<<iPadX<<","<<iPadY<<") qtot="<<iTotQdc<<" qfrac="<<r->Param()->Loc2PadFrac(locX3,iPadX,iPadY)<<endl;
- }
-// r->AddSDigit(pHit->C(),padx,pady,r->Param()->Local2PadQdc(localX3,padx,pady),pHit->GetTrack());
- }//hits loop
- }//prims loop
- rl->TreeS()->Fill();
- rl->WriteSDigits("OVERWRITE");
- }//events loop
-
- rl->UnloadHits();
- rl->UnloadSDigits();
-
- rl->TreeS()->Fill();
- rl->WriteSDigits("OVERWRITE");
- rl->UnloadSDigits();
- cout<<endl;r->Sdigits()->Print();
- r->ResetSDigits();
- Info("TestSdigits","Stop.");
+ TVector3 hit(426.55,246.28,17.21);
+ TVector2 x2=r->C(4)->Glob2Loc(hit);
+ Int_t iTotQdc=r->P()->TotQdc(x2,624e-9);
+ Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
+ Int_t padx,pady;
+ Int_t sec=r->P()->Loc2Pad(x2,padx,pady);
+ r->P()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
+ Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge",
+ hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc);
+
+ cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
+ for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
+ for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++)
+ cout<<r->P()->FracQdc(x2,iPadX,iPadY)<<endl;
+ Info("TestSD","Stop.");
}//void TestSdigits()
//__________________________________________________________________________________________________
void TestC()
{
Info("TestC","Creating test clusters.");
- rl->MakeTree("R");r->MakeBranch("R");
+ R()->GetLoader()->MakeTree("R");R()->MakeBranch("R");
AliRICHcluster c;
c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3));
c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3));
c.CoG();
- r->AddCluster(c);
+ R()->AddCluster(c);
- rl->TreeR()->Fill();
- rl->WriteRecPoints("OVERWRITE");
- rl->UnloadRecPoints();
- r->ResetClusters();
+ R()->GetLoader()->TreeR()->Fill(); R()->GetLoader()->WriteRecPoints("OVERWRITE");
+ R()->GetLoader()->UnloadRecPoints();
+ R()->ResetClusters();
Info("TestC","Stop.");
}//TestC()
//__________________________________________________________________________________________________
void TestSeg()
{
- AliRICHParam *p=r->Param();
- Int_t padx,pady;
- Double_t x,y;
- Double_t dz=p->DeadZone();
- Double_t sx=p->SectorSizeX(); Double_t sy=p->SectorSizeY(); Double_t px=p->PcSizeX(); Double_t py=p->PcSizeY();
- cout<<endl;
- Info(" 1- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , -py/2 ,padx,pady),padx,pady);
- Info(" 48- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , -py/2 ,padx,pady),padx,pady);
- Info(" 49- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , -py/2 ,padx,pady),padx,pady);
- Info(" 96- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , -py/2 ,padx,pady),padx,pady);
- Info(" 97- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , -py/2 ,padx,pady),padx,pady);
- Info("144- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , -py/2 ,padx,pady),padx,pady);
- cout<<endl;
- Info(" 1- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , -dz/2 ,padx,pady),padx,pady);
- Info(" 48- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , -dz/2 ,padx,pady),padx,pady);
- Info(" 49- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , -dz/2 ,padx,pady),padx,pady);
- Info(" 96- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , -dz/2 ,padx,pady),padx,pady);
- Info(" 97- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , -dz/2 ,padx,pady),padx,pady);
- Info("144- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , -dz/2 ,padx,pady),padx,pady);
- cout<<endl;
- Info(" 1- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , dz/2 ,padx,pady),padx,pady);
- Info(" 48- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , dz/2 ,padx,pady),padx,pady);
- Info(" 49- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , dz/2 ,padx,pady),padx,pady);
- Info(" 96- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , dz/2 ,padx,pady),padx,pady);
- Info(" 97- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , dz/2 ,padx,pady),padx,pady);
- Info("144- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , dz/2 ,padx,pady),padx,pady);
- cout<<endl;
- Info(" 1-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-px/2 , py/2 ,padx,pady),padx,pady);
- Info(" 48-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2-dz , py/2 ,padx,pady),padx,pady);
- Info(" 49-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad(-sx/2 , py/2 ,padx,pady),padx,pady);
- Info(" 96-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2 , py/2 ,padx,pady),padx,pady);
- Info(" 97-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( sx/2+dz , py/2 ,padx,pady),padx,pady);
- Info("144-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( px/2 , py/2 ,padx,pady),padx,pady);
- cout<<endl;
- Info(" 73-160","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , py/2 ,padx,pady),padx,pady);
- Info(" 73- 81","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , dz/2 ,padx,pady),padx,pady);
- Info("0-0dead","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , 0 ,padx,pady),padx,pady);
- Info(" 73- 80","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , -dz/2 ,padx,pady),padx,pady);
- Info(" 73- 1","sec=%i padx=%3i pady=%3i",p->Loc2Pad( 0 , -py/2 ,padx,pady),padx,pady);
- cout<<endl;
- p->Pad2Loc(padx= 1,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 48,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 49,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 96,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 97,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx=144,pady=1,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- cout<<endl;
- p->Pad2Loc(padx= 1,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 48,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 49,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 96,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 97,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx=144,pady=80,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- cout<<endl;
- p->Pad2Loc(padx= 1,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 48,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 49,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 96,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 97,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx=144,pady=81,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- cout<<endl;
- p->Pad2Loc(padx= 1,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 48,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 49,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 96,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx= 97,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
- p->Pad2Loc(padx=144,pady=160,x,y); cout<<"padx="<<padx<<" pady="<<pady<<" x="<<x<<" y="<<y<<endl;
+ AliRICHParam p;
+
+ new TCanvas("name","PC segmentation");
+ gPad->Range(-20,-20,200,150);
+ AliRICHDisplFast::DrawSectors();
+
+ TLatex t; t.SetTextSize(0.02);
+ t.DrawText(0,140,"View from interaction point");
+ t.DrawLatex(p.PcSizeX()+10,120,Form("Pc %6.2fx%6.2fcm %3ix%3ipads",p.PcSizeX() ,p.PcSizeY(), p.NpadsX() ,p.NpadsY()));
+ t.DrawLatex(p.PcSizeX()+10,115,Form("Sec %6.2fx%5.2fcm %3ix%2ipads",p.SectorSizeX(),p.SectorSizeY(),p.NpadsXsec(),p.NpadsYsec()));
+ t.DrawLatex(p.PcSizeX()+10,110,Form("Pad %6.2fx%4.2fcm DeadZone %6.2fcm",p.PadSizeX() ,p.PadSizeY(),p.DeadZone()));
+
+ TVector2 v2;
+ t.SetTextAlign(12);
+ v2=AliRICHParam::Pad2Loc( 1,24); t.DrawText(v2.X(),v2.Y(),"sec 1");
+ v2=AliRICHParam::Pad2Loc(81,24); t.DrawText(v2.X(),v2.Y(),"sec 2");
+ v2=AliRICHParam::Pad2Loc( 1,70); t.DrawText(v2.X(),v2.Y(),"sec 3");
+ v2=AliRICHParam::Pad2Loc(81,70); t.DrawText(v2.X(),v2.Y(),"sec 4");
+ v2=AliRICHParam::Pad2Loc( 1,120); t.DrawText(v2.X(),v2.Y(),"sec 5");
+ v2=AliRICHParam::Pad2Loc(81,120); t.DrawText(v2.X(),v2.Y(),"sec 6");
+
+// TGaxis *pAx=new TGaxis(0,0,140, 0,0,140,510,"-="); pAx->SetTitle("x, cm"); pAx->SetTextSize(0.05); pAx->Draw();
+// TGaxis *pAy=new TGaxis(0,0, 0,140,0,140,510,"-="); pAy->SetTitle("y, cm"); pAy->SetTextSize(0.05); pAy->Draw();
+
+
+ t.SetTextColor(kBlue);
+
+ Int_t padx,pady,sec;
+ Double_t margin=5;
+ Double_t x0=0; Double_t x1=p.SectorSizeX(); Double_t x2=p.SectorSizeX()+p.DeadZone(); Double_t x3=p.PcSizeX();
+ Double_t y0=0; Double_t y1=p.SectorSizeY(); Double_t y2=p.SectorSizeY()+p.DeadZone();
+ Double_t y3=2*p.SectorSizeY()+p.DeadZone(); Double_t y4=p.PcSizeY()-p.SectorSizeY();
+ Double_t y5=p.PcSizeY();
+
+//pads along x
+ t.SetTextAlign(11); t.DrawText(x0,y5+margin,"1");
+ t.SetTextAlign(31); t.DrawText(x1,y5+margin,"80");
+ t.SetTextAlign(11); t.DrawText(x2,y5+margin,"81");
+ t.SetTextAlign(31); t.DrawText(x3,y5+margin,"160");
+//pads along y
+ t.SetTextAlign(11); t.DrawText(x3+margin,y0,"1");
+ t.SetTextAlign(13); t.DrawText(x3+margin,y1,"48");
+ t.SetTextAlign(11); t.DrawText(x3+margin,y2,"49");
+ t.SetTextAlign(13); t.DrawText(x3+margin,y3,"96");
+ t.SetTextAlign(11); t.DrawText(x3+margin,y4,"97");
+ t.SetTextAlign(13); t.DrawText(x3+margin,y5,"144");
+
+ t.SetTextColor(kRed);
+
+//positions along x
+ t.SetTextAlign(13);t.DrawText(x0,y0-margin,Form("%5.2f",x0));
+ t.SetTextAlign(33);t.DrawText(x1,y0-margin,Form("%5.2f",x1));
+ t.SetTextAlign(13);t.DrawText(x2,y0-margin,Form("%5.2f",x2));
+ t.SetTextAlign(33);t.DrawText(x3,y0-margin,Form("%5.2f",x3));
+//positions along y
+ t.SetTextAlign(31);t.DrawText(x0-margin,y0,Form("%5.2f",y0));
+ t.SetTextAlign(33);t.DrawText(x0-margin,y1,Form("%5.2f",y1));
+ t.SetTextAlign(31);t.DrawText(x0-margin,y2,Form("%5.2f",y2));
+ t.SetTextAlign(33);t.DrawText(x0-margin,y3,Form("%5.2f",y3));
+ t.SetTextAlign(31);t.DrawText(x0-margin,y4,Form("%5.2f",y4));
+ t.SetTextAlign(33);t.DrawText(x0-margin,y5,Form("%5.2f",y5));
+//coners
+ t.SetTextSize(0.02);
+ TVector pad(2);
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x0,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x1,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x2,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+ v2=p.Pad2Loc(p.Loc2Pad(TVector2(x3,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
+//new canvas
+ new TCanvas("trasform","Test LRS-MRS transform");
+
+ TView *pView=new TView(1);
+ pView->SetRange(-600,-600,-600,600,600,600);
+//axis
+ Double_t X[6]={0,0,0,300,0,0}; Double_t Y[6]={0,0,0,0,300,0}; Double_t Z[6]={0,0,0,0,0,300};
+ TPolyLine3D *pXaxis=new TPolyLine3D(2,X);pXaxis->SetLineColor(kRed); pXaxis->Draw();
+ TPolyLine3D *pYaxis=new TPolyLine3D(2,Y);pYaxis->SetLineColor(kGreen); pYaxis->Draw();
+ TPolyLine3D *pZaxis=new TPolyLine3D(2,Z);pZaxis->SetLineColor(kBlue); pZaxis->Draw();
+//Draw PC for all chambers by trasfering Pc plane using Pc2Mrs methode
+ Int_t iNpointsX=50,iNpointsY=50;
+ for(Int_t iChamberN=1;iChamberN<=7;iChamberN++){//chamber loop
+ TPolyMarker3D *pChamber=new TPolyMarker3D(iNpointsX*iNpointsY);
+ Int_t i=0;
+ for(Double_t x=0;x<p.PcSizeX();x+=p.PcSizeX()/iNpointsX)
+ for(Double_t y=0;y<p.PcSizeY();y+=p.PcSizeY()/iNpointsY){//step loop
+ TVector3 v3=p.C(iChamberN)->Pc2Mrs(TVector2(x,y));//from regular grid of local PC points to MRS presentation
+ pChamber->SetPoint(i++,v3.X(),v3.Y(),v3.Z());//Pc plane poing in MRS
+ }//step loop
+ pChamber->SetMarkerSize(1);
+ pChamber->SetMarkerColor(iChamberN);
+ pChamber->Draw();
+ t.SetNDC();t.SetTextColor(iChamberN); t.DrawText(0.1,iChamberN*0.1,Form("Chamber %i",iChamberN));
+ }//chamber loop
+// gPad->GetView()->RotateView(94,45);
}//void TestSeg()
//__________________________________________________________________________________________________
void TestMenu()
{
TControlBar *pMenu = new TControlBar("vertical","RICH test");
pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods");
- pMenu->AddButton("Test transform", "TestTransform()", "Test ALiRICHChamber methods");
pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods");
pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits");
- pMenu->AddButton("Test digits OLD", "TestDigitsOLD()", "Create test set of OLD digits");
pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters");
pMenu->Show();
}//TestMenu()
//__________________________________________________________________________________________________
-void GeoMenu()
-{
- TControlBar *pMenu = new TControlBar("vertical","RICH draw");
- pMenu->AddButton("RICH Isometry", "gMC->Gdraw(\"ALIC\", 60,40,0, 10,10, 0.008,0.008)","Draws ALIC volume in isometry");
- pMenu->AddButton("RICH Front XY", "gMC->Gdraw(\"ALIC\", 0,0,0, 10,10, 0.01,0.01)","Draws ALIC volume in XY view");
- pMenu->AddButton("RICH Side YZ", "gMC->Gdraw(\"ALIC\",90,180, 0, 10,10, 0.01,0.01)","Draws ALIC volume in YZ view");
- pMenu->AddButton("RICH Top XZ", "gMC->Gdraw(\"ALIC\",90, 90, 0, 10,10, 0.01,0.01)","Draws ALIC volume in XZ view");
- pMenu->AddButton("Module Isometry","gMC->Gdraw(\"SRIC\", 30,60,0, 10,10, 0.1,0.1)","Draws SRIC volume in isometry");
- pMenu->AddButton("Module Front XY","gMC->Gdraw(\"SRIC\", 0,0,0, 10,10, 0.1,0.1)","Draws SRIC volume in XY view");
- pMenu->AddButton("Module Top XZ", "gMC->Gdraw(\"SRIC\",90, 90, 0, 10,10, 0.1,0.1)","Draws SRIC volume in XZ view");
- pMenu->AddButton("ALICE Tree", "((TGeant3*)gMC)->Gdtree(\"ALIC\")","Draws ALICE tree");
- pMenu->AddButton("RICH Tree", "((TGeant3*)gMC)->Gdtree(\"RICH\")","Draws RICH tree");
- pMenu->AddButton("Geo test", "GeoTest()", "Draw RICH geo as a macro");
- pMenu->AddButton("Print ref", "PrintGeo()", "Print RICH chambers default position");
- pMenu->AddButton("AliRICH::Print", "r->Print();", "Print RICH chambers default position");
- pMenu->AddButton("Test transform","TestTransform()","Test L2G and G2L methods");
- pMenu->Show();
-}//GeoMenu()
-//__________________________________________________________________________________________________
void menu()
{
TControlBar *pMenu = new TControlBar("vertical","RICH main");
if(ReadAlice()){//it's from file, reconstruct
- pMenu->AddButton("hits->sdigits->digits","MainTrank()","Convert");
- pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
- pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
-
- pMenu->AddButton("hits->sdigits", "H_SD()", "Perform first phase converstion");
- pMenu->AddButton("sdigits->digits", "SD_D()", "Perform first phase converstion");
- pMenu->AddButton("digits->clusters", "D_C()", "Perform first phase converstion");
-
- pMenu->AddButton("OLD Show","Show3()","Shows the structure of events in files");
- pMenu->AddButton("OLD specials->sdigits", "OLD_S_SD()", "Perform first phase converstion");
- pMenu->AddButton("OLD sdigits->digits", "OLD_SD_D()","Perform second phase converstion");
- pMenu->AddButton("OLD digits->clusters", "OLD_D_C()", "Perform second phase converstion");
+ pMenu->AddButton("Show", "Show()", "Shows the structure of events in files");
+ pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
+ pMenu->AddButton("Control Plots", "R()->ControlPlots()","Create some control histograms");
}else{//it's aliroot, simulate
pMenu->AddButton("Run", "a->Run(1)", "Process!");
+ pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
+ pMenu->AddButton("Read RAW","ReadRaw()","Read a list of digits from test beam file");
}
- pMenu->AddButton("Geo submenu", "GeoMenu()", "Shows geomentry submenu");
- pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI");
pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu");
pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser");
- pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast");
- pMenu->AddButton("Control Plots", "ControlPlots()", "Control Plots");
+ pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off");
+ pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off");
pMenu->AddButton("Quit", ".q", "Close session");
pMenu->Show();
a=gAlice;//for manual manipulation convinience
}//menu()
//__________________________________________________________________________________________________
+void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);}
+void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);}
+
+void ReadRaw()
+{
+// First interation for TB raw data reader
+ char *sRawFileName="beam/run1822_4sigma.dat";
+ FILE *pRawFile=fopen(sRawFileName,"r");
+ if(!pRawFile){Error("ReadRaw","Something wrong with raw data file %s",sRawFileName); return;}
+
+ Int_t iNpads=0,q=0,x=0,y=0;
+
+ while(fscanf(pRawFile,"%i",&iNpads)){
+ Info("ReadRaw","%i pads fired",iNpads);
+ for(Int_t i=0;i<iNpads;i++)
+ fscanf(pRawFile,"%i %i %i",&q,&x,&y);
+ }
+ fclose(pRawFile);
+}
+//__________________________________________________________________________________________________
+void FillContribs(Int_t part,Int_t C, Bool_t print)
+{
+ static Int_t contrib[10][7][2];
+ static Bool_t kEnter=kFALSE;
+
+ C--; // chamber numbering from 1 to 7
+ if(!kEnter) {
+ for(Int_t i=0;i<10;i++) {
+ for(Int_t j=0;j<7;j++) {
+ for(Int_t k=0;k<2;k++) contrib[i][j][k]=0;
+ }
+ }
+ kEnter=kTRUE;
+ }
+
+ if(print) {
+ for(Int_t k=0;k<2;k++) {cout << "----------------Positives to RICH ---------------" << endl;
+ cout << " chamber 1 2 3 4 5 6 7 " << endl;
+ cout << " -------------------------------------------------" << endl;
+ for(Int_t i=0;i<4;i++) {
+ if(i==0) cout << " e";
+ if(i==1) cout << "pi";
+ if(i==2) cout << " K";
+ if(i==3) cout << " p";
+ if(k==0) cout << "+ ";
+ if(k==1) cout << "- ";
+ for(Int_t j=0;j<7;j++) {
+ cout << contrib[i][j][k] << " ";
+ }
+ cout << endl;
+ }
+ }
+ }
+
+ // +ves
+ if(part==kPositron) contrib[0][C][0]++;
+ if(part==kPiPlus) contrib[1][C][0]++;
+ if(part==kKPlus) contrib[2][C][0]++;
+ if(part==kProton) contrib[3][C][0]++;
+
+ // -ves
+ if(part==kElectron) contrib[0][C][1]++;
+ if(part==kPiMinus) contrib[1][C][1]++;
+ if(part==kKMinus) contrib[2][C][1]++;
+ if(part==kProtonBar) contrib[3][C][1]++;
+}
+//__________________________________________________________________________________________________
+void ParticleContribs()
+{
+
+ TH1F *distH1 = new TH1F("distH1","distH1",100,0.,5.);
+ AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
+ Bool_t isHits =!pRich->GetLoader()->LoadHits();
+
+ pRich->GetLoader()->GetRunLoader()->LoadHeader(); pRich->GetLoader()->GetRunLoader()->LoadKinematics();
+
+
+ if(!isHits){Error("Exec","No hits. No contribs to calculate.");return;}
+
+ for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events Loop
+ pRich->GetLoader()->GetRunLoader()->GetEvent(iEventN);
+ cout << " event n. " << iEventN << endl;
+ Int_t nPrimaries = (Int_t)pRich->GetLoader()->TreeH()->GetEntries();
+ TObjArray * Hits = new TObjArray[nPrimaries];
+
+ for(Int_t i=0;i<nPrimaries;i++) {
+ pRich->GetLoader()->TreeH()->GetEntry(i);
+ Int_t nHits = pRich->Hits()->GetEntries();
+ for(Int_t k=0;k<nHits;k++) Hits[i].Add(pRich->Hits()->At(k));
+
+ }
+//deals with hits
+ for(Int_t i=0;i<nPrimaries;i++){//prims loop
+ pRich->GetLoader()->TreeH()->GetEntry(i);
+ Int_t nHits = pRich->Hits()->GetEntries();
+ for(Int_t j=0;j<nHits;j++){//hits loop
+ AliRICHhit *pHit = (AliRICHhit*)Hits[i].At(j);
+ TParticle *pParticle = pRich->GetLoader()->GetRunLoader()->GetAliRun()->Stack()->Particle(pHit->GetTrack());
+// if(pParticle->P()>1) FillContribs(pParticle->GetPdgCode(),pHit->C(),kFALSE);
+ FillContribs(pParticle->GetPdgCode(),pHit->C(),kFALSE);
+ if(pParticle->GetPDG()->Charge()!=0) distH1->Fill(pHit->Length());
+ }//hits loop
+ }//prims loop
+ }// event loop
+ FillContribs(0,0,kTRUE);
+ distH1->Draw();
+
+}//ParticleContribs()
+//__________________________________________________________________________________________________
+void CheckPR()
+{
+//Pattern recognition wirh Stack particles
+ TFile *pFile = new TFile("$(HOME)/RPR.root","RECREATE","RICH Pattern Recognition");
+ TNtupleD *hn = new TNtupleD("hn","ntuple","Pmod:Charge:TrackTheta:TrackPhi:TrackX:TrackY:MinX:MinY:ChargeMIP:ThetaCerenkov:NPhotons:MipIndex");
+ printf("\n\n");
+ printf("Pattern Recognition done for event %5i",0);
+ for(Int_t iEvtN=0;iEvtN<R()->GetLoader()->GetRunLoader()->GetNumberOfEvents();iEvtN++) {
+ R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
+ AliRICHTracker *tr = new AliRICHTracker();
+ tr->RecWithStack(hn);
+// Info("CheckPR","Pattern Recognition done for event %i \b",iEvtN);
+ printf("\b\b\b\b\b%5i",iEvtN+1);
+ }
+ printf("\n\n");
+ pFile->Write();pFile->Close();
+}