]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/DrawDigits.C
Fancy on-line monitor
[u/mrichter/AliRoot.git] / FMD / scripts / DrawDigits.C
1 //____________________________________________________________________
2 //
3 // $Id$
4 //
5 // Script that contains a class to draw eloss from hits, versus ADC
6 // counts from digits, using the AliFMDInputHits class in the util library. 
7 //
8 // It draws the energy loss versus the p/(mq^2).  It can be overlayed
9 // with the Bethe-Bloc curve to show how the simulation behaves
10 // relative to the expected. 
11 //
12 // Use the script `Compile.C' to compile this class using ACLic. 
13 //
14 #include <TH1D.h>
15 #include <AliFMDHit.h>
16 #include <AliFMDDigit.h>
17 #include <AliFMDInput.h>
18 #include <AliFMDEdepMap.h>
19 #include <iostream>
20 #include <TStyle.h>
21 #include <TArrayF.h>
22 #include <AliLog.h>
23
24 /** @class DrawDigits
25     @brief Draw hit energy loss versus digit ADC
26     @code 
27     Root> .L Compile.C
28     Root> Compile("DrawDigits.C")
29     Root> DrawDigits c
30     Root> c.Run();
31     @endcode
32     @ingroup FMD_script
33  */
34 class DrawDigits : public AliFMDInput
35 {
36 private:
37   TH1D* fAdc; // Histogram 
38 public:
39   //__________________________________________________________________
40   DrawDigits(Int_t m=1100, Double_t amin=-0.5, Double_t amax=1023.5) 
41   { 
42     AddLoad(kDigits);
43     fAdc = new TH1D("adc", "ADC", m, amin, amax);
44     fAdc->SetXTitle("ADC value");
45     fAdc->Sumw2();
46   }
47   //__________________________________________________________________
48   Bool_t ProcessDigit(AliFMDDigit* digit)
49   {
50     if (!digit) return kTRUE;
51     fAdc->Fill(digit->Counts());
52     return kTRUE;
53   }
54   //__________________________________________________________________
55   Bool_t Finish()
56   {
57     gStyle->SetPalette(1);
58     gStyle->SetOptTitle(0);
59     gStyle->SetCanvasColor(0);
60     gStyle->SetCanvasBorderSize(0);
61     gStyle->SetPadColor(0);
62     gStyle->SetPadBorderSize(0);
63     fAdc->SetStats(kFALSE);
64     fAdc->Scale(1. / fAdc->GetEntries());
65     fAdc->Draw();
66     return kTRUE;
67   }
68
69   ClassDef(DrawDigits,0);
70 };
71
72 //____________________________________________________________________
73 //
74 // EOF
75 //