]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/DrawDigitsRecs.C
More docs
[u/mrichter/AliRoot.git] / FMD / scripts / DrawDigitsRecs.C
CommitLineData
bf000c32 1//____________________________________________________________________
8f6ee336 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 <TH2D.h>
15#include <AliFMDHit.h>
16#include <AliFMDDigit.h>
17#include <AliFMDInput.h>
18#include <AliFMDUShortMap.h>
19#include <AliFMDFloatMap.h>
20#include <AliFMDMultStrip.h>
21#include <AliFMDMultRegion.h>
22#include <iostream>
23#include <TStyle.h>
24#include <TArrayF.h>
25#include <TCanvas.h>
26
9b48326f 27/** @class DrawDigitsRecs
28 @brief Draw digit ADC versus Rec point mult
29 @code
30 Root> .L Compile.C
31 Root> Compile("DrawDigitsRecs.C")
32 Root> DrawDigitsRecs c
33 Root> c.Run();
34 @endcode
35 @ingroup FMD_script
36 */
8f6ee336 37class DrawDigitsRecs : public AliFMDInputDigits
38{
39private:
40 TH2D* fAdcVsSingle; // Histogram
8f6ee336 41 AliFMDUShortMap fMap;
8f6ee336 42public:
bf000c32 43 //__________________________________________________________________
8f6ee336 44 TArrayF MakeLogScale(Int_t n, Double_t min, Double_t max)
45 {
46 TArrayF bins(n+1);
47 Float_t dp = n / TMath::Log10(max / min);
48 Float_t pmin = TMath::Log10(min);
49 bins[0] = min;
50 for (Int_t i = 1; i < n+1; i++) {
51 Float_t p = pmin + i / dp;
52 bins[i] = TMath::Power(10, p);
53 }
54 return bins;
55 }
bf000c32 56 //__________________________________________________________________
8f6ee336 57 DrawDigitsRecs(Int_t m=1100, Double_t amin=-0.5, Double_t amax=1099.5,
58 Int_t n=105, Double_t mmin=-0.5, Double_t mmax=20.5)
59 {
60 AddLoad(kRecPoints);
61 fAdcVsSingle = new TH2D("adcVsSingle", "ADC vs. Multiplicity (strip)",
62 m, amin, amax, n, mmin, mmax);
63 fAdcVsSingle->SetXTitle("ADC value");
64 fAdcVsSingle->SetYTitle("Strip Multiplicity");
8f6ee336 65 }
bf000c32 66 //__________________________________________________________________
9b48326f 67 /** Begining of event
68 @param ev Event number
69 @return @c false on error */
8f6ee336 70 Bool_t Begin(Int_t ev)
71 {
72 fMap.Reset();
8f6ee336 73 return AliFMDInputDigits::Begin(ev);
74 }
bf000c32 75 //__________________________________________________________________
8f6ee336 76 Bool_t ProcessDigit(AliFMDDigit* digit)
77 {
78 // Cache the energy loss
79 if (!digit) return kFALSE;
80 UShort_t det = digit->Detector();
81 Char_t rng = digit->Ring();
82 UShort_t sec = digit->Sector();
83 UShort_t str = digit->Strip();
84 if (str > 511) {
85 AliWarning(Form("Bad strip number %d in digit", str));
86 return kTRUE;
87 }
88 fMap(det, rng, sec, str) = digit->Counts();
89 return kTRUE;
90 }
bf000c32 91 //__________________________________________________________________
92 Bool_t ProcessRecPoint(AliFMDRecPoint* single)
8f6ee336 93 {
bf000c32 94 if (!single) continue;
95 UShort_t det = single->Detector();
96 Char_t rng = single->Ring();
97 UShort_t sec = single->Sector();
98 UShort_t str = single->Strip();
99 if (str > 511) {
100 AliWarning(Form("Bad strip number %d in single", str));
101 continue;
8f6ee336 102 }
bf000c32 103 fAdcVsSingle->Fill(fMap(det, rng, sec, str), single->Particles());
8f6ee336 104 return kTRUE;
105 }
bf000c32 106 //__________________________________________________________________
8f6ee336 107 Bool_t Finish()
108 {
109 gStyle->SetPalette(1);
110 gStyle->SetOptTitle(0);
111 gStyle->SetCanvasColor(0);
112 gStyle->SetCanvasBorderSize(0);
113 gStyle->SetPadColor(0);
114 gStyle->SetPadBorderSize(0);
115
8f6ee336 116 fAdcVsSingle->SetStats(kFALSE);
117 fAdcVsSingle->Draw("COLZ");
8f6ee336 118 return kTRUE;
119 }
120
121 ClassDef(DrawDigitsRecs,0);
122
123};
124
125//____________________________________________________________________
126//
127// EOF
128//