]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHDisplay.cxx
Minor corrections on the display (adc counts readable, ...).
[u/mrichter/AliRoot.git] / RICH / AliRICHDisplay.cxx
index 38824b00cf7c74bb9b7a6d1e65cddc25a3abd91f..499f9e16f2a15f646d3be4479b1d6e0a54c9ab9d 100644 (file)
 
 /*
   $Log$
+  Revision 1.17  2001/10/23 13:03:35  hristov
+  The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba)
+
+  Revision 1.16  2001/10/21 18:31:24  hristov
+  Several pointers were set to zero in the default constructors to avoid memory management problems
+
+  Revision 1.15  2001/10/09 07:34:09  hristov
+  Modifications needed by Root.03.01.06 (J.Chudoba)
+
+  Revision 1.14  2001/05/16 14:57:20  alibrary
+  New files for folders and Stack
+
+  Revision 1.13  2001/05/10 12:35:16  jbarbosa
+  Removed hit display, added rec. ring properties.
+
+  Revision 1.12  2001/03/14 18:15:03  jbarbosa
+  Changes to adapt to new IO.
+  Removed verbose output.
+
+  Revision 1.11  2001/02/27 15:21:34  jbarbosa
+  Transition to SDigits.
+
   Revision 1.10  2001/02/13 20:18:48  jbarbosa
   Corrected some more positioning of points. Changes in LoadDigits to accomodate the new IO.
 
 #include "AliRICHConst.h"
 #include "AliRICHDisplay.h"
 #include "AliRICHPoints.h"
+#include "AliHeader.h"
 
 #include "AliRICHHit.h"
 #include "AliRICHCerenkov.h"
@@ -106,7 +129,7 @@ AliRICHDisplay::AliRICHDisplay()
 { 
 
 // default constructor
-
+    fColPad = 0;
     fPoints = 0;
     fPhits = 0;
     fPCerenkovs = 0;
@@ -177,8 +200,10 @@ AliRICHDisplay::AliRICHDisplay(Int_t size)
     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;
@@ -231,7 +256,6 @@ AliRICHDisplay::AliRICHDisplay(Int_t size)
     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);
@@ -256,6 +280,8 @@ AliRICHDisplay::AliRICHDisplay(Int_t size)
     button->Draw();
     AppendPad(); // append display object as last object to force selection
     
+    fTrigPad->SetEditable(kFALSE);
+    fButtons->SetEditable(kFALSE);
     fCanvas->cd();
     fCanvas->Update();
 }
@@ -299,7 +325,6 @@ void AliRICHDisplay::DisplayButtons()
     
     
     fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
-    fButtons->SetEditable(kFALSE);
     fButtons->Draw();
     fButtons->SetFillColor(38);
     fButtons->SetBorderSize(2);
@@ -433,7 +458,7 @@ void AliRICHDisplay::DisplayColorScale()
     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;
@@ -530,7 +555,7 @@ void AliRICHDisplay::DrawRecHits()
     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;
@@ -679,12 +704,15 @@ void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
    
    //add clusters to the pad
    DrawClusters();
-   DrawHits();
-//   DrawCerenkovs();
-   printf("Calling DrawCoG\n");
-   DrawCoG();
-   printf("Calling DrawRecHits\n");
-   DrawRecHits();
+   //DrawHits();
+   //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);*/
    
@@ -708,7 +736,8 @@ void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
    
    if (px == 0 && py == 0) { //when called by sliders
        if (event == kButton1Up) {
-          Draw();
+        printf("Drawing event %d\n",event);
+        Draw();
        }
        return;
    }
@@ -770,14 +799,14 @@ void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
 
    if (chamber > 6) return;
 
-   printf("Entering LoadCoG\n");
+   //printf("Entering LoadCoG\n");
 
 
    AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
    AliRICHChamber*  iChamber;
 
    TClonesArray *pRICHrawclust  = pRICH->RawClustAddress(chamber);
-   printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
+   //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
    if (pRICHrawclust == 0) return;
 
    pRICH->ResetRawClusters();
