]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/DrawDigits.C
New SPD pre-processor (H. Tydesjo)
[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=1099.5) 
41   { 
42     AddLoad(kDigits);
43     fAdc = new TH1D("adc", "ADC", m, amin, amax);
44     fAdc->SetXTitle("ADC value");
45   }
46   //__________________________________________________________________
47   Bool_t ProcessDigit(AliFMDDigit* digit)
48   {
49     if (!digit) return kTRUE;
50     fAdc->Fill(digit->Counts());
51     return kTRUE;
52   }
53   //__________________________________________________________________
54   Bool_t Finish()
55   {
56     gStyle->SetPalette(1);
57     gStyle->SetOptTitle(0);
58     gStyle->SetCanvasColor(0);
59     gStyle->SetCanvasBorderSize(0);
60     gStyle->SetPadColor(0);
61     gStyle->SetPadBorderSize(0);
62     fAdc->SetStats(kFALSE);
63     fAdc->Draw();
64     return kTRUE;
65   }
66
67   ClassDef(DrawDigits,0);
68 };
69
70 //____________________________________________________________________
71 //
72 // EOF
73 //