// Latest changes by Christian Holm Christensen
//
+#include <TSystem.h>
#include <TApplication.h>
#include <TButton.h>
#include <TCanvas.h>
#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)
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;
fHits(0),
fCanvas(0),
fPad(0),
+ fButtons(0),
fSlider(0),
fZoomMode(kFALSE),
fX0(0),
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;
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;
void
AliFMDDisplay::ShowOnlyFMD()
{
+ // Show only the FMD
+ // Do not show
+ // other volumes
if (!fGeoManager) return;
static bool once = false;
if (once) return;
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);
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();
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();
void
AliFMDDisplay::MakeAux()
{
+ // MAke the aux canvas
+ // This is used to display spectra
+ // etc,
if ((TESTBIT(fTreeMask, kESD) ||
TESTBIT(fTreeMask, kDigits) ||
TESTBIT(fTreeMask, kRaw))) {
void
AliFMDDisplay::DrawAux()
{
+ // Draw in the Aux the canvas
+ // For example draw the spectra
+ // or such stuff
if (!fAux) return;
fAux->cd();
fAux->Clear();
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);
void
AliFMDDisplay::AtEnd()
{
+ // Called at of the event.
+ // Draw stuff.
+ // Draw spectrum.
fPad->cd();
fMarkers->Draw();
fPad->cd();
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();
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);
}
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)",
void
AliFMDDisplay::Redisplay()
{
+ // Redisplay stuff.
+ // Redraw markers, hits,
+ // spectra
if (fMarkers) fMarkers->Delete();
if (fHits) fHits->Clear();
if (fSpec) fSpec->Reset();
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; }
AliFMDDisplay::ProcessDigit(AliFMDDigit* digit)
{
// Process a digit
+ // Parameters:
+ // digit Digit information
if (!digit) { AliError("No digit"); return kFALSE; }
AliFMDParameters* parm = AliFMDParameters::Instance();
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));
AliFMDDisplay::ProcessRaw(AliFMDDigit* digit)
{
// PRocess raw data
+ // Parameters:
+ // digit Digit information
return ProcessDigit(digit);
}
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);
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;