ROOT logo
//____________________________________________________________________
//
// $Id$
//
// Script that contains a class to draw eloss from hits, versus ADC
// counts from digits, using the AliFMDInputHits class in the util library. 
//
// It draws the energy loss versus the p/(mq^2).  It can be overlayed
// with the Bethe-Bloc curve to show how the simulation behaves
// relative to the expected. 
//
// Use the script `Compile.C' to compile this class using ACLic. 
//
#include <TH1D.h>
#include <AliFMDHit.h>
#include <AliFMDDigit.h>
#include <AliFMDInput.h>
#include <AliFMDEdepMap.h>
#include <iostream>
#include <TStyle.h>
#include <TArrayF.h>
#include <AliLog.h>

/** @class DrawDigits
    @brief Draw hit energy loss versus digit ADC
    @code 
    Root> .L Compile.C
    Root> Compile("DrawDigits.C")
    Root> DrawDigits c
    Root> c.Run();
    @endcode
    @ingroup FMD_script
 */
class DrawDigits : public AliFMDInput
{
private:
  TH1D* fAdc; // Histogram 
public:
  //__________________________________________________________________
  DrawDigits(Int_t m=1100, Double_t amin=-0.5, Double_t amax=1023.5) 
    : AliFMDInput("galice.root")
  { 
    AddLoad(kDigits);
    fAdc = new TH1D("adc", "ADC", m, amin, amax);
    fAdc->SetXTitle("ADC value");
    fAdc->Sumw2();
  }
  //__________________________________________________________________
  Bool_t ProcessDigit(AliFMDDigit* digit)
  {
    if (!digit) return kTRUE;
    fAdc->Fill(digit->Counts());
    digit->Print("l");
    return kTRUE;
  }
  //__________________________________________________________________
  Bool_t Finish()
  {
    gStyle->SetPalette(1);
    gStyle->SetOptTitle(0);
    gStyle->SetCanvasColor(0);
    gStyle->SetCanvasBorderSize(0);
    gStyle->SetPadColor(0);
    gStyle->SetPadBorderSize(0);
    fAdc->SetStats(kFALSE);
    fAdc->Scale(1. / fAdc->GetEntries());
    fAdc->Draw();
    return kTRUE;
  }

  ClassDef(DrawDigits,0);
};

//____________________________________________________________________
//
// EOF
//
 DrawDigits.C:1
 DrawDigits.C:2
 DrawDigits.C:3
 DrawDigits.C:4
 DrawDigits.C:5
 DrawDigits.C:6
 DrawDigits.C:7
 DrawDigits.C:8
 DrawDigits.C:9
 DrawDigits.C:10
 DrawDigits.C:11
 DrawDigits.C:12
 DrawDigits.C:13
 DrawDigits.C:14
 DrawDigits.C:15
 DrawDigits.C:16
 DrawDigits.C:17
 DrawDigits.C:18
 DrawDigits.C:19
 DrawDigits.C:20
 DrawDigits.C:21
 DrawDigits.C:22
 DrawDigits.C:23
 DrawDigits.C:24
 DrawDigits.C:25
 DrawDigits.C:26
 DrawDigits.C:27
 DrawDigits.C:28
 DrawDigits.C:29
 DrawDigits.C:30
 DrawDigits.C:31
 DrawDigits.C:32
 DrawDigits.C:33
 DrawDigits.C:34
 DrawDigits.C:35
 DrawDigits.C:36
 DrawDigits.C:37
 DrawDigits.C:38
 DrawDigits.C:39
 DrawDigits.C:40
 DrawDigits.C:41
 DrawDigits.C:42
 DrawDigits.C:43
 DrawDigits.C:44
 DrawDigits.C:45
 DrawDigits.C:46
 DrawDigits.C:47
 DrawDigits.C:48
 DrawDigits.C:49
 DrawDigits.C:50
 DrawDigits.C:51
 DrawDigits.C:52
 DrawDigits.C:53
 DrawDigits.C:54
 DrawDigits.C:55
 DrawDigits.C:56
 DrawDigits.C:57
 DrawDigits.C:58
 DrawDigits.C:59
 DrawDigits.C:60
 DrawDigits.C:61
 DrawDigits.C:62
 DrawDigits.C:63
 DrawDigits.C:64
 DrawDigits.C:65
 DrawDigits.C:66
 DrawDigits.C:67
 DrawDigits.C:68
 DrawDigits.C:69
 DrawDigits.C:70
 DrawDigits.C:71
 DrawDigits.C:72
 DrawDigits.C:73
 DrawDigits.C:74
 DrawDigits.C:75
 DrawDigits.C:76
 DrawDigits.C:77
 DrawDigits.C:78