]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDDisplay.cxx
remove warning by histogram recreation
[u/mrichter/AliRoot.git] / FMD / AliFMDDisplay.cxx
index c7aee4bd357bbee4ee8e17fd0c9b9ee239acd71a..f9d45bce6fafa926fae33586d92a79945f52a7a4 100644 (file)
@@ -54,6 +54,7 @@
 #include "AliFMDRecPoint.h"     // ALIFMDRECPOINT_H
 #include "AliFMDGeometry.h"    // ALIFMDGEOMETRY_H
 #include "AliFMDParameters.h"  // ALIFMDPARAMETERS_H
+#include "AliFMDRawReader.h"    // ALIFMDRAWREADER_H
 #include <AliESDFMD.h>          // ALIESDFMD_H
 // #include <AliLog.h>
 #include "AliFMDDebug.h" // Better debug macros
@@ -128,7 +129,9 @@ AliFMDDisplay::AliFMDDisplay(Bool_t onlyFMD, const char* gAliceFile)
     fSpec(0), 
     fSpecCut(0),
     fAux(0), 
-    fReturn(kFALSE)
+    fReturn(kFALSE), 
+    fContinous(kFALSE),
+    fTimeout("gApplication->StopIdleing()", 10)
 {
   // Constructor of an FMD display object. 
   // Must be called 
@@ -165,7 +168,7 @@ AliFMDDisplay::MakeCanvas(const char** which)
   Int_t        n  = 0;
   Int_t        j  = 0;
   while (*(p++)) n++;
-  AliInfo(Form("Got %d buttons", n));
+  AliFMDDebug(1, ("Got %d buttons", n));
   if (n <= 0) return;
 
   Double_t yb = 0;
@@ -209,7 +212,7 @@ AliFMDDisplay::MakeCanvas(const char** which)
   p               = which;
   while ((m = *(p++))) {
     fCanvas->cd();
-    AliInfo(Form("Adding button %s", m));
+    AliFMDDebug(1, ("Adding button %s", m));
     TButton* b = new TButton(m, Form("AliFMDDisplay::Instance()->%s()", m),
                             x0, yb, TMath::Min(x0 + dx,.999F), y1);
     b->Draw();
@@ -239,17 +242,17 @@ AliFMDDisplay::ShowOnlyFMD()
   Bool_t hasFMD1 = kFALSE;
   Bool_t hasFMD2 = kFALSE;
   Bool_t hasFMD3 = kFALSE;
-  AliInfo("Getting material FMD_Si$");
+  AliFMDDebug(1, ("Getting material FMD_Si$"));
   TGeoMaterial* si   = gGeoManager->GetMaterial("FMD_Si$");      // kRed 
-  AliInfo("Getting material FMD_Carbon$");
+  AliFMDDebug(1, ("Getting material FMD_Carbon$"));
   TGeoMaterial* c    = gGeoManager->GetMaterial("FMD_Carbon$");  // kGray
-  AliInfo("Getting material FMD_Aluminum$");
+  AliFMDDebug(1, ("Getting material FMD_Aluminum$"));
   TGeoMaterial* al   = gGeoManager->GetMaterial("FMD_Aluminum$");// kGray-2
-  AliInfo("Getting material FMD_Copper$");
+  AliFMDDebug(1, ("Getting material FMD_Copper$"));
   TGeoMaterial* cu   = gGeoManager->GetMaterial("FMD_Copper$");        // kGreen-2
-  AliInfo("Getting material FMD_PCB$");
+  AliFMDDebug(1, ("Getting material FMD_PCB$"));
   TGeoMaterial* pcb  = gGeoManager->GetMaterial("FMD_PCB$");   // kGreen+2
-  AliInfo("Getting material FMD_PCB$");
+  AliFMDDebug(1, ("Getting material FMD_PCB$"));
   TGeoMaterial* chip = gGeoManager->GetMaterial("FMD_Si Chip$");// kGreen+2
   TObjArray     toshow;
   while ((node = static_cast<TGeoNode*>(next()))) {
@@ -405,12 +408,19 @@ AliFMDDisplay::MakeAux()
   if (!fAux) {
     fAux = new TCanvas("aux", "Aux");
     fAux->SetLogy();
+    fAux->SetFillColor(kWhite);
+    fAux->SetBorderMode(0);
+    fAux->SetBorderSize(0);
     Float_t dBin = (range->fHigh - range->fLow) / range->fNbins;
     fSpec = new TH1D("spec", "Spectra", range->fNbins, 
-                    range->fLow-dBin/2, range->fHigh-dBin/2);
+                    range->fLow-dBin/2, range->fHigh+dBin/2);
     fSpecCut = static_cast<TH1*>(fSpec->Clone("specCut"));
+    fSpec->SetXTitle("signal");
+    fSpec->SetYTitle("events");
     fSpec->SetFillColor(2);
     fSpec->SetFillStyle(3001);
+    fSpecCut->SetXTitle("signal");
+    fSpecCut->SetYTitle("events");
     fSpecCut->SetFillColor(4);
     fSpecCut->SetFillStyle(3001);
   }
@@ -430,6 +440,7 @@ AliFMDDisplay::DrawAux()
   if (!fAux) return;
   fAux->cd();
   fAux->Clear();
+  fAux->SetLogy(fSpec->GetMaximum() > 10);
   fSpec->Draw();
   fSpecCut->Draw("same");
   fAux->Modified();
@@ -463,11 +474,11 @@ AliFMDDisplay::Begin(Int_t event)
     Warning("End", "No geometry manager");
     return kFALSE;
   }
-  AliInfo("Drawing geometry");
+  AliFMDDebug(1, ("Drawing geometry"));
   fPad->cd();
   fGeoManager->GetTopVolume()->Draw();
   if (fOnlyFMD) ShowOnlyFMD();
-  AliInfo("Adjusting view");
+  AliFMDDebug(1, ("Adjusting view"));
   Int_t irep;
   if (fPad->GetView()) {
     fPad->GetView()->SetView(-200, -40, 80, irep);
@@ -501,15 +512,17 @@ AliFMDDisplay::Idle()
   // Sends the ROOT loop into the idle loop,
   // so that we can go on. 
   fWait = kTRUE;
+  if (fContinous) fTimeout.Start(10, kTRUE);
   while (fWait) {
     gApplication->StartIdleing();
     gSystem->InnerLoop();
     gApplication->StopIdleing();
+    if (fContinous) break;
   }
-  AliInfo("After idle loop");
+  AliFMDDebug(1, ("After idle loop"));
   if (fMarkers) fMarkers->Delete();
   if (fHits)    fHits->Clear();
-  AliInfo("After clearing caches");
+  AliFMDDebug(1, ("After clearing caches"));
 }
 
 //____________________________________________________________________
@@ -580,7 +593,8 @@ AliFMDDisplay::ChangeFactor()
   // The factor depends on what is 
   // drawn in the AUX canvas
   AliInfo(Form("Noise factor is now %4.1f, pedestal factor %3.1f", 
-              10*fFactor->GetMinimum(),fFactor->GetMaximum()));
+              10 * fFactor->GetMinimum(),
+              (fFactor->GetMaximum()-fFactor->GetMaximum())));
   Redisplay();
 }
 
@@ -724,10 +738,14 @@ AliFMDDisplay::ProcessDigit(AliFMDDigit* digit)
   UShort_t str           =  digit->Strip();
   Double_t ped           =  parm->GetPedestal(det,ring, sec, str);
   Double_t pedW          =  parm->GetPedestalWidth(det,ring, sec, str);
-  Double_t threshold     =  (ped * fFactor->GetMaximum()
-                            + pedW * fFactor->GetMinimum());
+  Double_t threshold     =  ((fFMDReader && fFMDReader->IsZeroSuppressed(det-1)
+                             ? 0 : (ped * (fFactor->GetMaximum()
+                                           -fFactor->GetMinimum())))
+                            + pedW * 10 * fFactor->GetMinimum());
   if (threshold > fgkAdcRange.fHigh) threshold = fgkAdcRange.fHigh;
   Float_t  counts        =  digit->Counts();
+  if (fFMDReader && fFMDReader->IsZeroSuppressed(det-1) && counts > 0)
+    counts += fFMDReader->NoiseFactor(det-1) * pedW;
 
   AliFMDDebug(10, ("FMD%d%c[%02d,%03d] counts %4d threshold %4d", 
                   det, ring, sec, str, Int_t(counts), Int_t(threshold)));