* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
- $Log$
-*/
-
+/* $Id$ */
//////////////////////////////////////////////////////////////////////////
// //
#include <TView.h>
#include <TText.h>
#include <TPolyMarker3D.h>
+#include <TAtt3D.h>
+#include <TAttLine.h>
#include <TPolyMarker.h>
#include <TPaveLabel.h>
#include <TPaveText.h>
#include <TArc.h>
#include <TTUBE.h>
#include <TSlider.h>
+#include <TGeometry.h>
#include <TSliderBox.h>
#include <TGaxis.h>
#include <TVirtualX.h>
#include <TMath.h>
#include <TRandom.h>
#include <X3DBuffer.h>
+#include <TParticle.h>
#include "AliRun.h"
#include "AliPDG.h"
#include "AliRICHConst.h"
#include "AliRICHDisplay.h"
#include "AliRICHPoints.h"
-#include "TParticle.h"
+#include "AliHeader.h"
+#include "AliRICHSDigit.h"
+#include "AliRICHDigit.h"
+#include "AliRICHRawCluster.h"
+#include "AliMC.h"
ClassImp(AliRICHDisplay)
//____________________________________________________________________________
AliRICHDisplay::AliRICHDisplay()
{
+
+// default constructor
+ fColPad = 0;
fPoints = 0;
fPhits = 0;
fPCerenkovs = 0;
SetRange();
// Set front view by default
- fTheta = 90;
- fPhi = 90;
+ fTheta = 90; //inclined HMPID
+ fPhi = 30; //inclined HMPID
+ //fTheta = 90; //normal HMPID
+ //fPhi = 90; //normal HMPID
fPsi = 0;
fChamber = 1;
fCathode = 1;
Float_t dxtr = 0.15;
Float_t dytr = 0.45;
fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
- fTrigPad->SetEditable(kFALSE);
fTrigPad->Draw();
fTrigPad->cd();
fTrigPad->SetFillColor(22);
button->Draw();
AppendPad(); // append display object as last object to force selection
+ fTrigPad->SetEditable(kFALSE);
+ fButtons->SetEditable(kFALSE);
fCanvas->cd();
fCanvas->Update();
}
fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
- fButtons->SetEditable(kFALSE);
fButtons->Draw();
fButtons->SetFillColor(38);
fButtons->SetBorderSize(2);
//_____________________________________________________________________________
void AliRICHDisplay::DisplayColorScale()
{
+
+// Draw the color scale in the RICH display canvas
Int_t i;
Int_t color;
gPad->Range(x1,y1,x2,y2);
TText *text = new TText(0,0,"");
text->SetTextFont(61);
- text->SetTextSize(0.03);
+ text->SetTextSize(0.2);
text->SetTextAlign(22);
TBox *box;
ylow = y1 + hs*(Float_t(i));
yup = y1 + hs*(Float_t(i+1));
color = 701+i;
- Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22);
+ Double_t logscale=Double_t(i+1)*(TMath::Log(kadc_satm)/22);
Int_t scale=(Int_t)TMath::Exp(logscale);
sprintf(label,"%d",scale);
box = new TBox(xlow, ylow, xup, yup);
if (gPad == fTrigPad) return 9999;
- const Int_t big = 9999;
- Int_t dist = big;
+ const Int_t kBig = 9999;
+ Int_t dist = kBig;
Float_t xmin = gPad->GetX1();
Float_t xmax = gPad->GetX2();
Float_t dx = 0.02*(xmax - xmin);
if (!fDrawCoG) return;
ResetRpoints();
- for (Int_t chamber=0;chamber<7;chamber++) {
+ for (Int_t chamber=0;chamber<kNCH;chamber++) {
LoadCoG(chamber,1);
}
if (!fDrawRecHits) return;
//ResetRecpoints();
- for (Int_t chamber=0;chamber<7;chamber++) {
+ for (Int_t chamber=0;chamber<kNCH;chamber++) {
LoadRecHits(chamber,1);
}
points = fRecpoints;
if (!points) return;
nrec = points->GetEntriesFast();
- printf("Nrec %d\n",nrec);
+ //printf("Nrec %d\n",nrec);
for (irec=0; irec < nrec; irec++) {
pm = (AliRICHPoints*)points->UncheckedAt(irec);
if (!pm) continue;
sprintf(ptitle,"Alice event: %d, Run:%d",
gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
title->AddText(ptitle);
- Int_t nparticles = gAlice->Particles()->GetEntriesFast();
+ Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
nparticles, fHitsCuts,fClustersCuts);
title->AddText(ptitle);
//add clusters to the pad
DrawClusters();
DrawHits();
-// DrawCerenkovs();
- printf("Calling DrawCoG\n");
- DrawCoG();
- printf("Calling DrawRecHits\n");
- DrawRecHits();
+ //DrawCerenkovs();
+ if (gAlice->TreeR())
+ {
+ //printf("Calling DrawCoG\n");
+ DrawCoG();
+ //printf("Calling DrawRecHits\n");
+ DrawRecHits();
+ }
/*for (Int_t i=0;i<7;i++)
LoadRecHits(i,1);*/
if (px == 0 && py == 0) { //when called by sliders
if (event == kButton1Up) {
- Draw();
+ printf("Drawing event %d\n",event);
+ Draw();
}
return;
}
if (chamber > 6) return;
- printf("Entering LoadCoG\n");
+ //printf("Entering LoadCoG\n");
- AliRICH *RICH = (AliRICH*)gAlice->GetModule("RICH");
+ AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
AliRICHChamber* iChamber;
- TClonesArray *RICHrawclust = RICH->RawClustAddress(chamber);
- printf ("Chamber:%d has adress:%p\n", chamber, RICHrawclust );
- if (RICHrawclust == 0) return;
+ TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
+ //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
+ if (pRICHrawclust == 0) return;
- RICH->ResetRawClusters();
+ pRICH->ResetRawClusters();
Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
gAlice->TreeR()->GetEvent(nent-1+cathode-1);
- Int_t nrawcl = RICHrawclust->GetEntriesFast();
- printf ("nrawcl:%d\n",nrawcl);
+ Int_t nrawcl = pRICHrawclust->GetEntriesFast();
+ //printf ("nrawcl:%d\n",nrawcl);
if (nrawcl == 0) return;
if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
- iChamber = &(RICH->Chamber(chamber));
+ iChamber = &(pRICH->Chamber(chamber));
AliRICHRawCluster *mRaw;
AliRICHPoints *points = 0;
//
//loop over all raw clusters and store their position
points = new AliRICHPoints(nrawcl);
for (Int_t iraw=0;iraw<nrawcl;iraw++) {
- mRaw = (AliRICHRawCluster*)RICHrawclust->UncheckedAt(iraw);
+ mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
fRpoints->AddAt(points,iraw);
points->SetMarkerColor(3);
points->SetMarkerStyle(3);
points->SetHitIndex(-1);
points->SetTrackIndex(-1);
points->SetDigitIndex(-1);
- Float_t VecLoc[3]={mRaw->fX,6.276,mRaw->fY};
- Float_t VecGlob[3];
- iChamber->LocaltoGlobal(VecLoc,VecGlob);
- points->SetPoint(iraw,VecGlob[0],VecGlob[1],VecGlob[2]);
+ Float_t vectorLoc[3]={mRaw->fX,5,mRaw->fY};
+ Float_t vectorGlob[3];
+ iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
+ points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
}
}
//___________________________________________
void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
{
-// Read rec. hits info
-// Loop on all detectors
-
- if (chamber > 6) return;
-
- printf("Entering LoadRecHits\n");
-
-
- AliRICH *RICH = (AliRICH*)gAlice->GetModule("RICH");
- AliRICHChamber* iChamber;
-
- TClonesArray *RICHrechits = RICH->RecHitsAddress(chamber);
- printf ("Chamber:%d has adress:%p\n", chamber, RICHrechits );
- if (RICHrechits == 0) return;
-
- //RICH->ResetRecHits();
-
-
- Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
- gAlice->TreeR()->GetEvent(nent-1+cathode-1);
- Int_t nrechits = RICHrechits->GetEntriesFast();
- printf ("nrechits:%d\n",nrechits);
- if (nrechits == 0) return;
- if (fRecpoints == 0) fRecpoints = new TObjArray(nrechits);
-
- iChamber = &(RICH->Chamber(chamber));
- AliRICHRecHit *mRec;
- AliRICHPoints *points = 0;
- //AliRICHEllipse *ellipse = 0;
- //
- //loop over all rechits and store their position
-
- points = new AliRICHPoints(nrechits);
- for (Int_t irec=0;irec<nrechits;irec++) {
- mRec = (AliRICHRecHit*)RICHrechits->UncheckedAt(irec);
- fRecpoints->AddAt(points,irec);
- points->SetMarkerColor(38);
- points->SetMarkerStyle(8);
- points->SetMarkerSize(1.);
- points->SetParticle(-1);
- points->SetHitIndex(-1);
- points->SetTrackIndex(-1);
- points->SetDigitIndex(-1);
- Float_t VecLoc[3]={mRec->fX,6.276,mRec->fY};
- Float_t VecGlob[3];
- iChamber->LocaltoGlobal(VecLoc,VecGlob);
- points->SetPoint(irec,VecGlob[0],VecGlob[1],VecGlob[2]);
- //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
- //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
- //ellipse=new TEllipse(VecGlob[0],VecGlob[2],10,10,0,360,phi);
- printf("Generating ellipse %d\n",irec);
- AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->Omega,mRec->Theta,mRec->Phi);
- ellipse->CreatePoints(chamber);
- //ellipse->SetFillStyle(1001);
- ellipse->SetMarkerColor(38);
- ellipse->Draw();
- //marker->SetRefObject((TObject*)points);
- //points->Set3DMarker(0, marker);
- }
+ chamber++;cathode++;
}
//___________________________________________
void AliRICHDisplay::LoadDigits()
// Loop on all detectors
ResetPoints();
- AliRICH *RICH = (AliRICH*)gAlice->GetDetector("RICH");
+ AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
AliRICHChamber* iChamber;
- AliRICHSegmentation* segmentation;
- Int_t NallDigits=0;
+ AliSegmentation* segmentation;
+ Int_t nAllDigits=0;
Int_t ich;
+
+ //printf("Entering LoadDigits\n");
+
+ if (gAlice->TreeD())
+ {
- for (ich=0; ich<7; ich++) {
- TClonesArray *RICHdigits = RICH->DigitsAddress(ich);
- if (RICHdigits == 0) continue;
- gAlice->ResetDigits();
- gAlice->TreeD()->GetEvent(1);
- Int_t ndigits = RICHdigits->GetEntriesFast();
- NallDigits+=ndigits;
- }
- if (fPoints == 0) fPoints = new TObjArray(NallDigits);
- Int_t counter=0;
- for (ich=0; ich<7; ich++) {
- TClonesArray *RICHdigits = RICH->DigitsAddress(ich);
- if (RICHdigits == 0) continue;
- gAlice->ResetDigits();
- gAlice->TreeD()->GetEvent(1);
- Int_t ndigits = RICHdigits->GetEntriesFast();
- if (ndigits == 0) continue;
- iChamber = &(RICH->Chamber(ich));
- segmentation=iChamber->GetSegmentationModel();
- Float_t dpx = segmentation->Dpx();
- Float_t dpy = segmentation->Dpy();
-
- //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
-
- AliRICHDigit *mdig;
- AliRICHPoints *points = 0;
- TMarker3DBox *marker = 0;
- //
- //loop over all digits and store their position
- Int_t npoints=1;
+ for (ich=0; ich<kNCH; ich++) {
+ TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
+ //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
+ if (pRICHdigits == 0) continue;
+ gAlice->ResetDigits();
+ gAlice->TreeD()->GetEvent(0);
+ Int_t ndigits = pRICHdigits->GetEntriesFast();
+ //printf("ndigits:%d\n",ndigits);
+ nAllDigits+=ndigits;
+ }
- for (Int_t digit=0;digit<ndigits;digit++) {
- mdig = (AliRICHDigit*)RICHdigits->UncheckedAt(digit);
+ if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
+ Int_t counter=0;
+ for (ich=0; ich<kNCH; ich++) {
+ TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
+ if (pRICHdigits == 0) continue;
+ gAlice->ResetDigits();
+ gAlice->TreeD()->GetEvent(0);
+ Int_t ndigits = pRICHdigits->GetEntriesFast();
+ if (ndigits == 0) continue;
+ iChamber = &(pRICH->Chamber(ich));
+ segmentation=iChamber->GetSegmentationModel();
+ Float_t dpx = segmentation->Dpx();
+ Float_t dpy = segmentation->Dpy();
+
+ //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
+
+ AliRICHDigit *mdig;
+ AliRICHPoints *points = 0;
+ TMarker3DBox *marker = 0;
+ //
+ //loop over all digits and store their position
+ Int_t npoints=1;
+
+ for (Int_t digit=0;digit<ndigits;digit++) {
+ mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
points = new AliRICHPoints(npoints);
fPoints->AddAt(points,counter);
counter++;
- Int_t charge=mdig->fSignal;
- Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
+ Int_t charge=mdig->Signal();
+ Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
Int_t color=701+index;
if (color>722) color=722;
points->SetMarkerColor(color);
points->SetMarkerStyle(21);
points->SetMarkerSize(0.5);
- Float_t xpad, ypad;
- segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
- Float_t VecLoc[3]={xpad,6.276,ypad};
- Float_t VecGlob[3];
- iChamber->LocaltoGlobal(VecLoc,VecGlob);
+ Float_t xpad, ypad, zpad;
+ segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
+ Float_t vectorLoc[3]={xpad,5,ypad};
+ Float_t vectorGlob[3];
+ iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
points->SetParticle(-1);
points->SetHitIndex(-1);
points->SetTrackIndex(-1);
points->SetDigitIndex(digit);
- points->SetPoint(0,VecGlob[0],VecGlob[1],VecGlob[2]);
+ points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
+ //printf("Y position (digit): %f\n", vectorGlob[1]);
- segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
+ segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
Float_t theta = iChamber->GetRotMatrix()->GetTheta();
Float_t phi = iChamber->GetRotMatrix()->GetPhi();
- marker=new TMarker3DBox(VecGlob[0],VecGlob[1],VecGlob[2],
+ marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
dpy/2,0,dpx/2,theta,phi);
marker->SetLineColor(2);
marker->SetFillStyle(1001);
marker->SetFillColor(color);
marker->SetRefObject((TObject*)points);
points->Set3DMarker(0, marker);
- } // loop over digits
- } // loop over chambers
+ } // loop over digits
+ } // loop over chambers
+ } //if TreeD
}
fChamber=chamber;
ResetPhits();
- AliRICH *RICH = (AliRICH*)gAlice->GetDetector("RICH");
+ AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
AliRICHChamber* iChamber;
- iChamber = &(RICH->Chamber(chamber-1));
- Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
+ iChamber = &(pRICH->Chamber(chamber-1));
+ Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
Int_t track;
if (fPhits == 0) fPhits = new TObjArray(ntracks);
//TVector *zp = new TVector(1000);
//TVector *ptrk = new TVector(1000);
//TVector *phit = new TVector(1000);
- Int_t NallHits=0;
+ Int_t nAllHits=0;
for (track=0; track<ntracks;track++) {
gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(track);
- TClonesArray *RICHhits = RICH->Hits();
- if (RICHhits == 0) return;
- Int_t nhits = RICHhits->GetEntriesFast();
- NallHits+=nhits;
+ pRICH->TreeH()->GetEvent(track);
+ TClonesArray *pRICHhits = pRICH->Hits();
+ if (pRICHhits == 0) return;
+ Int_t nhits = pRICHhits->GetEntriesFast();
+ nAllHits+=nhits;
}
- fPhits = new TObjArray(NallHits);
+ fPhits = new TObjArray(nAllHits);
Int_t npoints=0;
for (track=0; track<ntracks;track++) {
gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(track);
- TClonesArray *RICHhits = RICH->Hits();
- if (RICHhits == 0) return;
- Int_t nhits = RICHhits->GetEntriesFast();
+ pRICH->TreeH()->GetEvent(track);
+ TClonesArray *pRICHhits = pRICH->Hits();
+ if (pRICHhits == 0) return;
+ Int_t nhits = pRICHhits->GetEntriesFast();
if (nhits == 0) continue;
- AliRICHHit *mHit;
+ AliRICHhit *mHit;
AliRICHPoints *points = 0;
for (Int_t hit=0;hit<nhits;hit++) {
points = new AliRICHPoints(1);
fPhits->AddAt(points,npoints);
- mHit = (AliRICHHit*)RICHhits->UncheckedAt(hit);
- TParticle *current =
- (TParticle*)(*gAlice->Particles())[mHit->fTrack];
+ mHit = (AliRICHhit*)pRICHhits->UncheckedAt(hit);
+ TParticle *current = (TParticle*)gAlice->GetMCApp()->Particle(mHit->Track());
if (current->GetPdgCode() == 50000050) {
points->SetMarkerColor(kBlue);
} else if (current->GetPdgCode() == 50000051) {
}
points->SetMarkerStyle(5);
points->SetMarkerSize(1.);
- points->SetParticle(current->GetPdgCode());
+ points->SetParticle(mHit->Track());
points->SetHitIndex(hit);
- points->SetTrackIndex(mHit->fTrack);
+ points->SetTrackIndex(track);
points->SetDigitIndex(-1);
- points->SetPoint(hit,mHit->fX, mHit->fY, mHit->fZ);
+ points->SetPoint(0,mHit->X(), mHit->Y(), mHit->Z());
npoints++;
}
}
fChamber=chamber;
ResetPCerenkovs();
- AliRICH *RICH = (AliRICH*)gAlice->GetDetector("RICH");
+ AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
AliRICHChamber* iChamber;
- iChamber = &(RICH->Chamber(chamber-1));
+ iChamber = &(pRICH->Chamber(chamber-1));
- RICH->SetTreeAddress();
- Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
+ pRICH->SetTreeAddress();
+ Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
TVector *xp = new TVector(1000);
TVector *phit = new TVector(1000);
for (Int_t track=0; track<ntracks;track++) {
gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(track);
- TClonesArray *RICHCerenkovs = RICH->Cerenkovs();
- if (RICHCerenkovs == 0) return;
- Int_t nhits = RICHCerenkovs->GetEntriesFast();
+ pRICH->TreeH()->GetEvent(track);
+ TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
+ if (pRICHCerenkovs == 0) return;
+ Int_t nhits = pRICHCerenkovs->GetEntriesFast();
if (nhits == 0) continue;
AliRICHCerenkov *mCerenkov;
AliRICHPoints *cpoints = 0;
//Display Cerenkov hits in blue
for (Int_t hit=0;hit<nhits;hit++) {
- mCerenkov = (AliRICHCerenkov*)RICHCerenkovs->UncheckedAt(hit);
- (*xp)(npoints)=mCerenkov->fX;
- (*yp)(npoints)=mCerenkov->fY;
- (*zp)(npoints)=mCerenkov->fZ;
+ mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
+ (*xp)(npoints)=mCerenkov->X();
+ (*yp)(npoints)=mCerenkov->Y();
+ (*zp)(npoints)=mCerenkov->Z();
(*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
(*phit)(npoints)=Float_t(hit);
npoints++;
//_____________________________________________________________________________
void AliRICHDisplay::SetPickMode()
{
+
+// Toggle pick mode
+
fZoomMode = 0;
fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
//_____________________________________________________________________________
void AliRICHDisplay::SetZoomMode()
{
+
+// Toggle Zoom mode
+
fZoomMode = 1;
fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
fChamber = chamber;
fCathode = cathode;
- printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
+ //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
if (!fPad) return;
fPad->Clear();
LoadDigits();
if (delta) {
gAlice->Clear();
- Int_t current_event = gAlice->GetHeader()->GetEvent();
- Int_t new_event = current_event + delta;
- gAlice->GetEvent(new_event);
+ Int_t currentEvent = gAlice->GetHeader()->GetEvent();
+ Int_t newEvent = currentEvent + delta;
+ gAlice->GetEvent(newEvent);
if (!gAlice->TreeD()) return;
}
LoadDigits();
//______________________________________________________________________________
void AliRICHDisplay::UnZoom()
{
+
+// Return to previous zoom factor
+
if (fZooms <= 0) return;
fZooms--;
TPad *pad = (TPad*)gPad->GetPadSave();
if (!view) return;
pad->x3d();
}
-
-
-
-
-ClassImp(AliRICHEllipse)
-
-//________________________________________________________________________________
-AliRICHEllipse::AliRICHEllipse()
-{
- fCx = 0;
- fCy = 0;
- fOmega = 0;
- fTheta = 0;
- fPhi = 0;
- h= 0;
-}
-
-//________________________________________________________________________________
-AliRICHEllipse::~AliRICHEllipse()
-{
- fCx = 0;
- fCy = 0;
- fOmega = 0;
- fTheta = 0;
- fPhi = 0;
- h= 0;
-}
-
-
-//________________________________________________________________________________
-AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi)
-{
- fCx = cx;
- fCy = cy;
- fOmega = omega;
- fTheta = theta;
- fPhi = phi;
- h=10;
-}
-
-//________________________________________________________________________________
-void AliRICHEllipse::CreatePoints(Int_t chamber)
-{
- Int_t s1,s2;
- Float_t fiducial=h*TMath::Tan(fOmega+fTheta), l=h/TMath::Cos(fTheta), xtrial, y, c0, c1, c2;
- //TRandom *random=new TRandom();
-
- AliRICH *RICH = (AliRICH*)gAlice->GetModule("RICH");
- AliRICHChamber* iChamber;
-
- iChamber = &(RICH->Chamber(chamber));
- //cout<<"fiducial="<<fiducial<<endl;
-
- for(Float_t i=0;i<1000;i++)
- {
-
- c0=0;c1=0;c2=0;
- while((c1*c1-4*c2*c0)<=0)
- {
- //Choose which side to go...
- if(i>250 && i<750) s1=1;
- //if (gRandom->Rndm(1)>.5) s1=1;
- else s1=-1;
- //printf("s1:%d\n",s1);
- //Trial a y
- y=s1*i*gRandom->Rndm(Int_t(fiducial/50));
- //printf("Fiducial %f for omega:%f theta:%f phi:%f\n",fiducial,fOmega,fTheta,fPhi);
- Float_t alfa1=fTheta;
- Float_t theta1=fPhi;
- Float_t OMEGA1=fOmega;
-
- //Solve the eq for a trial x
- c0=-TMath::Power(y*TMath::Cos(alfa1)*TMath::Cos(theta1),2)-TMath::Power(y*TMath::Sin(alfa1),2)+TMath::Power(l*TMath::Tan(OMEGA1),2)+2*l*y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(OMEGA1),2)+TMath::Power(y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Tan(OMEGA1),2);
- c1=2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)-2*y*TMath::Cos(alfa1)*TMath::Power(TMath::Cos(theta1),2)*TMath::Sin(alfa1)+2*l*TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(OMEGA1),2)+2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)*TMath::Power(TMath::Sin(theta1),2)*TMath::Power(TMath::Tan(OMEGA1),2);
- c2=-TMath::Power(TMath::Cos(alfa1),2)-TMath::Power(TMath::Cos(theta1)*TMath::Sin(alfa1),2)+TMath::Power(TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Tan(OMEGA1),2);
- //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl;
- //printf("Result:%f\n\n",c1*c1-4*c2*c0);
- //i+=.01;
- }
-
- //Choose which side to go...
- //if(gRandom->Rndm(1)>.5) s=1;
- //else s=-1;
- if(i>500) s2=1;
- //if (gRandom->Rndm(1)>.5) s2=1;
- else s2=-1;
- xtrial=fCx+(-c1+s2*TMath::Sqrt(c1*c1-4*c2*c0))/(2*c2);
- //cout<<"x="<<xtrial<<" y="<<cy+y<<endl;
- //printf("Coordinates: %f %f\n",xtrial,fCy+y);
-
- Float_t VecLoc[3]={xtrial/.8,6.276,(fCy+y)/.8};
- Float_t VecGlob[3];
- iChamber->LocaltoGlobal(VecLoc,VecGlob);
- SetPoint(i,VecGlob[0],VecGlob[1],VecGlob[2]);
- //printf("Coordinates: %f %f %f\n",VecGlob[0],VecGlob[1],VecGlob[2]);
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-