]> 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 a01cb0b43bd9fd47525096c1b51d3bef51fb2762..427d5a356b65481037de503cb6ba47b78b8e05d7 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.17  2001/09/03 14:54:55  gosset
-Corrections for suppressing "segmentation violation" errors
-when using buttons "Chamber +", "Chamber -", "Cathode <>"
-
-Revision 1.16  2001/08/31 08:18:43  jchudoba
-Changes needed to run with Root 3.01
-
-Revision 1.15  2001/05/16 14:57:17  alibrary
-New files for folders and Stack
-
-Revision 1.14  2001/04/05 08:30:48  gosset
-Cleaning: suppression of Cpoints and (R2points + CoG2)
-Correction: TreeR->GetEvent(0) for raw clusters
-
-Revision 1.13  2001/03/30 13:01:50  gosset
-Centroid of raw clusters displayed for each cathode plane
-
-Revision 1.12  2001/03/05 23:50:08  morsch
-Correct access to digit and recpoint data.
-
-Revision 1.11  2001/01/26 21:41:55  morsch
-Use access functions to AliMUONDigit member data.
-
-Revision 1.10  2001/01/25 20:41:56  morsch
-Protect against empty TreeD and TreeR.
-
-Revision 1.9  2001/01/23 18:58:19  hristov
-Initialisation of some pointers
-
-Revision 1.8  2000/10/06 09:09:01  morsch
-Pad colour according to z-position (slats).
-
-Revision 1.7  2000/10/02 21:28:09  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.6  2000/07/03 11:54:57  morsch
-AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
-The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
-
-Revision 1.5  2000/06/28 15:16:35  morsch
-(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
-to allow development of slat-muon chamber simulation and reconstruction code in the MUON
-framework. The changes should have no side effects (mostly dummy arguments).
-(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
-of chambers with overlapping modules (MakePadHits, Disintegration).
-
-Revision 1.4  2000/06/27 09:46:57  morsch
-kMAXZOOM global constant now in AliMUONConstants
-
-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$ */
 
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
@@ -168,7 +54,7 @@ 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"
@@ -180,6 +66,7 @@ it is now really the Z position of the chambers.
 #include "AliMUONResponse.h"
 #include "AliMUONChamber.h"
 #include "AliMUONConstants.h"
+#include "AliMC.h"
 // to manage the same zoom on both cathodes
 
 
@@ -200,7 +87,7 @@ AliMUONDisplay::AliMUONDisplay()
 }
 
 //_____________________________________________________________________________
-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
@@ -338,9 +225,15 @@ AliMUONDisplay::AliMUONDisplay(Int_t size)
     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    
     ;
@@ -735,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);
@@ -744,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);
@@ -765,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);
@@ -891,18 +791,20 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
     AliMUONChamber*       iChamber;
     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();
+    gAlice->ResetDigits();
     Int_t nent = 0;
  
-   if (gAlice->TreeD()) {
-     nent = (Int_t) gAlice->TreeD()->GetEntries();
+   if (GetLoader()->TreeD()) {
+     nent = (Int_t) GetLoader()->TreeD()->GetEntries();
      printf(" entries %d \n", nent);
      //     gAlice->TreeD()->GetEvent(nent-2+cathode-1);
-     gAlice->TreeD()->GetEvent(cathode-1);
+     GetMUONData()->GetCathode(cathode-1);
     }
     
     Int_t ndigits = muonDigits->GetEntriesFast();
@@ -923,16 +825,12 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
     
     Int_t npoints  = 1;
     Float_t adcmax = 1024;
-    if (response) adcmax = response->MaxAdc();
+    if (response&&chamber<11) adcmax = response->MaxAdc();
 
     for (Int_t digit = 0; digit < ndigits; digit++) {
         mdig    = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
        if (mdig->Cathode() != cathode-1) continue;
-
-// debug hit numbers
-//     printf("  Chamber, cathode, digit, hit: %3d, %3d, %3d, %3d \n",
-//            chamber,cathode,digit,mdig->Hit());
-
+       
         //
         // First get all needed parameters
         //
@@ -943,6 +841,7 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
         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->TrackCharge(icharge);
@@ -981,8 +880,8 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
         points->SetHitIndex(-1);
         points->SetTrackIndex(-1);
         points->SetDigitIndex(digit);
-        points->SetPoint(0,xpad,ypad,zpos);    
-
+        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);
 
@@ -995,7 +894,7 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
     }
 }
 //___________________________________________
-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
@@ -1007,15 +906,15 @@ 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;
+    GetMUONData()->SetTreeAddress("RC");
+    TClonesArray *muonRawClusters  = GetMUONData()->RawClusters(chamber-1);
 
-//     pMUON->ResetRawClusters();
+    if (muonRawClusters == 0) return;
 
     Int_t nent = 0;
-    if (gAlice->TreeR()) {
-       nent=(Int_t)gAlice->TreeR()->GetEntries();
-       gAlice->TreeR()->GetEvent(0);
+    if (GetMUONData()->TreeR()) {
+       nent=(Int_t) GetMUONData()->TreeR()->GetEntries();
+       GetMUONData()->TreeR()->GetEvent(0);
     }
     
     Int_t nrawcl = muonRawClusters->GetEntriesFast();
@@ -1031,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.);
@@ -1039,14 +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::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;
@@ -1061,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;
@@ -1083,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->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(2.); // JCH change
-            points->SetParticle(mHit->Track());
-            points->SetHitIndex(hit);
-            points->SetTrackIndex(track);
-            points->SetDigitIndex(-1);
-           points->SetPoint(0,mHit->X(),mHit->Y(),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;
+      }
     }
 }
 
@@ -1172,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)
 {
@@ -1235,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();
@@ -1294,8 +1251,8 @@ void AliMUONDisplay::ResetRpoints()
   // Reset array of points
   //
     if (fRpoints) {
-       fRpoints->Delete();
-       delete fRpoints;
+       fRpoints->Clear();
+       //      delete fRpoints;
        fRpoints = 0;
     }
 }