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