]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONDisplay.cxx
Added arguments names in function declarations. (I. Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / AliMUONDisplay.cxx
index 1baf2f86b733d346ffa068b4163faccc772376e7..427d5a356b65481037de503cb6ba47b78b8e05d7 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.2  2000/06/15 07:58:48  morsch
-Code from MUON-dev joined
-
-Revision 1.1.2.15  2000/06/14 14:37:53  morsch
-method Trigger() modified
-
-Revision 1.1.2.14  2000/06/09 21:57:09  morsch
-Bug in color scale diplay corrected.
-Most coding rule violations corrected.
-
-Revision 1.1.2.13  2000/05/02 11:57:27  morsch
-Coding rules RN3, RN13, RN17 violations corrected.
-
-Revision 1.1.2.12  2000/04/26 12:27:33  morsch
-Mods for trigger display (P. Crochet):
-- color code versus time for pad hits in trigger chambers
-- call to TriggerDecision corrected
-
-Revision 1.1.2.11  2000/04/26 09:04:46  morsch
-Obsolete cathode correlation related code removed.
-
-Revision 1.1.2.10  2000/04/19 19:43:47  morsch
-change NCH to kNCH as in AliMUON.h
-no more TreeC related methods
-
-Revision 1.1.2.9  2000/03/20 18:10:33  morsch
-Trigger method for "online" trigger decission added
-
-Revision 1.1.2.8  2000/02/23 10:12:01  morsch
-Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
-General clean-up of commented code.
-
-Revision 1.1.2.7  2000/02/17 14:36:55  morsch
-Display of Trigger hits and clusters added.
-Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
-
-Revision 1.1.2.6  2000/02/15 10:19:42  morsch
-Previous log messages included
-
-Revision 1.1.2.5  2000/02/15 10:09:09  morsch
-Log Message added
-
-Revision 1.1.2.4  2000/02/08 09:17:16  gosset    
-One more improvement of MUON display:
-same zoom for both cathode planes in a chamber
-
-Revision 1.1.2.3  2000/02/07 15:37:21  gosset
-A few improvements of the MUON display:
-new buttons to change either chamber or cathode,
-added to the more complicated way
-(right mouse click and explicit filling of chamber and cathode)
-
-Revision 1.1.2.2  2000/02/04 10:57:34  gosset
-Z position of the chambers:
-it was the Z position of the stations;
-it is now really the Z position of the chambers.
-   !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
-   !!!!                   AND "AliMUONChamber::ZPosition"
-   !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
-   !!!!                   AND "AliMUONChamber::Z"                                                           
-*/
+/* $Id$ */
 
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
@@ -106,6 +44,7 @@ it is now really the Z position of the chambers.
 #include <TVirtualX.h>
 #include <TMath.h>
 #include <TMatrix.h>
+#include <TGeometry.h>
 #include <X3DBuffer.h>
 #include <TMarker3DBox.h>
 
@@ -115,17 +54,19 @@ it is now really the Z position of the chambers.
 #include "AliMUONDisplay.h"
 #include "AliMUONPoints.h"
 #include "TParticle.h"
-#include "AliMUONTriggerDecision.h"
+#include "AliMUONGlobalTrigger.h"
+#include "AliHeader.h"
 
 #include "AliMUONHit.h"
 #include "AliMUONPadHit.h"
 #include "AliMUONDigit.h"
 #include "AliMUONRawCluster.h"
 
-#include "AliMUONSegmentation.h"
+#include "AliSegmentation.h"
 #include "AliMUONResponse.h"
 #include "AliMUONChamber.h"
 #include "AliMUONConstants.h"
+#include "AliMC.h"
 // to manage the same zoom on both cathodes
 
 
@@ -140,14 +81,13 @@ AliMUONDisplay::AliMUONDisplay()
     fPoints = 0;
     fPhits = 0;
     fRpoints = 0;
-    fR2points = 0;
-    fCpoints = 0;
     fCanvas = 0;
     fNextCathode = kFALSE; 
+    fColPad = 0;
 }
 
 //_____________________________________________________________________________
