* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
- $Log$
- Revision 1.3 2000/06/09 14:52:08 jbarbosa
- New tentative ellipse drawing routine
-
- Revision 1.1 2000/04/19 13:07:45 morsch
- Digits, clusters and reconstruction results added.
-
-*/
-
//////////////////////////////////////////////////////////////////////////
// //
#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 <TRandom.h>
#include <X3DBuffer.h>
#include <TParticle.h>
-
+#include "AliRICHChamber.h"
#include "AliRun.h"
#include "AliPDG.h"
#include "AliDetector.h"
#include "AliRICH.h"
-#include "AliRICHConst.h"
#include "AliRICHDisplay.h"
#include "AliRICHPoints.h"
+#include "AliHeader.h"
-#include "AliRICHHit.h"
-#include "AliRICHCerenkov.h"
-#include "AliRICHPadHit.h"
-#include "AliRICHDigit.h"
-#include "AliRICHRawCluster.h"
-#include "AliRICHRecHit.h"
-#include "AliRICHEllipse.h"
+#include "AliMC.h"
ClassImp(AliRICHDisplay)
{
// default constructor
-
+ fColPad = 0;
fPoints = 0;
fPhits = 0;
fPCerenkovs = 0;
//_____________________________________________________________________________
AliRICHDisplay::AliRICHDisplay(Int_t size)
{
-// Create an event display object.
-// A canvas named "edisplay" is created with a vertical size in pixels
-//
-// A QUICK Overview of the Event Display functions
-// ===============================================
-//
-// The event display can ve invoked by executing the macro "display.C"
-// A canvas like in the picture below will appear.
-//
-// On the left side of the canvas, the following buttons appear:
-// *Next* to move to the next event
-// *Previous* to move to the previous event
-
-// *Pick* Select this option to be able to point on a track with the
-// mouse. Once on the track, use the right button to select
-// an action. For example, select SetMarkerAttributes to
-// change the marker type/color/size for the track.
-// *Zoom* Select this option (default) if you want to zoom.
-// To zoom, simply select the selected area with the left button.
-// *UnZoom* To revert to the previous picture size.
-//
-// slider R On the left side, the vertical slider can be used to
-// set the default picture size.
-//
-// When you are in Zoom mode, you can click on the black part of the canvas
-// to select special options with the right mouse button.
-
-//
-// When you are in pick mode, you can "Inspect" the object pointed by the mouse.
-// When you are on a track, select the menu item "InspectParticle"
-// to display the current particle attributes.
-//
-// You can activate the Root browser by selecting the Inspect menu
-// in the canvas tool bar menu. Then select "Start Browser"
-// This will open a new canvas with the browser. At this point, you may want
-// to display some histograms (from the Trees). Go to the "File" menu
-// of the browser and click on "New canvas".
-// In the browser, click on item "ROOT files" in the left pane.
-// Click on galice.root.
-// Click on TH
-// Click on TPC for example
-// Click on any variable (eg TPC.fX) to histogram the variable.
-//
-// If you are lost, you can click on HELP in any Root canvas or browser.
-//Begin_Html
-/*
- <img src="gif/AliRICHDisplay.gif">
-*/
-//End_Html
-
fPad = 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);
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);
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;
}
// Read raw clusters info and store x,y,z info in arrays fRpoints
// Loop on all detectors
- if (chamber > 6) return;
-
- printf("Entering LoadCoG\n");
-
+ if (chamber > 7) return;
AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
AliRICHChamber* iChamber;
- TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
- printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
+ TClonesArray *pRICHrawclust = pRICH->Clusters(chamber);
if (pRICHrawclust == 0) return;
- pRICH->ResetRawClusters();
+ pRICH->ResetClusters();
Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
gAlice->TreeR()->GetEvent(nent-1+cathode-1);
Int_t nrawcl = pRICHrawclust->GetEntriesFast();
- printf ("nrawcl:%d\n",nrawcl);
+ //printf ("nrawcl:%d\n",nrawcl);
if (nrawcl == 0) return;
if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
- iChamber = &(pRICH->Chamber(chamber));
- AliRICHRawCluster *mRaw;
+ iChamber = pRICH->C(chamber);
+ AliRICHcluster *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*)pRICHrawclust->UncheckedAt(iraw);
+ mRaw = (AliRICHcluster*)pRICHrawclust->UncheckedAt(iraw);
fRpoints->AddAt(points,iraw);
points->SetMarkerColor(3);
points->SetMarkerStyle(3);
points->SetHitIndex(-1);
points->SetTrackIndex(-1);
points->SetDigitIndex(-1);
- Float_t vectorLoc[3]={mRaw->fX,6.276,mRaw->fY};
+ Float_t vectorLoc[3]={mRaw->X(),5,mRaw->Y()};
Float_t vectorGlob[3];
iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
}
-}
+}//LoadCoG()
//___________________________________________
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 *pRICH = (AliRICH*)gAlice->GetModule("RICH");
- AliRICHChamber* iChamber;
-
- TClonesArray *pRICHrechits = pRICH->RecHitsAddress(chamber);
- printf ("Chamber:%d has adress:%p\n", chamber, pRICHrechits );
- if (pRICHrechits == 0) return;
-
- //RICH->ResetRecHits();
-
-
- Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
- gAlice->TreeR()->GetEvent(nent-1+cathode-1);
- Int_t nrechits = pRICHrechits->GetEntriesFast();
- printf ("nrechits:%d\n",nrechits);
- if (nrechits == 0) return;
- if (fRecpoints == 0) fRecpoints = new TObjArray(50);
-
- iChamber = &(pRICH->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*)pRICHrechits->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 vectorLoc[3]={mRec->fX,6.276,mRec->fY};
- Float_t vectorGlob[3];
- iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
- points->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
- //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
- //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
- //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
- printf("Generating ellipse %d\n",irec);
- AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->fOmega,mRec->fTheta,mRec->fPhi);
- ellipse->CreatePoints(chamber);
- //ellipse->SetFillStyle(1001);
- ellipse->SetMarkerColor(38);
- ellipse->Draw();
- //marker->SetRefObject((TObject*)points);
- //points->Set3DMarker(0, marker);
- }
+ chamber++;cathode++;
}
//___________________________________________
void AliRICHDisplay::LoadDigits()
ResetPoints();
AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
AliRICHChamber* iChamber;
- AliRICHSegmentation* segmentation;
Int_t nAllDigits=0;
Int_t ich;
+
+ //printf("Entering LoadDigits\n");
+
+ if (gAlice->TreeD())
+ {
- for (ich=0; ich<kNCH; ich++) {
- TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
- if (pRICHdigits == 0) continue;
- gAlice->ResetDigits();
- gAlice->TreeD()->GetEvent(1);
- Int_t ndigits = pRICHdigits->GetEntriesFast();
- nAllDigits+=ndigits;
- }
- 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(1);
- 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 (ich=1; ich<=kNCH; ich++) {
+ TClonesArray *pRICHdigits = pRICH->Digits(ich);
+ if (pRICHdigits == 0) continue;
+ gAlice->ResetDigits();
+ gAlice->TreeD()->GetEvent(0);
+ Int_t ndigits = pRICHdigits->GetEntriesFast();
+ nAllDigits+=ndigits;
+ }
- for (Int_t digit=0;digit<ndigits;digit++) {
- mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
+ if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
+ Int_t counter=0;
+ for (ich=1; ich<=kNCH; ich++) {
+ TClonesArray *pRICHdigits = pRICH->Digits(ich);
+ if (pRICHdigits == 0) continue;
+ gAlice->ResetDigits();
+ gAlice->TreeD()->GetEvent(0);
+ Int_t ndigits = pRICHdigits->GetEntriesFast();
+ if (ndigits == 0) continue;
+ iChamber = pRICH->C(ich);
+ Float_t dpx = AliRICHParam::PadSizeX();
+ Float_t dpy = AliRICHParam::PadSizeY();
+
+
+ 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=(Int_t)mdig->Q();
+ 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 vectorLoc[3]={xpad,6.276,ypad};
+ Float_t vectorLoc[3]={xpad,5,ypad};
Float_t vectorGlob[3];
iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
points->SetParticle(-1);
points->SetTrackIndex(-1);
points->SetDigitIndex(digit);
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);
Float_t theta = iChamber->GetRotMatrix()->GetTheta();
Float_t phi = iChamber->GetRotMatrix()->GetPhi();
marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
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
+}//LoadDigits();
+//__________________________________________________________________________________________________
void AliRICHDisplay::LoadHits(Int_t chamber)
{
// Read hits info and store x,y,z info in arrays fPhits
AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
AliRICHChamber* iChamber;
- iChamber = &(pRICH->Chamber(chamber-1));
- Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
+ iChamber = pRICH->C(chamber-1);
+ Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
Int_t track;
if (fPhits == 0) fPhits = new TObjArray(ntracks);
Int_t nAllHits=0;
for (track=0; track<ntracks;track++) {
gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(track);
+ pRICH->TreeH()->GetEvent(track);
TClonesArray *pRICHhits = pRICH->Hits();
if (pRICHhits == 0) return;
Int_t nhits = pRICHhits->GetEntriesFast();
Int_t npoints=0;
for (track=0; track<ntracks;track++) {
gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(track);
+ 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*)pRICHhits->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(mHit->fTrack);
+ points->SetParticle(mHit->Track());
points->SetHitIndex(hit);
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++;
}
}
-}
-
-//_____________________________________________________________________________
-
+}//LoadHits()
+//__________________________________________________________________________________________________
void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
{
// Read cerenkov hits info and store x,y,z info in array fPCerenkovs
// Loop on all detectors
-
- fChamber=chamber;
- ResetPCerenkovs();
-
- AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
- AliRICHChamber* iChamber;
-
- iChamber = &(pRICH->Chamber(chamber-1));
-
- pRICH->SetTreeAddress();
- Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
-
- if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
- TVector *xp = new TVector(1000);
- TVector *yp = new TVector(1000);
- TVector *zp = new TVector(1000);
- TVector *ptrk = new TVector(1000);
- TVector *phit = new TVector(1000);
- for (Int_t track=0; track<ntracks;track++) {
- gAlice->ResetHits();
- gAlice->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;
- Int_t npoints=0;
-
-
-//Display Cerenkov hits in blue
-
- for (Int_t hit=0;hit<nhits;hit++) {
- mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
- (*xp)(npoints)=mCerenkov->fX;
- (*yp)(npoints)=mCerenkov->fY;
- (*zp)(npoints)=mCerenkov->fZ;
- (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
- (*phit)(npoints)=Float_t(hit);
- npoints++;
- }
- if (npoints == 0) continue;
- cpoints = new AliRICHPoints(npoints);
- for (Int_t p=0;p<npoints;p++) {
- cpoints->SetMarkerColor(kBlue);
- cpoints->SetMarkerStyle(5);
- cpoints->SetMarkerSize(1.);
- cpoints->SetParticle(Int_t((*ptrk)(p)));
- cpoints->SetHitIndex(Int_t((*phit)(p)));
- cpoints->SetTrackIndex(track);
- cpoints->SetDigitIndex(-1);
- cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
- }
- xp->Zero();
- yp->Zero();
- ptrk->Zero();
- phit->Zero();
- fPCerenkovs->AddAt(cpoints,track);
- }
+ chamber++;
}
//_____________________________________________________________________________
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();