]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix some warnings.
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Oct 2008 08:04:44 +0000 (08:04 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Oct 2008 08:04:44 +0000 (08:04 +0000)
Added AliFMDSpectraDisplay (online monitor).

13 files changed:
FMD/AliFMDAltroMapping.h
FMD/AliFMDDisplay.cxx
FMD/AliFMDGeometryBuilder.cxx
FMD/AliFMDInput.cxx
FMD/AliFMDPattern.cxx
FMD/AliFMDPedestalDA.cxx
FMD/AliFMDRawReader.cxx
FMD/AliFMDRawStream.cxx
FMD/AliFMDSpectraDisplay.cxx [new file with mode: 0644]
FMD/AliFMDSpectraDisplay.h [new file with mode: 0644]
FMD/FMDutilLinkDef.h
FMD/libFMDutil.pkg
FMD/scripts/SpectraMonitor.C

index b7a2a755eb5d1aed12d7ba5fa52cf65dba763258..272f35c2678ba57b4026149af1ede311db5f1957 100644 (file)
@@ -59,7 +59,10 @@ public:
   /** Return detector number corresponding to given DDL number 
       @param ddl DDL number 
       @return Detector number */ 
-  Short_t DDL2Detector(UInt_t ddl) const { return (ddl<=2 ? ddl + 1 : -1); }
+  Short_t DDL2Detector(UInt_t ddl) const 
+  { 
+    return (ddl<=2 ? Short_t(ddl + 1) : -1); 
+  }
   /** Return the ring identifier corresponding to a board number 
       @param board Board number 
       @return Ring identifier */ 
index fac680a8da7715fc24856fb1ebc8d0a441fe3dd7..26b466d64ab9ccafa4fbe642a88e59011f15c1b1 100644 (file)
@@ -440,6 +440,7 @@ AliFMDDisplay::DrawAux()
   if (!fAux) return;
   fAux->cd();
   fAux->Clear();
+  fAux->SetLogy(fSpec->GetMaximum() > 10);
   fSpec->Draw();
   fSpecCut->Draw("same");
   fAux->Modified();
@@ -592,7 +593,7 @@ 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", 
-              fFactor->GetMinimum(),
+              10 * fFactor->GetMinimum(),
               (fFactor->GetMaximum()-fFactor->GetMaximum())));
   Redisplay();
 }
@@ -737,13 +738,13 @@ 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     =  (fFMDReader->IsZeroSuppressed(det-1) ? 
+  Double_t threshold     =  ((fFMDReader->IsZeroSuppressed(det-1) ? 
                             0 : (ped * (fFactor->GetMaximum()
-                                        -fFactor->GetMinimum())
-                                 + pedW * fFactor->GetMinimum()));
+                                        -fFactor->GetMinimum())))
+                            + pedW * 10 * fFactor->GetMinimum());
   if (threshold > fgkAdcRange.fHigh) threshold = fgkAdcRange.fHigh;
   Float_t  counts        =  digit->Counts();