-AliMUONDisplay::AliMUONDisplay(Int_t size)
+AliMUONDisplay::AliMUONDisplay(Int_t size, AliLoader * loader)
 {
 // Create an event display object.
 // A canvas named "edisplay" is created with a vertical size in pixels
@@ -215,15 +155,12 @@ AliMUONDisplay::AliMUONDisplay(Int_t size)
     //   fRzone   = 1.e10;
     fDrawClusters  = kTRUE;
     fDrawCoG       = kTRUE;
-    fDrawCoG  = kTRUE;
     fZoomMode      = 1;
     fZooms         = 0;
     fClustersCuts  = 0;
     fPoints        = 0;
     fPhits         = 0;
     fRpoints       = 0;
-    fR2points = 0;
-    fCpoints = 0;
     // Create colors
     CreateColors();
     // Create display canvas
@@ -259,7 +196,6 @@ AliMUONDisplay::AliMUONDisplay(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);
@@ -285,11 +221,19 @@ AliMUONDisplay::AliMUONDisplay(Int_t size)
     AppendPad(); // append display object as last object to force selection
     
     fCanvas->cd();
+    fTrigPad->SetEditable(kFALSE);
+    fButtons->SetEditable(kFALSE);
     fCanvas->Update();
     fNextCathode = kFALSE; 
+    fLoader = loader;
+    // initialize container
+    if(fLoader) 
+      fMUONData = new AliMUONData(fLoader,"MUON","MUON");
+    else
+      fMUONData =0x0;
 }
 
-AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
+AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display):AliDisplay(display)
 {
 // Dummy copy constructor    
     ;
@@ -312,14 +256,6 @@ AliMUONDisplay::~AliMUONDisplay()
     if (fRpoints) fRpoints->Delete();
     delete fRpoints;
     fRpoints     = 0;
-//
-    if (fR2points) fR2points->Delete();
-    delete fR2points;
-    fR2points     = 0;
-//
-    if (fCpoints) fCpoints->Delete();
-    delete fCpoints;
-    fCpoints     = 0;
 }
 
 //_____________________________________________________________________________
@@ -335,7 +271,6 @@ void AliMUONDisplay::DisplayButtons()
 
 
     fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
-    fButtons->SetEditable(kFALSE);
     fButtons->Draw();
     fButtons->SetFillColor(38);
     fButtons->SetBorderSize(2);
@@ -489,7 +424,7 @@ void AliMUONDisplay::DisplayColorScale()
     AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
     AliMUONResponse * response=iChamber->ResponseModel();
     Int_t adcmax=1024;
-    if (response) adcmax= (Int_t) response->MaxAdc();
+    if (response) adcmax = (Int_t) response->MaxAdc();
     
 
     TBox *box;
@@ -553,8 +488,8 @@ void AliMUONDisplay::DrawSegmentation()
     Int_t icat=1;
     
     AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
-    AliMUONChamber*  iChamber;
-    AliMUONSegmentation*  seg;
+    AliMUONChamber*   iChamber;
+    AliSegmentation*  seg;
     iChamber = &(pMUON->Chamber(fChamber));
     seg=iChamber->SegmentationModel(icat);
     Float_t zpos=iChamber->Z();