@@ -786,7 +815,7 @@ void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
    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);
    
@@ -806,7 +835,7 @@ void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
        points->SetHitIndex(-1);
        points->SetTrackIndex(-1);
        points->SetDigitIndex(-1);
-       Float_t  vectorLoc[3]={mRaw->fX,-5,mRaw->fY};
+       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]);
@@ -820,14 +849,14 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
 
    if (chamber > 6) return;
 
-   printf("Entering LoadRecHits\n");
+   ///printf("Entering LoadRecHits\n");
 
 
    AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
    AliRICHChamber*  iChamber;
 
    TClonesArray *pRICHrechits1D  = pRICH->RecHitsAddress1D(chamber);
-   printf ("Chamber:%d\n", chamber);
+   //printf ("Chamber:%d\n", chamber);
    if (pRICHrechits1D != 0)
      {
 
@@ -837,7 +866,7 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
        Int_t nent1D=(Int_t)gAlice->TreeR()->GetEntries();
        gAlice->TreeR()->GetEvent(nent1D-1+cathode-1);
        Int_t nrechits1D = pRICHrechits1D->GetEntriesFast();
-       printf ("nrechits1D:%d\n",nrechits1D);
+       //printf ("nrechits1D:%d\n",nrechits1D);
        if (nrechits1D != 0)
         {
           if (fRecpoints == 0) fRecpoints = new TObjArray(50);
@@ -855,20 +884,22 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
             fRecpoints->AddAt(points1D,irec);
             points1D->SetMarkerColor(38);
             points1D->SetMarkerStyle(8);
-            points1D->SetMarkerSize(1.);
+            points1D->SetMarkerSize(.5);
             points1D->SetParticle(-1);
             points1D->SetHitIndex(-1);
             points1D->SetTrackIndex(-1);
             points1D->SetDigitIndex(-1);
-            Float_t  vectorLoc[3]={mRec1D->fX,-5,mRec1D->fY};
+            Float_t  vectorLoc[3]={mRec1D->fX,5,mRec1D->fY};
             Float_t  vectorGlob[3];
             iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
             points1D->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);
+            //printf("Generating ellipse %d\n",irec);
             AliRICHEllipse *ellipse=new AliRICHEllipse(mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta,mRec1D->fPhi,mRec1D->fEmissPoint);
+            printf("Ring at x:%f, y:%f - Omega:%f rad, theta:%3.1f deg, phi:%3.1f deg\n",mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta*180/TMath::Pi(),mRec1D->fPhi*180/TMath::Pi());
+            printf("fEmissPoint:%f\n",mRec1D->fEmissPoint);
             ellipse->CerenkovRingDrawing(chamber,irec);
             //ellipse->SetFillStyle(1001);
             ellipse->SetMarkerColor(38);
@@ -880,7 +911,7 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
      }
 
    TClonesArray *pRICHrechits3D  = pRICH->RecHitsAddress3D(chamber);