-  if (fFMDReader->IsZeroSuppressed(det-1))
+  if (fFMDReader->IsZeroSuppressed(det-1) && counts > 0)
     counts += fFMDReader->NoiseFactor(det-1) * pedW;
 
   AliFMDDebug(10, ("FMD%d%c[%02d,%03d] counts %4d threshold %4d", 
index 6423586c9bc1724e8794f3ea190370995c80b63c..eed735b2d8ea8155900dff003c255d09c0fe4105 100644 (file)
@@ -949,9 +949,10 @@ AliFMDGeometryBuilder::FMD3Geometry(AliFMD3* fmd3,
   // Fiducial holes 
   const TObjArray& fiducialHoles  = fmd3->FiducialHoles();
   double           fiducialRadius = fmd3->GetFiducialRadius();
-  TGeoTube*        fiducialShape  = new TGeoTube("FMD3_fiducial_hole", 0, 
-                                                fiducialRadius, 
-                                                flangeDepth+.1);
+#if 0
+  TGeoTube*        fiducialShape  = 
+#endif
+    new TGeoTube("FMD3_fiducial_hole", 0, fiducialRadius, flangeDepth+.1);
   Int_t            nFiducialHoles = fiducialHoles.GetEntriesFast();
   double           flangeAngle    = TMath::Pi() / 4;
   double           flangeX        = r5->Y()+flangeLength;
@@ -961,8 +962,6 @@ AliFMDGeometryBuilder::FMD3Geometry(AliFMD3* fmd3,
 #if 0// For debugging geometry 
   TGeoVolume* fiducialVolume = new TGeoVolume("FMD3_fiducial", fiducialShape);
   fiducialVolume->SetLineColor(kGreen);
-#else
-  (void*)fiducialShape;
 #endif
   for (Int_t i = 0; i < nFiducialHoles; i++) { 
     TVector2&        v  =  *(static_cast<TVector2*>(fiducialHoles.At(i)));
@@ -1016,11 +1015,9 @@ AliFMDGeometryBuilder::FMD3Geometry(AliFMD3* fmd3,
                     - 0.033 * TMath::Sin(holeA));
   Double_t plateX = (fmd3->ConeR(-plateZ + fmd3->GetInnerZ()+fmd3->GetNoseZ()) 
                     - 0.033 * TMath::Cos(holeA));
-  TGeoTrd1* holeShape = new TGeoTrd1("FMD3_cone_hole", 
-                                    holeLW, holeHW, holeD, holeL);
+  new TGeoTrd1("FMD3_cone_hole", holeLW, holeHW, holeD, holeL);
   TGeoTrd1* plateShape = new TGeoTrd1("FMD3_cooling_plate", 
                                      holeLW, holeHW, .033, holeL);
-  (void*)holeShape;
   TGeoRotation* holeRot = new TGeoRotation();
   holeRot->SetName("FMD3_cone_hole_rotation");
   holeRot->RotateZ(90);
index 4496982720aa754bdee0b3cedfe832d37bcd167f..fc803ed7a37143c1c53efbea1d2dbdf04ca2cfc3 100644 (file)
@@ -156,7 +156,7 @@ Int_t
 AliFMDInput::NEvents() const 
 {
   // Get number of events
-  if (TESTBIT(fTreeMask, kRaw)) return -1;
+  if (TESTBIT(fTreeMask, kRaw)) return fReader->GetNumberOfEvents();
   if (fTreeE) return fTreeE->GetEntries();
   return -1;
 }
index 932736d11b423abfe9db4a9905946c48c2c9bc0e..bd51c5058570400a7fb8fca0357d746a58efe40d 100644 (file)
@@ -66,7 +66,8 @@ AliFMDPattern::AliFMDPatternDetector::AliFMDPatternDetector(UShort_t id)
     fCounts(0), 
     fGraphs(0), 
     fFrame(0), 
-    fInners(id == 1 ? 10 : 0)
+    fInners(10), 
+    fOuters(id == 1 ? 0 : 20)
 {
   // CTOR 
   // 
index c9396728ad66cc8dae290661c466f52626d459e0..959b0da0aeef00a5f8716ab56848dfad69494fc3 100644 (file)
@@ -299,7 +299,7 @@ void AliFMDPedestalDA::Terminate(TFile* diagFile)
 }
 
 //_____________________________________________________________________
-void AliFMDPedestalDA::FillinTimebins(std::ofstream& out, UShort_t ddl)
+void AliFMDPedestalDA::FillinTimebins(std::ofstream& out, UShort_t /*ddl*/)
 {
 #if 0
   unsigned short  boards[] = { 0x0, 0x1, 0x10, 0x11, 0xFFFF };
index 2fbbd7743c1a5ef3cffd9772267ef4ab2bd8e19d..bb7bd9e11a577f3514588ec372397be63753e69b 100644 (file)
@@ -62,7 +62,8 @@
 #include <TTree.h>             // ROOT_TTree
 #include <TClonesArray.h>      // ROOT_TClonesArray
 #include <TString.h>
- #include <iostream>
+#include <iostream>
+#include <climits>
 // #include <iomanip>
 
 //____________________________________________________________________
@@ -147,12 +148,12 @@ AliFMDRawReader::ReadAdcs(TClonesArray* array)
   while (isGood) {
     isGood = input.ReadChannel(ddl, hwaddr, last, data);
     // if (!isGood) break;
-    if (ddl >= UInt_t(-1)) { 
+    if (ddl >= UINT_MAX /* UInt_t(-1) */) { 
       AliFMDDebug(5, ("At end of event with %d digits", 
                      array->GetEntriesFast()));
       break;
     }
-    if (oldddl != ddl) { 
+    if (UInt_t(oldddl) != ddl) { 
       fZeroSuppress[ddl] = input.GetZeroSupp();
       AliFMDDebug(20, ("RCU @ DDL %d zero suppression: %s", 
                       ddl, (fZeroSuppress[ddl] ? "yes" : "no")));
@@ -188,6 +189,8 @@ AliFMDRawReader::ReadAdcs(TClonesArray* array)
                    "hardware address 0x%03x", ddl, hwaddr));
       continue;
     }
+    AliFMDDebug(1, ("Board: 0x%02x, Altro: 0x%x, Channel: 0x%x, Length: %4d", 
+                   board, chip, channel, last));
 
     stripMin = pars->GetMinStrip(det, ring, sec, strbase);
     stripMax = pars->GetMaxStrip(det, ring, sec, strbase);
@@ -723,7 +726,7 @@ Bool_t AliFMDRawReader::ReadSODevent(AliFMDCalibSampleRate* sampleRate,
   
   AliFMDDebug(0, ("End of SOD/EOD"));
   
-   
+  return kTRUE;
 }
 //____________________________________________________________________
 
index f8c71c56fbfabebf9fc237591947b179a3ef0bf6..3234b1f816872180f1af78d796bbce31b754d1e4 100644 (file)
@@ -33,6 +33,7 @@
 // #include <iomanip>
 // #include <iostream>
 #include "AliRawReader.h"
+#include <climits>
 
 //____________________________________________________________________
 ClassImp(AliFMDRawStream)
@@ -69,7 +70,7 @@ AliFMDRawStream::ReadChannel(UInt_t& ddl, UInt_t& addr,
       if(!next){
        AliFMDDebug(15, ("Read word # %d (!next)", l));
        addr = GetPrevHWAddress();
-       ddl  = GetPrevDDLNumber();
+       ddl  = (GetPrevDDLNumber() < 0 ? UINT_MAX: GetPrevDDLNumber());
        len  = l+1; // Need to add one - l points to last valid index
        last = signal;
        break;
@@ -79,7 +80,7 @@ AliFMDRawStream::ReadChannel(UInt_t& ddl, UInt_t& addr,
        AliFMDDebug(15, ("New hardware address, was 0x%x, now 0x%x", 
                          GetPrevHWAddress(), GetHWAddress()));
        addr = GetPrevHWAddress();
-       ddl  = GetPrevDDLNumber();
+       ddl  = (GetPrevDDLNumber() < 0 ? UINT_MAX : GetPrevDDLNumber());
        len  = l+1; // Need to add one - l points to last valid index
        last = signal;
        break;
diff --git a/FMD/AliFMDSpectraDisplay.cxx b/FMD/AliFMDSpectraDisplay.cxx
new file mode 100644 (file)
index 0000000..1e9c549
--- /dev/null
@@ -0,0 +1,579 @@
+// 
+//____________________________________________________________________
+//
+// $Id: DrawHits.C 22496 2007-11-26 13:50:44Z cholm $
+//
+// Script that contains a class to draw hits, using the
+// AliFMDInputHits class in the util library. 
+//
+// Use the script `Compile.C' to compile this class using ACLic. 
+//
+#include <AliCDBManager.h>
+#include <AliFMDParameters.h>
+#include <AliFMDHit.h>
+#include <AliFMDDigit.h>
+#include <AliFMDSDigit.h>
+#include <AliFMDRecPoint.h>
+#include <AliESDFMD.h>
+#include <AliFMDPattern.h>
+#include <AliFMDSpectraDisplay.h>
+#include <TBrowser.h>
+#include <TDirectory.h>
+#include <TObjArray.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TH3.h>
+#include <TGraph.h>
+#include <TF1.h>
+#include <iostream>
+#include <TStyle.h>
+#include <TEnv.h>
+#include <TCanvas.h>
+#include <TGFrame.h>
+#include <TGCanvas.h>
+#include <TGListTree.h>
+#include <TGClient.h>
+#include <TSystem.h>
+#include <KeySymbols.h>
+#include <TClass.h>
+#include <RQ_OBJECT.h>
+#include <TSlider.h>
+
+//==================================================================
+void AliFMDSpectraDisplayElement::MakeHistograms(TAxis* axis) 
+{
+  if (fFull) return;
+  if (axis->IsVariableBinSize()) {
+    fFull = new TH1F(Form("f_%s", GetName()), Form("%s spectra", GetName()),
+                    axis->GetXbins()->fN, axis->GetXbins()->fArray);
+    fCut = new TH1F(Form("c_%s", GetName()), 
+                   Form("%s restricted spectra", GetName()),
+                   axis->GetXbins()->fN, axis->GetXbins()->fArray);
+  }
+  else { 
+    fFull = new TH1F(Form("f_%s", GetName()), Form("%s spectra", GetName()),
+                    axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
+    fCut = new TH1F(Form("c_%s", GetName()), 
+                   Form("%s restricted spectra", GetName()),
+                   axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
+  }
+  fFull->SetFillColor(kRed);
+  fFull->SetFillStyle(3001);
+  fCut->SetFillColor(kBlue);
+  fCut->SetFillStyle(3001);
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplayElement::DoFill(Double_t v) 
+{
+  if (fFull) fFull->Fill(v);
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplayElement::Show(Option_t* option, 
+                                      Double_t l, Double_t h) 
+{
+  if (!fFull) return;
+  gPad->SetLogy(fFull->GetMaximum() > 10);
+  fFull->Draw(option);
+  Double_t lx = fFull->GetXaxis()->GetXmin();
+  Double_t hx = fFull->GetXaxis()->GetXmax();
+  Double_t rr = (hx-lx);
+  Double_t ll = rr * l + lx;
+  Double_t hh = rr * h + lx;
+  for (Int_t i = 1; i <= fFull->GetNbinsX(); i++) { 
+    if (fFull->GetBinCenter(i) <= ll || 
+       fFull->GetBinCenter(i) >  hh) { 
+      fCut->SetBinContent(i, 0); 
+      continue;
+    }
+    fCut->SetBinContent(i, fFull->GetBinContent(i));
+  }
+  fCut->Draw(Form("%s same", option));
+}
+
+//__________________________________________________________________
+Int_t
+AliFMDSpectraDisplayElement::Compare(const TObject*) const
+{
+  return -1;
+}
+
+
+//==================================================================
+AliFMDSpectraDisplayTop::AliFMDSpectraDisplayTop(TGCompositeFrame& frame, 
+                                                TCanvas* canvas) 
+  : AliFMDSpectraDisplayElement("All", "Everything"), 
+    fHints(kLHintsExpandX|kLHintsExpandY,3, 3, 3, 3),
+    fContainer(&frame, 200, 350), 
+    fList(&fContainer, kHorizontalFrame),
+    fChildren(0),
+    fCurrentEntry(0),
+    fCanvas(canvas),
+    fHist1DIcon(gClient->GetPicture("h1_t.xpm")),
+    fHist2DIcon(gClient->GetPicture("h2_t.xpm")),
+    fHist3DIcon(gClient->GetPicture("h3_t.xpm")),
+    fGraphIcon(gClient->GetPicture("graph.xpm")), 
+    fAxis(0),
+    fEntry(*(fList.AddItem(0, GetName(), this)))
+{
+  fContainer.AddFrame(&fList, &fHints);
+  frame.AddFrame(&fContainer, &fHints);
+
+  fList.Connect("Clicked(TGListTreeItem*,Int_t)", 
+               "AliFMDSpectraDisplayTop", this, 
+               "HandleEntry(TGListTreeItem*,Int_t)");
+  fList.Connect("KeyPressed(TGListTreeItem*,ULong_t,ULong_t)", 
+               "AliFMDSpectraDisplayTop", this, 
+               "HandleKey(TGListTreeItem*,UInt_t,UInt_t)");
+  fList.Connect("ReturnPressed(TGListTreeItem*)", 
+               "AliFMDSpectraDisplayTop", this, 
+               "HandleReturn(TGListTreeItem*)");
+}
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::SetAxis(TAxis* axis) 
+{
+  fAxis = axis;
+  MakeHistograms(axis);
+}
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::ClearCanvas()
+{
+  if (!fCanvas) return;
+  fCanvas->Clear();
+}
+  
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::ClearList()
+{
+  fList.DeleteItem(fList.GetFirstItem());
+  UpdateList();
+}
+  
+  
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::HandleReturn(TGListTreeItem * f)
+{
+    
+  if (!f) { 
+    fList.UnselectAll(kFALSE);
+    fList.SetSelected(0);
+    return;
+  }
+  fList.ToggleItem(f);
+  UpdateList();
+}
+  
+  
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::HandleKey(TGListTreeItem * f, UInt_t keysym, UInt_t)
+{
+  if (!f) { 
+    fList.UnselectAll(kFALSE);
+    fList.SetSelected(0);
+    return;
+  }
+  TGListTreeItem* next = 0;
+  switch (keysym) {
+  case kKey_Up:
+    next = f->GetPrevSibling();
+    if (!next) { 
+      next = f->GetParent();
+      if (next) fList.CloseItem(next);
+    }
+    break;
+  case kKey_Down:
+    next = f->GetNextSibling();
+    if (!next && f->GetParent()) {
+      next = f->GetParent()->GetNextSibling();
+      fList.CloseItem(f->GetParent());
+    }
+    break;
+  case kKey_Left:
+    next = f->GetParent();
+    if (next) fList.CloseItem(next);
+    break;
+  case kKey_Right:
+    next = f->GetFirstChild();
+    if (next) fList.OpenItem(f);
+    break;
+  case kKey_PageUp:
+    fList.PageUp(kTRUE);
+    next = fList.GetSelected();
+    break;
+  case kKey_PageDown:
+    fList.PageDown(kTRUE);
+    next = fList.GetSelected();
+    break;
+  }
+  // if (next) gClient->NeedRedraw(&fList);
+  if (next && next != f) {
+    fList.ClearHighlighted();
+    fList.SetSelected(next);
+    HandleEntry(next,0);
+  }
+  if (next) gClient->NeedRedraw(&fList);
+}
+
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::HandleEntry(TGListTreeItem* entry, Int_t /*id*/) 
+{
+  TGListTreeItem* old = fCurrentEntry;
+  if (entry) {
+    if (!entry->GetUserData()) return;
+    fCurrentEntry = entry;
+  }
+  else {
+    fCurrentEntry = 0;
+    ClearCanvas();
+  }
+  if (old != fCurrentEntry && fCanvas) fCanvas->cd();
+  SelectionChanged();
+}
+
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::UpdateList() 
+{
+  gClient->NeedRedraw(&fList);
+}
+
+//____________________________________________________________________
+void
+AliFMDSpectraDisplayTop::UpdateCanvas() 
+{
+  if (!fCanvas) return;
+  fCanvas->Modified();
+  fCanvas->Update();
+  fCanvas->cd();
+}
+//____________________________________________________________________
+TObject* AliFMDSpectraDisplayTop::Current() const
+{
+  if (!fCurrentEntry) return 0;
+  if (!fCurrentEntry->GetUserData()) return 0;
+  return static_cast<TObject*>(fCurrentEntry->GetUserData());
+}
+  
+//__________________________________________________________________
+AliFMDSpectraDisplayDetector& AliFMDSpectraDisplayTop::GetOrAdd(UShort_t id) 
+{ 
+  Int_t     idx = id - 1;
+  AliFMDSpectraDisplayDetector* d   = 0;
+  if (fChildren.GetEntriesFast() <= idx ||
+      !(d = static_cast<AliFMDSpectraDisplayDetector*>(fChildren.At(idx))))  { 
+    d = new AliFMDSpectraDisplayDetector(id, *this);
+    fChildren.AddAtAndExpand(d, idx);
+    // GetTop().GetList().SortChildren(&fEntry);
+    // GetTop().GetList().Sort(&(d->GetEntry()));
+  }
+  return *d;
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplayTop::Fill(UShort_t det, Char_t ring, 
+              UShort_t sec, UShort_t str, Double_t v) 
+{ 
+  AliFMDSpectraDisplayDetector& d = GetOrAdd(det);
+  d.Fill(ring, sec, str, v);
+  DoFill(v);
+}
+//__________________________________________________________________
+Int_t
+AliFMDSpectraDisplayTop::Compare(const TObject*) const
+{
+  return -1;
+}
+//==================================================================
+AliFMDSpectraDisplayDetector::AliFMDSpectraDisplayDetector(UShort_t det, 
+                                          AliFMDSpectraDisplayTop& tree) 
+  : AliFMDSpectraDisplayElement(Form("FMD%d", det), "FMD Sub-detector"), 
+    fId(det), 
+    fParent(tree),
+    fChildren(0),
+    fEntry(*(tree.GetList().AddItem(&(tree.GetEntry()), GetName())))
+{
+  fEntry.SetUserData(this);
+  fEntry.SetText(GetName());
+  if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
+}
+//__________________________________________________________________
+AliFMDSpectraDisplayRing& AliFMDSpectraDisplayDetector::GetOrAdd(Char_t id) 
+{ 
+  Int_t idx = (id == 'I' || id == 'i') ? 0 : 1;
+  AliFMDSpectraDisplayRing* r   = 0;;
+  if (fChildren.GetEntriesFast() <= idx ||
+      !(r = static_cast<AliFMDSpectraDisplayRing*>(fChildren.At(idx))))  { 
+    r = new AliFMDSpectraDisplayRing(id, *this);
+    fChildren.AddAtAndExpand(r, idx);
+    // GetTop().GetList().SortChildren(&fEntry);
+    // GetTop().GetList().Sort(&(r->GetEntry()));
+  }
+  return *r;
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplayDetector::Fill(Char_t ring, UShort_t sec, 
+                                       UShort_t str, Double_t v) 
+{ 
+  AliFMDSpectraDisplayRing& r = GetOrAdd(ring);
+  r.Fill(sec, str, v);
+  DoFill(v);
+}  
+//__________________________________________________________________
+Int_t
+AliFMDSpectraDisplayDetector::Compare(const TObject* o) const
+{
+  std::cout << "Comparing detector to a " << o->ClassName() << std::endl;
+  if (o->IsA() == AliFMDSpectraDisplayDetector::Class()) { 
+    const AliFMDSpectraDisplayDetector* ro = 
+      static_cast<const AliFMDSpectraDisplayDetector*>(o);
+    return (Id() <  ro->Id() ? -1 : 
+           Id() == ro->Id() ? 0 : 1);
+  }
+  return -1;
+}
+//==================================================================
+AliFMDSpectraDisplayRing::AliFMDSpectraDisplayRing(Char_t id,
+                            AliFMDSpectraDisplayDetector& d) 
+  : AliFMDSpectraDisplayElement(Form("FMD%d%c", d.Id(), id), "FMD Ring"), 
+    fParent(d),
+    fId(id),
+    fChildren(0),
+    fEntry(*(GetTop().GetList().AddItem(&(d.GetEntry()), GetName(), this)))
+{
+  fEntry.SetText(GetName());
+  if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
+}
+//__________________________________________________________________
+AliFMDSpectraDisplaySector& AliFMDSpectraDisplayRing::GetOrAdd(UShort_t id) 
+{ 
+  AliFMDSpectraDisplaySector* s = 0;
+  if (fChildren.GetEntriesFast() <= id ||
+      !(s = static_cast<AliFMDSpectraDisplaySector*>(fChildren.At(id)))) {
+    s = new AliFMDSpectraDisplaySector(id, *this);
+    fChildren.AddAtAndExpand(s, id);
+    // GetTop().GetList().SortChildren(&fEntry);
+    // GetTop().GetList().Sort(&(s->GetEntry()));
+  }
+  return *s;
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplayRing::Fill(UShort_t sec, UShort_t str, Double_t v) 
+{ 
+  AliFMDSpectraDisplaySector& s = GetOrAdd(sec);
+  s.Fill(str, v);
+  DoFill(v);
+}
+//__________________________________________________________________
+Int_t
+AliFMDSpectraDisplayRing::Compare(const TObject* o) const
+{
+  std::cout << "Comparing ring to a " << o->ClassName() << std::endl;
+  if (o->IsA() == AliFMDSpectraDisplayRing::Class()) { 
+    const AliFMDSpectraDisplayRing* ro = 
+      static_cast<const AliFMDSpectraDisplayRing*>(o);
+    return (Id() <  ro->Id() ? -1 : 
+           Id() == ro->Id() ? 0 : 1);
+  }
+  return -1;
+}
+//==================================================================
+AliFMDSpectraDisplaySector::AliFMDSpectraDisplaySector(UShort_t id, 
+                                      AliFMDSpectraDisplayRing& r) 
+  : AliFMDSpectraDisplayElement(Form("FMD%d%c_%02d",r.DetectorId(),r.Id(),id), 
+                               "FMD Sector"), 
+    fParent(r),
+    fId(id),
+    fChildren(0),
+    fEntry(*(GetTop().GetList().AddItem(&(r.GetEntry()), GetName(), this)))
+{
+  fEntry.SetText(GetName());
+  if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
+}
+//__________________________________________________________________
+AliFMDSpectraDisplayStrip& AliFMDSpectraDisplaySector::GetOrAdd(UShort_t id) 
+{ 
+  AliFMDSpectraDisplayStrip* s = 0;
+  if (fChildren.GetEntriesFast() <= id || 
+      !(s = static_cast<AliFMDSpectraDisplayStrip*>(fChildren.At(id)))) {
+    s = new AliFMDSpectraDisplayStrip(id, *this);
+    fChildren.AddAtAndExpand(s, id);
+    // GetTop().GetList().SortChildren(&fEntry);
+    // GetTop().GetList().Sort(&(s->GetEntry()));
+  }
+  return *s;
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplaySector::Fill(UShort_t str, Double_t v) 
+{ 
+  AliFMDSpectraDisplayStrip& s = GetOrAdd(str);
+  s.Fill(v);
+  DoFill(v);
+}
+//__________________________________________________________________
+Int_t
+AliFMDSpectraDisplaySector::Compare(const TObject* o) const
+{
+  std::cout << "Comparing sector to a " << o->ClassName() << std::endl;
+  if (o->IsA() == AliFMDSpectraDisplaySector::Class()) { 
+    const AliFMDSpectraDisplaySector* ro = 
+      static_cast<const AliFMDSpectraDisplaySector*>(o);
+    return (Id() <  ro->Id() ? -1 : 
+           Id() == ro->Id() ? 0 : 1);
+  }
+  return -1;
+}
+//==================================================================
+AliFMDSpectraDisplayStrip::AliFMDSpectraDisplayStrip(UShort_t id, 
+                                  AliFMDSpectraDisplaySector& s) 
+  : AliFMDSpectraDisplayElement(Form("FMD%d%c_%02d_%03d", 
+                                    s.DetectorId(), s.RingId(), 
+                                    s.Id(), id), "FMD Strip"), 
+    fParent(s),
+    fId(id),
+    fEntry(*(GetTop().GetList().AddItem(&(s.GetEntry()), GetName(), this)))
+{
+  fEntry.SetText(GetName());
+  fEntry.SetPictures(GetTop().GetH1Pic(), GetTop().GetH1Pic());
+  if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
+}
+//__________________________________________________________________
+void AliFMDSpectraDisplayStrip::Fill(Double_t v) 
+{ 
+  DoFill(v);
+}
+//__________________________________________________________________
+Int_t
+AliFMDSpectraDisplayStrip::Compare(const TObject* o) const
+{
+  std::cout << "Comparing strip to a " << o->ClassName() << std::endl;
+  if (o->IsA() == AliFMDSpectraDisplayStrip::Class()) { 
+    const AliFMDSpectraDisplayStrip* ro = 
+      static_cast<const AliFMDSpectraDisplayStrip*>(o);
+    return (Id() <  ro->Id() ? -1 : 
+           Id() == ro->Id() ? 0 : 1);
+  }
+  return -1;
+}
+
+//==================================================================
+AliFMDSpectraDisplay::AliFMDSpectraDisplay()
+  : AliFMDPattern(), 
+    fSelector(gClient->GetRoot(), 100, 100), 
+    fTop(fSelector, fAux)
+{
+  AddLoad(AliFMDInput::kRaw);
+  SetName("RAW");
+  SetTitle("RAW");
+  
+  fTop.Connect("SelectionChanged()", 
+              "AliFMDSpectraDisplay", this, "HandleDraw()");
+  
+  fSelector.MapSubwindows();
+  fSelector.Resize(fSelector.GetDefaultSize());
+  fSelector.MapWindow();
+}
+
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::HandleDraw()
+{
+  TObject* user = fTop.Current();
+  if (!user) return kFALSE;
+  if (!user->InheritsFrom(AliFMDSpectraDisplayElement::Class())) { 
+    Warning("HandleDraw", "%s does not inherit from Spectra::Element", 
+           user->GetName());
+    return kFALSE;
+  }
+  fAux->cd();
+  AliFMDSpectraDisplayElement* e 
+    = static_cast<AliFMDSpectraDisplayElement*>(user);
+  e->Show("hist", fSlider->GetMinimum(), fSlider->GetMaximum());
+  fAux->Modified();
+  fAux->Update();
+  fAux->cd();
+  return kTRUE;
+}
+//__________________________________________________________________
+void 
+AliFMDSpectraDisplay::MakeAux()
+{
+  AliFMDPattern::MakeAux();
+  if (!fAux) return;
+  fTop.SetAxis(fSpec->GetXaxis());
+}
+//__________________________________________________________________
+void 
+AliFMDSpectraDisplay::DrawAux()
+{
+  // Draw in the Aux the canvas 
+  // For example draw the spectra 
+  // or such stuff 
+  if (fTop.Current() != &fTop && HandleDraw()) return;
+  AliFMDPattern::DrawAux();
+}
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::ProcessHit(AliFMDHit* hit, TParticle* p) 
+{
+  fTop.Fill(hit->Detector(), 
+           hit->Ring(), 
+           hit->Sector(),
+           hit->Strip(), 
+           hit->Edep());
+  return AliFMDPattern::ProcessHit(hit, p);
+}
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::ProcessDigit(AliFMDDigit* digit)
+{
+  fTop.Fill(digit->Detector(), 
+           digit->Ring(), 
+           digit->Sector(),
+           digit->Strip(), 
+           digit->Counts());
+  return AliFMDDisplay::ProcessDigit(digit);
+}
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::ProcessSDigit(AliFMDSDigit* sdigit)
+{
+  fTop.Fill(sdigit->Detector(), 
+           sdigit->Ring(), 
+           sdigit->Sector(),
+           sdigit->Strip(), 
+           sdigit->Counts());
+  return AliFMDDisplay::ProcessSDigit(sdigit);
+}
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::ProcessRawDigit(AliFMDDigit* digit)
+{
+  return ProcessDigit(digit);
+}
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::ProcessRecPoint(AliFMDRecPoint* recpoint)
+{
+  fTop.Fill(recpoint->Detector(), 
+           recpoint->Ring(), 
+           recpoint->Sector(),
+           recpoint->Strip(), 
+           recpoint->Particles());
+  return AliFMDDisplay::ProcessRecPoint(recpoint);
+}
+//__________________________________________________________________
+Bool_t 
+AliFMDSpectraDisplay::ProcessESD(UShort_t det, Char_t rng, UShort_t sec, 
+                                UShort_t str, Float_t x, Float_t mult)
+{
+  fTop.Fill(det, rng, sec, str, mult);
+  return AliFMDDisplay::ProcessESD(det, rng, sec, str, x, mult);
+}
+//__________________________________________________________________
+//
+// EOF
+//
diff --git a/FMD/AliFMDSpectraDisplay.h b/FMD/AliFMDSpectraDisplay.h
new file mode 100644 (file)
index 0000000..20fd856
--- /dev/null
@@ -0,0 +1,729 @@
+#ifndef AliFMDSPECTRADISPLAY_H
+#define AliFMDSPECTRADISPLAY_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+/** @file    AliFMDDisplay.h
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:39:09 2006
+    @brief   FMD Event display 
+*/
+//___________________________________________________________________
+//
+// The classes defined here, are utility classes for reading in data
+// for the FMD.  They are  put in a seperate library to not polute the
+// normal libraries.  The classes are intended to be used as base
+// classes for customized class that do some sort of analysis on the
+// various types of data produced by the FMD. 
+//
+#include "AliFMDPattern.h"
+#include <TGFrame.h>
+#include <TGListTree.h>
+#include <TObjArray.h>
+#include <TQObject.h>
+#include <RQ_OBJECT.h>
+
+class TGPicture;
+class TH1;
+class TAxis;
+
+class AliFMDSpectraDisplayTop;
+class AliFMDSpectraDisplayDetector;
+class AliFMDSpectraDisplayRing;
+class AliFMDSpectraDisplaySector;
+class AliFMDSpectraDisplayStrip;
+
+//__________________________________________________________________
+/**
+ * Base class for elements in the tree.
+ * 
+ */
+class AliFMDSpectraDisplayElement : public TNamed 
+{
+public:
+  /** 
+   * Destructor.
+   * 
+   * 
+   */  
+  virtual ~AliFMDSpectraDisplayElement() {}
+  /** 
+   * Draw it
+   * 
+   * @param option Draw option
+   * @param l      Low cut 
+   * @param h      High cut
+   */
+  virtual void Show(Option_t* option, Double_t l, Double_t h);
+  /** 
+   * Get the top of the tree
+   * 
+   * @return Top element
+   */
+  virtual AliFMDSpectraDisplayTop& GetTop() = 0;
+  /** 
+   * Make histograms for this element.
+   * 
+   * @param axis Axis specs
+   */
+  virtual void MakeHistograms(TAxis* axis);
+  /** 
+   * Compare to object
+   * 
+   * @param o 
+   * 
+   * @return 
+   */  
+  virtual Int_t Compare(const TObject* o) const;
+protected:
+  /** 
+   * Constructor
+   * 
+   * @param name  Name 
+   * @param title Title
+   */  
+  AliFMDSpectraDisplayElement(const char* name, const char* title) 
+    : TNamed(name, title), fFull(0), fCut(0)
+  {}
+  AliFMDSpectraDisplayElement(const AliFMDSpectraDisplayElement& o) 
+    : TNamed(o), 
+      fFull(o.fFull), 
+      fCut(o.fCut) 
+  {}
+  AliFMDSpectraDisplayElement&
+  operator=(const AliFMDSpectraDisplayElement&) { return *this; }
+  /** 
+   * Fill histogram
+   * 
+   * @param v Value to fill
+   */
+  void DoFill(Double_t v);
+  TH1* fFull; // Full spectra
+  TH1* fCut;  // Spectra after cut
+  ClassDef(AliFMDSpectraDisplayElement,0); // Element in FMD spectra display
+};
+
+//__________________________________________________________________
+/**
+ * Top element in FMD spectra display
+ * 
+ */
+class AliFMDSpectraDisplayTop : public AliFMDSpectraDisplayElement, 
+                               public TQObject
+{
+public:
+  /** 
+   * Constructor
+   * 
+   * @param frame   Parent frame
+   * @param canvas  Canvas
+   */
+  AliFMDSpectraDisplayTop(TGCompositeFrame& frame, TCanvas* canvas);
+  /** 
+   * Get the list tree
+   * 
+   * @return List tree
+   */
+  TGListTree& GetList() { return fList; }
+  /** 
+   * Get or add a detector element
+   * 
+   * @param id Element id
+   * 
+   * @return element
+   */
+  AliFMDSpectraDisplayDetector& GetOrAdd(UShort_t id);
+  /** 
+   * Fill histograms
+   * 
+   * @param d    Detector
+   * @param ring Ring 
+   * @param sec  Sector
+   * @param str  Strip
+   * @param v    value
+   */
+  void      Fill(UShort_t d, Char_t ring, 
+                UShort_t sec, UShort_t str, Double_t v);
+  /** 
+   * Get the axis spec.
+   *
+   * @return Axis spec,
+   */
+  TAxis* GetAxis() { return fAxis; }
+  /** 
+   * Set the axis spec.
+   * 
+   * @param a Axis spec.
+   */
+  void SetAxis(TAxis* a);
+  /** 
+   * Get the top.
+   * 
+   * @return top element
+   */
+  AliFMDSpectraDisplayTop&   GetTop() { return *this; }
+       
+  /** 
+   * Handle entries 
+   *
+   * @param e  selected entry, if any 
+   * @param id Id of entry 
+   */
+  virtual void HandleEntry(TGListTreeItem* e, Int_t id);
+  /** 
+   * Handle key strokes 
+   * @param f      Item selected, if any 
+   * @param keysym Key symbol 
+   * @param mask   Modifier mask 
+   */
+  virtual void HandleKey(TGListTreeItem* f, UInt_t keysym, UInt_t mask);
+  /**
+   * Handle Return 
+   * @param f Selected item, if any 
+   */
+  virtual void HandleReturn(TGListTreeItem* f);
+  /** 
+   * Clear the list 
+   */
+  virtual void ClearList();
+  /** 
+   * Clear the canvas 
+   */ 
+  virtual void ClearCanvas();
+  /** 
+   * Update canvas 
+   */ 
+  virtual void UpdateCanvas();
+  /** 
+   * Update canvas 
+   */ 
+  virtual void UpdateList();
+  /** 
+   * Return the currently selected entry 
+   */ 
+  TGListTreeItem* CurrentEntry() const { return fCurrentEntry; }
+  /** 
+   * @return the currently selected user data (possibly 0) 
+   */
+  TObject* Current() const;
+  /** 
+   * Selection changed signal 
+   */
+  void SelectionChanged() { Emit("SelectionChanged()"); }//*SIGNAL*
+  /** 
+   * Get Picture for 1D histogram 
+   */
+  const TGPicture* GetH1Pic() { return fHist1DIcon; }
+  /** 
+   * 2D Histogram Icon 
+   */
+  const TGPicture* GetH2Pic() { return fHist2DIcon; }
+  /** 
+   * 3D Histogram Icon 
+   */
+  const TGPicture* GetH3Pic() { return fHist3DIcon; }
+  /** 
+   * Graph Icon 
+   */
+  const TGPicture* GetGPic() { return fGraphIcon; }
+  /** 
+   * Get the entry 
+   *
+   * @return 
+   */
+  TGListTreeItem&  GetEntry() { return fEntry; }
+  /** 
+   * Compare to object
+   * 
+   * @param o 
+   * 
+   * @return 
+   */  
+  virtual Int_t Compare(const TObject* o) const;
+protected:
+  AliFMDSpectraDisplayTop(const AliFMDSpectraDisplayTop& o) 
+    : AliFMDSpectraDisplayElement(o), 
+      TQObject(),
+      fHints(o.fHints),
+      fContainer(), // o.fContainer), 
+      fList(), // o.fList), 
+      fChildren(o.fChildren), 
+      fCurrentEntry(o.fCurrentEntry),
+      fCanvas(o.fCanvas),
+      fHist1DIcon(o.fHist1DIcon),
+      fHist2DIcon(o.fHist2DIcon),
+      fHist3DIcon(o.fHist3DIcon),
+      fGraphIcon(o.fGraphIcon),
+      fAxis(o.fAxis),
+      fEntry(o.fEntry)
+  {}
+  
+  AliFMDSpectraDisplayTop& operator=(const AliFMDSpectraDisplayTop&) 
+  {
+    return *this;
+  }
+  TGLayoutHints fHints;                // Layout hints
+  TGCanvas      fContainer;            // Container
+  TGListTree    fList;                 // List
+  TObjArray     fChildren;             // Children
+  TGListTreeItem* fCurrentEntry;       // Current entry
+  TCanvas*        fCanvas;             // Canvas
+  const TGPicture*    fHist1DIcon;     // 1D Histogram Icon
+  const TGPicture*    fHist2DIcon;     // 2D Histogram Icon
+  const TGPicture*    fHist3DIcon;     // 3D Histogram Icon
+  const TGPicture*    fGraphIcon;      // Graph Icon 
+  TAxis* fAxis;                        // The axis to use 
+  TGListTreeItem& fEntry;              // Entry
+
+  ClassDef(AliFMDSpectraDisplayTop,0);
+};
+
+//__________________________________________________________________
+/**
+ * Detector element in FMD spectra display
+ * 
+ */
+class AliFMDSpectraDisplayDetector : public AliFMDSpectraDisplayElement 
+{
+public:
+  /** 
+   * Constructor
+   * 
+   * @param det 
+   * @param top 
+   */
+  AliFMDSpectraDisplayDetector(UShort_t det, AliFMDSpectraDisplayTop& top);
+  /** 
+   * Get identifier
+   * 
+   * @return 
+   */
+  UShort_t Id() const { return fId; }
+  /** 
+   * Get top of hierarcy
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayTop&     GetTop() { return fParent; }
+  /** 
+   * Get parent
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayTop&     GetParent() { return fParent; }
+  /** 
+   * Get or add a ring element
+   * 
+   * @param id 
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayRing&    GetOrAdd(Char_t id);
+  /** 
+   * Fill histograms
+   * 
+   * @param ring 
+   * @param sec 
+   * @param str 
+   * @param v 
+   */
+  void     Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v);
+  /** 
+   * Get the entry
+   * 
+   * 
+   * @return 
+   */
+  TGListTreeItem&  GetEntry() { return fEntry; }
+  /** 
+   * Compare to object
+   * 
+   * @param o 
+   * 
+   * @return 
+   */  
+  virtual Int_t Compare(const TObject* o) const;
+protected:
+  UShort_t                            fId; // Identifier
+  AliFMDSpectraDisplayTop&            fParent; // Parent
+  TObjArray                           fChildren; // Children
+  TGListTreeItem&                     fEntry; // The entry
+  ClassDef(AliFMDSpectraDisplayDetector,0); // Detector element in FMD spectra
+};
+
+//__________________________________________________________________
+/**
+ * Ring element in FMD spectra display
+ * 
+ */
+class AliFMDSpectraDisplayRing : public AliFMDSpectraDisplayElement 
+{
+public:
+  /** 
+   * Constructor
+   * 
+   * @param id 
+   * @param d 
+   */
+  AliFMDSpectraDisplayRing(Char_t id, AliFMDSpectraDisplayDetector& d);
+  /** 
+   * Get identifier
+   * 
+   * @return 
+   */
+  Char_t    Id() const { return fId; }
+  /** 
+   * Get detector identifier
+   * 
+   * @return 
+   */
+  UShort_t  DetectorId() { return fParent.Id(); }
+  /** 
+   * Get top of hierarcy
+   * 
+   * @return 
+   */  
+  AliFMDSpectraDisplayTop&      GetTop() { return fParent.GetTop(); }
+  /** 
+   * Get parent detector
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayDetector& GetDetector() { return GetParent(); }
+  /** 
+   * Get parent detector
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayDetector& GetParent() { return fParent; }
+  /** 
+   * Get or add a sector element
+   * 
+   * @param id 
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplaySector&   GetOrAdd(UShort_t id);
+  /** 
+   * Fill histograms
+   * 
+   * @param sec 
+   * @param str 
+   * @param v 
+   */
+  void      Fill(UShort_t sec, UShort_t str, Double_t v);
+  /** 
+   * Get the entry
+   * 
+   * @return 
+   */
+  TGListTreeItem&  GetEntry() { return fEntry; }
+  /** 
+   * Compare to object
+   * 
+   * @param o 
+   * 
+   * @return 
+   */  
+  virtual Int_t Compare(const TObject* o) const;
+protected:
+  AliFMDSpectraDisplayDetector&       fParent; // Parent
+  Char_t                              fId;        // Identifier
+  TObjArray                           fChildren;  // Children
+  TGListTreeItem&                     fEntry;     // Entry
+  ClassDef(AliFMDSpectraDisplayRing,0); // Ring element in FMD spectra
+};
+  
+//__________________________________________________________________
+/**
+ * Sector element in FMD spectra display
+ * 
+ */
+class AliFMDSpectraDisplaySector : public AliFMDSpectraDisplayElement 
+{
+public:
+  /** 
+   * Constructor
+   * 
+   * @param id 
+   * @param r 
+   */
+  AliFMDSpectraDisplaySector(UShort_t id, AliFMDSpectraDisplayRing& r);
+  /** 
+   * Get identifier
+   * 
+   * @return 
+   */
+  UShort_t  Id() const    { return fId; }
+  /** 
+   * Get detector identifier
+   * 
+   * @return 
+   */
+  UShort_t  DetectorId()  { return fParent.DetectorId(); }
+  /** 
+   * Get ring identifier
+   * 
+   * @return 
+   */
+  Char_t    RingId()      { return fParent.Id(); }
+  /** 
+   * Get top of hierarcy
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayTop&      GetTop()      { return fParent.GetTop(); }
+  /** 
+   * Get parent detector
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
+  /** 
+   * Get parent ring.
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayRing&     GetRing()     { return fParent; }
+  /** 
+   * Get parent ring.
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayRing&     GetParent()   { return fParent; }
+  /** 
+   * Get or add a strip element
+   * 
+   * @param id 
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayStrip&    GetOrAdd(UShort_t id);
+  /** 
+   * Fill histograms
+   * 
+   * @param str 
+   * @param v 
+   */  
+  void      Fill(UShort_t str, Double_t v);
+  /** 
+   * Get the entry
+   * 
+   * @return 
+   */  
+  TGListTreeItem&  GetEntry() { return fEntry; }
+  /** 
+   * Compare to object
+   * 
+   * @param o 
+   * 
+   * @return 
+   */  
+  virtual Int_t Compare(const TObject* o) const;
+protected:
+  AliFMDSpectraDisplayRing&           fParent;  // PArent
+  UShort_t                            fId;      // Identifier
+  TObjArray                           fChildren;// Children
+  TGListTreeItem&                     fEntry;   // Entry
+  ClassDef(AliFMDSpectraDisplaySector,0); // Sector element in FMD spectra
+};
+
+//__________________________________________________________________
+/**
+ * Strip element in FMD spectra display
+ * 
+ */
+class AliFMDSpectraDisplayStrip : public AliFMDSpectraDisplayElement 
+{
+public:
+  /** 
+   * Constructor
+   * 
+   * @param id 
+   * @param s 
+   */
+  AliFMDSpectraDisplayStrip(UShort_t id, AliFMDSpectraDisplaySector& s);
+  /** 
+   * Get identifier
+   * 
+   * @return 
+   */
+  UShort_t  Id() const    { return fId; }
+  /** 
+   * Get detector identifier
+   * 
+   * @return 
+   */
+  UShort_t  DetectorId()  { return fParent.DetectorId(); }
+  /** 
+   * Get ring identifier
+   * 
+   * @return 
+   */
+  Char_t    RingId()      { return fParent.RingId(); }
+  /** 
+   * Get sector identifier
+   * 
+   * @return 
+   */
+  UShort_t  SectorId()    { return fParent.Id(); }
+  /** 
+   * Get top of hierarcy
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayTop&      GetTop()      { return fParent.GetTop(); }
+  /** 
+   * Get parent detector
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
+  /** 
+   * Get parent ring
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplayRing&     GetRing()     { return fParent.GetRing(); }
+  /** 
+   * Get parent sector
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplaySector&   GetSector()   { return fParent; }
+  /** 
+   * Get parent sector
+   * 
+   * @return 
+   */
+  AliFMDSpectraDisplaySector&   GetParent()   { return fParent; }
+  /** 
+   * Fill histograms
+   * 
+   * @param v 
+   */  
+  void      Fill(Double_t v);
+  /** 
+   * Get entry
+   * 
+   * @return 
+   */
+  TGListTreeItem&  GetEntry() { return fEntry; }
+  /** 
+   * Compare to object
+   * 
+   * @param o 
+   * 
+   * @return 
+   */  
+  virtual Int_t Compare(const TObject* o) const;
+protected:
+  AliFMDSpectraDisplaySector&         fParent; // Parent
+  UShort_t                            fId;     // Identifier 
+  TGListTreeItem&                     fEntry;  // Entry
+  ClassDef(AliFMDSpectraDisplayStrip,0);
+};
+
+//____________________________________________________________________
+/**
+ * FMD event and spectra display
+ * 
+ */
+class AliFMDSpectraDisplay : public AliFMDPattern
+{
+public:
+  /** 
+   * Constructor
+   * 
+   */
+  AliFMDSpectraDisplay();
+  /** 
+   * Handle draw
+   * 
+   * @return 
+   */
+  Bool_t HandleDraw(); 
+  /** 
+   * Make AUX canvas
+   * 
+   */
+  void MakeAux();
+  /** 
+   * Draw spectra
+   * 
+   */
+  void DrawAux();
+  /** 
+   * Process a hit
+   * 
+   * @param hit 
+   * @param p 
+   * 
+   * @return 
+   */
+  Bool_t ProcessHit(AliFMDHit* hit, TParticle* p);
+  /** 
+   * Process a digit
+   * 
+   * @param digit 
+   * 
+   * @return 
+   */
+  Bool_t ProcessDigit(AliFMDDigit* digit);
+  /** 
+   * Process a summable digit
+   * 
+   * @param sdigit 
+   * 
+   * @return 
+   */
+  Bool_t ProcessSDigit(AliFMDSDigit* sdigit);
+  /** 
+   * Process a raw digit
+   * 
+   * @param digit 
+   * 
+   * @return 
+   */
+  Bool_t ProcessRawDigit(AliFMDDigit* digit);
+  /** 
+   * Process a reconstruction point
+   * 
+   * @param recpoint 
+   * 
+   * @return 
+   */  
+  Bool_t ProcessRecPoint(AliFMDRecPoint* recpoint);
+  /** 
+   * Process and ESD entry
+   * 
+   * @param det 
+   * @param rng 
+   * @param sec 
+   * @param str 
+   * @param x 
+   * @param mult 
+   * 
+   * @return 
+   */
+  Bool_t ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
+                   Float_t x, Float_t mult);
+protected:
+  TGMainFrame  fSelector; // GUI to select spectra
+  AliFMDSpectraDisplayTop fTop;     // Top of hierarcy
+  ClassDef(AliFMDSpectraDisplay,0); // FMD event and spectra display
+}
+;
+
+#endif
+//____________________________________________________________________
+//
+// Local Variables:
+//   mode: C++
+// End:
+//
+// EOF
+//
+
index c563631b11ae4568fc4bb84b2f78ad1e4c3c3fd9..89a488873d3df41a2c64362c493138ad5ff70489 100644 (file)
 #pragma link C++ class  AliFMDGainDA;
 #pragma link C++ class  AliFMDBackgroundCorrection+;
 
+#pragma link C++ class  AliFMDSpectraDisplay;
+#pragma link C++ class  AliFMDSpectraDisplayElement;
+#pragma link C++ class  AliFMDSpectraDisplayTop;
+#pragma link C++ class  AliFMDSpectraDisplayDetector;
+#pragma link C++ class  AliFMDSpectraDisplayRing;
+#pragma link C++ class  AliFMDSpectraDisplaySector;
+#pragma link C++ class  AliFMDSpectraDisplayStrip;
+
 #else
 # error Not for compilation 
 #endif
index 2c5f1d77c4f6e9921e5d7584f645a9d296f80444..6519ca17cf532bdd30f8c4b6029d88a3487c4ff3 100644 (file)
@@ -12,7 +12,8 @@ SRCS          =  AliFMDInput.cxx              \
                   AliFMDAnaESD.cxx             \
                   AliFMDBaseDA.cxx             \
                    AliFMDPedestalDA.cxx                \
-                  AliFMDGainDA.cxx             \
+                  AliFMDGainDA.cxx             \
+                  AliFMDSpectraDisplay.cxx     \
                   AliFMDBackgroundCorrection.cxx 
 
 HDRS           =  $(SRCS:.cxx=.h) 
index 4bc04091a46baa37f64a19aec3a2195e175fe0ad..e709a569c8731b24638dfb1a58b6ff5f81f12a40 100644 (file)
@@ -8,6 +8,51 @@
 //
 // Use the script `Compile.C' to compile this class using ACLic. 
 //
+
+void
+SpectraMonitor(const char* file="", 
+              Int_t       runno=0, 
+              const char* cdbSrc="local://$ALICE_ROOT", 
+              UShort_t    over=0)
+{
+  gSystem->Load("libFMDutil.so");
+  // AliLog::SetModuleDebugLevel("FMD", 8);
+  TString fname(file);
+  if (fname.CompareTo("help", TString::kIgnoreCase) == 0) { 
+    std::cout << "Usage: RunSpectraMonitor(<src>[,<runno>[,<cdb>[,<over>]]])\n"
+             << "\n"
+             << "Where:\n\n"
+             << "   <src>         Is a data source (online, file)\n"
+             << "   <runno>       Is the (optional) run number\n"
+             << "   <cdb>         Is the (optional) CDB storage\n"
+             << "   <over>        Is the (optional) over sampling rate\n\n"
+             << "Defaults are <runno>=0 and cdb=\"local://$ALICE_ROOT\"\n" 
+             << "<over> allows one to override the CDB setting.  Default\n"
+             << "is to use the CDB setting.\n\n"
+             << "Note: This script _must_ be compiled with ACLic"
+             << std::endl;
+    return;
+  }
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage(cdbSrc);
+  cdb->SetRun(runno);
+  UInt_t what = (AliFMDParameters::kPulseGain      |
+                AliFMDParameters::kPedestal       |
+                AliFMDParameters::kDeadMap        |
+                AliFMDParameters::kZeroSuppression|
+                AliFMDParameters::kAltroMap       |
+                AliFMDParameters::kStripRange);
+  if (over != 0) what |= AliFMDParameters::kSampleRate;
+  AliFMDParameters::Instance()->Init(kFALSE, what);
+  if (over != 0) AliFMDParameters::Instance()->SetSampleRate(over);
+  
+  AliFMDSpectraDisplay* d = new AliFMDSpectraDisplay;
+  d->AddLoad(AliFMDInput::kRaw);
+  d->SetRawFile(file);
+  d->Run();
+}
+
+#if 0
 #include <AliCDBManager.h>
 #include <AliFMDParameters.h>
 #include <AliFMDHit.h>
@@ -686,7 +731,7 @@ RunSpectraMonitor(const char* file="",
   d->SetRawFile(file);
   d->Run();
 }
-
+#endif