@@ -565,13 +500,13 @@ void AliMUONDisplay::DrawSegmentation()
        for (Int_t j=0; j<seg->Npy(); j++) {
            Float_t y0;
            y0=j*seg->Dpy()-seg->Dpy()/2.;
-           for (seg->FirstPad(0.,y0,300,0.); 
+           for (seg->FirstPad(0.,y0,0,300,0.); 
                 seg->MorePads();
                 seg->NextPad())
            {
                if (seg->ISector()==0) continue;
-               Float_t x,y;
-               seg->GetPadCxy(seg->Ix(), seg->Iy(), x, y);
+               Float_t x,y,z;
+               seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
                Float_t dpx=seg->Dpx(seg->ISector())/2;
                Float_t dpy=seg->Dpy(seg->ISector())/2;
                marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
@@ -586,14 +521,14 @@ void AliMUONDisplay::DrawSegmentation()
            Float_t x0=j*seg->Dpx();
            Float_t y0=TMath::Sqrt(r*r-x0*x0);
            
-           for (seg->FirstPad(x0,0,0,y0); 
+           for (seg->FirstPad(x0,0,0,0,y0); 
                 seg->MorePads();
                 seg->NextPad())
            {
                if (seg->ISector()==0) continue;
                
-               Float_t x,y;
-               seg->GetPadCxy(seg->Ix(), seg->Iy(), x, y);
+               Float_t x,y,z;
+               seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
                Float_t dpx=seg->Dpx(seg->ISector())/2;
                Float_t dpy=seg->Dpy(seg->ISector())/2;
                marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
@@ -680,32 +615,6 @@ void AliMUONDisplay::DrawCoG()
        pm->Draw();
     }
 }
-void AliMUONDisplay::DrawCoG2()
-{
-//    Draw hits for MUON chambers
-
-    if (!fDrawCoG) return;
-    if (fChamber > 10) return;  
-
-    if (fCathode==1) {
-       LoadCoG2(fChamber,2);
-    } else if (fCathode==2) {
-       LoadCoG2(fChamber,1);
-    }
-
-    Int_t ncog, icog;
-    TObjArray *points;
-    AliMUONPoints *pm;
-    
-    points = R2points();
-    if (!points) return;
-    ncog = points->GetEntriesFast();
-    for (icog=0;icog<ncog;icog++) {
-       pm = (AliMUONPoints*)points->UncheckedAt(icog);
-       if (!pm) continue;
-       pm->Draw();
-    }
-}
 //_____________________________________________________________________________
 
 void AliMUONDisplay::DrawTitle(Option_t *option)
@@ -719,6 +628,13 @@ void AliMUONDisplay::DrawTitle(Option_t *option)
     Float_t dx   = xmax-xmin;
     Float_t dy   = ymax-ymin;
     
+    AliRunLoader * RunLoader;
+    if (fLoader)
+      RunLoader = fLoader->GetRunLoader();
+    else
+      RunLoader = 0x0;
+
+
     if (strlen(option) == 0) {
        TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
 //      title->SetTextSize(0.023932);
@@ -728,12 +644,12 @@ void AliMUONDisplay::DrawTitle(Option_t *option)
        title->Draw();
        char ptitle[100];
        sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
-               gAlice->GetHeader()->GetEvent(),
+               RunLoader->GetEventNumber(),
                gAlice->GetHeader()->GetRun(),
                fChamber,
                fCathode);
        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);
@@ -749,7 +665,7 @@ void AliMUONDisplay::DrawTitle(Option_t *option)
 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
 {
 //    Draw a view of MUON clusters
-    printf("\n Draw View");
+    printf("\n Draw View\n");
     
     gPad->SetCursor(kWatch);
     // gPad->SetFillColor(39);
@@ -774,19 +690,15 @@ void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
     }
 
 // Display MUON Chamber Geometry
-// gAlice->GetGeometry()->Draw("same");
     char nodeName[7];
     sprintf(nodeName,"MUON%d",100+fChamber);
-    printf("\n Node name %s", nodeName);
     
     TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
     if (node1) node1->Draw("same");  
 //add clusters to the pad
     DrawClusters();
-    printf("Node name %s", nodeName);   
     DrawHits();
     DrawCoG();
-    DrawCoG2();
 //     DrawSegmentation();
     // add itself to the list (must be last)
     AppendPad();
@@ -850,7 +762,7 @@ void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
        if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
        if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
        gPad->Range(x0,y0,x1,y1);
-       if (fZooms < kMAXZOOM-1) {
+       if (fZooms < AliMUONConstants::MaxZoom()-1) {
            fZooms++;
            fZoomX0[fZooms] = x0;
            fZoomY0[fZooms] = y0;
@@ -870,23 +782,31 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
 
     if (chamber > 14) return;
     printf(" chamber %d \n",chamber);
-    fChamber=chamber;
-    fCathode=cathode;
+    fChamber = chamber;
+    fCathode = cathode;
     
     ResetPoints();
     
-    AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
+    AliMUON *pMUON  =     (AliMUON*)gAlice->GetModule("MUON");
     AliMUONChamber*       iChamber;
-    AliMUONSegmentation*  segmentation;
+    AliSegmentation*      segmentation;
     AliMUONResponse*      response;
+   
+    GetMUONData()->SetTreeAddress("D");
 
-    TClonesArray *muonDigits  = pMUON->DigitsAddress(chamber-1);
+    TClonesArray *muonDigits  = GetMUONData()->Digits(chamber-1);
     if (muonDigits == 0) return;
 
     gAlice->ResetDigits();
-
-    Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
-    gAlice->TreeD()->GetEvent(nent-2+cathode-1);
+    Int_t nent = 0;
+   if (GetLoader()->TreeD()) {
+     nent = (Int_t) GetLoader()->TreeD()->GetEntries();
+     printf(" entries %d \n", nent);
+     //     gAlice->TreeD()->GetEvent(nent-2+cathode-1);
+     GetMUONData()->GetCathode(cathode-1);
+    }
+    
     Int_t ndigits = muonDigits->GetEntriesFast();
     if (ndigits == 0) return;
     if (fPoints == 0) fPoints = new TObjArray(ndigits);
@@ -895,51 +815,55 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
 
     segmentation = iChamber->SegmentationModel(cathode);
     response     = iChamber->ResponseModel();
-    Float_t zpos=iChamber->Z();  
+    Float_t zpos = iChamber->Z();
+
     AliMUONDigit  *mdig;
-    AliMUONPoints *points = 0;
-    TMarker3DBox *marker=0;
+    AliMUONPoints *points  = 0;
+    TMarker3DBox  *marker  = 0;
     //
     //loop over all digits and store their position
     
-    Int_t npoints=1;
-    Float_t adcmax=1024;
-    if (response) adcmax= response->MaxAdc();
+    Int_t npoints  = 1;
+    Float_t adcmax = 1024;
+    if (response&&chamber<11) adcmax = response->MaxAdc();
 
-    for (Int_t digit=0;digit<ndigits;digit++) {
+    for (Int_t digit = 0; digit < ndigits; digit++) {
         mdig    = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
+       if (mdig->Cathode() != cathode-1) continue;
+       
         //
         // First get all needed parameters
         //
-        Int_t charge=mdig->fSignal;
-        Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
-        Int_t color=261+index;
-       Int_t colorTrigger=2;   
-        if (color>282) color=282;
+        Int_t charge = mdig->Signal();
+        Int_t index  = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
+        Int_t color  = 261+index;
+       Int_t colorTrigger = 2;   
+        if (color > 282) color = 282;
 
        if (chamber > 10) { // trigger chamber 
-           Int_t sumCharge=0;
-           for (Int_t icharge=0; icharge<10; icharge++) {
-               sumCharge=sumCharge+mdig->fTcharges[icharge];
+
+           Int_t sumCharge = 0;
+           for (Int_t icharge = 0; icharge < 10; icharge++) {
+               sumCharge = sumCharge+mdig->TrackCharge(icharge);
            }
-           Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10;
-           if(sumCharge<=10||testCharge>0) {
-               colorTrigger=color; 
+           Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
+           if(sumCharge <= 10 || testCharge > 0) {
+               colorTrigger = color; 
            } else {
-               colorTrigger=5; 
+               colorTrigger = 5; 
            }
        }
 
        // get the center of the pad - add on x and y half of pad size
-       Float_t xpad, ypad;
-       segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
+       Float_t xpad, ypad, zpad;
+       segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
+       
+        Int_t   isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
+        Float_t  dpx = segmentation->Dpx(isec)/2;
+        Float_t  dpy = segmentation->Dpy(isec)/2;
+//
+//     segmentation->Dump();
        
-        Int_t isec=segmentation->Sector(mdig->fPadX, mdig->fPadY);
-        Float_t dpx=segmentation->Dpx(isec)/2;
-        Float_t dpy=segmentation->Dpy(isec)/2;
-       Int_t nPara, offset;
-        segmentation->GetNParallelAndOffset(mdig->fPadX,mdig->fPadY,
-               &nPara,&offset);
        //
        // Then set the objects
        //
@@ -956,21 +880,21 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
         points->SetHitIndex(-1);
         points->SetTrackIndex(-1);
         points->SetDigitIndex(digit);
-        points->SetPoint(0,xpad,ypad,zpos);    
-       for (Int_t imark=0;imark<nPara; imark++)
-       {
-           segmentation->GetPadCxy(mdig->fPadX + imark*offset, mdig->fPadY,xpad, ypad);
-           marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
-           marker->SetLineColor(2);
-           marker->SetFillStyle(1001);
-           marker->SetFillColor(color);
-           marker->SetRefObject((TObject*)points);
-           points->Set3DMarker(imark, marker);
-       }
+        points->SetPoint(0,xpad,ypad,zpos);
+       
+       Int_t lineColor = (zpad-zpos > 0) ? 2:3;
+       marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
+
+           
+       marker->SetLineColor(lineColor);
+       marker->SetFillStyle(1001);
+       marker->SetFillColor(color);
+       marker->SetRefObject((TObject*)points);
+       points->Set3DMarker(0, marker);
     }
 }
 //___________________________________________
-void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
+void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
 {
 // Read raw clusters info and store x,y,z info in arrays fRpoints
 // Loop on all detectors
@@ -982,14 +906,17 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
     AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
     AliMUONChamber*  iChamber;
     
-    TClonesArray *muonRawClusters  = pMUON->RawClustAddress(chamber-1);
-    if (muonRawClusters == 0) return;
-
-    pMUON->ResetRawClusters();
+    GetMUONData()->SetTreeAddress("RC");
+    TClonesArray *muonRawClusters  = GetMUONData()->RawClusters(chamber-1);
 
+    if (muonRawClusters == 0) return;
 
-    Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
-    gAlice->TreeR()->GetEvent(nent-2+cathode-1);
+    Int_t nent = 0;
+    if (GetMUONData()->TreeR()) {
+       nent=(Int_t) GetMUONData()->TreeR()->GetEntries();
+       GetMUONData()->TreeR()->GetEvent(0);
+    }
+    
     Int_t nrawcl = muonRawClusters->GetEntriesFast();
     if (nrawcl == 0) return;
     if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
@@ -1003,7 +930,6 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
     points = new AliMUONPoints(nrawcl);
     for (Int_t iraw=0;iraw<nrawcl;iraw++) {
        mRaw   = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
-       fRpoints->AddAt(points,iraw);
         points->SetMarkerColor(51);
         points->SetMarkerStyle(2);
         points->SetMarkerSize(1.);
@@ -1011,58 +937,16 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
         points->SetHitIndex(-1);
         points->SetTrackIndex(-1);
         points->SetDigitIndex(-1);
-        points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
+        points->SetPoint(iraw,mRaw->GetX(0),mRaw->GetY(0),zpos);
+       fRpoints->AddAt(points,iraw);
+       //      printf("%f and %f and %f\n",mRaw->GetX(0),mRaw->GetY(0),mRaw->GetZ(0));
     }
 }
 //___________________________________________
-void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
-{
-// Read raw clusters info and store x,y,z info in arrays fRpoints
-// Loop on all detectors
-
-    if (chamber > 10) return;
-
-    ResetR2points();
-
-    AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
-    AliMUONChamber*  iChamber;
-    
-    TClonesArray *muonRawClusters  = pMUON->RawClustAddress(chamber-1);
-    if (muonRawClusters == 0) return;
-    
-    pMUON->ResetRawClusters();
-
-    Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
-    gAlice->TreeR()->GetEvent(nent-2+cathode-1);
-    Int_t nrawcl = muonRawClusters->GetEntriesFast();
-    if (nrawcl == 0) return;
-    if (fR2points == 0) fR2points = new TObjArray(nrawcl);
-    
-    iChamber = &(pMUON->Chamber(chamber-1));
-    Float_t zpos=iChamber->Z();  
-    AliMUONRawCluster  *mRaw;
-    AliMUONPoints *points = 0;
-    //
-    //loop over all raw clusters and store their position
-    points = new AliMUONPoints(nrawcl);
-    for (Int_t iraw=0;iraw<nrawcl;iraw++) {
-       mRaw   = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
-       fR2points->AddAt(points,iraw);
-        points->SetMarkerColor(51);
-        points->SetMarkerStyle(4);
-        points->SetMarkerSize(1.3);
-        points->SetParticle(-1);
-        points->SetHitIndex(-1);
-        points->SetTrackIndex(-1);
-        points->SetDigitIndex(-1);
-        points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
-   }
-}
-//___________________________________________
 void AliMUONDisplay::LoadHits(Int_t chamber)
 {
-// Read hits info and store x,y,z info in arrays fPhits
-// Loop on all detectors
+  // Read hits info and store x,y,z info in arrays fPhits
+  // Loop on all detectors
 
     if (chamber > 14) return;
     Int_t track;
@@ -1077,21 +961,24 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
     iChamber = &(pMUON->Chamber(chamber-1));
     Float_t zpos=iChamber->Z();
 
-    Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
-    Int_t nthits=0;
-    for (track=0; track<ntracks;track++) {
-       gAlice->ResetHits();
-       gAlice->TreeH()->GetEvent(track);
-       TClonesArray *muonHits  = pMUON->Hits();
+
+    if (GetMUONData()->TreeH()) {
+      GetMUONData()->SetTreeAddress("H");
+      Int_t ntracks = (Int_t)GetMUONData()->TreeH()->GetEntries(); //skowron
+      Int_t nthits  = 0;
+      for (track = 0; track < ntracks; track++) {
+       GetMUONData()->ResetHits();
+       GetMUONData()->GetTrack(track);//skowron
+       TClonesArray *muonHits  = GetMUONData()->Hits();
        if (muonHits == 0) return;
        nthits += muonHits->GetEntriesFast();
-    } 
-    if (fPhits == 0) fPhits = new TObjArray(nthits);
-    Int_t nhold=0;
-    for (track=0; track<ntracks;track++) {
-       gAlice->ResetHits();
-       gAlice->TreeH()->GetEvent(track);
-       TClonesArray *muonHits  = pMUON->Hits();
+      
+      if (fPhits == 0) fPhits = new TObjArray(nthits);
+      Int_t nhold=0;
+      for (track=0; track<ntracks;track++) {
+       GetMUONData()->ResetHits();
+       GetMUONData()->GetTrack(track);//skowron
+       TClonesArray *muonHits  = GetMUONData()->Hits();
        if (muonHits == 0) return;
        Int_t nhits = muonHits->GetEntriesFast();
        if (nhits == 0) continue;
@@ -1099,24 +986,26 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
        AliMUONPoints *points = 0;
        Int_t npoints=1;
        for (Int_t hit=0;hit<nhits;hit++) {
-            mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
-            Int_t nch  = mHit->fChamber;              // chamber number
-            if (nch != chamber) continue;
-           //
-           // Retrieve info and set the objects
-           //
-           points = new AliMUONPoints(npoints);
-           fPhits->AddAt(points,nhold+hit);
-            points->SetMarkerColor(kRed);
-            points->SetMarkerStyle(5);
-            points->SetMarkerSize(1.);
-            points->SetParticle(mHit->fTrack);
-            points->SetHitIndex(hit);
-            points->SetTrackIndex(track);
-            points->SetDigitIndex(-1);
-           points->SetPoint(0,mHit->fX,mHit->fY,zpos);
+         mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
+         Int_t nch  = mHit->Chamber();              // chamber number
+         if (nch != chamber) continue;
+         //
+         // Retrieve info and set the objects
+         //
+         points = new AliMUONPoints(npoints);
+         fPhits->AddAt(points,nhold+hit);
+         points->SetMarkerColor(kRed);
+         points->SetMarkerStyle(5);
+         points->SetMarkerSize(1.);
+         points->SetParticle(mHit->Track());
+         points->SetHitIndex(hit);
+         points->SetTrackIndex(track);
+         points->SetDigitIndex(-1);
+         points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
+         //        printf("%f and %f and %f\n",mHit->X(),mHit->Y(),mHit->Z());
        }
        nhold+=nhits;
+      }
     }
 }
 
@@ -1188,12 +1077,59 @@ void AliMUONDisplay::NextCathode()
 //_____________________________________________________________________________
 void AliMUONDisplay::Trigger()
 {
-  // returns Trigger Decision for current event
-  AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
-  decision->Trigger(); 
-}
-
 
+  AliMUONGlobalTrigger* globalTrig;
+
+  GetMUONData()->SetTreeAddress("GLT");
+  GetMUONData()->GetTrigger();
+
+  globalTrig =  (AliMUONGlobalTrigger*)GetMUONData()->GlobalTrigger()->UncheckedAt(0);
+  if (globalTrig == 0) return;
+
+  printf("===================================================\n");
+  printf(" Global Trigger output       Low pt  High pt   All\n");
+
+  printf(" number of Single Plus      :\t");
+  printf("%i\t",globalTrig->SinglePlusLpt());
+  printf("%i\t",globalTrig->SinglePlusHpt());
+  printf("%i\t",globalTrig->SinglePlusApt());
+  printf("\n");
+
+  printf(" number of Single Minus     :\t");
+  printf("%i\t",globalTrig->SingleMinusLpt());
+  printf("%i\t",globalTrig->SingleMinusHpt());
+  printf("%i\t",globalTrig->SingleMinusApt());
+  printf("\n");
+
+  printf(" number of Single Undefined :\t"); 
+  printf("%i\t",globalTrig->SingleUndefLpt());
+  printf("%i\t",globalTrig->SingleUndefHpt());
+  printf("%i\t",globalTrig->SingleUndefApt());
+  printf("\n");
+
+  printf(" number of UnlikeSign pair  :\t"); 
+  printf("%i\t",globalTrig->PairUnlikeLpt());
+  printf("%i\t",globalTrig->PairUnlikeHpt());
+  printf("%i\t",globalTrig->PairUnlikeApt());
+  printf("\n");
+
+  printf(" number of LikeSign pair    :\t");  
+  printf("%i\t",globalTrig->PairLikeLpt());
+  printf("%i\t",globalTrig->PairLikeHpt());
+  printf("%i\t",globalTrig->PairLikeApt());
+  printf("\n");
+  printf("===================================================\n");
+  printf("\n");
+  
+
+ //  // returns Trigger Decision for current event
+//   AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(GetLoader(),1);
+
+//   //  AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
+//   AliMUONData* muonData = decision->GetMUONData();
+//   muonData->SetTreeAddress("D");
+//   decision->Trigger(); 
+}
 //_____________________________________________________________________________
 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
 {
@@ -1251,18 +1187,23 @@ void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
 //_____________________________________________________________________________
 void AliMUONDisplay::ShowNextEvent(Int_t delta)
 {
+  AliRunLoader * RunLoader;
+  if (fLoader)
+    RunLoader = fLoader->GetRunLoader();
+  else
+    RunLoader = 0x0;
+    
 //  Display (current event_number + delta)
 //    delta =  1  shown next event
 //    delta = -1 show previous event
     if (delta) {
-       gAlice->Clear();
-       Int_t currentEvent = gAlice->GetHeader()->GetEvent();
-       Int_t newEvent     = currentEvent + delta;
-       gAlice->GetEvent(newEvent);
-       fEvent=newEvent;
-       if (!gAlice->TreeD()) return; 
+      //RunLoader->CleanDetectors();
+      //RunLoader->CleanKinematics();
+      Int_t currentEvent = RunLoader->GetEventNumber();
+      Int_t newEvent     = currentEvent + delta;
+      RunLoader->GetEvent(newEvent);
+      fEvent=newEvent;
     }
-    
     LoadDigits(fChamber, fCathode);
     fPad->cd(); 
     Draw();
@@ -1310,36 +1251,11 @@ void AliMUONDisplay::ResetRpoints()
   // Reset array of points
   //
     if (fRpoints) {
-       fRpoints->Delete();
-       delete fRpoints;
+       fRpoints->Clear();
+       //      delete fRpoints;
        fRpoints = 0;
     }
 }
-//_____________________________________________________________________________
-void AliMUONDisplay::ResetR2points()
-{
-  //
-  // Reset array of points
-  //
-    if (fR2points) {
-       fR2points->Delete();
-       delete fR2points;
-       fR2points = 0;
-    }
-}
-//_____________________________________________________________________________
-void AliMUONDisplay::ResetCpoints()
-{
-    //
-    // Reset array of points
-    //
-  if (fCpoints) {
-      fCpoints->Delete();
-      delete fCpoints;
-      fCpoints = 0;
-  }
-}
-
 
 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
 {