]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONDisplay.cxx
Stored additional energy information
[u/mrichter/AliRoot.git] / MUON / AliMUONDisplay.cxx
index 421029394dc1b632c30b44ae1187feb7def083f0..620e16af9d5303a0215784ba7f02f3d0b9dcf55b 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.3  2000/06/26 14:02:38  morsch
-Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
-
-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$ */
 
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
@@ -109,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>
 
@@ -119,13 +55,14 @@ it is now really the Z position of the chambers.
 #include "AliMUONPoints.h"
 #include "TParticle.h"
 #include "AliMUONTriggerDecision.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"
@@ -143,10 +80,9 @@ AliMUONDisplay::AliMUONDisplay()
     fPoints = 0;
     fPhits = 0;
     fRpoints = 0;
-    fR2points = 0;
-    fCpoints = 0;
     fCanvas = 0;
     fNextCathode = kFALSE; 
+    fColPad = 0;
 }
 
 //_____________________________________________________________________________
@@ -218,15 +154,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
@@ -262,7 +195,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);
@@ -288,11 +220,13 @@ 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; 
 }
 
-AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
+AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display):AliDisplay(display)
 {
 // Dummy copy constructor    
     ;
@@ -315,14 +249,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;
 }
 
 //_____________________________________________________________________________
@@ -338,7 +264,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);
@@ -492,7 +417,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;
@@ -556,8 +481,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();
@@ -568,13 +493,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);
@@ -589,14 +514,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);
@@ -683,32 +608,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)
@@ -777,19 +676,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();
@@ -873,23 +768,29 @@ 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;
 
-    TClonesArray *muonDigits  = pMUON->DigitsAddress(chamber-1);
+    TClonesArray *muonDigits  = pMUON->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);
+//     gAlice->ResetDigits();
+    Int_t nent = 0;
+   if (pMUON->GetLoader()->TreeD()) {
+     nent = (Int_t) pMUON->GetLoader()->TreeD()->GetEntries();
+     printf(" entries %d \n", nent);
+     //     gAlice->TreeD()->GetEvent(nent-2+cathode-1);
+     pMUON->GetMUONData()->GetCathode(cathode-1);
+    }
+    
     Int_t ndigits = muonDigits->GetEntriesFast();
     if (ndigits == 0) return;
     if (fPoints == 0) fPoints = new TObjArray(ndigits);
@@ -898,51 +799,54 @@ 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) 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
        //
@@ -960,20 +864,20 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
         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);
-       }
+
+       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
@@ -985,14 +889,17 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
     AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
     AliMUONChamber*  iChamber;
     
-    TClonesArray *muonRawClusters  = pMUON->RawClustAddress(chamber-1);
+    TClonesArray *muonRawClusters  = pMUON->GetMUONData()->RawClusters(chamber-1);
     if (muonRawClusters == 0) return;
 
-    pMUON->ResetRawClusters();
-
+//     pMUON->ResetRawClusters();
 
-    Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
-    gAlice->TreeR()->GetEvent(nent-2+cathode-1);
+    Int_t nent = 0;
+    if (gAlice->TreeR()) {
+       nent=(Int_t)gAlice->TreeR()->GetEntries();
+       gAlice->TreeR()->GetEvent(0);
+    }
+    
     Int_t nrawcl = muonRawClusters->GetEntriesFast();
     if (nrawcl == 0) return;
     if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
@@ -1018,50 +925,6 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
     }
 }
 //___________________________________________
-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
@@ -1080,11 +943,11 @@ 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++) {
+    Int_t ntracks = (Int_t)pMUON->TreeH()->GetEntries(); //skowron
+    Int_t nthits  = 0;
+    for (track = 0; track < ntracks; track++) {
        gAlice->ResetHits();
-       gAlice->TreeH()->GetEvent(track);
+       pMUON->TreeH()->GetEvent(track);//skowron
        TClonesArray *muonHits  = pMUON->Hits();
        if (muonHits == 0) return;
        nthits += muonHits->GetEntriesFast();
@@ -1093,7 +956,7 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
     Int_t nhold=0;
     for (track=0; track<ntracks;track++) {
        gAlice->ResetHits();
-       gAlice->TreeH()->GetEvent(track);
+       pMUON->TreeH()->GetEvent(track);//skowron
        TClonesArray *muonHits  = pMUON->Hits();
        if (muonHits == 0) return;
        Int_t nhits = muonHits->GetEntriesFast();
@@ -1103,7 +966,7 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
        Int_t npoints=1;
        for (Int_t hit=0;hit<nhits;hit++) {
             mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
-            Int_t nch  = mHit->fChamber;              // chamber number
+            Int_t nch  = mHit->Chamber();              // chamber number
             if (nch != chamber) continue;
            //
            // Retrieve info and set the objects
@@ -1113,11 +976,11 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
             points->SetMarkerColor(kRed);
             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(0,mHit->fX,mHit->fY,zpos);
+           points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
        }
        nhold+=nhits;
     }
@@ -1318,31 +1181,6 @@ void AliMUONDisplay::ResetRpoints()
        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 &)
 {