]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDDisplay.cxx
Changed call to TClonesArray::GetEntries() to TClonesArray::GetEntriesFast() for...
[u/mrichter/AliRoot.git] / FMD / AliFMDDisplay.cxx
index 017fd7b0a667c9ce9fab10f19c95b1c03e3729d1..21fb81ed865cca811792a1157441834cf3a46ebd 100644 (file)
@@ -29,6 +29,7 @@
 // Latest changes by Christian Holm Christensen
 //
 
+#include <TSystem.h>
 #include <TApplication.h>
 #include <TButton.h>
 #include <TCanvas.h>
@@ -50,7 +51,8 @@
 #include "AliFMDGeometry.h"    // ALIFMDGEOMETRY_H
 #include "AliFMDParameters.h"  // ALIFMDPARAMETERS_H
 #include <AliESDFMD.h>          // ALIESDFMD_H
-#include <AliLog.h>
+// #include <AliLog.h>
+#include "AliFMDDebug.h" // Better debug macros
 
 //____________________________________________________________________
 ClassImp(AliFMDDisplay)
@@ -66,12 +68,17 @@ AliFMDDisplay*
 AliFMDDisplay::Instance()
 {
   // Return static instance 
+  // If the instance does not exist
+  // it is not created!
   return fgInstance;
 }
 
 //____________________________________________________________________
 AliFMDDisplay::~AliFMDDisplay()
 {
+  // Destructor. 
+  // Cleans 
+  // up 
   if (fMarkers) {
     fMarkers->Delete();
     delete fMarkers;
@@ -94,6 +101,7 @@ AliFMDDisplay::AliFMDDisplay(Bool_t onlyFMD, const char* gAliceFile)
     fHits(0),
     fCanvas(0), 
     fPad(0), 
+    fButtons(0),
     fSlider(0),
     fZoomMode(kFALSE),
     fX0(0),
@@ -107,9 +115,14 @@ AliFMDDisplay::AliFMDDisplay(Bool_t onlyFMD, const char* gAliceFile)
     fOldXPixel(0),
     fOldYPixel(0),
     fLineDrawn(0),
-    fOnlyFMD(onlyFMD)
+    fOnlyFMD(onlyFMD),
+    fSpec(0), 
+    fSpecCut(0),
+    fAux(0)
 {
   // Constructor of an FMD display object. 
+  // Must be called 
+  // before Instance 
   AddLoad(kGeometry);
   if (fgInstance) delete fgInstance;
   fgInstance = this;
@@ -121,6 +134,9 @@ AliFMDDisplay::AliFMDDisplay(Bool_t onlyFMD, const char* gAliceFile)
 void           
 AliFMDDisplay::MakeCanvas(const char** which)
 {
+  // Make a canvas 
+  // Parameters: 
+  //   which   Which button to put up. 
   gStyle->SetPalette(1);
   Double_t y1 = .10;
   Int_t    w  = 700;
@@ -168,6 +184,9 @@ AliFMDDisplay::MakeCanvas(const char** which)
 void           
 AliFMDDisplay::ShowOnlyFMD()
 {
+  // Show only the FMD 
+  // Do not show 
+  // other volumes 
   if (!fGeoManager) return;
   static bool once = false;
   if (once) return;
@@ -221,7 +240,10 @@ AliFMDDisplay::ShowOnlyFMD()
 void           
 AliFMDDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py) 
 {
-  // AliInfo(Form("Event %d, at (%d,%d)", px, py));
+  // Execute an event on canvas 
+  // Parameters: 
+  //   event   What happened
+  //   px, py  Pixel coordinates 
   if (px == 0 && py == 0) return;
   if (!fZoomMode && fPad->GetView()) {
     fPad->GetView()->ExecuteRotateView(event, px, py);
@@ -264,7 +286,9 @@ AliFMDDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Int_t          
 AliFMDDisplay::DistancetoPrimitive(Int_t px, Int_t) 
 {
-  // AliInfo(Form("@ (%d,%d)", px, py));
+  // Calculate the distance from point to 
+  // something in the canvas. 
+  // Depends on the zoom mode. 
   fPad->SetCursor(kCross);
   Float_t xmin = fPad->GetX1();
   Float_t xmax = fPad->GetX2();
@@ -277,7 +301,9 @@ AliFMDDisplay::DistancetoPrimitive(Int_t px, Int_t)
 Bool_t 
 AliFMDDisplay::Init()
 {
-  // Initialize.  GEt transforms and such, 
+  // Initialize.  GEt transforms and such,
+  // so that we can draw thins properly 
+  // Returns true on success 
   if (!AliFMDInput::Init()) return kFALSE;
   AliFMDGeometry* geom = AliFMDGeometry::Instance();
   geom->Init();
@@ -296,6 +322,9 @@ AliFMDDisplay::Init()
 void
 AliFMDDisplay::MakeAux()
 {
+  // MAke the aux canvas 
+  // This is used to display spectra
+  // etc, 
   if ((TESTBIT(fTreeMask, kESD) || 
        TESTBIT(fTreeMask, kDigits) || 
        TESTBIT(fTreeMask, kRaw))) {
@@ -323,6 +352,9 @@ AliFMDDisplay::MakeAux()
 void
 AliFMDDisplay::DrawAux()
 {
+  // Draw in the Aux the canvas 
+  // For example draw the spectra 
+  // or such stuff 
   if (!fAux) return;
   fAux->cd();
   fAux->Clear();
@@ -338,6 +370,8 @@ Bool_t
 AliFMDDisplay::Begin(Int_t event) 
 {
   // Begin of event.  Make canvas is not already done 
+  // Parameters: 
+  //   event   The event number 
   if (!fCanvas) {
     const char* m[] = { "Continue", "Zoom", "Pick", "Redisplay", 0 }; 
     MakeCanvas(m);
@@ -369,6 +403,9 @@ AliFMDDisplay::Begin(Int_t event)
 void
 AliFMDDisplay::AtEnd() 
 {
+  // Called at of the event. 
+  // Draw stuff. 
+  // Draw spectrum. 
   fPad->cd();
   fMarkers->Draw();
   fPad->cd();
@@ -381,6 +418,9 @@ AliFMDDisplay::AtEnd()
 void
 AliFMDDisplay::Idle() 
 {
+  // Idle loop. 
+  // Sends the ROOT loop into the idle loop,
+  // so that we can go on. 
   fWait = kTRUE;
   while (fWait) {
     gApplication->StartIdleing();
@@ -407,7 +447,9 @@ AliFMDDisplay::End()
 Int_t
 AliFMDDisplay::LookupColor(Float_t x, Float_t max) const
 {
-  // Look-up color 
+  // Look-up color.  
+  // Get a colour from the  current palette depending 
+  // on the ratio x/max 
   Int_t idx = Int_t(x / max * gStyle->GetNumberOfColors());
   return gStyle->GetColorPalette(idx);
 }
@@ -416,6 +458,9 @@ AliFMDDisplay::LookupColor(Float_t x, Float_t max) const
 void
 AliFMDDisplay::ChangeCut() 
 {
+  // Change the cut on the slider. 
+  // The factor depends on what is 
+  // drawn in the AUX canvas
   fMultCut        = fSlider->GetMinimum() * 10;
   fPedestalFactor = fSlider->GetMinimum() * 10;
   AliInfo(Form("Multiplicity cut: %7.5f, Pedestal factor: %7.4f (%6.5f)", 
@@ -427,6 +472,9 @@ AliFMDDisplay::ChangeCut()
 void
 AliFMDDisplay::Redisplay()
 {
+  // Redisplay stuff. 
+  // Redraw markers, hits, 
+  // spectra 
   if (fMarkers) fMarkers->Delete();
   if (fHits)    fHits->Clear();
   if (fSpec)    fSpec->Reset();
@@ -470,7 +518,9 @@ AliFMDDisplay::AddMarker(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
 Bool_t 
 AliFMDDisplay::ProcessHit(AliFMDHit* hit, TParticle* /* p */) 
 {
-  // Process a hit 
+  // Process a hit. 
+  // Parameters: 
+  //   hit   Hit data
   if (!hit) { AliError("No hit");   return kFALSE; }
   // if (!p)   { AliError("No track"); return kFALSE; }
 
@@ -494,6 +544,8 @@ Bool_t
 AliFMDDisplay::ProcessDigit(AliFMDDigit* digit)
 {
   // Process a digit 
+  // Parameters: 
+  //   digit Digit information 
   if (!digit) { AliError("No digit");   return kFALSE; }
 
   AliFMDParameters* parm = AliFMDParameters::Instance();
@@ -505,7 +557,7 @@ AliFMDDisplay::ProcessDigit(AliFMDDigit* digit)
   Double_t pedW          =  parm->GetPedestalWidth(det,ring, sec, str);
   Double_t threshold     =  ped + fPedestalFactor * pedW;
   Float_t  counts        =  digit->Counts();
-  AliDebug(10, Form("FMD%d%c[%2d,%3d] ADC: %d > %d (=%4.2f+%4.2f*%4.2f)", 
+  AliFMDDebug(10, ("FMD%d%c[%2d,%3d] ADC: %d > %d (=%4.2f+%4.2f*%4.2f)", 
                    digit->Detector(), digit->Ring(), digit->Sector(), 
                    digit->Strip(), Int_t(counts), Int_t(threshold), 
                    ped, fPedestalFactor, pedW));
@@ -523,6 +575,8 @@ Bool_t
 AliFMDDisplay::ProcessRaw(AliFMDDigit* digit)
 {
   // PRocess raw data 
+  // Parameters: 
+  //   digit Digit information 
   return ProcessDigit(digit);
 }
 
@@ -531,6 +585,8 @@ Bool_t
 AliFMDDisplay::ProcessRecPoint(AliFMDRecPoint* recpoint)
 {
   // Process reconstructed point 
+  // Parameters: 
+  //  recpoint  Reconstructed multiplicity/energy
   if (!recpoint) { AliError("No recpoint");   return kFALSE; }
   if (recpoint->Particles() < fMultCut) return kTRUE;
   if (fHits) fHits->Add(recpoint);
@@ -544,6 +600,10 @@ Bool_t
 AliFMDDisplay::ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
                          Float_t, Float_t mult)
 {
+  // Process data from ESD 
+  // Parameters 
+  //   det,rng,sec,str   Detector coordinates. 
+  //   mult              Multiplicity. 
   Double_t cmult = mult;
   if (fSpec) fSpec->Fill(cmult);
   if (cmult < fMultCut || cmult == AliESDFMD::kInvalidMult) return kTRUE;