-   printf ("Chamber:%d\n", chamber);
+   //printf ("Chamber:%d\n", chamber);
    if (pRICHrechits3D != 0)
      {
        
@@ -890,7 +921,7 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
        Int_t nent3D=(Int_t)gAlice->TreeR()->GetEntries();
        gAlice->TreeR()->GetEvent(nent3D-1+cathode-1);
        Int_t nrechits3D = pRICHrechits3D->GetEntriesFast();
-       printf ("nrechits3D:%d\n",nrechits3D);
+       //printf ("nrechits3D:%d\n",nrechits3D);
        if (nrechits3D != 0)
         {
           if (fRecpoints == 0) fRecpoints = new TObjArray(50);
@@ -913,18 +944,22 @@ void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
             points3D->SetHitIndex(-1);
             points3D->SetTrackIndex(-1);
             points3D->SetDigitIndex(-1);
-            Float_t  vectorLoc[3]={mRec3D->fX,-5,mRec3D->fY};
+            Float_t  vectorLoc[3]={mRec3D->fX,5,mRec3D->fY};
             Float_t  vectorGlob[3];
             iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
             points3D->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);
+            //printf("Generating ellipse %d\n",irec);
             AliRICHEllipse *ellipse=new AliRICHEllipse(mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta,mRec3D->fPhi,0.75);
-            ellipse->CerenkovRingDrawing(chamber,irec);
+            printf("Ring at x:%f, y:%f - Omega:%f rad, theta:%3.1f deg, phi:%3.1f deg\n",mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta*180/TMath::Pi(),mRec3D->fPhi*180/TMath::Pi());
+            //ellipse->CerenkovRingDrawing(chamber,irec);
             //ellipse->SetFillStyle(1001);
+            ellipse->CreatePoints(chamber);
+            ellipse->SetMarkerStyle(7);
             ellipse->SetMarkerColor(42);
+            ellipse->SetMarkerSize(1);
             ellipse->Draw();
             //marker->SetRefObject((TObject*)points3D);
             //points3D->Set3DMarker(0, marker); 
@@ -945,19 +980,19 @@ void AliRICHDisplay::LoadDigits()
    Int_t nAllDigits=0;
    Int_t ich;
 
-   printf("Entering LoadDigits\n");
+   //printf("Entering LoadDigits\n");
 
    if (gAlice->TreeD())
      {
    
        for (ich=0; ich<kNCH; ich++) {
         TClonesArray *pRICHdigits  = pRICH->DigitsAddress(ich);
-        printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
+        //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
         if (pRICHdigits == 0) continue;
         gAlice->ResetDigits();
-        gAlice->TreeD()->GetEvent(1);
+        gAlice->TreeD()->GetEvent(0);
         Int_t ndigits = pRICHdigits->GetEntriesFast();
-        printf("ndigits:%d\n",ndigits);
+        //printf("ndigits:%d\n",ndigits);
         nAllDigits+=ndigits;
        }
        
@@ -967,7 +1002,7 @@ void AliRICHDisplay::LoadDigits()
         TClonesArray *pRICHdigits  = pRICH->DigitsAddress(ich);
         if (pRICHdigits == 0) continue;
         gAlice->ResetDigits();
-        gAlice->TreeD()->GetEvent(1);
+        gAlice->TreeD()->GetEvent(0);
         Int_t ndigits = pRICHdigits->GetEntriesFast();
         if (ndigits == 0) continue;
         iChamber = &(pRICH->Chamber(ich));
@@ -989,7 +1024,7 @@ void AliRICHDisplay::LoadDigits()
           points = new AliRICHPoints(npoints);
           fPoints->AddAt(points,counter);
           counter++;
-          Int_t charge=mdig->fSignal;
+          Int_t charge=mdig->Signal();
           Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
           Int_t color=701+index;
           if (color>722) color=722;
@@ -997,8 +1032,8 @@ void AliRICHDisplay::LoadDigits()
           points->SetMarkerStyle(21);
           points->SetMarkerSize(0.5);
           Float_t xpad, ypad, zpad;
-          segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
-          Float_t vectorLoc[3]={xpad,-5,ypad};
+          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);
@@ -1006,8 +1041,9 @@ void AliRICHDisplay::LoadDigits()
           points->SetTrackIndex(-1);
           points->SetDigitIndex(digit);
           points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
+          //printf("Y position (digit): %f\n", vectorGlob[1]);
           
-          segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
+          segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
           Float_t theta = iChamber->GetRotMatrix()->GetTheta();
           Float_t phi   = iChamber->GetRotMatrix()->GetPhi();     
           marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
@@ -1087,6 +1123,7 @@ void AliRICHDisplay::LoadHits(Int_t chamber)
             points->SetTrackIndex(track);
             points->SetDigitIndex(-1);
             points->SetPoint(hit,mHit->X(), mHit->Y(), mHit->Z());
+           //printf("Y position: %f\n", mHit->Y());
            npoints++;
        }
     }
@@ -1197,7 +1234,7 @@ void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
     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();